Update sm9 functions

This commit is contained in:
Zhi Guan
2018-12-07 16:32:12 +08:00
parent 6f5b7a4c96
commit 1c00e47681
11 changed files with 5613 additions and 14 deletions

View File

@@ -54,6 +54,39 @@
#include <openssl/bn_hash.h>
#include "sm9_lcl.h"
#if 0
typedef struct {
int nid;
int nid;
} sm9_algor_table;
static const sm9_algor_table sm9encrypt_scheme_table[] = {
{NID_sm9encrypt_with_sm3, NID_sm3},
{NID_sm9encrypt_with_sha256, NID_sha256},
};
static const sm9_algoro_table sm9sign_scheme_table[] = {
{NID_sm9sign_with_sm3, NID_sm3},
{NID_sm9sign_with_sha256, NID_sha256},
};
static const sm9_algor_table sm9_encrypt_table[] = {
{sm9encrypt-with-sm3-xor, NID_sm3, NID_undef},
{sm9encrypt-with-sm3-sms4-cbc, NID_sm3, NID_sms4_cbc},
{sm9encrypt-with-sm3-sms4-ctr, NID_sm3, NID_sms4_ctr},
};
static const sm9_algor sm9_hash1[] = {
{NID_sm9hash1_with_sm3, NID_sm3},
{NID_sm9hash1_with_sha256, NID_sha256},
{NID_sm9kdf_with_sm3, NID_sm3},
{NID_sm9kdf_with_sha256, NID_sha256},
};
#endif
SM9_MASTER_KEY *SM9_MASTER_KEY_new(void)
{
SM9_MASTER_KEY *ret = NULL;

View File

@@ -456,6 +456,9 @@ static int pkey_sm9_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *va
return -2;
}
/* TODO: currently data instead of dgst is signed.
* we need to support to ctrl which to sign.
*/
const EVP_PKEY_METHOD sm9_pkey_meth = {
EVP_PKEY_SM9, /* pkey_id */
0, /* flags */