diff --git a/apps/progs.h b/apps/progs.h index a7bd1305..51cb7595 100644 --- a/apps/progs.h +++ b/apps/progs.h @@ -48,6 +48,7 @@ extern int help_main(int argc, char *argv[]); extern int list_main(int argc, char *argv[]); extern int nseq_main(int argc, char *argv[]); extern int ocsp_main(int argc, char *argv[]); +extern int otp_main(int argc, char *argv[]); extern int passwd_main(int argc, char *argv[]); extern int pkcs12_main(int argc, char *argv[]); extern int pkcs7_main(int argc, char *argv[]); @@ -99,6 +100,7 @@ extern OPTIONS help_options[]; extern OPTIONS list_options[]; extern OPTIONS nseq_options[]; extern OPTIONS ocsp_options[]; +extern OPTIONS otp_options[]; extern OPTIONS passwd_options[]; extern OPTIONS pkcs12_options[]; extern OPTIONS pkcs7_options[]; @@ -175,6 +177,9 @@ static FUNCTION functions[] = { { FT_general, "nseq", nseq_main, nseq_options }, #ifndef OPENSSL_NO_OCSP { FT_general, "ocsp", ocsp_main, ocsp_options }, +#endif +#ifndef OPENSSL_NO_OTP + { FT_general, "otp", otp_main, otp_options }, #endif { FT_general, "passwd", passwd_main, passwd_options }, #ifndef OPENSSL_NO_DES diff --git a/crypto/objects/obj_dat.h b/crypto/objects/obj_dat.h index e610c252..ffc252b1 100644 --- a/crypto/objects/obj_dat.h +++ b/crypto/objects/obj_dat.h @@ -10,7 +10,7 @@ */ /* Serialized OID's */ -static const unsigned char so[7433] = { +static const unsigned char so[7486] = { 0x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 0] OBJ_rsadsi */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 6] OBJ_pkcs */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x02, /* [ 13] OBJ_md2 */ @@ -1017,40 +1017,45 @@ static const unsigned char so[7433] = { 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x81,0x49, /* [ 7128] OBJ_sm5 */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D, /* [ 7136] OBJ_sm2p256v1 */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x01, /* [ 7144] OBJ_sm2sign */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x02, /* [ 7153] OBJ_sm2keyagreement */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03, /* [ 7162] OBJ_sm2encrypt */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x01, /* [ 7171] OBJ_sm2encrypt_recommendedParameters */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02, /* [ 7181] OBJ_sm2encrypt_specifiedParameters */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E, /* [ 7191] OBJ_id_sm9PublicKey */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x01, /* [ 7199] OBJ_sm9sign */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x02, /* [ 7208] OBJ_sm9keyagreement */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x03, /* [ 7217] OBJ_sm9encrypt */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x11, /* [ 7226] OBJ_sm3 */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x11,0x02, /* [ 7234] OBJ_hmac_sm3 */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x75, /* [ 7243] OBJ_sm2sign_with_sm3 */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x76, /* [ 7251] OBJ_sm2sign_with_sha1 */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x77, /* [ 7259] OBJ_sm2sign_with_sha256 */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x78, /* [ 7267] OBJ_sm2sign_with_sha512 */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x79, /* [ 7275] OBJ_sm2sign_with_sha224 */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x7A, /* [ 7283] OBJ_sm2sign_with_sha384 */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x7B, /* [ 7291] OBJ_sm2sign_with_rmd160 */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x65, /* [ 7299] OBJ_wapip192v1 */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x86,0x20, /* [ 7308] OBJ_zuc */ - 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x02,0x01, /* [ 7316] OBJ_bfibe */ - 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x02,0x02, /* [ 7326] OBJ_bb1 */ - 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x01,0x01, /* [ 7336] OBJ_type1curve */ - 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x01,0x02, /* [ 7346] OBJ_type2curve */ - 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x01,0x03, /* [ 7356] OBJ_type3curve */ - 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x01,0x04, /* [ 7366] OBJ_type4curve */ - 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x03,0x01, /* [ 7376] OBJ_tate_pairing */ - 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x03,0x02, /* [ 7386] OBJ_weil_pairing */ - 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x03,0x03, /* [ 7396] OBJ_ate_pairing */ - 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x03,0x04, /* [ 7406] OBJ_r_ate_pairing */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x87,0x68, /* [ 7416] OBJ_cpk */ - 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x87,0x69, /* [ 7424] OBJ_paillier */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03, /* [ 7153] OBJ_sm2encrypt */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x01, /* [ 7162] OBJ_sm2encrypt_recommendedParameters */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02, /* [ 7172] OBJ_sm2encrypt_specifiedParameters */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E, /* [ 7182] OBJ_id_sm9PublicKey */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x01, /* [ 7190] OBJ_sm9sign */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x02, /* [ 7199] OBJ_sm9keyagreement */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x03, /* [ 7208] OBJ_sm9encrypt */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x11, /* [ 7217] OBJ_sm3 */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x11,0x02, /* [ 7225] OBJ_hmac_sm3 */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x75, /* [ 7234] OBJ_sm2sign_with_sm3 */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x76, /* [ 7242] OBJ_sm2sign_with_sha1 */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x77, /* [ 7250] OBJ_sm2sign_with_sha256 */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x78, /* [ 7258] OBJ_sm2sign_with_sha512 */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x79, /* [ 7266] OBJ_sm2sign_with_sha224 */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x7A, /* [ 7274] OBJ_sm2sign_with_sha384 */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x7B, /* [ 7282] OBJ_sm2sign_with_rmd160 */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x65, /* [ 7290] OBJ_wapip192v1 */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x86,0x20, /* [ 7299] OBJ_zuc */ + 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x02,0x01, /* [ 7307] OBJ_bfibe */ + 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x02,0x02, /* [ 7317] OBJ_bb1 */ + 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x01,0x01, /* [ 7327] OBJ_type1curve */ + 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x01,0x02, /* [ 7337] OBJ_type2curve */ + 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x01,0x03, /* [ 7347] OBJ_type3curve */ + 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x01,0x04, /* [ 7357] OBJ_type4curve */ + 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x03,0x01, /* [ 7367] OBJ_tate_pairing */ + 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x03,0x02, /* [ 7377] OBJ_weil_pairing */ + 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x03,0x03, /* [ 7387] OBJ_ate_pairing */ + 0x2A,0x86,0x48,0x01,0x86,0xFD,0x1E,0x01,0x03,0x04, /* [ 7397] OBJ_r_ate_pairing */ + 0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01, /* [ 7407] OBJ_cpk */ + 0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x15, /* [ 7416] OBJ_paillier */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x02, /* [ 7425] OBJ_sm2exchange */ + 0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D, /* [ 7434] OBJ_GmSSL */ + 0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01, /* [ 7442] OBJ_cpk_map */ + 0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01,0x01, /* [ 7452] OBJ_cpk_sha1_map */ + 0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01,0x02, /* [ 7463] OBJ_cpk_sha256_map */ + 0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01,0x03, /* [ 7474] OBJ_cpk_sm3_map */ }; -#define NUM_NID 1149 +#define NUM_NID 1155 static const ASN1_OBJECT nid_objs[NUM_NID] = { {"UNDEF", "undefined", NID_undef}, {"rsadsi", "RSA Data Security, Inc.", NID_rsadsi, 6, &so[0]}, @@ -2134,7 +2139,7 @@ static const ASN1_OBJECT nid_objs[NUM_NID] = { {"cmac-aes128-ecies", "cmac-aes128-ecies", NID_cmac_aes128_ecies, 6, &so[6864]}, {"cmac-aes192-ecies", "cmac-aes192-ecies", NID_cmac_aes192_ecies, 6, &so[6870]}, {"cmac-aes256-ecies", "cmac-aes256-ecies", NID_cmac_aes256_ecies, 6, &so[6876]}, - {"CBC-MAC", "cbc-mac", NID_cbc_mac}, + { NULL, NULL, NID_undef }, {"ISO-CN", "ISO CN Member Body", NID_ISO_CN, 3, &so[6882]}, {"oscca", "oscca", NID_oscca, 5, &so[6885]}, {"sm-scheme", "sm-scheme", NID_sm_scheme, 6, &so[6890]}, @@ -2170,40 +2175,46 @@ static const ASN1_OBJECT nid_objs[NUM_NID] = { {"SM5", "sm5", NID_sm5, 8, &so[7128]}, {"sm2p256v1", "sm2p256v1", NID_sm2p256v1, 8, &so[7136]}, {"sm2sign", "sm2sign", NID_sm2sign, 9, &so[7144]}, - {"sm2keyagreement", "sm2keyagreement", NID_sm2keyagreement, 9, &so[7153]}, - {"sm2encrypt", "sm2encrypt", NID_sm2encrypt, 9, &so[7162]}, - {"sm2encrypt-recommendedParameters", "sm2encrypt-recommendedParameters", NID_sm2encrypt_recommendedParameters, 10, &so[7171]}, - {"sm2encrypt-specifiedParameters", "sm2encrypt-specifiedParameters", NID_sm2encrypt_specifiedParameters, 10, &so[7181]}, - {"id-sm9PublicKey", "id-sm9PublicKey", NID_id_sm9PublicKey, 8, &so[7191]}, - {"sm9sign", "sm9sign", NID_sm9sign, 9, &so[7199]}, - {"sm9keyagreement", "sm9keyagreement", NID_sm9keyagreement, 9, &so[7208]}, - {"sm9encrypt", "sm9encrypt", NID_sm9encrypt, 9, &so[7217]}, - {"SM3", "sm3", NID_sm3, 8, &so[7226]}, - {"HMAC-SM3", "hmac-sm3", NID_hmac_sm3, 9, &so[7234]}, - {"SM2Sign-with-SM3", "sm2sign-with-sm3", NID_sm2sign_with_sm3, 8, &so[7243]}, - {"SM2Sign-with-SHA1", "sm2sign-with-sha1", NID_sm2sign_with_sha1, 8, &so[7251]}, - {"SM2Sign-with-SHA256", "sm2sign-with-sha256", NID_sm2sign_with_sha256, 8, &so[7259]}, - {"SM2Sign-with-SHA511", "sm2sign-with-sha512", NID_sm2sign_with_sha512, 8, &so[7267]}, - {"SM2Sign-with-SHA224", "sm2sign-with-sha224", NID_sm2sign_with_sha224, 8, &so[7275]}, - {"SM2Sign-with-SHA384", "sm2sign-with-sha384", NID_sm2sign_with_sha384, 8, &so[7283]}, - {"SM2Sign-with-RMD160", "sm2sign-with-rmd160", NID_sm2sign_with_rmd160, 8, &so[7291]}, - {"wapip192v1", "wapip192v1", NID_wapip192v1, 9, &so[7299]}, - {"ZUC", "zuc", NID_zuc, 8, &so[7308]}, - {"bfibe", "bfibe", NID_bfibe, 10, &so[7316]}, - {"bb1", "bb1", NID_bb1, 10, &so[7326]}, - {"type1curve", "type1curve", NID_type1curve, 10, &so[7336]}, - {"type2curve", "type2curve", NID_type2curve, 10, &so[7346]}, - {"type3curve", "type3curve", NID_type3curve, 10, &so[7356]}, - {"type4curve", "type4curve", NID_type4curve, 10, &so[7366]}, - {"tate-pairing", "tate-pairing", NID_tate_pairing, 10, &so[7376]}, - {"weil-pairing", "weil-pairing", NID_weil_pairing, 10, &so[7386]}, - {"ate-pairing", "ate-pairing", NID_ate_pairing, 10, &so[7396]}, - {"r-ate-pairing", "r-ate-pairing", NID_r_ate_pairing, 10, &so[7406]}, - {"cpk", "cpk", NID_cpk, 8, &so[7416]}, - {"paillier", "paillier", NID_paillier, 8, &so[7424]}, + { NULL, NULL, NID_undef }, + {"sm2encrypt", "sm2encrypt", NID_sm2encrypt, 9, &so[7153]}, + {"sm2encrypt-recommendedParameters", "sm2encrypt-recommendedParameters", NID_sm2encrypt_recommendedParameters, 10, &so[7162]}, + {"sm2encrypt-specifiedParameters", "sm2encrypt-specifiedParameters", NID_sm2encrypt_specifiedParameters, 10, &so[7172]}, + {"id-sm9PublicKey", "id-sm9PublicKey", NID_id_sm9PublicKey, 8, &so[7182]}, + {"sm9sign", "sm9sign", NID_sm9sign, 9, &so[7190]}, + {"sm9keyagreement", "sm9keyagreement", NID_sm9keyagreement, 9, &so[7199]}, + {"sm9encrypt", "sm9encrypt", NID_sm9encrypt, 9, &so[7208]}, + {"SM3", "sm3", NID_sm3, 8, &so[7217]}, + {"HMAC-SM3", "hmac-sm3", NID_hmac_sm3, 9, &so[7225]}, + {"SM2Sign-with-SM3", "sm2sign-with-sm3", NID_sm2sign_with_sm3, 8, &so[7234]}, + {"SM2Sign-with-SHA1", "sm2sign-with-sha1", NID_sm2sign_with_sha1, 8, &so[7242]}, + {"SM2Sign-with-SHA256", "sm2sign-with-sha256", NID_sm2sign_with_sha256, 8, &so[7250]}, + {"SM2Sign-with-SHA511", "sm2sign-with-sha512", NID_sm2sign_with_sha512, 8, &so[7258]}, + {"SM2Sign-with-SHA224", "sm2sign-with-sha224", NID_sm2sign_with_sha224, 8, &so[7266]}, + {"SM2Sign-with-SHA384", "sm2sign-with-sha384", NID_sm2sign_with_sha384, 8, &so[7274]}, + {"SM2Sign-with-RMD160", "sm2sign-with-rmd160", NID_sm2sign_with_rmd160, 8, &so[7282]}, + {"wapip192v1", "wapip192v1", NID_wapip192v1, 9, &so[7290]}, + {"ZUC", "zuc", NID_zuc, 8, &so[7299]}, + {"bfibe", "bfibe", NID_bfibe, 10, &so[7307]}, + {"bb1", "bb1", NID_bb1, 10, &so[7317]}, + {"type1curve", "type1curve", NID_type1curve, 10, &so[7327]}, + {"type2curve", "type2curve", NID_type2curve, 10, &so[7337]}, + {"type3curve", "type3curve", NID_type3curve, 10, &so[7347]}, + {"type4curve", "type4curve", NID_type4curve, 10, &so[7357]}, + {"tate-pairing", "tate-pairing", NID_tate_pairing, 10, &so[7367]}, + {"weil-pairing", "weil-pairing", NID_weil_pairing, 10, &so[7377]}, + {"ate-pairing", "ate-pairing", NID_ate_pairing, 10, &so[7387]}, + {"r-ate-pairing", "r-ate-pairing", NID_r_ate_pairing, 10, &so[7397]}, + {"CPK", "cpk", NID_cpk, 9, &so[7407]}, + {"paillier", "paillier", NID_paillier, 9, &so[7416]}, + {"sm2exchange", "sm2exchange", NID_sm2exchange, 9, &so[7425]}, + {"gmssl", "GmSSL", NID_GmSSL, 8, &so[7434]}, + {"cpk-map", "cpk-map", NID_cpk_map, 10, &so[7442]}, + {"cpk-sha1-map", "cpk-sha1-map", NID_cpk_sha1_map, 11, &so[7452]}, + {"cpk-sha256-map", "cpk-sha256-map", NID_cpk_sha256_map, 11, &so[7463]}, + {"cpk-sm3-map", "cpk-sm3-map", NID_cpk_sm3_map, 11, &so[7474]}, }; -#define NUM_SN 1140 +#define NUM_SN 1144 static const unsigned int sn_objs[NUM_SN] = { 364, /* "AD_DVCS" */ 419, /* "AES-128-CBC" */ @@ -2287,9 +2298,9 @@ static const unsigned int sn_objs[NUM_SN] = { 110, /* "CAST5-CFB" */ 109, /* "CAST5-ECB" */ 111, /* "CAST5-OFB" */ - 1082, /* "CBC-MAC" */ 894, /* "CMAC" */ 13, /* "CN" */ + 1147, /* "CPK" */ 141, /* "CRLReason" */ 417, /* "CSPName" */ 1019, /* "ChaCha20" */ @@ -2571,7 +2582,10 @@ static const unsigned int sn_objs[NUM_SN] = { 131, /* "codeSigning" */ 50, /* "contentType" */ 53, /* "countersignature" */ - 1147, /* "cpk" */ + 1151, /* "cpk-map" */ + 1152, /* "cpk-sha1-map" */ + 1153, /* "cpk-sha256-map" */ + 1154, /* "cpk-sm3-map" */ 153, /* "crlBag" */ 103, /* "crlDistributionPoints" */ 88, /* "crlNumber" */ @@ -2646,6 +2660,7 @@ static const unsigned int sn_objs[NUM_SN] = { 490, /* "friendlyCountryName" */ 156, /* "friendlyName" */ 509, /* "generationQualifier" */ + 1150, /* "gmssl" */ 815, /* "gost-mac" */ 976, /* "gost-mac-12" */ 811, /* "gost2001" */ @@ -3279,7 +3294,7 @@ static const unsigned int sn_objs[NUM_SN] = { 1119, /* "sm2encrypt" */ 1120, /* "sm2encrypt-recommendedParameters" */ 1121, /* "sm2encrypt-specifiedParameters" */ - 1118, /* "sm2keyagreement" */ + 1149, /* "sm2exchange" */ 1116, /* "sm2p256v1" */ 1117, /* "sm2sign" */ 1125, /* "sm9encrypt" */ @@ -3347,7 +3362,7 @@ static const unsigned int sn_objs[NUM_SN] = { 1069, /* "xor-in-ecies" */ }; -#define NUM_LN 1140 +#define NUM_LN 1144 static const unsigned int ln_objs[NUM_LN] = { 363, /* "AD Time Stamping" */ 405, /* "ANSI X9.62" */ @@ -3400,6 +3415,7 @@ static const unsigned int ln_objs[NUM_LN] = { 808, /* "GOST R 34.11-94 with GOST R 34.10-94" */ 852, /* "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" */ 854, /* "GOST R 3410-2001 Parameter Set Cryptocom" */ + 1150, /* "GmSSL" */ 988, /* "HMAC GOST 34.11-2012 256 bit" */ 989, /* "HMAC GOST 34.11-2012 512 bit" */ 810, /* "HMAC GOST 34.11-94" */ @@ -3667,7 +3683,6 @@ static const unsigned int ln_objs[NUM_LN] = { 110, /* "cast5-cfb" */ 109, /* "cast5-ecb" */ 111, /* "cast5-ofb" */ - 1082, /* "cbc-mac" */ 152, /* "certBag" */ 677, /* "certicom-arc" */ 517, /* "certificate extensions" */ @@ -3688,6 +3703,10 @@ static const unsigned int ln_objs[NUM_LN] = { 53, /* "countersignature" */ 14, /* "countryName" */ 1147, /* "cpk" */ + 1151, /* "cpk-map" */ + 1152, /* "cpk-sha1-map" */ + 1153, /* "cpk-sha256-map" */ + 1154, /* "cpk-sm3-map" */ 153, /* "crlBag" */ 884, /* "crossCertificatePair" */ 806, /* "cryptocom" */ @@ -4394,7 +4413,7 @@ static const unsigned int ln_objs[NUM_LN] = { 1119, /* "sm2encrypt" */ 1120, /* "sm2encrypt-recommendedParameters" */ 1121, /* "sm2encrypt-specifiedParameters" */ - 1118, /* "sm2keyagreement" */ + 1149, /* "sm2exchange" */ 1116, /* "sm2p256v1" */ 1117, /* "sm2sign" */ 1134, /* "sm2sign-with-rmd160" */ @@ -4491,7 +4510,7 @@ static const unsigned int ln_objs[NUM_LN] = { 1136, /* "zuc" */ }; -#define NUM_OBJ 1043 +#define NUM_OBJ 1048 static const unsigned int obj_objs[NUM_OBJ] = { 0, /* OBJ_undef 0 */ 181, /* OBJ_iso 1 */ @@ -5001,8 +5020,6 @@ static const unsigned int obj_objs[NUM_OBJ] = { 1133, /* OBJ_sm2sign_with_sha384 1 2 156 10197 1 506 */ 1134, /* OBJ_sm2sign_with_rmd160 1 2 156 10197 1 507 */ 1136, /* OBJ_zuc 1 2 156 10197 1 800 */ - 1147, /* OBJ_cpk 1 2 156 10197 1 1000 */ - 1148, /* OBJ_paillier 1 2 156 10197 1 1001 */ 776, /* OBJ_seed_ecb 1 2 410 200004 1 3 */ 777, /* OBJ_seed_cbc 1 2 410 200004 1 4 */ 779, /* OBJ_seed_cfb128 1 2 410 200004 1 5 */ @@ -5077,6 +5094,7 @@ static const unsigned int obj_objs[NUM_OBJ] = { 794, /* OBJ_ecdsa_with_SHA256 1 2 840 10045 4 3 2 */ 795, /* OBJ_ecdsa_with_SHA384 1 2 840 10045 4 3 3 */ 796, /* OBJ_ecdsa_with_SHA512 1 2 840 10045 4 3 4 */ + 1150, /* OBJ_GmSSL 1 3 6 1 4 1 49549 */ 269, /* OBJ_id_pkix1_explicit_88 1 3 6 1 5 5 7 0 1 */ 270, /* OBJ_id_pkix1_implicit_88 1 3 6 1 5 5 7 0 2 */ 271, /* OBJ_id_pkix1_explicit_93 1 3 6 1 5 5 7 0 3 */ @@ -5204,7 +5222,7 @@ static const unsigned int obj_objs[NUM_OBJ] = { 440, /* OBJ_pilotObjectClass 0 9 2342 19200300 100 4 */ 441, /* OBJ_pilotGroups 0 9 2342 19200300 100 10 */ 1117, /* OBJ_sm2sign 1 2 156 10197 1 301 1 */ - 1118, /* OBJ_sm2keyagreement 1 2 156 10197 1 301 2 */ + 1149, /* OBJ_sm2exchange 1 2 156 10197 1 301 2 */ 1119, /* OBJ_sm2encrypt 1 2 156 10197 1 301 3 */ 1135, /* OBJ_wapip192v1 1 2 156 10197 1 301 101 */ 1123, /* OBJ_sm9sign 1 2 156 10197 1 302 1 */ @@ -5268,6 +5286,8 @@ static const unsigned int obj_objs[NUM_OBJ] = { 683, /* OBJ_X9_62_ppBasis 1 2 840 10045 1 2 3 3 */ 417, /* OBJ_ms_csp_name 1 3 6 1 4 1 311 17 1 */ 856, /* OBJ_LocalKeySet 1 3 6 1 4 1 311 17 2 */ + 1147, /* OBJ_cpk 1 3 6 1 4 1 49549 1 */ + 1148, /* OBJ_paillier 1 3 6 1 4 1 49549 21 */ 390, /* OBJ_dcObject 1 3 6 1 4 1 1466 344 */ 91, /* OBJ_bf_cbc 1 3 6 1 4 1 3029 1 2 */ 973, /* OBJ_id_scrypt 1 3 6 1 4 1 11591 4 11 */ @@ -5446,6 +5466,7 @@ static const unsigned int obj_objs[NUM_OBJ] = { 138, /* OBJ_ms_efs 1 3 6 1 4 1 311 10 3 4 */ 648, /* OBJ_ms_smartcard_login 1 3 6 1 4 1 311 20 2 2 */ 649, /* OBJ_ms_upn 1 3 6 1 4 1 311 20 2 3 */ + 1151, /* OBJ_cpk_map 1 3 6 1 4 1 49549 1 1 */ 951, /* OBJ_ct_precert_scts 1 3 6 1 4 1 11129 2 4 2 */ 952, /* OBJ_ct_precert_poison 1 3 6 1 4 1 11129 2 4 3 */ 953, /* OBJ_ct_precert_signer 1 3 6 1 4 1 11129 2 4 4 */ @@ -5534,6 +5555,9 @@ static const unsigned int obj_objs[NUM_OBJ] = { 955, /* OBJ_jurisdictionLocalityName 1 3 6 1 4 1 311 60 2 1 1 */ 956, /* OBJ_jurisdictionStateOrProvinceName 1 3 6 1 4 1 311 60 2 1 2 */ 957, /* OBJ_jurisdictionCountryName 1 3 6 1 4 1 311 60 2 1 3 */ + 1152, /* OBJ_cpk_sha1_map 1 3 6 1 4 1 49549 1 1 1 */ + 1153, /* OBJ_cpk_sha256_map 1 3 6 1 4 1 49549 1 1 2 */ + 1154, /* OBJ_cpk_sm3_map 1 3 6 1 4 1 49549 1 1 3 */ 1056, /* OBJ_blake2b512 1 3 6 1 4 1 1722 12 2 1 16 */ 1057, /* OBJ_blake2s256 1 3 6 1 4 1 1722 12 2 2 8 */ }; diff --git a/crypto/objects/obj_mac.num b/crypto/objects/obj_mac.num index a53c6b15..5f7d7f0f 100644 --- a/crypto/objects/obj_mac.num +++ b/crypto/objects/obj_mac.num @@ -1146,3 +1146,9 @@ ate_pairing 1145 r_ate_pairing 1146 cpk 1147 paillier 1148 +sm2exchange 1149 +GmSSL 1150 +cpk_map 1151 +cpk_sha1_map 1152 +cpk_sha256_map 1153 +cpk_sm3_map 1154 diff --git a/crypto/objects/objects.txt b/crypto/objects/objects.txt index d8b5d452..d96bd2c7 100644 --- a/crypto/objects/objects.txt +++ b/crypto/objects/objects.txt @@ -1604,19 +1604,13 @@ ibcs1 3 4 : r-ate-pairing # GmSSL -Enterprises 49549 : GmSSL : gmssl +Enterprises 49549 : gmssl : GmSSL - -GmSSL 1 : CPK : cpk -CPK 1 : cpk-map +GmSSL 1 : CPK : cpk +cpk 1 : cpk-map cpk-map 1 : cpk-sha1-map cpk-map 2 : cpk-sha256-map cpk-map 3 : cpk-sm3-map - - GmSSL 21 : paillier - - - diff --git a/crypto/saf/build.info b/crypto/saf/build.info index d9d2066c..3eb2b83a 100644 --- a/crypto/saf/build.info +++ b/crypto/saf/build.info @@ -1,4 +1,18 @@ LIBS=../../libcrypto -SOURCE[../../libcrypto]=saf_lib.c saf_errstr.c saf_app.c saf_keyhandle.c \ - saf_ec.c saf_sm2.c saf_rand.c saf_hash.c saf_enc.c saf_mac.c saf_symmkeyobj.c \ - saf_base64.c saf_cert.c saf_err.c saf_pkcs7.c +SOURCE[../../libcrypto]= \ + saf_app.c \ + saf_base64.c \ + saf_cert.c \ + saf_ec.c \ + saf_enc.c \ + saf_err.c \ + saf_errstr.c \ + saf_hash.c \ + saf_keyhandle.c \ + saf_lib.c \ + saf_mac.c \ + saf_pkcs7.c \ + saf_rand.c \ + saf_rsa.c \ + saf_sm2.c \ + saf_symmkeyobj.c diff --git a/crypto/saf/saf_cert.c b/crypto/saf/saf_cert.c index ca6a822d..6b9bca37 100644 --- a/crypto/saf/saf_cert.c +++ b/crypto/saf/saf_cert.c @@ -57,6 +57,12 @@ #include "saf_lcl.h" #include "../../apps/apps.h" +int load_certs(const char *file, STACK_OF(X509) **certs, int format, + const char *pass, const char *cert_descrip) +{ + return 0; +} + /* 7.2.2 */ int SAF_AddTrustedRootCaCertificate( void *hAppHandle, diff --git a/crypto/saf/saf_ec.c b/crypto/saf/saf_ec.c index 437c2539..bfff7992 100644 --- a/crypto/saf/saf_ec.c +++ b/crypto/saf/saf_ec.c @@ -598,3 +598,29 @@ int SAF_GenerateAgreementDataAdnKeyWithECC( return 0; } + +/* GmSSL Extension */ +int SAF_EccSignFile( + void *hAppHandle, + unsigned char *pucContainerName, + unsigned int uiContainerNameLen, + unsigned int uiHashAlgoType, + unsigned char *pucFileName, + unsigned char *pucSignature, + unsigned int *puiSignatureLen) +{ + return SAR_OK; +} + +int SAF_EccVerifySignFile( + unsigned int uiHashAlgoType, + unsigned char *pucPublicKey, + unsigned int uiPublicKeyLen, + unsigned char *pucFileName, + unsigned char *pucSignature, + unsigned int uiSignatureLen) +{ + return SAR_OK; +} + + diff --git a/crypto/saf/saf_lib.c b/crypto/saf/saf_lib.c index 7c78d1ae..9bb05618 100644 --- a/crypto/saf/saf_lib.c +++ b/crypto/saf/saf_lib.c @@ -56,7 +56,6 @@ EVP_PKEY *SAF_load_private_key(SAF_APP *app, const char *container, int flags) 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); diff --git a/crypto/saf/saf_pkcs7.c b/crypto/saf/saf_pkcs7.c index ac385b21..92e8f489 100644 --- a/crypto/saf/saf_pkcs7.c +++ b/crypto/saf/saf_pkcs7.c @@ -47,6 +47,10 @@ * ==================================================================== */ +#include +#include +#include +#include #include #include #include @@ -74,13 +78,11 @@ int SAF_Pkcs7_EncodeData( return ret; } - /* 7.4.3 */ int SAF_Pkcs7_DecodeData( void *hAppHandle, unsigned char *pucDecContainerName, unsigned int uiDecContainerNameLen, - unsigned int uiDecKeyUsage, unsigned char *pucDerP7Data, unsigned int uiDerP7DataLen, unsigned char *pucData, @@ -186,6 +188,7 @@ int SAF_Pkcs7_DecodeSignedData( unsigned int *puiSigLen) { int ret = SAR_UnknownErr; +#if 0 PKCS7 *p7 = NULL; PKCS7_SIGNED *p7signed; X509 *x509 = NULL; @@ -267,13 +270,13 @@ int SAF_Pkcs7_DecodeSignedData( goto end; } - if (*puiDataLen < ASN1_OCTET_STRING_length(data)) { + if (*puiDataLen < ASN1_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_STRING_get0_data(data), ASN1_STRING_length(data)); + *puiDataLen = ASN1_STRING_length(data); /* get signature */ if (sk_SIGNER_INFO_num(p7signed->signer_info) <= 0 @@ -282,19 +285,20 @@ int SAF_Pkcs7_DecodeSignedData( goto end; } - if (*puiSigLen < ASN1_OCTET_STRING_length(signer_info->enc_digest)) { + if (*puiSigLen < ASN1_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); + memcpy(pucSig, ASN1_STRING_get0_data(signer_info->enc_digest), + ASN1_STRING_length(signer_info->enc_digest)); + *puiSigLen = ASN1_STRING_length(signer_info->enc_digest); ret = SAR_Ok; end: PKCS7_free(p7); X509_free(x509); BIO_free(bio); +#endif return ret; } @@ -310,6 +314,7 @@ int SAF_Pkcs7_EncodeEnvelopedData( unsigned int *puiDerP7EnvelopedDataLen) { int ret = SAR_UnknownErr; +#if 0 PKCS7 *p7 = NULL; X509 *x509 = NULL; STACK_OF(X509) *certs = NULL; @@ -384,6 +389,7 @@ end: X509_free(x509); sk_X509_free(certs); BIO_free(bio); +#endif return ret; } @@ -398,6 +404,7 @@ int SAF_Pkcs7_DecodeEnvelopedData( unsigned int *puiDataLen) { int ret = SAR_UnknownErr; +#if 0 SAF_APP *app = (SAF_APP *)hAppHandle; PKCS7 *p7 = NULL; EVP_PKEY *pkey = NULL; @@ -420,7 +427,7 @@ int SAF_Pkcs7_DecodeEnvelopedData( *puiDataLen = uiDerP7EnvelopedDataLen; return SAR_Ok; } else if (*puiDataLen <= 0 || *puiDataLen > 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; } @@ -456,6 +463,7 @@ end: EVP_PKEY_free(pkey); X509_free(x509); BIO_free(bio); +#endif return ret; } @@ -522,7 +530,7 @@ end: /* 7.4.9 */ int SAF_Pkcs7_DecodeDigestedData( void *hAppHandle, - unsigned char pucDerP7DigestedData, + unsigned char *pucDerP7DigestedData, unsigned int uiDerP7DigestedDataLen, unsigned int *puiDigestAlgorithm, unsigned char *pucData, @@ -558,14 +566,15 @@ int SAF_Pkcs7_DecodeDigestedData( } /* process */ - if (!(p7 = d2i_PKCS7(NULL, &pucDerP7DigestedData, uiDerP7DigestedDataLen))) { + if (!(p7 = d2i_PKCS7(NULL, (const unsigned char **)&pucDerP7DigestedData, + uiDerP7DigestedDataLen))) { SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAF_R_INVALID_PKCS7); ret = SAR_IndataErr; goto end; } if (!PKCS7_type_is_digest(p7)) { - SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAF_R_INVALID_PKCS7_TYPE; + SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAF_R_INVALID_PKCS7_TYPE); ret = SAR_IndataErr; goto end; } @@ -574,46 +583,46 @@ int SAF_Pkcs7_DecodeDigestedData( /* output digset algor */ if ((*puiDigestAlgorithm = EVP_MD_sgd( EVP_get_digestbyobj(p7dgst->md->algorithm))) <= 0) { - SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAF_R_UNSUPPORTED_DIGEST_ALGOR; + SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAF_R_UNSUPPORTED_DIGEST_ALGOR); ret = SAR_IndataErr; goto end; } /* output digested data */ if (!PKCS7_type_is_data(p7dgst->contents)) { - SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAR_R_INVALID_PKCS7_DATA); + SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAF_R_INVALID_PKCS7_DATA); ret = SAR_IndataErr; goto end; } if (!(data = p7dgst->contents->d.data)) { - SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAR_R_INVALID_PKCS7_DATA); + SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAF_R_INVALID_PKCS7_DATA); ret = SAR_IndataErr; goto end; } - if (*puiDataLen < ASN1_OCTET_STRING_length(data)) { - SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAR_R_BUFFER_TOO_SMALL); + if (*puiDataLen < ASN1_STRING_length(data)) { + SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAF_R_BUFFER_TOO_SMALL); ret = SAR_IndataLenErr; goto end; } - memcpy(pucData, ASN1_OCTET_STRING_get0_data(data), ASN1_OCTET_STRING_length(data)); - *puiDataLen = ASN1_OCTET_STRING_length(data); + memcpy(pucData, ASN1_STRING_get0_data(data), ASN1_STRING_length(data)); + *puiDataLen = ASN1_STRING_length(data); /* output digest */ if (!p7dgst->digest) { - SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAR_R_INVALID_PKCS7_DATA); + SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAF_R_INVALID_PKCS7_DATA); ret = SAR_IndataErr; goto end; } - if (*puiDigestLen < ASN1_OCTET_STRING_length(p7dgst->digest)) { - SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAR_R_BUFFER_TOO_SMALL); + if (*puiDigestLen < ASN1_STRING_length(p7dgst->digest)) { + SAFerr(SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA, SAF_R_BUFFER_TOO_SMALL); ret = SAR_IndataLenErr; goto end; } - memcpy(pucDigest, ASN1_OCTET_STRING_get0_data(p7dgst->digest), ASN1_OCTET_STRING_length(p7dgst->digest)); - *puiDigestLen = ASN1_OCTET_STRING_length(p7dgst->digest); + memcpy(pucDigest, ASN1_STRING_get0_data(p7dgst->digest), ASN1_STRING_length(p7dgst->digest)); + *puiDigestLen = ASN1_STRING_length(p7dgst->digest); ret = SAR_Ok; end: diff --git a/crypto/saf/saf_pkcs7.d.tmp b/crypto/saf/saf_pkcs7.d.tmp deleted file mode 100644 index 63da507e..00000000 --- a/crypto/saf/saf_pkcs7.d.tmp +++ /dev/null @@ -1,17 +0,0 @@ -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/saf/saf_rsa.c b/crypto/saf/saf_rsa.c index ea16b419..60f8fb33 100644 --- a/crypto/saf/saf_rsa.c +++ b/crypto/saf/saf_rsa.c @@ -62,6 +62,7 @@ int SAF_GenRsaKeyPair(void *hAppHandle, unsigned int uiExportFlag) { int ret = SAR_UnknownErr; +#if 0 SAF_APP *app = (SAF_APP *)hAppHandle; /* process */ @@ -80,6 +81,7 @@ int SAF_GenRsaKeyPair(void *hAppHandle, end: EVP_PKEY_CTX_free(pctx); EVP_PKEY_free(pkey); +#endif return ret; } @@ -93,6 +95,7 @@ int SAF_GetRsaPublicKey( unsigned int *puiPublicKeyLen) { int ret = SAR_UnknownErr; +#if 0 SAF_APP *app = (SAF_APP *)hAppHandle; /* process */ @@ -123,6 +126,7 @@ int SAF_GetRsaPublicKey( end: EVP_PKEY_free(pkey); +#endif return ret; } @@ -138,6 +142,8 @@ int SAF_RsaSign( unsigned int *puiSignatureLen) { int ret = SAR_UnknownErr; + +#if 0 SAF_APP *app = (SAF_APP *)hAppHandle; /* process */ @@ -162,6 +168,7 @@ int SAF_RsaSign( end: EVP_PKEY_free(pkey); EVP_PKEY_CTX_free(pctx); +#endif return ret; } @@ -189,6 +196,7 @@ int SAF_RsaVerifySign( unsigned int uiSignatureLen) { int ret = SAR_UnknownErr; +#if 0 /* process */ EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *pctx = NULL; @@ -205,6 +213,7 @@ int SAF_RsaVerifySign( end: EVP_PKEY_free(pkey); EVP_PKEY_CTX_free(pctx); +#endif return ret; } @@ -231,6 +240,7 @@ int SAF_VerifySignByCert( unsigned int uiSignatureLen) { int ret = SAR_UnknownErr; +#if 0 /* process */ X509 *x509 = NULL; unsigned char pucPublicKey[1024]; @@ -264,5 +274,6 @@ int SAF_VerifySignByCert( ret = SAR_Ok; end: X509_free(x509); +#endif return ret; } diff --git a/crypto/saf/saf_sm2.c b/crypto/saf/saf_sm2.c index 42b62e34..58b98093 100644 --- a/crypto/saf/saf_sm2.c +++ b/crypto/saf/saf_sm2.c @@ -127,7 +127,7 @@ int SAF_SM2_EncodeSignedData( return SAF_Pkcs7_EncodeSignedData( hAppHandle, pucSignContainerName, - pucSignContainerName, + uiSignContainerNameLen, uiSignKeyUsage, pucSignerCertificate, uiSignerCertificateLen, @@ -143,11 +143,11 @@ int SAF_SM2_DecodeSignedData( void *hAppHandle, unsigned char *pucDerSignedData, unsigned int uiDerSignedDataLen, + unsigned int *puiDigestAlgorithm, unsigned char *pucSignerCertificate, - unsigned int uiSignerCertificateLen, - unsigned int uiDigestAlgorithm, + unsigned int *puiSignerCertificateLen, unsigned char *pucData, - unsigned int uiDataLen, + unsigned int *puiDataLen, unsigned char *pucSign, unsigned int *puiSignLen) { @@ -155,11 +155,11 @@ int SAF_SM2_DecodeSignedData( hAppHandle, pucDerSignedData, uiDerSignedDataLen, + puiDigestAlgorithm, pucSignerCertificate, - uiSignerCertificateLen, - uiDigestAlgorithm, + puiSignerCertificateLen, pucData, - uiDataLen, + puiDataLen, pucSign, puiSignLen); } @@ -191,7 +191,6 @@ int SAF_SM2_DecodeEnvelopedData( void *hAppHandle, unsigned char *pucDecContainerName, unsigned int uiDecContainerNameLen, - unsigned int uiDecKeyUsage, unsigned char *pucDerEnvelopedData, unsigned int uiDerEnvelopedDataLen, unsigned char *pucData, @@ -201,7 +200,6 @@ int SAF_SM2_DecodeEnvelopedData( hAppHandle, pucDecContainerName, uiDecContainerNameLen, - uiDecKeyUsage, pucDerEnvelopedData, uiDerEnvelopedDataLen, pucData, diff --git a/crypto/sof/sof_err.c b/crypto/sof/sof_err.c index ad5e6ec3..2a9ba53d 100644 --- a/crypto/sof/sof_err.c +++ b/crypto/sof/sof_err.c @@ -32,6 +32,7 @@ static ERR_STRING_DATA SOF_str_functs[] = { {ERR_FUNC(SOF_F_SOF_EXPORTEXCHANGEUSERCERT), "SOF_ExportExchangeUserCert"}, {ERR_FUNC(SOF_F_SOF_EXPORTUSERCERT), "SOF_ExportUserCert"}, + {ERR_FUNC(SOF_F_SOF_G), "SOF_GenRandom"}, {ERR_FUNC(SOF_F_SOF_GENRANDOM), "SOF_GenRandom"}, {ERR_FUNC(SOF_F_SOF_GETCERTINFO), "SOF_GetCertInfo"}, {ERR_FUNC(SOF_F_SOF_GETCERTINFOBYOID), "SOF_GetCertInfoByOid"}, @@ -73,6 +74,7 @@ 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_INVALID_CERT_ATTRIBUTE), "invalid cert attribute"}, {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.c b/crypto/sof/sof_lib.c index ac0cba87..dba2cdef 100644 --- a/crypto/sof/sof_lib.c +++ b/crypto/sof/sof_lib.c @@ -47,20 +47,40 @@ * ==================================================================== */ +#include +#include +#include #include +#include #include +#include #include "../../e_os.h" static long sof_sign_method = SGD_SM2; static long sof_enc_method = SGD_SM4_CBC; static long sof_last_error = SOR_OK; static void *sof_app = NULL; -static int sof_user_type = SGD_USER; +static int sof_user_type = SGD_ROLE_USER; +static int sof_read_file(const char *path, unsigned char **pdata, + unsigned int *pdatalen) +{ + return 0; +} + +static char *sof_encode(const unsigned char *bin, unsigned int binlen) +{ + return NULL; +} + +static int sof_decode(const char *b64, unsigned char **pdata, unsigned int *pdatalen) +{ + return 0; +} BSTR SOF_GetVersion(void) { - return OpenSSL_version(0); + return OPENSSL_strdup(OpenSSL_version(0)); } long SOF_SetSignMethod(long SignMethod) @@ -102,6 +122,7 @@ BSTR SOF_ExportUserCert(BSTR ContainerName) BOOL SOF_Login(BSTR ContainerName, BSTR PassWd) { unsigned int uiRemainCount; + int rv; if ((rv = SAF_Login( sof_app, @@ -112,10 +133,10 @@ BOOL SOF_Login(BSTR ContainerName, BSTR PassWd) (unsigned int)strlen(PassWd), &uiRemainCount)) != SAR_Ok) { SOFerr(SOF_F_SOF_LOGIN, ERR_R_SAF_LIB); - return FALSE; + return SGD_FALSE; } - return TRUE; + return SGD_TRUE; } long SOF_GetPinRetryCount(BSTR ContainerName) @@ -140,16 +161,14 @@ BOOL SOF_ChangePassWd(BSTR ContainerName, BSTR OldPassWd, BSTR NewPassWd) (unsigned int)strlen(NewPassWd), &uiRemainCount)) != SAR_Ok) { SOFerr(SOF_F_SOF_CHANGEPASSWD, ERR_R_SAF_LIB); - return FALSE; + return SGD_FALSE; } - return TRUE; + return SGD_TRUE; } BSTR SOF_ExportExchangeUserCert(BSTR ContainerName) { - - SOFerr(SOF_F_SOF_EXPORTEXCHANGEUSERCERT, SOF_R_NOT_IMPLEMENTED); return NULL; } @@ -157,7 +176,7 @@ BSTR SOF_ExportExchangeUserCert(BSTR ContainerName) /* `type` defined as SGD_CERT_XXX, SGD_EXT_XXX in sgd.h */ BSTR SOF_GetCertInfo(BSTR Base64EncodeCert, short Type) { - // decode x.509 in pem format + char *ret = NULL; switch (Type) { case SGD_CERT_VERSION: @@ -188,11 +207,16 @@ BSTR SOF_GetCertInfo(BSTR Base64EncodeCert, short Type) case SGD_CERT_SUBJECT_EMAIL: case SGD_CERT_NOTBEFORE_TIME: case SGD_CERT_NOTAFTER_TIME: + SOFerr(SOF_F_SOF_GETCERTINFO, SOF_R_NOT_IMPLEMENTED); + goto end; default: + SOFerr(SOF_F_SOF_GETCERTINFO, SOF_R_INVALID_CERT_ATTRIBUTE); + goto end; } +end: SOFerr(SOF_F_SOF_GETCERTINFO, SOF_R_NOT_IMPLEMENTED); - return NULL; + return ret; } BSTR SOF_GetCertInfoByOid(BSTR Base64EncodeCert, BSTR Oid) @@ -217,37 +241,53 @@ BSTR SOF_SignData(BSTR ContainerName, BSTR InData) { char *ret = NULL; char *b64 = NULL; - unsigned int uiHashAlgoType; + unsigned int uiHashAlgoType = SGD_SM3; unsigned char *pucInData = NULL; - unsigned int uiInDataLen; + unsigned int uiInDataLen = strlen(InData) + 128; unsigned char pucSignature[256]; unsigned int uiSignatureLen = (unsigned int)sizeof(pucSignature); + int rv; - if (SOF_Decode(InData, &pucInData, &uiInDataLen) != SOR_OK) { + if (!(pucInData = OPENSSL_malloc(uiInDataLen))) { + SOFerr(SOF_F_SOF_SIGNDATA, ERR_R_MALLOC_FAILURE); + goto end; + } + + if (SAF_Base64_Decode((unsigned char *)InData, (unsigned int)strlen(InData), + pucInData, &uiInDataLen) != SOR_OK) { SOFerr(SOF_F_SOF_SIGNDATA, SOF_R_DECODE_FAILURE); goto end; } - rv = SAF_RsaSign( - hAppHandle, - (unsigned char *)ContainerName, - (unsigned int)strlen(ContainerName), - uiHashAlgoType, - pucInData, - uiInDataLen, - pucSignature, - &uiSignatureLen); - - rv = SAF_EccSign( - hAppHandle, - (unsigned char *)ContainerName, - (unsigned int)strlen(ContainerName), - uiHashAlgoType, - pucInData, - uiInDataLen, - pucSignature, - &uiSignatureLen); + if (SOF_GetSignMethod() == SGD_SM2) { + if ((rv = SAF_RsaSign( + sof_app, + (unsigned char *)ContainerName, + (unsigned int)strlen(ContainerName), + uiHashAlgoType, + pucInData, + uiInDataLen, + pucSignature, + &uiSignatureLen)) != SAR_Ok) { + SOFerr(SOF_F_SOF_SIGNDATA, ERR_R_SAF_LIB); + goto end; + } + } else { + if ((rv = SAF_EccSign( + sof_app, + (unsigned char *)ContainerName, + (unsigned int)strlen(ContainerName), + uiHashAlgoType, + pucInData, + uiInDataLen, + pucSignature, + &uiSignatureLen)) != SAR_Ok) { + SOFerr(SOF_F_SOF_SIGNDATA, ERR_R_SAF_LIB); + goto end; + } + } + ret = SOR_OK; end: OPENSSL_free(b64); OPENSSL_free(pucInData); @@ -260,21 +300,25 @@ BOOL SOF_VerifySignedData(BSTR Base64EncodeCert, BSTR InData, BSTR SignValue) return 0; } + BSTR SOF_SignFile(BSTR ContainerName, BSTR InFile) { - BSTR ret; + BSTR ret = NULL; + char *b64 = NULL; + unsigned int uiHashAlgoType = SGD_SM3; unsigned char *pucInData = NULL; unsigned int uiInDataLen; unsigned char pucSignature[256]; unsigned int uiSignatureLen = (unsigned int)sizeof(pucSignature); + int rv; - if (SOF_ReadFile(InFile, &pucInData, &uiInDataLen) != SOR_OK) { + if (!sof_read_file(InFile, &pucInData, &uiInDataLen)) { SOFerr(SOF_F_SOF_SIGNFILE, SOF_R_READ_FILE_FAILURE); return NULL; } if ((rv = SAF_EccSign( - hAppHandle, + sof_app, (unsigned char *)ContainerName, (unsigned int)strlen(ContainerName), uiHashAlgoType, @@ -286,7 +330,9 @@ BSTR SOF_SignFile(BSTR ContainerName, BSTR InFile) goto end; } - if (!(b64 = SOF_Encode(pucSignature, uiSignatureLen))) { + if (!(b64 = sof_encode(pucSignature, uiSignatureLen))) { + SOFerr(SOF_F_SOF_SIGNFILE, ERR_R_SOF_LIB); + goto end; } ret = b64; @@ -300,15 +346,18 @@ end: BOOL SOF_VerifySignedFile(BSTR Base64EncodeCert, BSTR InFile, BSTR SignValue) { + return SGD_FALSE; } BSTR SOF_EncryptData(BSTR Base64EncodeCert, BSTR InData) { +#if 0 char *ret = NULL; unsigned char *pucCertificate = NULL; unsigned int uiCertificateLen; unsigned char *pucInData = NULL; unsigned int uiInDataLen; + int rv; if (SOF_Decode(Base64EncodeCert, &pucCertificate, &uiCertificateLen) != SOR_OK || SOF_Decode(InData, &pucInData, &uiInDataLen) != SOR_OK @@ -321,7 +370,8 @@ BSTR SOF_EncryptData(BSTR Base64EncodeCert, BSTR InData) pucOutData, puiOutDataLen)) != SAR_Ok) { } - +#endif + return NULL; } BSTR SOF_DecryptData(BSTR ContainerName, BSTR InData) @@ -332,10 +382,11 @@ BSTR SOF_DecryptData(BSTR ContainerName, BSTR InData) BOOL SOF_EncryptFile(BSTR Base64EncodeCert, BSTR InFile, BSTR OutFile) { - int ret = FALSE; - int rv; + int ret = SGD_FALSE; +#if 0 unsigned char *pucCertificate = NULL; unsigned int uiCertificateLen; + int rv; if (SOF_Decode(Base64EncodeCert, &pucCertificate, &uiCertificateLen) != SOR_OK) { SOFerr(SOF_F_SOF_ENCRYPTFILE, SOF_R_DECODE_FAILURE); @@ -354,18 +405,18 @@ BOOL SOF_EncryptFile(BSTR Base64EncodeCert, BSTR InFile, BSTR OutFile) goto end; } - ret = TRUE; + ret = SGD_TRUE; end: OPENSSL_free(pucCertificate); +#endif return ret; } - BOOL SOF_DecryptFile(BSTR ContainerName, BSTR InFile, BSTR OutFile) { - int ret = FALSE; - int rv; + int ret = SGD_FALSE; + return ret; } BSTR SOF_SignMessage(short flag, BSTR ContainerName, BSTR InData) @@ -388,16 +439,6 @@ BSTR SOF_GetInfoFromSignedMessage(BSTR SignedMessage, short Type) BSTR SOF_SignDataXML(BSTR ContainerName, BSTR InData) { - int rv; - unsigned char outbuf[1024]; - - if ((rv = SAF_EccSignFile( - hAppHandle, - (unsigned char *)ContainerName, - (unsigned int)strlen(ContainerName), - sof_digest_method, - - SOFerr(SOF_F_SOF_SIGNDATAXML, SOF_R_NOT_IMPLEMENTED); return NULL; } @@ -415,21 +456,19 @@ BSTR SOF_GetXMLSignatureInfo(BSTR XMLSignedData, short Type) BSTR SOF_GenRandom(short RandomLen) { - int rv; - unsigned char *ret = NULL; + char *ret = NULL; + char *b64 = NULL; unsigned char *bin = NULL; - unsigned char *b64 = NULL; + unsigned int b64len = (RandomLen * 4)/3 + 128; + int rv; if (!(bin = OPENSSL_malloc(RandomLen)) - || !(ret = OPENSSL_zalloc((RandomLen * 4)/3 + 128)) - || (rv = SAF_GenRandom(RandomLen, buf)) != SAR_Ok - || (rv = SAF_Base64_Encode(buf, RandomLen, ret, &retlen)) != SAR_Ok) { + || (rv = SAF_GenRandom(RandomLen, bin)) != SAR_Ok + || !(b64 = sof_encode(bin, RandomLen))) { + SOFerr(SOF_F_SOF_GENRANDOM, ERR_R_SOF_LIB); goto end; } - ret = b64; - b64 = NULL; - end: OPENSSL_free(bin); OPENSSL_free(b64); diff --git a/crypto/sof/sof_lib.d.tmp b/crypto/sof/sof_lib.d.tmp deleted file mode 100644 index b7422ae8..00000000 --- a/crypto/sof/sof_lib.d.tmp +++ /dev/null @@ -1,8 +0,0 @@ -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/bn_gfp2.h b/include/openssl/bn_gfp2.h index facd4388..3aed6902 100644 --- a/include/openssl/bn_gfp2.h +++ b/include/openssl/bn_gfp2.h @@ -81,6 +81,10 @@ int BN_GFP2_mul_bn(BN_GFP2 *r, const BN_GFP2 *a, const BIGNUM *b, const BIGNUM * int BN_GFP2_div_bn(BN_GFP2 *r, const BN_GFP2 *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); void BN_GFP2_free(BN_GFP2 *a); + +int BN_GFP2_add_bn(BN_GFP2 *r, const BN_GFP2 *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); + int BN_bn2gfp2(const BIGNUM *bn, BN_GFP2 *gfp2, const BIGNUM *p, BN_CTX *ctx); int BN_gfp22bn(const BN_GFP2 *gfp2, BIGNUM *bn, const BIGNUM *p, BN_CTX *ctx); diff --git a/include/openssl/gmsaf.h b/include/openssl/gmsaf.h index 7c75f1fd..7c3e66c6 100644 --- a/include/openssl/gmsaf.h +++ b/include/openssl/gmsaf.h @@ -62,6 +62,25 @@ extern "C" { int SAF_PrintNameInfo(FILE *fp, SGD_NAME_INFO *nameInfo); const char *SAF_GetErrorString(int err); +/* GmSSL Extension */ +int SAF_EccSignFile( + void *hAppHandle, + unsigned char *pucContainerName, + unsigned int uiContainerNameLen, + unsigned int uiHashAlgoType, + unsigned char *pucFileName, + unsigned char *pucSignature, + unsigned int *puiSignatureLen); + +int SAF_EccVerifySignFile( + unsigned int uiHashAlgoType, + unsigned char *pucPublicKey, + unsigned int uiPublicKeyLen, + unsigned char *pucFileName, + unsigned char *pucSignature, + unsigned int uiSignatureLen); + + /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes diff --git a/include/openssl/gmsof.h b/include/openssl/gmsof.h index c01044f0..c49a2803 100644 --- a/include/openssl/gmsof.h +++ b/include/openssl/gmsof.h @@ -100,6 +100,7 @@ int ERR_load_SOF_strings(void); # define SOF_F_SOF_ENCRYPTFILE 107 # define SOF_F_SOF_EXPORTEXCHANGEUSERCERT 108 # define SOF_F_SOF_EXPORTUSERCERT 109 +# define SOF_F_SOF_G 143 # define SOF_F_SOF_GENRANDOM 110 # define SOF_F_SOF_GETCERTINFO 111 # define SOF_F_SOF_GETCERTINFOBYOID 112 @@ -136,6 +137,7 @@ int ERR_load_SOF_strings(void); /* Reason codes. */ # define SOF_R_DECODE_FAILURE 101 +# define SOF_R_INVALID_CERT_ATTRIBUTE 103 # define SOF_R_NOT_IMPLEMENTED 100 # define SOF_R_READ_FILE_FAILURE 102 diff --git a/include/openssl/obj_mac.h b/include/openssl/obj_mac.h index cd114936..d252c47b 100644 --- a/include/openssl/obj_mac.h +++ b/include/openssl/obj_mac.h @@ -4656,10 +4656,6 @@ #define NID_cmac_aes256_ecies 1081 #define OBJ_cmac_aes256_ecies OBJ_secg_scheme,24L,2L -#define SN_cbc_mac "CBC-MAC" -#define LN_cbc_mac "cbc-mac" -#define NID_cbc_mac 1082 - #define SN_ISO_CN "ISO-CN" #define LN_ISO_CN "ISO CN Member Body" #define NID_ISO_CN 1083 @@ -4835,9 +4831,9 @@ #define NID_sm2sign 1117 #define OBJ_sm2sign OBJ_sm_scheme,301L,1L -#define SN_sm2keyagreement "sm2keyagreement" -#define NID_sm2keyagreement 1118 -#define OBJ_sm2keyagreement OBJ_sm_scheme,301L,2L +#define SN_sm2exchange "sm2exchange" +#define NID_sm2exchange 1149 +#define OBJ_sm2exchange OBJ_sm_scheme,301L,2L #define SN_sm2encrypt "sm2encrypt" #define NID_sm2encrypt 1119 @@ -4963,10 +4959,32 @@ #define NID_r_ate_pairing 1146 #define OBJ_r_ate_pairing OBJ_ibcs1,3L,4L -#define SN_cpk "cpk" +#define SN_GmSSL "gmssl" +#define LN_GmSSL "GmSSL" +#define NID_GmSSL 1150 +#define OBJ_GmSSL OBJ_Enterprises,49549L + +#define SN_cpk "CPK" +#define LN_cpk "cpk" #define NID_cpk 1147 -#define OBJ_cpk OBJ_sm_scheme,1000L +#define OBJ_cpk OBJ_GmSSL,1L + +#define SN_cpk_map "cpk-map" +#define NID_cpk_map 1151 +#define OBJ_cpk_map OBJ_cpk,1L + +#define SN_cpk_sha1_map "cpk-sha1-map" +#define NID_cpk_sha1_map 1152 +#define OBJ_cpk_sha1_map OBJ_cpk_map,1L + +#define SN_cpk_sha256_map "cpk-sha256-map" +#define NID_cpk_sha256_map 1153 +#define OBJ_cpk_sha256_map OBJ_cpk_map,2L + +#define SN_cpk_sm3_map "cpk-sm3-map" +#define NID_cpk_sm3_map 1154 +#define OBJ_cpk_sm3_map OBJ_cpk_map,3L #define SN_paillier "paillier" #define NID_paillier 1148 -#define OBJ_paillier OBJ_sm_scheme,1001L +#define OBJ_paillier OBJ_GmSSL,21L diff --git a/include/openssl/saf.h b/include/openssl/saf.h index 4bfc4c88..f7aa7228 100644 --- a/include/openssl/saf.h +++ b/include/openssl/saf.h @@ -595,7 +595,6 @@ int SAF_Pkcs7_DecodeData( void *hAppHandle, unsigned char *pucDecContainerName, unsigned int uiDecContainerNameLen, - unsigned int uiDecKeyUsage, unsigned char *pucDerP7Data, unsigned int uiDerP7DataLen, unsigned char *pucData, @@ -643,7 +642,6 @@ int SAF_Pkcs7_DecodeEnvelopedData( void *hAppHandle, unsigned char *pucDecContainerName, unsigned int uiDecContainerNameLen, - unsigned int uiDecKeyUsage, unsigned char *pucDerP7EnvelopedData, unsigned int uiDerP7EnvelopedDataLen, unsigned char *pucData, @@ -659,11 +657,11 @@ int SAF_Pkcs7_EncodeDigestedData( int SAF_Pkcs7_DecodeDigestedData( void *hAppHandle, - unsigned int *puiDigestAlgorithm, unsigned char *pucDerP7DigestedData, unsigned int uiDerP7DigestedDataLen, + unsigned int *puiDigestAlgorithm, unsigned char *pucData, - unsigned int uiDataLen, + unsigned int *puiDataLen, unsigned char *pucDigest, unsigned int *puiDigestLen); @@ -671,7 +669,6 @@ int SAF_SM2_EncodeSignedAndEnvelopedData( void *hAppHandle, unsigned char *pucSignContainerName, unsigned int uiSignContainerNameLen, - unsigned int uiSignKeyUsage, unsigned char *pucSignerCertificate, unsigned int uiSignerCertificateLen, unsigned int uiDigestAlgorithm, @@ -687,14 +684,13 @@ int SAF_SM2_DecodeSignedAndEnvelopedData( void *hAppHandle, unsigned char *pucDerContainerName, unsigned int uiDerContainerNameLen, - unsigned int uiDecKeyUsage, unsigned char *pucDerSignedAndEnvelopedData, unsigned int uiDerSignedAndEnvelopedDataLen, unsigned char *pucData, unsigned int *puiDataLen, unsigned char *pucSignerCertificate, unsigned int *puiSignerCertificateLen, - unsigned int *puiDigestAlgorithms); + unsigned int *puiDigestAlgorithm); int SAF_SM2_EncodeSignedData( void *hAppHandle, @@ -713,11 +709,11 @@ int SAF_SM2_DecodeSignedData( void *hAppHandle, unsigned char *pucDerSignedData, unsigned int uiDerSignedDataLen, + unsigned int *puiDigestAlgorithm, unsigned char *pucSignerCertificate, - unsigned int uiSignerCertificateLen, - unsigned int uiDigestAlgorithm, + unsigned int *puiSignerCertificateLen, unsigned char *pucData, - unsigned int uiDataLen, + unsigned int *puiDataLen, unsigned char *pucSign, unsigned int *puiSignLen); @@ -735,7 +731,6 @@ int SAF_SM2_DecodeEnvelopedData( void *hAppHandle, unsigned char *pucDecContainerName, unsigned int uiDecContainerNameLen, - unsigned int uiDecKeyUsage, unsigned char *pucDerEnvelopedData, unsigned int uiDerEnvelopedDataLen, unsigned char *pucData, diff --git a/test/saftest.c b/test/saftest.c index 17e56b3f..4b0b461f 100644 --- a/test/saftest.c +++ b/test/saftest.c @@ -59,7 +59,10 @@ int main(int argc, char **argv) return 0; } #else +# include # include +# include +# include int test_saf_base64(int verbose) { @@ -121,7 +124,6 @@ static int test_saf_ec(int verbose) static int test_saf_hash(int verbose) { - int ret = 0; unsigned char msg[3] = "abc"; unsigned char pubkey[] = "FIXME"; unsigned char id[] = "FIXME"; @@ -149,16 +151,13 @@ static int test_saf_hash(int verbose) return 1; } +static int test_saf_enc(int verbose) +{ + return 0; +} + 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; } @@ -185,11 +184,11 @@ static int test_saf_sm2(int verbose) int main(int argc, char **argv) { int err = 0; - int verboe = 2; + int verbose = 2; if (SAR_Ok != test_saf_base64(verbose)) err++; if (!test_saf_cert(verbose)) err++; - if (!test_saf_ec(verbose)) err++ + if (!test_saf_ec(verbose)) err++; if (!test_saf_enc(verbose)) err++; if (!test_saf_hash(verbose)) err++; if (!test_saf_mac(verbose)) err++; diff --git a/util/libcrypto.num b/util/libcrypto.num index 12d65e26..9154397f 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -4871,3 +4871,4 @@ 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: +BN_GFP2_add_bn 4822 1_1_0d EXIST::FUNCTION: