From 002096751c3cf1cdfaba36ffe24ae9523d3f6776 Mon Sep 17 00:00:00 2001 From: Zhi Guan Date: Wed, 8 Mar 2017 15:02:42 +0800 Subject: [PATCH] update crypto --- crypto/bb1ibe/bb1ibe_lib.c | 4 +- crypto/bfibe/bfibe_lib.c | 10 +- crypto/cpk/cpk_lib.c | 4 +- crypto/ct/ct_vfy.o-29b9236e | 0 crypto/ec/ec_kmeth.c | 3 + crypto/ec2/bn_gfp2.c | 8 +- crypto/ec2/bn_solinas.c | 4 +- crypto/ecies/ecies_gmssl.c | 21 +- crypto/gmapi/gmapi_sdf_rsa.c | 8 +- crypto/gmapi/gmapi_sgd.c | 10 + crypto/kdf2/kdf_ibcs.c | 2 +- crypto/saf/saf_base64.c | 48 --- crypto/saf/saf_err.c | 18 + crypto/saf/saf_lcl.h | 7 +- crypto/saf/saf_lib.c | 63 +++- crypto/saf/saf_pkcs7.c | 168 ++++++--- crypto/saf/saf_pkcs7.d.tmp | 17 + crypto/skf/skf_meth.c | 2 - crypto/sm2/sm2_kap.c | 6 +- crypto/sm9/sm9_enc.c | 9 +- crypto/sof/sof_err.c | 6 +- crypto/sof/sof_lib.d.tmp | 8 + include/openssl/gmapi.h | 2 + include/openssl/gmsaf.h | 15 + include/openssl/gmsof.h | 2 + include/openssl/saf.h | 22 +- include/openssl/sm2.h | 2 + test/saftest.c | 84 ++++- util/libcrypto.num | 643 +++++++++++++++++++++++++++++++++++ 29 files changed, 1062 insertions(+), 134 deletions(-) create mode 100644 crypto/ct/ct_vfy.o-29b9236e create mode 100644 crypto/saf/saf_pkcs7.d.tmp create mode 100644 crypto/sof/sof_lib.d.tmp diff --git a/crypto/bb1ibe/bb1ibe_lib.c b/crypto/bb1ibe/bb1ibe_lib.c index a2d075a1..a1293ddc 100644 --- a/crypto/bb1ibe/bb1ibe_lib.c +++ b/crypto/bb1ibe/bb1ibe_lib.c @@ -442,7 +442,7 @@ end: * c->u = HashToRange(DoubleHash(c->Chi0, c->Chi1, y, wbuf)) */ static int BB1CiphertextBlock_hash_to_range(BB1PublicParameters *mpk, - const BB1CiphertextBlock *c, const unsigned char *wbuf, size_t wbuflen, + BB1CiphertextBlock *c, const unsigned char *wbuf, size_t wbuflen, BIGNUM *bn, BN_CTX *bn_ctx) { int ret = 0; @@ -870,7 +870,7 @@ int BB1IBE_do_decrypt(BB1PublicParameters *mpk, BB1IBEerr(BB1IBE_F_BB1IBE_DO_DECRYPT, ERR_R_BN_LIB); goto end; } - if (BN_GFP2_cmp(w, w1) != 0) { + if (!BN_GFP2_equ(w, w1)) { BB1IBEerr(BB1IBE_F_BB1IBE_DO_DECRYPT, BB1IBE_R_BB1CIPHERTEXT_INVALID_MAC); goto end; } diff --git a/crypto/bfibe/bfibe_lib.c b/crypto/bfibe/bfibe_lib.c index 32256411..e3bc839d 100644 --- a/crypto/bfibe/bfibe_lib.c +++ b/crypto/bfibe/bfibe_lib.c @@ -468,7 +468,8 @@ int BFIBE_do_decrypt(BFPublicParameters *mpk, const EVP_MD *md; KDF_FUNC hash_bytes; unsigned char rho[EVP_MAX_MD_SIZE * 2]; - unsigned int size; + size_t size; + unsigned int len; int i; if (!mpk || !in || !outlen || !sk) { @@ -539,7 +540,8 @@ int BFIBE_do_decrypt(BFPublicParameters *mpk, BFIBEerr(BFIBE_F_BFIBE_DO_DECRYPT, ERR_R_EC_LIB); goto end; } - if (!EVP_Digest(rho, size, rho, &size, md, NULL)) { + len = size; + if (!EVP_Digest(rho, size, rho, &len, md, NULL)) { BFIBEerr(BFIBE_F_BFIBE_DO_DECRYPT, ERR_R_EVP_LIB); goto end; } @@ -566,8 +568,8 @@ int BFIBE_do_decrypt(BFPublicParameters *mpk, } /* k = HashToRange(rho || Hash(out)) in [0, mpk->q) */ - size = EVP_MD_size(md); - if (!EVP_Digest(out, in->w->length, rho + EVP_MD_size(md), &size, md, NULL)) { + len = EVP_MD_size(md); + if (!EVP_Digest(out, in->w->length, rho + EVP_MD_size(md), &len, md, NULL)) { BFIBEerr(BFIBE_F_BFIBE_DO_DECRYPT, ERR_R_EVP_LIB); goto end; } diff --git a/crypto/cpk/cpk_lib.c b/crypto/cpk/cpk_lib.c index c26f3215..a100eb77 100755 --- a/crypto/cpk/cpk_lib.c +++ b/crypto/cpk/cpk_lib.c @@ -497,7 +497,7 @@ static DSA *X509_ALGOR_get1_DSA(X509_ALGOR *algor) { DSA *dsa = NULL; int ptype; - void *pval; + const void *pval; ASN1_OCTET_STRING *pstr; const unsigned char *p; @@ -713,7 +713,7 @@ static EC_KEY *X509_ALGOR_get1_EC_KEY(X509_ALGOR *algor) { EC_KEY *ec_key = NULL; int ptype; - void *pval; + const void *pval; const unsigned char *p; X509_ALGOR_get0(NULL, &ptype, &pval, algor); diff --git a/crypto/ct/ct_vfy.o-29b9236e b/crypto/ct/ct_vfy.o-29b9236e new file mode 100644 index 00000000..e69de29b diff --git a/crypto/ec/ec_kmeth.c b/crypto/ec/ec_kmeth.c index 4eb731cd..cf6797a5 100644 --- a/crypto/ec/ec_kmeth.c +++ b/crypto/ec/ec_kmeth.c @@ -61,6 +61,9 @@ void EC_KEY_set_default_secg_method(void) default_ec_key_meth = EC_KEY_OpenSSL(); } +/* defained in sm2/sm2_kmeth.c */ +extern const EC_KEY_METHOD *EC_KEY_GmSSL(void); + void EC_KEY_set_default_sm_method(void) { default_ec_key_meth = EC_KEY_GmSSL(); diff --git a/crypto/ec2/bn_gfp2.c b/crypto/ec2/bn_gfp2.c index 1e32e687..3d196d15 100644 --- a/crypto/ec2/bn_gfp2.c +++ b/crypto/ec2/bn_gfp2.c @@ -169,6 +169,13 @@ int BN_GFP2_cmp(const BN_GFP2 *a, const BN_GFP2 *b) return ((BN_cmp(a->a0, b->a0) == 0) && (BN_cmp(a->a1, b->a1) == 0)); } +int BN_GFP2_equ(const BN_GFP2 *a, const BN_GFP2 *b) +{ + //FIXME + + return 0; +} + int BN_GFP2_add(BN_GFP2 *r, const BN_GFP2 *a, const BN_GFP2 *b, const BIGNUM *p, BN_CTX *ctx) { @@ -494,4 +501,3 @@ int BN_gfp22bn(const BN_GFP2 *gfp2, BIGNUM *bn, const BIGNUM *p, BN_CTX *ctx) } return 1; } - diff --git a/crypto/ec2/bn_solinas.c b/crypto/ec2/bn_solinas.c index 8322e07b..0dc83c72 100644 --- a/crypto/ec2/bn_solinas.c +++ b/crypto/ec2/bn_solinas.c @@ -127,14 +127,14 @@ int BN_bn2solinas(const BIGNUM *bn, BN_SOLINAS *solinas) } end: - return 0; + return ret; } int BN_solinas2bn(const BN_SOLINAS *solinas, BIGNUM *bn) { int ret = 0; - BIGNUM *tmp = NULL; #if 0 + BIGNUM *tmp = NULL; if (b <= 0 || a <= b || (s != 1 && s != -1) || (c != 1 && c != -1)) { BNerr(BN_F_BN_SOLINAS2BN, BN_R_INVALID_SOLINAS_PARAMETERS); diff --git a/crypto/ecies/ecies_gmssl.c b/crypto/ecies/ecies_gmssl.c index 941550d3..528dcc90 100644 --- a/crypto/ecies/ecies_gmssl.c +++ b/crypto/ecies/ecies_gmssl.c @@ -50,15 +50,27 @@ #include #include #include +#include #include +static int ECIES_PARAMS_init_with_type(ECIES_PARAMS *params, int type) +{ + + return 0; +} + int gmssl_ecies_encrypt(int type, const unsigned char *in, size_t inlen, unsigned char *out, size_t *outlen, EC_KEY *ec_key) { ECIES_CIPHERTEXT_VALUE *cv = NULL; + ECIES_PARAMS params; + + if (!ECIES_PARAMS_init_with_type(¶ms, type)) { + return 0; + } RAND_seed(in, inlen); - if (!(cv = ECIES_do_encrypt(type, in, inlen, ec_key))) { + if (!(cv = ECIES_do_encrypt(¶ms, in, inlen, ec_key))) { *outlen = 0; return 0; } @@ -72,11 +84,16 @@ int gmssl_ecies_decrypt(int type, const unsigned char *in, size_t inlen, unsigned char *out, size_t *outlen, EC_KEY *ec_key) { ECIES_CIPHERTEXT_VALUE *cv = NULL; + ECIES_PARAMS params; const unsigned char *cp = in; unsigned char *der = NULL; int derlen = -1; int ret = -1; + if (!ECIES_PARAMS_init_with_type(¶ms, type)) { + return -1; + } + if (!(cv = d2i_ECIES_CIPHERTEXT_VALUE(NULL, &cp, inlen))) { return -1; } @@ -86,7 +103,7 @@ int gmssl_ecies_decrypt(int type, const unsigned char *in, size_t inlen, goto end; } - ret = ECIES_do_decrypt(type, cv, out, outlen, ec_key); + ret = ECIES_do_decrypt(¶ms, cv, out, outlen, ec_key); end: OPENSSL_clear_free(der, derlen); diff --git a/crypto/gmapi/gmapi_sdf_rsa.c b/crypto/gmapi/gmapi_sdf_rsa.c index 822f3d98..cc8957ef 100644 --- a/crypto/gmapi/gmapi_sdf_rsa.c +++ b/crypto/gmapi/gmapi_sdf_rsa.c @@ -195,10 +195,10 @@ int RSA_get_RSArefPrivateKey(RSA *rsa, RSArefPrivateKey *ref) if (!BN_bn2bin(rsa->n, ref->m) || !BN_bn2bin(rsa->e, ref->e + MAX_RSA_EXPONENT_LEN - BN_num_bytes(rsa->e)) || !BN_bn2bin(rsa->d, ref->d + nbytes - BN_num_bytes(rsa->d)) || - !BN_bn2bin(rsa->p, &(ref->prime[0]) + nbytes/2 - BN_num_bytes(rsa->p)) || - !BN_bn2bin(rsa->q, &(ref->prime[1]) + nbytes/2 - BN_num_bytes(rsa->q)) || - !BN_bn2bin(rsa->dmp1, &(ref->pexp[0]) + nbytes/2 - BN_num_bytes(rsa->dmp1)) || - !BN_bn2bin(rsa->dmq1, &(ref->pexp[1]) + nbytes/2 - BN_num_bytes(rsa->dmq1)) || + !BN_bn2bin(rsa->p, (unsigned char *)&(ref->prime[0]) + nbytes/2 - BN_num_bytes(rsa->p)) || + !BN_bn2bin(rsa->q, (unsigned char *)&(ref->prime[1]) + nbytes/2 - BN_num_bytes(rsa->q)) || + !BN_bn2bin(rsa->dmp1, (unsigned char *)&(ref->pexp[0]) + nbytes/2 - BN_num_bytes(rsa->dmp1)) || + !BN_bn2bin(rsa->dmq1, (unsigned char *)&(ref->pexp[1]) + nbytes/2 - BN_num_bytes(rsa->dmq1)) || !BN_bn2bin(rsa->iqmp, ref->coef + nbytes/2 - BN_num_bytes(rsa->iqmp))) { GMAPIerr(GMAPI_F_RSA_GET_RSAREFPRIVATEKEY, GMAPI_R_INVALID_RSA_PRIVATE_KEY); diff --git a/crypto/gmapi/gmapi_sgd.c b/crypto/gmapi/gmapi_sgd.c index e81684f4..9557a30c 100644 --- a/crypto/gmapi/gmapi_sgd.c +++ b/crypto/gmapi/gmapi_sgd.c @@ -116,3 +116,13 @@ int GMAPI_sgd2mdnid(int sgd) return 0; } + +int EVP_MD_sgd(const EVP_MD *md) +{ + return 0; +} + +int EVP_CIPHER_sgd(const EVP_CIPHER *cipher) +{ + return 0; +} diff --git a/crypto/kdf2/kdf_ibcs.c b/crypto/kdf2/kdf_ibcs.c index 3d5fe597..5da18cf0 100644 --- a/crypto/kdf2/kdf_ibcs.c +++ b/crypto/kdf2/kdf_ibcs.c @@ -133,7 +133,7 @@ KDF_FUNC KDF_get_ibcs(const EVP_MD *md) #endif #ifndef OPENSSL_NO_BLAKE2 case NID_blake2b512: - return ibcs_blake2s256kdf; + return ibcs_blake2b512kdf; case NID_blake2s256: return ibcs_blake2s256kdf; #endif diff --git a/crypto/saf/saf_base64.c b/crypto/saf/saf_base64.c index a3353118..29ce9da9 100644 --- a/crypto/saf/saf_base64.c +++ b/crypto/saf/saf_base64.c @@ -362,51 +362,3 @@ end: SAF_Base64_DestroyBase64Obj(handle); return ret; } - -int SAF_Base64_test(int verbose) -{ - int ret = SAR_UnknownErr; - /* sizeof(buf1)%3 == 1 makes base64 ended with "==" */ - unsigned char buf1[121]; - unsigned char buf2[512]; - unsigned char buf3[512]; - unsigned int len1, len2, len3; - - /* generate some random binary for testing */ - RAND_bytes(buf1, sizeof(buf1)); - memset(buf2, 0, sizeof(buf2)); - memset(buf3, 0, sizeof(buf3)); - - len1 = (unsigned int)sizeof(buf1); - len2 = (unsigned int)sizeof(buf2); - if ((ret = SAF_Base64_Encode(buf1, len1, buf2, &len2)) != SAR_OK) { - ERR_print_errors_fp(stderr); - goto end; - } - if (verbose) { - printf("%s\n", buf2); - } - - len3 = sizeof(buf3); - if ((ret = SAF_Base64_Decode(buf2, len2, buf3, &len3)) != SAR_OK) { - ERR_print_errors_fp(stderr); - goto end; - } - - /* check correctness */ - if (len1 == len3 && memcmp(buf1, buf3, len1) == 0) { - ret = SAR_OK; - } else { - /* make sure to assign `ret`, or it might be set as OK by - * previous functions */ - ret = SAR_UnknownErr; - } - -end: - if (verbose) { - printf("%s %s\n", __FUNCTION__, - ret == SAR_OK ? "passed" : "failed"); - } - - return SAR_OK; -} diff --git a/crypto/saf/saf_err.c b/crypto/saf/saf_err.c index 799ccd9b..b4710882 100644 --- a/crypto/saf/saf_err.c +++ b/crypto/saf/saf_err.c @@ -56,10 +56,18 @@ static ERR_STRING_DATA SAF_str_functs[] = { {ERR_FUNC(SAF_F_SAF_HASHUPDATE), "SAF_HashUpdate"}, {ERR_FUNC(SAF_F_SAF_INITIALIZE), "SAF_Initialize"}, {ERR_FUNC(SAF_F_SAF_KEY_NEW), "SAF_KEY_new"}, + {ERR_FUNC(SAF_F_SAF_LOAD_PRIVATE_KEY), "SAF_load_private_key"}, + {ERR_FUNC(SAF_F_SAF_LOAD_PUBLIC_KEY), "SAF_load_public_key"}, {ERR_FUNC(SAF_F_SAF_LOGIN), "SAF_Login"}, {ERR_FUNC(SAF_F_SAF_LOGOUT), "SAF_Logout"}, {ERR_FUNC(SAF_F_SAF_MACFINAL), "SAF_MacFinal"}, {ERR_FUNC(SAF_F_SAF_MACUPDATE), "SAF_MacUpdate"}, + {ERR_FUNC(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA), + "SAF_Pkcs7_DecodeDigestedData"}, + {ERR_FUNC(SAF_F_SAF_PKCS7_DECODEENVELOPEDDATA), + "SAF_Pkcs7_DecodeEnvelopedData"}, + {ERR_FUNC(SAF_F_SAF_PKCS7_DECODESIGNEDDATA), + "SAF_Pkcs7_DecodeSignedData"}, {ERR_FUNC(SAF_F_SAF_PKCS7_ENCODEDIGESTEDDATA), "SAF_Pkcs7_EncodeDigestedData"}, {ERR_FUNC(SAF_F_SAF_PKCS7_ENCODEENVELOPEDDATA), @@ -89,6 +97,7 @@ static ERR_STRING_DATA SAF_str_reasons[] = { {ERR_REASON(SAF_R_GEN_RANDOM_FAILURE), "gen random failure"}, {ERR_REASON(SAF_R_INT_OVERFLOW), "int overflow"}, {ERR_REASON(SAF_R_INVALID_ALGOR), "invalid algor"}, + {ERR_REASON(SAF_R_INVALID_APP), "invalid app"}, {ERR_REASON(SAF_R_INVALID_CERTIFICATE), "invalid certificate"}, {ERR_REASON(SAF_R_INVALID_DIGEST_ALGOR), "invalid digest algor"}, {ERR_REASON(SAF_R_INVALID_HANDLE), "invalid handle"}, @@ -98,14 +107,23 @@ static ERR_STRING_DATA SAF_str_reasons[] = { {ERR_REASON(SAF_R_INVALID_KEY_LENGTH), "invalid key length"}, {ERR_REASON(SAF_R_INVALID_KEY_USAGE), "invalid key usage"}, {ERR_REASON(SAF_R_INVALID_LENGTH), "invalid length"}, + {ERR_REASON(SAF_R_INVALID_PKCS7), "invalid pkcs7"}, + {ERR_REASON(SAF_R_INVALID_PKCS7_DATA), "invalid pkcs7 data"}, + {ERR_REASON(SAF_R_INVALID_PKCS7_TYPE), "invalid pkcs7 type"}, + {ERR_REASON(SAF_R_INVALID_PKEY_TYPE), "invalid pkey type"}, {ERR_REASON(SAF_R_INVALID_PUBLIC_KEY), "invalid public key"}, + {ERR_REASON(SAF_R_LOA), "loa"}, {ERR_REASON(SAF_R_LOAD_CERTS_FAILURE), "load certs failure"}, {ERR_REASON(SAF_R_LOAD_KEY_FAILURE), "load key failure"}, + {ERR_REASON(SAF_R_LOAD_PRIVATE_KEY_FAILURE), "load private key failure"}, + {ERR_REASON(SAF_R_LOAD_PUBLIC_KEY_FAILURE), "load public key failure"}, {ERR_REASON(SAF_R_MAC_FAILURE), "mac failure"}, {ERR_REASON(SAF_R_NOT_SUPPORTED), "not supported"}, {ERR_REASON(SAF_R_OPERATION_NOT_INITIALIZED), "operation not initialized"}, + {ERR_REASON(SAF_R_PKCS7_VERIFY_FAILURE), "pkcs7 verify failure"}, {ERR_REASON(SAF_R_UNSUPPORTED_ALGOR), "unsupported algor"}, + {ERR_REASON(SAF_R_UNSUPPORTED_DIGEST_ALGOR), "unsupported digest algor"}, {0, NULL} }; diff --git a/crypto/saf/saf_lcl.h b/crypto/saf/saf_lcl.h index 7a0caf4b..d29f5837 100644 --- a/crypto/saf/saf_lcl.h +++ b/crypto/saf/saf_lcl.h @@ -77,7 +77,7 @@ typedef struct { typedef struct { SAF_SYMMKEYOBJ *hSymmKeyObj; unsigned char key[64]; - int keylen; + size_t keylen; EVP_CIPHER_CTX *cipher_ctx; CMAC_CTX *cmac_ctx; } SAF_KEY; @@ -87,3 +87,8 @@ void SAF_KEY_free(SAF_KEY *key); SAF_SYMMKEYOBJ *SAF_SYMMKEYOBJ_dup(const SAF_SYMMKEYOBJ *a); void SAF_SYMMKEYOBJ_free(SAF_SYMMKEYOBJ *a); + + +EVP_PKEY *SAF_load_private_key(SAF_APP *app, const char *container, int flags); +EVP_PKEY *SAF_load_public_key(SAF_APP *app, const char *container, int flags); + diff --git a/crypto/saf/saf_lib.c b/crypto/saf/saf_lib.c index c6307c1c..7c78d1ae 100644 --- a/crypto/saf/saf_lib.c +++ b/crypto/saf/saf_lib.c @@ -50,9 +50,68 @@ #include #include "saf_lcl.h" -static int readfile(const char *file, unsigned char **pout, size_t *len) + +EVP_PKEY *SAF_load_private_key(SAF_APP *app, const char *container, int flags) { - return SAR_Ok; + EVP_PKEY *ret = NULL; + EVP_PKEY *pkey = NULL; + char key_id[1024]; + int type; + + if (!app->engine) { + SAFerr(SAF_F_SAF_LOAD_PRIVATE_KEY, SAF_R_INVALID_APP); + return NULL; + } + + snprintf(key_id, sizeof(key_id), "%s.%s", container, + ((flags & EVP_PKT_SIGN) ? "sign" : "enc")); + + if (!(pkey = ENGINE_load_private_key(app->engine, key_id, NULL, NULL))) { + SAFerr(SAF_F_SAF_LOAD_PRIVATE_KEY, SAF_R_LOAD_PRIVATE_KEY_FAILURE); + goto end; + } + + if (EVP_PKEY_base_id(pkey) != + ((flags & EVP_PK_EC) ? EVP_PKEY_EC : EVP_PKEY_RSA)) { + SAFerr(SAF_F_SAF_LOAD_PRIVATE_KEY, SAF_R_INVALID_PKEY_TYPE); + goto end; + } + + ret = pkey; + pkey = NULL; +end: + EVP_PKEY_free(pkey); + return ret; } +EVP_PKEY *SAF_load_public_key(SAF_APP *app, const char *container, int flags) +{ + EVP_PKEY *ret = NULL; + EVP_PKEY *pkey = NULL; + char key_id[1024]; + if (!app->engine) { + SAFerr(SAF_F_SAF_LOAD_PUBLIC_KEY, SAF_R_INVALID_APP); + return NULL; + } + + snprintf(key_id, sizeof(key_id), "%s.%s", container, + ((flags & EVP_PKT_SIGN) ? "sign" : "enc")); + + if (!(pkey = ENGINE_load_public_key(app->engine, key_id, NULL, NULL))) { + SAFerr(SAF_F_SAF_LOAD_PUBLIC_KEY, SAF_R_LOAD_PUBLIC_KEY_FAILURE); + goto end; + } + + if (EVP_PKEY_base_id(pkey) != + ((flags & EVP_PK_EC) ? EVP_PKEY_EC : EVP_PKEY_RSA)) { + SAFerr(SAF_F_SAF_LOAD_PUBLIC_KEY, SAF_R_INVALID_PKEY_TYPE); + goto end; + } + + ret = pkey; + pkey = NULL; +end: + EVP_PKEY_free(pkey); + return ret; +} diff --git a/crypto/saf/saf_pkcs7.c b/crypto/saf/saf_pkcs7.c index 1ef4ea57..ac385b21 100644 --- a/crypto/saf/saf_pkcs7.c +++ b/crypto/saf/saf_pkcs7.c @@ -48,6 +48,7 @@ */ #include +#include #include #include #include @@ -70,37 +71,28 @@ int SAF_Pkcs7_EncodeData( unsigned int *puiDerP7DataLen) { int ret = SAR_UnknownErr; - - STACK_OF(X509) *encerts = NULL; - - p7 = PKCS7_encrypt(encerts, in, cipher, flags); - - p7 = PKCS7_sign(NULL, NULL, other, in, flags); - - - - - return ret; } /* 7.4.3 */ int SAF_Pkcs7_DecodeData( - void *hAppHandle) + void *hAppHandle, + unsigned char *pucDecContainerName, + unsigned int uiDecContainerNameLen, + unsigned int uiDecKeyUsage, + unsigned char *pucDerP7Data, + unsigned int uiDerP7DataLen, + unsigned char *pucData, + unsigned int *puiDataLen, + unsigned char *pucSignerCertificate, + unsigned int *puiSignerCertificateLen, + unsigned int *puiDigestAlgorithm) { int ret = SAR_UnknownErr; return ret; } -EVP_PKEY *SAF_LoadPrivateKey( - void *hAppHandle, - unsigned char *pucSignContainerName, - unsigned int uiSignContainerNameLen) -{ - return NULL; -} - /* 7.4.4 */ int SAF_Pkcs7_EncodeSignedData( void *hAppHandle, @@ -116,9 +108,12 @@ int SAF_Pkcs7_EncodeSignedData( unsigned int *puiDerP7DataLen) { int ret = SAR_UnknownErr; + SAF_APP *app = (SAF_APP *)hAppHandle; + PKCS7 *p7 = NULL; EVP_PKEY *pkey = NULL; X509 *x509 = NULL; BIO *data = NULL; + int len; if (!hAppHandle || !pucSignContainerName || !pucSignerCertificate || !pucData || !pucDerP7Data || !puiDerP7DataLen) { @@ -127,21 +122,21 @@ int SAF_Pkcs7_EncodeSignedData( } if (uiSignContainerNameLen <= 0 || uiSignContainerNameLen > INT_MAX + || strlen((char *)pucSignContainerName) != uiSignContainerNameLen || uiSignerCertificateLen <= 0 || uiSignerCertificateLen > INT_MAX || uiDataLen <= 0 || uiDataLen > INT_MAX) { SAFerr(SAF_F_SAF_PKCS7_ENCODESIGNEDDATA, SAF_R_INVALID_INPUT_LENGTH); return SAR_IndataLenErr; } - if (!(pkey = SAF_LoadPrivateKey( - hAppHandle, - pucSignContainerName, - uiSignContainerNameLen))) { + if (!(pkey = SAF_load_private_key(app, (char *)pucSignContainerName, + EVP_PK_EC|EVP_PKT_SIGN))) { SAFerr(SAF_F_SAF_PKCS7_ENCODESIGNEDDATA, SAF_R_LOAD_KEY_FAILURE); goto end; } - if (!(x509 = d2i_X509(NULL, &pucSignerCertificate, uiSignerCertificateLen))) { + if (!(x509 = d2i_X509(NULL, (const unsigned char **)&pucSignerCertificate, + uiSignerCertificateLen))) { SAFerr(SAF_F_SAF_PKCS7_ENCODESIGNEDDATA, ERR_R_X509_LIB); goto end; } @@ -192,36 +187,114 @@ int SAF_Pkcs7_DecodeSignedData( { int ret = SAR_UnknownErr; PKCS7 *p7 = NULL; + PKCS7_SIGNED *p7signed; X509 *x509 = NULL; + PKCS7_SIGNER_INFO *signer_info; + X509_ALGOR *algor; + BIO *bio = NULL; - p7 = d2i_PKCS7(NULL, &pucDerP7SignedData, uiDerP7SignedDataLen); + if (!hAppHandle || !pucDerP7SignedData || !puiDigestAlgorithm + || !puiSignerCertificateLen || !puiDataLen || !puiSigLen) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, ERR_R_PASSED_NULL_PARAMETER); + return SAR_IndataErr; + } + + if (uiDerP7SignedDataLen <= 0 || uiDerP7SignedDataLen > INT_MAX) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_INVALID_INPUT_LENGTH); + return SAR_IndataLenErr; + } + + /* process */ + if (!(p7 = d2i_PKCS7(NULL, (const unsigned char **)&pucDerP7SignedData, + uiDerP7SignedDataLen))) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_INVALID_PKCS7_DATA); + goto end; + } + + if (!(bio = BIO_new(BIO_s_mem()))) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, ERR_R_MALLOC_FAILURE); + goto end; + } if (!PKCS7_type_is_signed(p7)) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_INVALID_PKCS7_TYPE); goto end; } - PKCS7_SIGNED *p7signed = p7->d.sign; - - X509_ALGOR *algor = sk_X509_ALGOR_value(p7signed->md_algs, 0); - const EVP_MD *md = EVP_get_digestbyobj(algor->algorithm); - *puiDigestAlgorithm = EVP_MD_sdg(md); - - X509 *x509 = sk_X509_ALGOR_value(p7signed->cert); - PKCS7_SIGNER_INFO *signer_info = sk_PKCS7_SIGNER_INFO_value(p7signed->signer_info, 0); - - PKCS7 *p7data = p7signed->contents; - if (!PKCS7_type_is_data(p7data)) { + if (!PKCS7_verify(p7, NULL, NULL, NULL, bio, 0)) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_PKCS7_VERIFY_FAILURE); goto end; } - ASN1_OCTET_STRING *data = p7data->d.data; + if (!(p7signed = p7->d.sign)) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_INVALID_PKCS7_DATA); + goto end; + } + + /* get digest algor */ + if (sk_X509_ALGOR_num(p7signed->md_algs) != 1 + || !(algor = sk_X509_ALGOR_value(p7signed->md_algs, 0)) + || (*puiDigestAlgorithm = EVP_MD_sgd(EVP_get_digestbyobj(algor->algorithm))) <= 0) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_INVALID_PKCS7_DATA); + goto end; + } + + /* get signer's certificate */ + if (sk_X509_ALGOR_num(p7signed->cert) != 1 + || !(x509 = sk_X509_ALGOR_value(p7signed->cert, 0))) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_INVALID_PKCS7_DATA); + goto end; + } + if ((len = i2d_X509(x509, NULL)) <= 0) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, ERR_R_X509_LIB); + goto end; + } + if (*puiSignerCertificateLen < len) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_BUFFER_TOO_SMALL); + goto end; + } + if ((len = i2d_X509(x509, &pucSignerCertficate)) <= 0) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, ERR_R_X509_LIB); + goto end; + } + *puiSignerCertificateLen = len; + + /* get data */ + if (!(p7signed->contents) + || !PKCS7_type_is_data(p7signed->contents) + || !(data = p7signed->contents->d.data)) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_INVALID_PKCS7_DATA); + goto end; + } + + if (*puiDataLen < ASN1_OCTET_STRING_length(data)) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_BUFFER_TOO_SMALL); + goto end; + } + + memcpy(pucData, ASN1_OCTET_STRING_get0_data(data), ASN1_OCTET_STRING_length(data)); *puiDataLen = ASN1_OCTET_STRING_length(data); - memcpy(pucData, ASN1_OCTET_STRING_get0_data(data), *puiDataLen); + /* get signature */ + if (sk_SIGNER_INFO_num(p7signed->signer_info) <= 0 + || !(signer_info = sk_SIGNER_INFO_value(p7signed->signer_info, 0))) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_INVALID_PKCS7_DATA); + goto end; + } - PKCS7_verify(p7, NULL, chain_store, NULL, outbio, flags); - + if (*puiSigLen < ASN1_OCTET_STRING_length(signer_info->enc_digest)) { + SAFerr(SAF_F_SAF_PKCS7_DECODESIGNEDDATA, SAF_R_BUFFER_TOO_SMALL); + goto end; + } + memcpy(pucSig, ASN1_OCTET_STRING_get0_data(signer_info->enc_digest), + ASN1_OCTET_STRING_length(signer_info->enc_digest)); + *puiSigLen = ASN1_OCTET_STRING_length(signer_info->enc_digest); + ret = SAR_Ok; +end: + PKCS7_free(p7); + X509_free(x509); + BIO_free(bio); return ret; } @@ -275,7 +348,6 @@ int SAF_Pkcs7_EncodeEnvelopedData( ret = SAR_CertEncodeErr; goto end; } - // FIXME: check usage, valid time of x509 sk_X509_push(certs, x509); x509 = NULL; @@ -340,7 +412,7 @@ int SAF_Pkcs7_DecodeEnvelopedData( if (uiDecContainerNameLen <= 0 || uiDecContainerNameLen > INT_MAX || uiDerP7EnvelopedDataLen <= 0 || uiDerP7EnvelopedDataLen > INT_MAX) { - SAFerr(SAF_F_SAF_PKCS7_DECODEENVELOPEDDATA, SAR_R_INVALID_INPUT_LENGTH); + SAFerr(SAF_F_SAF_PKCS7_DECODEENVELOPEDDATA, SAF_R_INVALID_INPUT_LENGTH); return SAR_IndataLenErr; } @@ -352,21 +424,27 @@ int SAF_Pkcs7_DecodeEnvelopedData( return SAR_IndataLenErr; } - if (!(pkey = SAF_load_private_key(app, pucDecContainerName, - uiDecContainerNameLen, SGD_PK_ENC))) { + if (!(pkey = SAF_load_private_key(app, (char *)pucDecContainerName, + EVP_PK_EC|EVP_PKT_ENC))) { + SAFerr(SAF_F_SAF_PKCS7_DECODEENVELOPEDDATA, SAF_R_LOAd_PUBLIC_KEY_FAILURE); + goto end; } if (!(x509 = SAF_LoadCertificate(app, pucDecContainerName, uiDecContainerNameLen, SGD_PK_ENC))) { + goto end; } if (!(bio = BIO_new(BIO_s_membuf()))) { + goto end; } if (!PKCS7_decrypt(p7, pkey, x509, bio, 0)) { + goto end; } if (!BIO_get_mem_buf(bio, &buf)) { + goto end; } memcpy(pucData, buf->data, buf->length); diff --git a/crypto/saf/saf_pkcs7.d.tmp b/crypto/saf/saf_pkcs7.d.tmp new file mode 100644 index 00000000..63da507e --- /dev/null +++ b/crypto/saf/saf_pkcs7.d.tmp @@ -0,0 +1,17 @@ +crypto/saf/saf_pkcs7.o: crypto/saf/saf_pkcs7.c include/openssl/evp.h \ + include/openssl/opensslconf.h include/openssl/ossl_typ.h \ + include/openssl/e_os2.h include/openssl/symhacks.h \ + include/openssl/bio.h include/openssl/crypto.h include/openssl/stack.h \ + include/openssl/safestack.h include/openssl/opensslv.h \ + include/openssl/objects.h include/openssl/obj_mac.h \ + include/openssl/asn1.h include/openssl/bn.h include/openssl/pkcs7.h \ + include/openssl/gmapi.h include/openssl/ec.h include/openssl/sm2.h \ + include/openssl/err.h include/openssl/lhash.h include/openssl/kdf2.h \ + include/openssl/kdf.h include/openssl/x509.h include/openssl/buffer.h \ + include/openssl/rsa.h include/openssl/dsa.h include/openssl/dh.h \ + include/openssl/sha.h include/openssl/x509_vfy.h \ + include/openssl/ecies.h include/openssl/sm3.h include/openssl/sgd.h \ + include/openssl/saf.h include/openssl/sdf.h include/openssl/skf.h \ + include/openssl/sof.h include/openssl/gmsaf.h crypto/saf/saf_lcl.h \ + include/openssl/cmac.h include/openssl/gmsdf.h \ + include/openssl/engine.h include/openssl/rand.h include/openssl/ui.h diff --git a/crypto/skf/skf_meth.c b/crypto/skf/skf_meth.c index f18be36d..b0b425be 100644 --- a/crypto/skf/skf_meth.c +++ b/crypto/skf/skf_meth.c @@ -56,8 +56,6 @@ SKF_METHOD *SKF_METHOD_load_library(const char *so_path) SKF_METHOD *ret = NULL; SKF_METHOD *skf = NULL; DSO *dso = NULL; - void *func; - int i; if (!(dso = DSO_load(NULL, so_path, NULL, 0))) { goto end; diff --git a/crypto/sm2/sm2_kap.c b/crypto/sm2/sm2_kap.c index 7d7ba539..0e9dedf9 100644 --- a/crypto/sm2/sm2_kap.c +++ b/crypto/sm2/sm2_kap.c @@ -569,10 +569,8 @@ int SM2_KAP_final_check(SM2_KAP_CTX *ctx, const unsigned char *checksum, return 1; } -int SM2_compute_key(void *out, size_t outlen, - const EC_POINT *pub_key, EC_KEY *ecdh, - const EC_POINT *pub_key2, EC_KEY *ec_key2, - const char *id1, const char *id2, int is_ini) +int SM2_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, + const EC_KEY *ec_key, void *(*KDF) (const void *in, size_t inlen, void *out, size_t *outlen)) { return 0; } diff --git a/crypto/sm9/sm9_enc.c b/crypto/sm9/sm9_enc.c index 21bf14c3..94c51aeb 100644 --- a/crypto/sm9/sm9_enc.c +++ b/crypto/sm9/sm9_enc.c @@ -47,6 +47,9 @@ * ==================================================================== */ +#include +#include +#include #include #include #include @@ -888,8 +891,10 @@ end: SM9Ciphertext_free(ret); ret = NULL; } - OPENSSL_cleanse(key, keylen); - OPENSSL_free(key); + if (key) { + OPENSSL_cleanse(key, keylen); + OPENSSL_free(key); + } return ret; } diff --git a/crypto/sof/sof_err.c b/crypto/sof/sof_err.c index 252beb37..ad5e6ec3 100644 --- a/crypto/sof/sof_err.c +++ b/crypto/sof/sof_err.c @@ -1,6 +1,6 @@ /* * Generated by util/mkerr.pl DO NOT EDIT - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -30,7 +30,7 @@ static ERR_STRING_DATA SOF_str_functs[] = { {ERR_FUNC(SOF_F_SOF_ENCRYPTDATA), "SOF_EncryptData"}, {ERR_FUNC(SOF_F_SOF_ENCRYPTFILE), "SOF_EncryptFile"}, {ERR_FUNC(SOF_F_SOF_EXPORTEXCHANGEUSERCERT), - "SOF_ExportExChangeUserCert"}, + "SOF_ExportExchangeUserCert"}, {ERR_FUNC(SOF_F_SOF_EXPORTUSERCERT), "SOF_ExportUserCert"}, {ERR_FUNC(SOF_F_SOF_GENRANDOM), "SOF_GenRandom"}, {ERR_FUNC(SOF_F_SOF_GETCERTINFO), "SOF_GetCertInfo"}, @@ -72,7 +72,9 @@ static ERR_STRING_DATA SOF_str_functs[] = { }; static ERR_STRING_DATA SOF_str_reasons[] = { + {ERR_REASON(SOF_R_DECODE_FAILURE), "decode failure"}, {ERR_REASON(SOF_R_NOT_IMPLEMENTED), "not implemented"}, + {ERR_REASON(SOF_R_READ_FILE_FAILURE), "read file failure"}, {0, NULL} }; diff --git a/crypto/sof/sof_lib.d.tmp b/crypto/sof/sof_lib.d.tmp new file mode 100644 index 00000000..b7422ae8 --- /dev/null +++ b/crypto/sof/sof_lib.d.tmp @@ -0,0 +1,8 @@ +crypto/sof/sof_lib.o: crypto/sof/sof_lib.c include/openssl/err.h \ + include/openssl/e_os2.h include/openssl/opensslconf.h \ + include/openssl/ossl_typ.h include/openssl/bio.h \ + include/openssl/crypto.h include/openssl/stack.h \ + include/openssl/safestack.h include/openssl/opensslv.h \ + include/openssl/symhacks.h include/openssl/lhash.h \ + include/openssl/gmsof.h include/openssl/sgd.h include/openssl/sof.h \ + crypto/sof/../../e_os.h diff --git a/include/openssl/gmapi.h b/include/openssl/gmapi.h index a33260c2..8f7b077a 100644 --- a/include/openssl/gmapi.h +++ b/include/openssl/gmapi.h @@ -71,6 +71,8 @@ const char *GMAPI_keyusage2str(int usage); int GMAPI_sgd2ciphernid(int sgd); int GMAPI_sgd2mdnid(int sgd); +int EVP_MD_sgd(const EVP_MD *md); +int EVP_CIPHER_sgd(const EVP_CIPHER *cipher); /* SGD <==> EVP */ const EVP_MD *EVP_get_digestbysgd(int sgd); diff --git a/include/openssl/gmsaf.h b/include/openssl/gmsaf.h index 12110780..7c75f1fd 100644 --- a/include/openssl/gmsaf.h +++ b/include/openssl/gmsaf.h @@ -107,10 +107,15 @@ int ERR_load_SAF_strings(void); # define SAF_F_SAF_HASHUPDATE 131 # define SAF_F_SAF_INITIALIZE 132 # define SAF_F_SAF_KEY_NEW 133 +# define SAF_F_SAF_LOAD_PRIVATE_KEY 151 +# define SAF_F_SAF_LOAD_PUBLIC_KEY 152 # define SAF_F_SAF_LOGIN 134 # define SAF_F_SAF_LOGOUT 135 # define SAF_F_SAF_MACFINAL 136 # define SAF_F_SAF_MACUPDATE 137 +# define SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA 153 +# define SAF_F_SAF_PKCS7_DECODEENVELOPEDDATA 154 +# define SAF_F_SAF_PKCS7_DECODESIGNEDDATA 155 # define SAF_F_SAF_PKCS7_ENCODEDIGESTEDDATA 149 # define SAF_F_SAF_PKCS7_ENCODEENVELOPEDDATA 138 # define SAF_F_SAF_PKCS7_ENCODESIGNEDDATA 150 @@ -134,6 +139,7 @@ int ERR_load_SAF_strings(void); # define SAF_R_GEN_RANDOM_FAILURE 105 # define SAF_R_INT_OVERFLOW 106 # define SAF_R_INVALID_ALGOR 107 +# define SAF_R_INVALID_APP 124 # define SAF_R_INVALID_CERTIFICATE 108 # define SAF_R_INVALID_DIGEST_ALGOR 122 # define SAF_R_INVALID_HANDLE 109 @@ -143,13 +149,22 @@ int ERR_load_SAF_strings(void); # define SAF_R_INVALID_KEY_LENGTH 113 # define SAF_R_INVALID_KEY_USAGE 114 # define SAF_R_INVALID_LENGTH 115 +# define SAF_R_INVALID_PKCS7 125 +# define SAF_R_INVALID_PKCS7_DATA 126 +# define SAF_R_INVALID_PKCS7_TYPE 127 +# define SAF_R_INVALID_PKEY_TYPE 128 # define SAF_R_INVALID_PUBLIC_KEY 116 +# define SAF_R_LOA 132 # define SAF_R_LOAD_CERTS_FAILURE 117 # define SAF_R_LOAD_KEY_FAILURE 123 +# define SAF_R_LOAD_PRIVATE_KEY_FAILURE 129 +# define SAF_R_LOAD_PUBLIC_KEY_FAILURE 130 # define SAF_R_MAC_FAILURE 118 # define SAF_R_NOT_SUPPORTED 119 # define SAF_R_OPERATION_NOT_INITIALIZED 120 +# define SAF_R_PKCS7_VERIFY_FAILURE 133 # define SAF_R_UNSUPPORTED_ALGOR 121 +# define SAF_R_UNSUPPORTED_DIGEST_ALGOR 131 # ifdef __cplusplus } diff --git a/include/openssl/gmsof.h b/include/openssl/gmsof.h index 674e87ea..c01044f0 100644 --- a/include/openssl/gmsof.h +++ b/include/openssl/gmsof.h @@ -135,7 +135,9 @@ int ERR_load_SOF_strings(void); # define SOF_F_SOF_VERIFYTIMESTAMP 142 /* Reason codes. */ +# define SOF_R_DECODE_FAILURE 101 # define SOF_R_NOT_IMPLEMENTED 100 +# define SOF_R_READ_FILE_FAILURE 102 # ifdef __cplusplus } diff --git a/include/openssl/saf.h b/include/openssl/saf.h index 6c34a825..4bfc4c88 100644 --- a/include/openssl/saf.h +++ b/include/openssl/saf.h @@ -592,7 +592,17 @@ int SAF_Pkcs7_EncodeData( unsigned int *puiDerP7DataLen); int SAF_Pkcs7_DecodeData( - void *hAppHandle); + void *hAppHandle, + unsigned char *pucDecContainerName, + unsigned int uiDecContainerNameLen, + unsigned int uiDecKeyUsage, + unsigned char *pucDerP7Data, + unsigned int uiDerP7DataLen, + unsigned char *pucData, + unsigned int *puiDataLen, + unsigned char *pucSignerCertificate, + unsigned int *puiSignerCertificateLen, + unsigned int *puiDigestAlgorithm); int SAF_Pkcs7_EncodeSignedData( void *hAppHandle, @@ -611,13 +621,13 @@ int SAF_Pkcs7_DecodeSignedData( void *hAppHandle, unsigned char *pucDerP7SignedData, unsigned int uiDerP7SignedDataLen, + unsigned int *puiDigestAlgorithm, unsigned char *pucSignerCertificate, - unsigned int uiSignerCertificateLen, - unsigned int uiDigestAlgorithm, + unsigned int *puiSignerCertificateLen, unsigned char *pucData, - unsigned int uiDataLen, - unsigned char *pucSign, - unsigned int *puiSignLen); + unsigned int *puiDataLen, + unsigned char *pucSig, + unsigned int *puiSigLen); int SAF_Pkcs7_EncodeEnvelopedData( void *hAppHandle, diff --git a/include/openssl/sm2.h b/include/openssl/sm2.h index 47a76044..1444a5c8 100755 --- a/include/openssl/sm2.h +++ b/include/openssl/sm2.h @@ -175,6 +175,8 @@ int SM2_sign(int type, const unsigned char *dgst, int dgstlen, int SM2_verify(int type, const unsigned char *dgst, int dgstlen, const unsigned char *sig, int siglen, EC_KEY *ec_key); +int SM2_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, + const EC_KEY *ec_key, void *(*KDF) (const void *in, size_t inlen, void *out, size_t *outlen)); typedef struct sm2_kap_ctx_st { diff --git a/test/saftest.c b/test/saftest.c index 80ba1529..17e56b3f 100644 --- a/test/saftest.c +++ b/test/saftest.c @@ -61,9 +61,52 @@ int main(int argc, char **argv) #else # include -static int test_saf_base64(int verbose) +int test_saf_base64(int verbose) { - return 0; + int ret = SAR_UnknownErr; + /* sizeof(buf1)%3 == 1 makes base64 ended with "==" */ + unsigned char buf1[121]; + unsigned char buf2[512]; + unsigned char buf3[512]; + unsigned int len1, len2, len3; + + /* generate some random binary for testing */ + RAND_bytes(buf1, sizeof(buf1)); + memset(buf2, 0, sizeof(buf2)); + memset(buf3, 0, sizeof(buf3)); + + len1 = (unsigned int)sizeof(buf1); + len2 = (unsigned int)sizeof(buf2); + if ((ret = SAF_Base64_Encode(buf1, len1, buf2, &len2)) != SAR_Ok) { + ERR_print_errors_fp(stderr); + goto end; + } + if (verbose) { + printf("%s\n", buf2); + } + + len3 = sizeof(buf3); + if ((ret = SAF_Base64_Decode(buf2, len2, buf3, &len3)) != SAR_Ok) { + ERR_print_errors_fp(stderr); + goto end; + } + + /* check correctness */ + if (len1 == len3 && memcmp(buf1, buf3, len1) == 0) { + ret = SAR_Ok; + } else { + /* make sure to assign `ret`, or it might be set as OK by + * previous functions */ + ret = SAR_UnknownErr; + } + +end: + if (verbose) { + printf("%s %s\n", __FUNCTION__, + ret == SAR_Ok ? "passed" : "failed"); + } + + return ret; } static int test_saf_cert(int verbose) @@ -78,11 +121,44 @@ static int test_saf_ec(int verbose) static int test_saf_hash(int verbose) { - return 0; + int ret = 0; + unsigned char msg[3] = "abc"; + unsigned char pubkey[] = "FIXME"; + unsigned char id[] = "FIXME"; + unsigned char dgst[EVP_MAX_MD_SIZE]; + unsigned int dgstlen; + + dgstlen = (unsigned int)sizeof(dgst); + if (SAF_Hash(SGD_SM3, msg, sizeof(msg), NULL, 0, NULL, 0, + dgst, &dgstlen) != SAR_Ok) { + if (verbose) { + fprintf(stderr, "%s() error on test 1\n", __func__); + } + return 0; + } + + dgstlen = (unsigned int)sizeof(dgst); + if (SAF_Hash(SGD_SM3, msg, sizeof(msg), pubkey, sizeof(pubkey), + id, sizeof(id), dgst, &dgstlen) != SAR_Ok) { + if (verbose) { + fprintf(stderr, "%s() error on test 2\n", __func__); + } + return 0; + } + + return 1; } static int test_saf_mac(int verbose) { + int ret = 0; + void *hKeyHandle = NULL; + unsigned char data[] = "hello world"; + unsigned char mac[EVP_MAX_MD_SIZE]; + + + + return 0; } @@ -111,7 +187,7 @@ int main(int argc, char **argv) int err = 0; int verboe = 2; - if (!test_saf_base64(verbose)) err++; + if (SAR_Ok != test_saf_base64(verbose)) err++; if (!test_saf_cert(verbose)) err++; if (!test_saf_ec(verbose)) err++ if (!test_saf_enc(verbose)) err++; diff --git a/util/libcrypto.num b/util/libcrypto.num index 22c40d46..12d65e26 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -4228,3 +4228,646 @@ EVP_sms4_gcm 4194 1_1_0d EXIST::FUNCTION:SMS4 EVP_sms4_ocb 4195 1_1_0d EXIST::FUNCTION:SMS4 EVP_sms4_ccm 4196 1_1_0d EXIST::FUNCTION:SMS4 EVP_sms4_wrap_pad 4197 1_1_0d EXIST::FUNCTION:SMS4 +SM2_CIPHERTEXT_VALUE_new_from_ECCCIPHERBLOB 4198 1_1_0d EXIST::FUNCTION: +BFPrivateKeyBlock_new 4199 1_1_0d EXIST::FUNCTION: +SM2_ENC_PARAMS_init_with_recommended 4200 1_1_0d EXIST::FUNCTION: +BFMasterSecret_it 4201 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +BFMasterSecret_it 4201 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +SAF_Pkcs7_EncodeData 4202 1_1_0d EXIST::FUNCTION: +EC_KEY_GmSSL 4203 1_1_0d EXIST::FUNCTION: +SAF_Base64_CreateBase64Obj 4204 1_1_0d EXIST::FUNCTION: +CPK_MASTER_SECRET_new 4205 1_1_0d EXIST::FUNCTION: +SKF_CreateContainer 4206 1_1_0d EXIST::FUNCTION: +SM9_decrypt_with_recommended 4207 1_1_0d EXIST::FUNCTION: +BFPublicParameters_new 4208 1_1_0d EXIST::FUNCTION: +BFMasterSecret_new 4209 1_1_0d EXIST::FUNCTION: +SAF_PrintNameInfo 4210 1_1_0d EXIST::FUNCTION: +EC_KEY_METHOD_set_decrypt 4211 1_1_0d EXIST::FUNCTION: +sms4_ctr128_encrypt 4212 1_1_0d EXIST::FUNCTION: +ECDSA_SIG_new_from_ECCSIGNATUREBLOB 4213 1_1_0d EXIST::FUNCTION: +SAF_GetCaCertificate 4214 1_1_0d EXIST::FUNCTION: +EC_KEY_new_from_ECCPUBLICKEYBLOB 4215 1_1_0d EXIST::FUNCTION: +SM2_decrypt_with_recommended 4216 1_1_0d EXIST::FUNCTION: +CPK_MASTER_SECRET_print 4217 1_1_0d EXIST::FUNCTION: +ECIES_do_decrypt 4218 1_1_0d EXIST::FUNCTION: +FFX_decrypt 4219 1_1_0d EXIST::FUNCTION: +SAF_ChangePin 4220 1_1_0d EXIST::FUNCTION: +BFPrivateKeyBlock_it 4221 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +BFPrivateKeyBlock_it 4221 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +CPK_MAP_new_default 4222 1_1_0d EXIST::FUNCTION: +SAF_Pkcs7_EncodeDigestedData 4223 1_1_0d EXIST::FUNCTION: +RSA_get_RSAPRIVATEKEYBLOB 4224 1_1_0d EXIST::FUNCTION: +SAF_Pkcs7_DecodeDigestedData 4225 1_1_0d EXIST::FUNCTION: +d2i_SM9PublicParameters 4226 1_1_0d EXIST::FUNCTION: +SM9_extract_private_key 4227 1_1_0d EXIST::FUNCTION: +SOF_SetCertTrustList 4228 1_1_0d EXIST::FUNCTION: +i2d_BFPublicParameters 4229 1_1_0d EXIST::FUNCTION: +sms4_unwrap_key 4230 1_1_0d EXIST::FUNCTION: +sms4_set_encrypt_key 4231 1_1_0d EXIST::FUNCTION: +SKF_RSAVerify 4232 1_1_0d EXIST::FUNCTION: +PAILLIER_PUBLIC_KEY_it 4233 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +PAILLIER_PUBLIC_KEY_it 4233 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +sms4_avx2_encrypt_8blocks 4234 1_1_0d EXIST::FUNCTION: +SKF_Transmit 4235 1_1_0d EXIST::FUNCTION: +SM9Signature_it 4236 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +SM9Signature_it 4236 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +SDF_GenerateKeyWithKEK 4237 1_1_0d EXIST::FUNCTION: +SKF_ExportCertificate 4238 1_1_0d EXIST::FUNCTION: +SAF_GetCertificateInfo 4239 1_1_0d EXIST::FUNCTION: +SKF_GetPINInfo 4240 1_1_0d EXIST::FUNCTION: +SAF_CreateHashObj 4241 1_1_0d EXIST::FUNCTION: +SDF_GetDeviceInfo 4242 1_1_0d EXIST::FUNCTION: +ECIES_do_encrypt 4243 1_1_0d EXIST::FUNCTION: +SM9PublicParameters_free 4244 1_1_0d EXIST::FUNCTION: +SOF_SetEncryptMethod 4245 1_1_0d EXIST::FUNCTION: +SDF_InternalPrivateKeyOperation_RSA 4246 1_1_0d EXIST::FUNCTION: +SAF_MacFinal 4247 1_1_0d EXIST::FUNCTION: +d2i_BFPublicParameters 4248 1_1_0d EXIST::FUNCTION: +SAF_VerifyCertificate 4249 1_1_0d EXIST::FUNCTION: +SDF_ReleasePrivateKeyAccessRight 4250 1_1_0d EXIST::FUNCTION: +SDF_DeleteFile 4251 1_1_0d EXIST::FUNCTION: +CPK_MAP_print 4252 1_1_0d EXIST::FUNCTION: +SAF_Pkcs7_EncodeEnvelopedData 4253 1_1_0d EXIST::FUNCTION: +PAILLIER_free 4254 1_1_0d EXIST::FUNCTION: +EVP_CIPHER_sgd 4255 1_1_0d EXIST::FUNCTION: +SKF_ExtECCVerify 4256 1_1_0d EXIST::FUNCTION: +EC_POINT_cmp_fppoint 4257 1_1_0d EXIST::FUNCTION: +SM2_do_sign 4258 1_1_0d EXIST::FUNCTION: +SAF_GenerateAgreementDataWithECC 4259 1_1_0d EXIST::FUNCTION: +sm3_hmac_final 4260 1_1_0d EXIST::FUNCTION: +BFPublicParameters_free 4261 1_1_0d EXIST::FUNCTION: +SM9_decrypt 4262 1_1_0d EXIST::FUNCTION: +SAF_RsaVerifySignFile 4263 1_1_0d EXIST::FUNCTION: +i2d_CPK_PUBLIC_PARAMS 4264 1_1_0d EXIST::FUNCTION: +CPK_MASTER_SECRET_create 4265 1_1_0d EXIST::FUNCTION: +SKF_PrintECCPrivateKey 4266 1_1_0d EXIST::FUNCTION: +SAF_Base64_EncodeFinal 4267 1_1_0d EXIST::FUNCTION: +SAF_GetExtTypeInfo 4268 1_1_0d EXIST::FUNCTION: +SKF_GenerateKeyWithECC 4269 1_1_0d EXIST::FUNCTION: +SKF_get_alg_name 4270 1_1_0d EXIST::FUNCTION: +sms4_avx2_encrypt_init 4271 1_1_0d EXIST::FUNCTION: +SOF_CreateTimeStampResponse 4272 1_1_0d EXIST::FUNCTION: +SAF_RemoveCaCertificate 4273 1_1_0d EXIST::FUNCTION: +SAF_RsaSign 4274 1_1_0d EXIST::FUNCTION: +SM9_do_encrypt 4275 1_1_0d EXIST::FUNCTION: +BB1PrivateKeyBlock_it 4276 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +BB1PrivateKeyBlock_it 4276 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +sms4_ede_encrypt 4277 1_1_0d EXIST::FUNCTION: +KDF_get_ikev2_kdf 4278 1_1_0d EXIST::FUNCTION: +SKF_ExtECCSign 4279 1_1_0d EXIST::FUNCTION: +SM9Signature_free 4280 1_1_0d EXIST::FUNCTION: +RSA_new_from_RSAPUBLICKEYBLOB 4281 1_1_0d EXIST::FUNCTION: +d2i_SM9Signature 4282 1_1_0d EXIST::FUNCTION: +SAF_ImportEncedKey 4283 1_1_0d EXIST::FUNCTION: +SKF_GenerateAgreementDataAndKeyWithECC 4284 1_1_0d EXIST::FUNCTION: +SDF_InternalPublicKeyOperation_RSA 4285 1_1_0d EXIST::FUNCTION: +SM2_ENC_PARAMS_new 4286 1_1_0d EXIST::FUNCTION: +SKF_PrintDeviceInfo 4287 1_1_0d EXIST::FUNCTION: +EC_GROUP_get_type1curve_eta 4288 1_1_0d EXIST::FUNCTION: +d2i_PAILLIER_PUBLIC_KEY 4289 1_1_0d EXIST::FUNCTION: +SM9PrivateKey_new 4290 1_1_0d EXIST::FUNCTION: +sm3_hmac 4291 1_1_0d EXIST::FUNCTION: +SOF_GetPinRetryCount 4292 1_1_0d EXIST::FUNCTION: +SAF_SM2_DecodeSignedAndEnvelopedData 4293 1_1_0d EXIST::FUNCTION: +EC_KEY_get_ECCPUBLICKEYBLOB 4294 1_1_0d EXIST::FUNCTION: +SKF_ChangePIN 4295 1_1_0d EXIST::FUNCTION: +ECIES_CIPHERTEXT_VALUE_free 4296 1_1_0d EXIST::FUNCTION: +BFCiphertextBlock_it 4297 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +BFCiphertextBlock_it 4297 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +SKF_ImportRSAKeyPair 4298 1_1_0d EXIST::FUNCTION: +PAILLIER_encrypt 4299 1_1_0d EXIST::FUNCTION: +SAF_GetErrorString 4300 1_1_0d EXIST::FUNCTION: +SAF_GenRandom 4301 1_1_0d EXIST::FUNCTION: +sms4_set_decrypt_key 4302 1_1_0d EXIST::FUNCTION: +eia3_update 4303 1_1_0d EXIST::FUNCTION: +SKF_ExtRSAPriKeyOperation 4304 1_1_0d EXIST::FUNCTION: +SAF_Login 4305 1_1_0d EXIST::FUNCTION: +BN_bn2solinas 4306 1_1_0d EXIST::FUNCTION: +SKF_DecryptInit 4307 1_1_0d EXIST::FUNCTION: +SKF_Encrypt 4308 1_1_0d EXIST::FUNCTION: +SAF_GenerateAgreementDataAdnKeyWithECC 4309 1_1_0d EXIST::FUNCTION: +ECIES_decrypt_with_recommended 4310 1_1_0d EXIST::FUNCTION: +BB1IBE_extract_private_key 4311 1_1_0d EXIST::FUNCTION: +SAF_Base64_DestroyBase64Obj 4312 1_1_0d EXIST::FUNCTION: +SDF_HashFinal 4313 1_1_0d EXIST::FUNCTION: +SAF_Mac 4314 1_1_0d EXIST::FUNCTION: +BN_GFP2_is_zero 4315 1_1_0d EXIST::FUNCTION: +ECIES_PARAMS_init_with_recommended 4316 1_1_0d EXIST::FUNCTION: +sms4_ede_decrypt_8blocks 4317 1_1_0d EXIST::FUNCTION: +SAF_VerifySignByCert 4318 1_1_0d EXIST::FUNCTION: +SKF_ChangeDevAuthKey 4319 1_1_0d EXIST::FUNCTION: +eia3 4320 1_1_0d EXIST::FUNCTION: +FFX_CTX_free 4321 1_1_0d EXIST::FUNCTION: +SAF_MacUpdate 4322 1_1_0d EXIST::FUNCTION: +EC_KEY_new_from_ECCrefPublicKey 4323 1_1_0d EXIST::FUNCTION: +SDF_OpenSession 4324 1_1_0d EXIST::FUNCTION: +SDF_Encrypt 4325 1_1_0d EXIST::FUNCTION: +SOF_VerifySignedFile 4326 1_1_0d EXIST::FUNCTION: +GMAPI_keyusage2str 4327 1_1_0d EXIST::FUNCTION: +SDF_ExportEncPublicKey_RSA 4328 1_1_0d EXIST::FUNCTION: +SKF_GenECCKeyPair 4329 1_1_0d EXIST::FUNCTION: +SKF_EnumDev 4330 1_1_0d EXIST::FUNCTION: +SDF_GetErrorString 4331 1_1_0d EXIST::FUNCTION: +d2i_SM9MasterSecret 4332 1_1_0d EXIST::FUNCTION: +BB1MasterSecret_free 4333 1_1_0d EXIST::FUNCTION: +EVP_get_cipherbysgd 4334 1_1_0d EXIST::FUNCTION: +SKF_ECCVerify 4335 1_1_0d EXIST::FUNCTION: +zuc_set_key 4336 1_1_0d EXIST::FUNCTION: +ERR_load_SM9_strings 4337 1_1_0d EXIST::FUNCTION: +SOF_VerifySignedMessage 4338 1_1_0d EXIST::FUNCTION: +EC_KEY_METHOD_set_encrypt 4339 1_1_0d EXIST::FUNCTION: +SAF_SM2_DecodeEnvelopedData 4340 1_1_0d EXIST::FUNCTION: +SDF_HashUpdate 4341 1_1_0d EXIST::FUNCTION: +i2d_PAILLIER_PUBLIC_KEY 4342 1_1_0d EXIST::FUNCTION: +EC_GROUP_new_type1curve 4343 1_1_0d EXIST::FUNCTION: +BN_GFP2_copy 4344 1_1_0d EXIST::FUNCTION: +sms4_encrypt_8blocks 4345 1_1_0d EXIST::FUNCTION: +sms4_ede_encrypt_8blocks 4346 1_1_0d EXIST::FUNCTION: +BB1PrivateKeyBlock_free 4347 1_1_0d EXIST::FUNCTION: +KDF_get_ibcs 4348 1_1_0d EXIST::FUNCTION: +sms4_encrypt 4349 1_1_0d EXIST::FUNCTION: +ERR_load_SKF_strings 4350 1_1_0d EXIST::FUNCTION: +SAF_GetVersion 4351 1_1_0d EXIST::FUNCTION: +SOF_GetXMLSignatureInfo 4352 1_1_0d EXIST::FUNCTION: +CPK_MASTER_SECRET_extract_public_params 4353 1_1_0d EXIST::FUNCTION: +SAF_GetRsaPublicKey 4354 1_1_0d EXIST::FUNCTION: +SAF_Pkcs7_DecodeSignedData 4355 1_1_0d EXIST::FUNCTION: +BN_hash_to_range 4356 1_1_0d EXIST::FUNCTION: +ECIES_PARAMS_get_mac 4357 1_1_0d EXIST::FUNCTION: +ERR_load_CPK_strings 4358 1_1_0d EXIST::FUNCTION: +ECDSA_SIG_get_ECCSignature 4359 1_1_0d EXIST::FUNCTION: +KDF_get_x9_63 4360 1_1_0d EXIST::FUNCTION: +SAF_EnumKeyContainerInfoFree 4361 1_1_0d EXIST::FUNCTION: +ERR_load_SDF_strings 4362 1_1_0d EXIST::FUNCTION: +SKF_ImportSessionKey 4363 1_1_0d EXIST::FUNCTION: +sm3_hmac_update 4364 1_1_0d EXIST::FUNCTION: +SDF_PrintECCPrivateKey 4365 1_1_0d EXIST::FUNCTION: +sms4_avx2_encrypt_16blocks 4366 1_1_0d EXIST::FUNCTION: +i2d_SM9Signature 4367 1_1_0d EXIST::FUNCTION: +SKF_DigestInit 4368 1_1_0d EXIST::FUNCTION: +SM9PrivateKey_free 4369 1_1_0d EXIST::FUNCTION: +SDF_GenerateRandom 4370 1_1_0d EXIST::FUNCTION: +BN_GFP2_sqr 4371 1_1_0d EXIST::FUNCTION: +EC_KEY_get_ECCrefPublicKey 4372 1_1_0d EXIST::FUNCTION: +BN_GFP2_zero 4373 1_1_0d EXIST::FUNCTION: +sms4_ede_encrypt_16blocks 4374 1_1_0d EXIST::FUNCTION: +BB1PrivateKeyBlock_new 4375 1_1_0d EXIST::FUNCTION: +PAILLIER_check_key 4376 1_1_0d EXIST::FUNCTION: +SDF_GenerateAgreementDataAndKeyWithECC 4377 1_1_0d EXIST::FUNCTION: +EC_KEY_set_ECCPUBLICKEYBLOB 4378 1_1_0d EXIST::FUNCTION: +SM2_sign_ex 4379 1_1_0d EXIST::FUNCTION: +SOF_GetCertTrustListAltNames 4380 1_1_0d EXIST::FUNCTION: +RSA_set_RSAPUBLICKEYBLOB 4381 1_1_0d EXIST::FUNCTION: +PAILLIER_decrypt 4382 1_1_0d EXIST::FUNCTION: +SM2_CIPHERTEXT_VALUE_set_ECCCipher 4383 1_1_0d EXIST::FUNCTION: +SKF_CreateApplication 4384 1_1_0d EXIST::FUNCTION: +sms4_cbc_encrypt 4385 1_1_0d EXIST::FUNCTION: +SDF_ExportSignPublicKey_ECC 4386 1_1_0d EXIST::FUNCTION: +ECIES_CIPHERTEXT_VALUE_it 4387 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +ECIES_CIPHERTEXT_VALUE_it 4387 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +SM2_ENC_PARAMS_free 4388 1_1_0d EXIST::FUNCTION: +SKF_GenerateAgreementDataWithECC 4389 1_1_0d EXIST::FUNCTION: +BFIBE_encrypt 4390 1_1_0d EXIST::FUNCTION: +SDF_PrintECCSignature 4391 1_1_0d EXIST::FUNCTION: +RSA_set_RSAPRIVATEKEYBLOB 4392 1_1_0d EXIST::FUNCTION: +CPK_MASTER_SECRET_get_name 4393 1_1_0d EXIST::FUNCTION: +SAF_EnumKeyContainerInfo 4394 1_1_0d EXIST::FUNCTION: +SM2_KAP_CTX_init 4395 1_1_0d EXIST::FUNCTION: +SOF_SignMessageDetach 4396 1_1_0d EXIST::FUNCTION: +BN_GFP2_free 4397 1_1_0d EXIST::FUNCTION: +SKF_CloseHandle 4398 1_1_0d EXIST::FUNCTION: +CPK_PUBLIC_PARAMS_new 4399 1_1_0d EXIST::FUNCTION: +SDF_CloseSession 4400 1_1_0d EXIST::FUNCTION: +GMAPI_sgd2ciphernid 4401 1_1_0d EXIST::FUNCTION: +SM9MasterSecret_it 4402 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +SM9MasterSecret_it 4402 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +SKF_ExtECCEncrypt 4403 1_1_0d EXIST::FUNCTION: +i2d_CPK_MASTER_SECRET 4404 1_1_0d EXIST::FUNCTION: +SAF_GenerateKeyWithEPK 4405 1_1_0d EXIST::FUNCTION: +SAF_Pkcs7_DecodeEnvelopedData 4406 1_1_0d EXIST::FUNCTION: +SM2_encrypt 4407 1_1_0d EXIST::FUNCTION: +SKF_EncryptUpdate 4408 1_1_0d EXIST::FUNCTION: +sms4_encrypt_init 4409 1_1_0d EXIST::FUNCTION: +SAF_SymmEncryptUpdate 4410 1_1_0d EXIST::FUNCTION: +ECIES_PARAMS_get_kdf 4411 1_1_0d EXIST::FUNCTION: +SDF_GenerateKeyWithIPK_RSA 4412 1_1_0d EXIST::FUNCTION: +SAF_GetCaCertificateCount 4413 1_1_0d EXIST::FUNCTION: +SM2_do_decrypt 4414 1_1_0d EXIST::FUNCTION: +CPK_MASTER_SECRET_digest 4415 1_1_0d EXIST::FUNCTION: +SM2_CIPHERTEXT_VALUE_new 4416 1_1_0d EXIST::FUNCTION: +d2i_BFCiphertextBlock 4417 1_1_0d EXIST::FUNCTION: +SKF_ImportCertificate 4418 1_1_0d EXIST::FUNCTION: +PAILLIER_ciphertext_add 4419 1_1_0d EXIST::FUNCTION: +BFCiphertextBlock_new 4420 1_1_0d EXIST::FUNCTION: +eia3_init 4421 1_1_0d EXIST::FUNCTION: +SM9Ciphertext_it 4422 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +SM9Ciphertext_it 4422 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +eea3_init 4423 1_1_0d EXIST::FUNCTION: +i2d_SM2_CIPHERTEXT_VALUE 4424 1_1_0d EXIST::FUNCTION: +i2d_BFCiphertextBlock 4425 1_1_0d EXIST::FUNCTION: +SAF_Pkcs7_EncodeSignedData 4426 1_1_0d EXIST::FUNCTION: +BB1MasterSecret_new 4427 1_1_0d EXIST::FUNCTION: +EC_KEY_get_ECCrefPrivateKey 4428 1_1_0d EXIST::FUNCTION: +SDF_Decrypt 4429 1_1_0d EXIST::FUNCTION: +SM9_do_verify 4430 1_1_0d EXIST::FUNCTION: +SOF_SignMessage 4431 1_1_0d EXIST::FUNCTION: +SKF_ExtECCDecrypt 4432 1_1_0d EXIST::FUNCTION: +SDF_ExternalEncrypt_ECC 4433 1_1_0d EXIST::FUNCTION: +SAF_GenerateKeyWithECC 4434 1_1_0d EXIST::FUNCTION: +SOF_GetCertInfoByOid 4435 1_1_0d EXIST::FUNCTION: +BN_gfp22bn 4436 1_1_0d EXIST::FUNCTION: +FFX_CTX_new 4437 1_1_0d EXIST::FUNCTION: +SDF_ImportKeyWithISK_ECC 4438 1_1_0d EXIST::FUNCTION: +SAF_GetCertificateStateByOCSP 4439 1_1_0d EXIST::FUNCTION: +SOF_GenRandom 4440 1_1_0d EXIST::FUNCTION: +SDF_InternalSign_ECC 4441 1_1_0d EXIST::FUNCTION: +FpPoint_it 4442 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +FpPoint_it 4442 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +d2i_BB1PrivateKeyBlock 4443 1_1_0d EXIST::FUNCTION: +SKF_Decrypt 4444 1_1_0d EXIST::FUNCTION: +SOF_DecryptFile 4445 1_1_0d EXIST::FUNCTION: +PAILLIER_new 4446 1_1_0d EXIST::FUNCTION: +RSA_get_RSArefPrivateKey 4447 1_1_0d EXIST::FUNCTION: +SKF_GetFileInfo 4448 1_1_0d EXIST::FUNCTION: +d2i_SM2_CIPHERTEXT_VALUE 4449 1_1_0d EXIST::FUNCTION: +GMAPI_sgd2mdnid 4450 1_1_0d EXIST::FUNCTION: +SKF_LockDev 4451 1_1_0d EXIST::FUNCTION: +d2i_ECIESParameters 4452 1_1_0d EXIST::FUNCTION: +EC_KEY_METHOD_get_encrypt 4453 1_1_0d EXIST::FUNCTION: +BFIBE_do_decrypt 4454 1_1_0d EXIST::FUNCTION: +BN_GFP2_exp 4455 1_1_0d EXIST::FUNCTION: +SDF_ReadFile 4456 1_1_0d EXIST::FUNCTION: +SAF_Initialize 4457 1_1_0d EXIST::FUNCTION: +zuc_encrypt 4458 1_1_0d EXIST::FUNCTION: +ECIES_PARAMS_new 4459 1_1_0d EXIST::FUNCTION: +d2i_SM9PrivateKey 4460 1_1_0d EXIST::FUNCTION: +EVP_MD_sgd 4461 1_1_0d EXIST::FUNCTION: +SKF_WaitForDevEvent 4462 1_1_0d EXIST::FUNCTION: +ECDSA_SIG_set_ECCSIGNATUREBLOB 4463 1_1_0d EXIST::FUNCTION: +d2i_BFPrivateKeyBlock 4464 1_1_0d EXIST::FUNCTION: +SDF_GenerateKeyWithEPK_ECC 4465 1_1_0d EXIST::FUNCTION: +SDF_PrintRSAPublicKey 4466 1_1_0d EXIST::FUNCTION: +BB1IBE_do_encrypt 4467 1_1_0d EXIST::FUNCTION: +d2i_CPK_MASTER_SECRET_bio 4468 1_1_0d EXIST::FUNCTION: +SOF_GetInfoFromSignedMessage 4469 1_1_0d EXIST::FUNCTION: +EVP_get_digestbysgd 4470 1_1_0d EXIST::FUNCTION: +i2d_BB1MasterSecret 4471 1_1_0d EXIST::FUNCTION: +SOF_ValidateCert 4472 1_1_0d EXIST::FUNCTION: +SKF_DeleteFile 4473 1_1_0d EXIST::FUNCTION: +SAF_Pkcs7_DecodeData 4474 1_1_0d EXIST::FUNCTION: +SDF_PrintECCCipher 4475 1_1_0d EXIST::FUNCTION: +SAF_SymmDecryptFinal 4476 1_1_0d EXIST::FUNCTION: +ERR_load_FFX_strings 4477 1_1_0d EXIST::FUNCTION: +i2d_SM9PrivateKey 4478 1_1_0d EXIST::FUNCTION: +ERR_load_OTP_strings 4479 1_1_0d EXIST::FUNCTION: +SAF_AddCrl 4480 1_1_0d EXIST::FUNCTION: +SDF_GenerateAgreementDataWithECC 4481 1_1_0d EXIST::FUNCTION: +SAF_DestroyHashObj 4482 1_1_0d EXIST::FUNCTION: +SDF_ExchangeDigitEnvelopeBaseOnRSA 4483 1_1_0d EXIST::FUNCTION: +BFIBE_decrypt 4484 1_1_0d EXIST::FUNCTION: +SKF_ECCExportSessionKey 4485 1_1_0d EXIST::FUNCTION: +CPK_PUBLIC_PARAMS_compute_share_key 4486 1_1_0d EXIST::FUNCTION: +FpPoint_new 4487 1_1_0d EXIST::FUNCTION: +SM2_KAP_CTX_cleanup 4488 1_1_0d EXIST::FUNCTION: +sm3_compress 4489 1_1_0d EXIST::FUNCTION: +OTP_generate 4490 1_1_0d EXIST::FUNCTION: +SM2_CIPHERTEXT_VALUE_print 4491 1_1_0d EXIST::FUNCTION: +PAILLIER_ciphertext_scalar_mul 4492 1_1_0d EXIST::FUNCTION: +SAF_Logout 4493 1_1_0d EXIST::FUNCTION: +SAF_GetRootCaCertificate 4494 1_1_0d EXIST::FUNCTION: +SDF_PrintECCPublicKey 4495 1_1_0d EXIST::FUNCTION: +SDF_ExchangeDigitEnvelopeBaseOnECC 4496 1_1_0d EXIST::FUNCTION: +sms4_ede_set_decrypt_key 4497 1_1_0d EXIST::FUNCTION: +i2d_BB1PublicParameters 4498 1_1_0d EXIST::FUNCTION: +sm3 4499 1_1_0d EXIST::FUNCTION: +CPK_MASTER_SECRET_free 4500 1_1_0d EXIST::FUNCTION: +ECIES_encrypt 4501 1_1_0d EXIST::FUNCTION: +SAF_AddCaCertificate 4502 1_1_0d EXIST::FUNCTION: +SM9_do_sign 4503 1_1_0d EXIST::FUNCTION: +SKF_CancelWaitForDevEvent 4504 1_1_0d EXIST::FUNCTION: +SM9_encrypt_with_recommended 4505 1_1_0d EXIST::FUNCTION: +BN_GFP2_mul 4506 1_1_0d EXIST::FUNCTION: +SDF_ImportKey 4507 1_1_0d EXIST::FUNCTION: +SAF_Base64_Decode 4508 1_1_0d EXIST::FUNCTION: +SKF_ConnectDev 4509 1_1_0d EXIST::FUNCTION: +EC_KEY_new_from_ECCrefPrivateKey 4510 1_1_0d EXIST::FUNCTION: +SDF_InternalVerify_ECC 4511 1_1_0d EXIST::FUNCTION: +CPK_PUBLIC_PARAMS_validate_private_key 4512 1_1_0d EXIST::FUNCTION: +SOF_GetDeviceInfo 4513 1_1_0d EXIST::FUNCTION: +sms4_knc_encrypt_16blocks 4514 1_1_0d EXIST::FUNCTION: +SOF_VerifyTimeStamp 4515 1_1_0d EXIST::FUNCTION: +EC_KEY_METHOD_type 4516 1_1_0d EXIST::FUNCTION: +BN_GFP2_new 4517 1_1_0d EXIST::FUNCTION: +SM2_verify 4518 1_1_0d EXIST::FUNCTION: +CPK_PUBLIC_PARAMS_extract_public_key 4519 1_1_0d EXIST::FUNCTION: +SKF_EncryptFinal 4520 1_1_0d EXIST::FUNCTION: +SM9MasterSecret_new 4521 1_1_0d EXIST::FUNCTION: +BB1PublicParameters_new 4522 1_1_0d EXIST::FUNCTION: +BN_solinas2bn 4523 1_1_0d EXIST::FUNCTION: +SOF_InitCertAppPolicy 4524 1_1_0d EXIST::FUNCTION: +SAF_GenEccKeyPair 4525 1_1_0d EXIST::FUNCTION: +EC_type1curve_tate_ratio 4526 1_1_0d EXIST::FUNCTION: +SKF_DecryptFinal 4527 1_1_0d EXIST::FUNCTION: +SM9_sign 4528 1_1_0d EXIST::FUNCTION: +sms4_ofb128_encrypt 4529 1_1_0d EXIST::FUNCTION: +SKF_PrintECCPublicKey 4530 1_1_0d EXIST::FUNCTION: +SM2_encrypt_with_recommended 4531 1_1_0d EXIST::FUNCTION: +SDF_DestroyKey 4532 1_1_0d EXIST::FUNCTION: +BN_GF2P_add_bn 4533 1_1_0d EXIST::FUNCTION: +i2d_ECIES_CIPHERTEXT_VALUE 4534 1_1_0d EXIST::FUNCTION: +SDF_CalculateMAC 4535 1_1_0d EXIST::FUNCTION: +EC_KEY_get_ECCPRIVATEKEYBLOB 4536 1_1_0d EXIST::FUNCTION: +SAF_CreateSymmKeyObj 4537 1_1_0d EXIST::FUNCTION: +SM2_KAP_compute_key 4538 1_1_0d EXIST::FUNCTION: +i2d_BB1CiphertextBlock 4539 1_1_0d EXIST::FUNCTION: +ECIES_encrypt_with_recommended 4540 1_1_0d EXIST::FUNCTION: +FFX_compute_luhn 4541 1_1_0d EXIST::FUNCTION: +EC_GROUP_generate_typ1curve 4542 1_1_0d EXIST::FUNCTION: +SOF_SignData 4543 1_1_0d EXIST::FUNCTION: +SAF_Finalize 4544 1_1_0d EXIST::FUNCTION: +SAF_EccPublicKeyEncByCert 4545 1_1_0d EXIST::FUNCTION: +d2i_CPK_PUBLIC_PARAMS 4546 1_1_0d EXIST::FUNCTION: +FpPoint_free 4547 1_1_0d EXIST::FUNCTION: +SAF_Base64_DecodeUpdate 4548 1_1_0d EXIST::FUNCTION: +d2i_BFMasterSecret 4549 1_1_0d EXIST::FUNCTION: +SAF_EnumCertificates 4550 1_1_0d EXIST::FUNCTION: +SKF_OpenApplication 4551 1_1_0d EXIST::FUNCTION: +CPK_PUBLIC_PARAMS_it 4552 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +CPK_PUBLIC_PARAMS_it 4552 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +SM2_CIPHERTEXT_VALUE_encode 4553 1_1_0d EXIST::FUNCTION: +SKF_SetSymmKey 4554 1_1_0d EXIST::FUNCTION: +BN_GFP2_mul_bn 4555 1_1_0d EXIST::FUNCTION: +SDF_ExternalVerify_ECC 4556 1_1_0d EXIST::FUNCTION: +SOF_SignFile 4557 1_1_0d EXIST::FUNCTION: +SOF_ExportUserCert 4558 1_1_0d EXIST::FUNCTION: +ERR_load_GMAPI_strings 4559 1_1_0d EXIST::FUNCTION: +BN_GFP2_div_bn 4560 1_1_0d EXIST::FUNCTION: +SDF_ExternalPublicKeyOperation_RSA 4561 1_1_0d EXIST::FUNCTION: +SKF_OpenContainer 4562 1_1_0d EXIST::FUNCTION: +SOF_GetLastError 4563 1_1_0d EXIST::FUNCTION: +zuc_generate_keystream 4564 1_1_0d EXIST::FUNCTION: +SOF_GetUserList 4565 1_1_0d EXIST::FUNCTION: +BN_bn2gfp2 4566 1_1_0d EXIST::FUNCTION: +SKF_DigestFinal 4567 1_1_0d EXIST::FUNCTION: +SKF_CreateFile 4568 1_1_0d EXIST::FUNCTION: +i2d_SM9MasterSecret 4569 1_1_0d EXIST::FUNCTION: +FFX_encrypt 4570 1_1_0d EXIST::FUNCTION: +CPK_MAP_is_valid 4571 1_1_0d EXIST::FUNCTION: +SAF_EnumCertificatesFree 4572 1_1_0d EXIST::FUNCTION: +d2i_PAILLIER_PRIVATE_KEY 4573 1_1_0d EXIST::FUNCTION: +SDF_PrintDeviceInfo 4574 1_1_0d EXIST::FUNCTION: +RSA_new_from_RSArefPrivateKey 4575 1_1_0d EXIST::FUNCTION: +KDF_get_nist_concatenation 4576 1_1_0d EXIST::FUNCTION: +SAF_GetCertFromLdap 4577 1_1_0d EXIST::FUNCTION: +SKF_EnumApplication 4578 1_1_0d EXIST::FUNCTION: +SKF_DisConnectDev 4579 1_1_0d EXIST::FUNCTION: +SAF_DestroyKeyHandle 4580 1_1_0d EXIST::FUNCTION: +BN_GFP2_equ 4581 1_1_0d EXIST::FUNCTION: +SOF_DecryptData 4582 1_1_0d EXIST::FUNCTION: +ECIES_PARAMS_dup 4583 1_1_0d EXIST::FUNCTION: +SKF_ExportPublicKey 4584 1_1_0d EXIST::FUNCTION: +SOF_ExportExchangeUserCert 4585 1_1_0d EXIST::FUNCTION: +SDF_GenerateKeyWithEPK_RSA 4586 1_1_0d EXIST::FUNCTION: +SKF_CloseApplication 4587 1_1_0d EXIST::FUNCTION: +ERR_load_BB1IBE_strings 4588 1_1_0d EXIST::FUNCTION: +sm3_final 4589 1_1_0d EXIST::FUNCTION: +CPK_MASTER_SECRET_validate_public_params 4590 1_1_0d EXIST::FUNCTION: +sm3_update 4591 1_1_0d EXIST::FUNCTION: +EC_KEY_set_ECCPRIVATEKEYBLOB 4592 1_1_0d EXIST::FUNCTION: +EC_KEY_set_default_secg_method 4593 1_1_0d EXIST::FUNCTION: +SAF_HashFinal 4594 1_1_0d EXIST::FUNCTION: +SDF_CreateFile 4595 1_1_0d EXIST::FUNCTION: +CPK_PUBLIC_PARAMS_get_name 4596 1_1_0d EXIST::FUNCTION: +CPK_MAP_num_indexes 4597 1_1_0d EXIST::FUNCTION: +SAF_EccVerifySign 4598 1_1_0d EXIST::FUNCTION: +ECIES_decrypt 4599 1_1_0d EXIST::FUNCTION: +SKF_EnumFiles 4600 1_1_0d EXIST::FUNCTION: +SM2_do_verify 4601 1_1_0d EXIST::FUNCTION: +BFCiphertextBlock_free 4602 1_1_0d EXIST::FUNCTION: +BB1IBE_setup 4603 1_1_0d EXIST::FUNCTION: +CPK_MAP_str2index 4604 1_1_0d EXIST::FUNCTION: +SM9MasterSecret_free 4605 1_1_0d EXIST::FUNCTION: +SKF_EnumContainer 4606 1_1_0d EXIST::FUNCTION: +SKF_ReadFile 4607 1_1_0d EXIST::FUNCTION: +sms4_knc_encrypt_8blocks 4608 1_1_0d EXIST::FUNCTION: +CPK_PUBLIC_PARAMS_digest 4609 1_1_0d EXIST::FUNCTION: +SAF_Hash 4610 1_1_0d EXIST::FUNCTION: +i2d_ECIESParameters 4611 1_1_0d EXIST::FUNCTION: +SM2_sign_setup 4612 1_1_0d EXIST::FUNCTION: +SM9Ciphertext_new 4613 1_1_0d EXIST::FUNCTION: +SKF_RSAExportSessionKey 4614 1_1_0d EXIST::FUNCTION: +SOF_GetCertInfo 4615 1_1_0d EXIST::FUNCTION: +SAF_Base64_DecodeFinal 4616 1_1_0d EXIST::FUNCTION: +FFX_init 4617 1_1_0d EXIST::FUNCTION: +BB1MasterSecret_it 4618 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +BB1MasterSecret_it 4618 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +BFIBE_do_encrypt 4619 1_1_0d EXIST::FUNCTION: +SAF_SymmDecryptUpdate 4620 1_1_0d EXIST::FUNCTION: +ECDSA_SIG_new_from_ECCSignature 4621 1_1_0d EXIST::FUNCTION: +SAF_DestroySymmAlgoObj 4622 1_1_0d EXIST::FUNCTION: +SDF_GenerateKeyWithECC 4623 1_1_0d EXIST::FUNCTION: +sms4_encrypt_16blocks 4624 1_1_0d EXIST::FUNCTION: +sm3_hmac_init 4625 1_1_0d EXIST::FUNCTION: +sm3_init 4626 1_1_0d EXIST::FUNCTION: +ECIES_PARAMS_get_enc 4627 1_1_0d EXIST::FUNCTION: +SAF_GetEccPublicKey 4628 1_1_0d EXIST::FUNCTION: +SAF_Base64_Encode 4629 1_1_0d EXIST::FUNCTION: +BN_GFP2_canonical 4630 1_1_0d EXIST::FUNCTION: +SKF_ImportECCKeyPair 4631 1_1_0d EXIST::FUNCTION: +SKF_GetErrorString 4632 1_1_0d EXIST::FUNCTION: +SM2_CIPHERTEXT_VALUE_decode 4633 1_1_0d EXIST::FUNCTION: +SM9_do_decrypt 4634 1_1_0d EXIST::FUNCTION: +eea3 4635 1_1_0d EXIST::FUNCTION: +ERR_load_SOF_strings 4636 1_1_0d EXIST::FUNCTION: +SKF_DevAuth 4637 1_1_0d EXIST::FUNCTION: +sms4_ede_decrypt_16blocks 4638 1_1_0d EXIST::FUNCTION: +SDF_ExportEncPublicKey_ECC 4639 1_1_0d EXIST::FUNCTION: +sms4_knc_encrypt_init 4640 1_1_0d EXIST::FUNCTION: +SKF_GenRSAKeyPair 4641 1_1_0d EXIST::FUNCTION: +d2i_CPK_PUBLIC_PARAMS_bio 4642 1_1_0d EXIST::FUNCTION: +BB1CiphertextBlock_it 4643 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +BB1CiphertextBlock_it 4643 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +sms4_ecb_encrypt 4644 1_1_0d EXIST::FUNCTION: +SM2_CIPHERTEXT_VALUE_get_ECCCipher 4645 1_1_0d EXIST::FUNCTION: +ERR_load_PAILLIER_strings 4646 1_1_0d EXIST::FUNCTION: +SDF_GenerateKeyPair_RSA 4647 1_1_0d EXIST::FUNCTION: +i2d_CPK_PUBLIC_PARAMS_bio 4648 1_1_0d EXIST::FUNCTION: +SOF_EncryptFile 4649 1_1_0d EXIST::FUNCTION: +PAILLIER_PRIVATE_KEY_it 4650 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +PAILLIER_PRIVATE_KEY_it 4650 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +ERR_load_BFIBE_strings 4651 1_1_0d EXIST::FUNCTION: +SKF_EncryptInit 4652 1_1_0d EXIST::FUNCTION: +EC_KEY_set_ECCrefPublicKey 4653 1_1_0d EXIST::FUNCTION: +RSA_set_RSArefPrivateKey 4654 1_1_0d EXIST::FUNCTION: +SKF_GetDevState 4655 1_1_0d EXIST::FUNCTION: +SM9PrivateKey_it 4656 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +SM9PrivateKey_it 4656 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +SAF_GenRsaKeyPair 4657 1_1_0d EXIST::FUNCTION: +i2d_CPK_MASTER_SECRET_bio 4658 1_1_0d EXIST::FUNCTION: +SKF_PrintECCCipher 4659 1_1_0d EXIST::FUNCTION: +d2i_BB1MasterSecret 4660 1_1_0d EXIST::FUNCTION: +SDF_WriteFile 4661 1_1_0d EXIST::FUNCTION: +SKF_UnlockDev 4662 1_1_0d EXIST::FUNCTION: +BN_is_solinas 4663 1_1_0d EXIST::FUNCTION: +ECIES_PARAMS_free 4664 1_1_0d EXIST::FUNCTION: +SAF_HashUpdate 4665 1_1_0d EXIST::FUNCTION: +SM2_compute_message_digest 4666 1_1_0d EXIST::FUNCTION: +SOF_GetServerCertificate 4667 1_1_0d EXIST::FUNCTION: +CPK_MASTER_SECRET_it 4668 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +CPK_MASTER_SECRET_it 4668 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +SKF_DeleteApplication 4669 1_1_0d EXIST::FUNCTION: +SDF_PrintRSAPrivateKey 4670 1_1_0d EXIST::FUNCTION: +SM9Ciphertext_free 4671 1_1_0d EXIST::FUNCTION: +SKF_SetLabel 4672 1_1_0d EXIST::FUNCTION: +SKF_RSASignData 4673 1_1_0d EXIST::FUNCTION: +sms4_cfb128_encrypt 4674 1_1_0d EXIST::FUNCTION: +SKF_WriteFile 4675 1_1_0d EXIST::FUNCTION: +SM9Signature_new 4676 1_1_0d EXIST::FUNCTION: +SM9PublicParameters_it 4677 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +SM9PublicParameters_it 4677 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +SKF_GenExtRSAKey 4678 1_1_0d EXIST::FUNCTION: +SM2_do_encrypt 4679 1_1_0d EXIST::FUNCTION: +SOF_GetVersion 4680 1_1_0d EXIST::FUNCTION: +SAF_GetCrlFromLdap 4681 1_1_0d EXIST::FUNCTION: +d2i_BB1PublicParameters 4682 1_1_0d EXIST::FUNCTION: +CPK_MASTER_SECRET_extract_private_key 4683 1_1_0d EXIST::FUNCTION: +SAF_RemoveRootCaCertificate 4684 1_1_0d EXIST::FUNCTION: +SKF_CloseContainer 4685 1_1_0d EXIST::FUNCTION: +BN_GFP2_sub 4686 1_1_0d EXIST::FUNCTION: +BN_GFP2_set_bn 4687 1_1_0d EXIST::FUNCTION: +SAF_SymmEncryptFinal 4688 1_1_0d EXIST::FUNCTION: +SDF_ExportSignPublicKey_RSA 4689 1_1_0d EXIST::FUNCTION: +i2d_BFMasterSecret 4690 1_1_0d EXIST::FUNCTION: +SAF_EccPublicKeyEnc 4691 1_1_0d EXIST::FUNCTION: +SKF_DeleteContainer 4692 1_1_0d EXIST::FUNCTION: +SKF_DigestUpdate 4693 1_1_0d EXIST::FUNCTION: +BFIBE_extract_private_key 4694 1_1_0d EXIST::FUNCTION: +SKF_DecryptUpdate 4695 1_1_0d EXIST::FUNCTION: +BN_GFP2_div 4696 1_1_0d EXIST::FUNCTION: +ECIES_CIPHERTEXT_VALUE_new 4697 1_1_0d EXIST::FUNCTION: +i2d_SM9PublicParameters 4698 1_1_0d EXIST::FUNCTION: +CPK_PUBLIC_PARAMS_free 4699 1_1_0d EXIST::FUNCTION: +BB1IBE_do_decrypt 4700 1_1_0d EXIST::FUNCTION: +i2d_SM9Ciphertext 4701 1_1_0d EXIST::FUNCTION: +EC_KEY_METHOD_get_decrypt 4702 1_1_0d EXIST::FUNCTION: +SAF_AddTrustedRootCaCertificate 4703 1_1_0d EXIST::FUNCTION: +SKF_MacInit 4704 1_1_0d EXIST::FUNCTION: +SDF_HashInit 4705 1_1_0d EXIST::FUNCTION: +SM2_KAP_prepare 4706 1_1_0d EXIST::FUNCTION: +SAF_VerifyCertificateByCrl 4707 1_1_0d EXIST::FUNCTION: +ECDSA_SIG_get_ECCSIGNATUREBLOB 4708 1_1_0d EXIST::FUNCTION: +i2d_PAILLIER_PRIVATE_KEY 4709 1_1_0d EXIST::FUNCTION: +SDF_OpenDevice 4710 1_1_0d EXIST::FUNCTION: +SKF_GetContainerType 4711 1_1_0d EXIST::FUNCTION: +PAILLIER_generate_key 4712 1_1_0d EXIST::FUNCTION: +eia3_final 4713 1_1_0d EXIST::FUNCTION: +RSA_get_RSAPUBLICKEYBLOB 4714 1_1_0d EXIST::FUNCTION: +SM2_KAP_final_check 4715 1_1_0d EXIST::FUNCTION: +EC_type1curve_tate 4716 1_1_0d EXIST::FUNCTION: +SM2_ENC_PARAMS_dup 4717 1_1_0d EXIST::FUNCTION: +SOF_SetSignMethod 4718 1_1_0d EXIST::FUNCTION: +sms4_ede_decrypt 4719 1_1_0d EXIST::FUNCTION: +SKF_VerifyPIN 4720 1_1_0d EXIST::FUNCTION: +i2d_BB1PrivateKeyBlock 4721 1_1_0d EXIST::FUNCTION: +BB1PublicParameters_free 4722 1_1_0d EXIST::FUNCTION: +BB1IBE_decrypt 4723 1_1_0d EXIST::FUNCTION: +SOF_GetTimeStampInfo 4724 1_1_0d EXIST::FUNCTION: +zuc_ctx_init 4725 1_1_0d EXIST::FUNCTION: +SOF_ChangePassWd 4726 1_1_0d EXIST::FUNCTION: +SDF_ImportKeyWithISK_RSA 4727 1_1_0d EXIST::FUNCTION: +SM2_CIPHERTEXT_VALUE_free 4728 1_1_0d EXIST::FUNCTION: +SKF_PrintECCSignature 4729 1_1_0d EXIST::FUNCTION: +SM2_sign 4730 1_1_0d EXIST::FUNCTION: +SM2_CIPHERTEXT_VALUE_set_ECCCIPHERBLOB 4731 1_1_0d EXIST::FUNCTION: +BFMasterSecret_free 4732 1_1_0d EXIST::FUNCTION: +SOF_GetSignMethod 4733 1_1_0d EXIST::FUNCTION: +SAF_SM2_EncodeSignedAndEnvelopedData 4734 1_1_0d EXIST::FUNCTION: +SOF_VerifySignedMessageDetach 4735 1_1_0d EXIST::FUNCTION: +BN_GFP2_inv 4736 1_1_0d EXIST::FUNCTION: +SDF_GenerateKeyPair_ECC 4737 1_1_0d EXIST::FUNCTION: +SM2_CIPHERTEXT_VALUE_new_from_ECCCipher 4738 1_1_0d EXIST::FUNCTION: +SM9_encrypt 4739 1_1_0d EXIST::FUNCTION: +SAF_EccVerifySignByCert 4740 1_1_0d EXIST::FUNCTION: +EC_KEY_set_default_sm_method 4741 1_1_0d EXIST::FUNCTION: +d2i_ECIES_CIPHERTEXT_VALUE 4742 1_1_0d EXIST::FUNCTION: +SDF_ImportKeyWithKEK 4743 1_1_0d EXIST::FUNCTION: +SAF_SM2_EncodeSignedData 4744 1_1_0d EXIST::FUNCTION: +SAF_SymmDecrypt 4745 1_1_0d EXIST::FUNCTION: +BN_GFP2_sub_bn 4746 1_1_0d EXIST::FUNCTION: +SAF_RsaSignFile 4747 1_1_0d EXIST::FUNCTION: +BFPrivateKeyBlock_free 4748 1_1_0d EXIST::FUNCTION: +SKF_PrintRSAPrivateKey 4749 1_1_0d EXIST::FUNCTION: +SDF_GenerateKeyWithIPK_ECC 4750 1_1_0d EXIST::FUNCTION: +SM9_setup_by_pairing_name 4751 1_1_0d EXIST::FUNCTION: +d2i_CPK_MASTER_SECRET 4752 1_1_0d EXIST::FUNCTION: +EC_GROUP_is_type1curve 4753 1_1_0d EXIST::FUNCTION: +EC_KEY_set_ECCrefPrivateKey 4754 1_1_0d EXIST::FUNCTION: +SKF_Mac 4755 1_1_0d EXIST::FUNCTION: +SOF_DelCertTrustList 4756 1_1_0d EXIST::FUNCTION: +SAF_Base64_EncodeUpdate 4757 1_1_0d EXIST::FUNCTION: +EC_POINT_hash2point 4758 1_1_0d EXIST::FUNCTION: +SOF_Login 4759 1_1_0d EXIST::FUNCTION: +SKF_GetDevInfo 4760 1_1_0d EXIST::FUNCTION: +SAF_GetRootCaCertificateCount 4761 1_1_0d EXIST::FUNCTION: +SOF_GetCertTrustList 4762 1_1_0d EXIST::FUNCTION: +ECDSA_SIG_set_ECCSignature 4763 1_1_0d EXIST::FUNCTION: +SAF_SymmEncrypt 4764 1_1_0d EXIST::FUNCTION: +SKF_GenRandom 4765 1_1_0d EXIST::FUNCTION: +SDF_CloseDevice 4766 1_1_0d EXIST::FUNCTION: +RSA_new_from_RSArefPublicKey 4767 1_1_0d EXIST::FUNCTION: +i2d_FpPoint 4768 1_1_0d EXIST::FUNCTION: +SOF_EncryptData 4769 1_1_0d EXIST::FUNCTION: +SKF_UnblockPIN 4770 1_1_0d EXIST::FUNCTION: +KDF_get_tls_kdf 4771 1_1_0d EXIST::FUNCTION: +BFPublicParameters_it 4772 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +BFPublicParameters_it 4772 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +SM2_CIPHERTEXT_VALUE_size 4773 1_1_0d EXIST::FUNCTION: +SM9PublicParameters_new 4774 1_1_0d EXIST::FUNCTION: +RSA_new_from_RSAPRIVATEKEYBLOB 4775 1_1_0d EXIST::FUNCTION: +d2i_FpPoint 4776 1_1_0d EXIST::FUNCTION: +d2i_BB1CiphertextBlock 4777 1_1_0d EXIST::FUNCTION: +sms4_wrap_key 4778 1_1_0d EXIST::FUNCTION: +i2d_BFPrivateKeyBlock 4779 1_1_0d EXIST::FUNCTION: +SM2_CIPHERTEXT_VALUE_get_ECCCIPHERBLOB 4780 1_1_0d EXIST::FUNCTION: +EC_GROUP_get_type1curve_zeta 4781 1_1_0d EXIST::FUNCTION: +SKF_PrintRSAPublicKey 4782 1_1_0d EXIST::FUNCTION: +EC_KEY_new_from_ECCPRIVATEKEYBLOB 4783 1_1_0d EXIST::FUNCTION: +SM2_get_public_key_data 4784 1_1_0d EXIST::FUNCTION: +SAF_SM2_DecodeSignedData 4785 1_1_0d EXIST::FUNCTION: +BB1PublicParameters_it 4786 1_1_0d EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +BB1PublicParameters_it 4786 1_1_0d EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +SOF_VerifySignedDataXML 4787 1_1_0d EXIST::FUNCTION: +SKF_MacUpdate 4788 1_1_0d EXIST::FUNCTION: +SKF_ECCSignData 4789 1_1_0d EXIST::FUNCTION: +SM2_compute_id_digest 4790 1_1_0d EXIST::FUNCTION: +ERR_load_KDF2_strings 4791 1_1_0d EXIST::FUNCTION: +SAF_SM2_EncodeEnvelopedData 4792 1_1_0d EXIST::FUNCTION: +BB1IBE_encrypt 4793 1_1_0d EXIST::FUNCTION: +SOF_SignDataXML 4794 1_1_0d EXIST::FUNCTION: +SM9_verify 4795 1_1_0d EXIST::FUNCTION: +BFIBE_setup 4796 1_1_0d EXIST::FUNCTION: +CPK_PUBLIC_PARAMS_print 4797 1_1_0d EXIST::FUNCTION: +CPK_MAP_num_factors 4798 1_1_0d EXIST::FUNCTION: +sms4_ede_set_encrypt_key 4799 1_1_0d EXIST::FUNCTION: +SM2_decrypt 4800 1_1_0d EXIST::FUNCTION: +SOF_GetEncryptMethod 4801 1_1_0d EXIST::FUNCTION: +BB1CiphertextBlock_new 4802 1_1_0d EXIST::FUNCTION: +d2i_SM9Ciphertext 4803 1_1_0d EXIST::FUNCTION: +SDF_GetPrivateKeyAccessRight 4804 1_1_0d EXIST::FUNCTION: +ERR_load_SAF_strings 4805 1_1_0d EXIST::FUNCTION: +RSA_get_RSArefPublicKey 4806 1_1_0d EXIST::FUNCTION: +SAF_EccSign 4807 1_1_0d EXIST::FUNCTION: +eea3_encrypt 4808 1_1_0d EXIST::FUNCTION: +RSA_set_RSArefPublicKey 4809 1_1_0d EXIST::FUNCTION: +SKF_ExtRSAPubKeyOperation 4810 1_1_0d EXIST::FUNCTION: +SOF_VerifySignedData 4811 1_1_0d EXIST::FUNCTION: +SKF_Digest 4812 1_1_0d EXIST::FUNCTION: +SAF_RsaVerifySign 4813 1_1_0d EXIST::FUNCTION: +SKF_ClearSecureState 4814 1_1_0d EXIST::FUNCTION: +SKF_MacFinal 4815 1_1_0d EXIST::FUNCTION: +EC_GROUP_new_type1curve_ex 4816 1_1_0d EXIST::FUNCTION: +BB1CiphertextBlock_free 4817 1_1_0d EXIST::FUNCTION: +SM2_do_sign_ex 4818 1_1_0d EXIST::FUNCTION: +SOF_CreateTimeStampRequest 4819 1_1_0d EXIST::FUNCTION: +BN_GF2P_add 4820 1_1_0d EXIST::FUNCTION: +SM2_compute_key 4821 1_1_0d EXIST::FUNCTION: