diff --git a/crypto/err/err_all.c b/crypto/err/err_all.c index 7bf9e9a4..4e7ab151 100644 --- a/crypto/err/err_all.c +++ b/crypto/err/err_all.c @@ -48,10 +48,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include int err_load_crypto_strings_int(void) { diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index d96e406c..c148c892 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -208,7 +208,7 @@ int EVP_CIPHER_type(const EVP_CIPHER *ctx) return NID_sms4_cfb128; #endif -#ifndef OPENSSL_NO_SM1: +#ifndef OPENSSL_NO_SM1 case NID_sm1_cfb128: case NID_sm1_cfb8: case NID_sm1_cfb1: diff --git a/crypto/objects/obj_dat.h b/crypto/objects/obj_dat.h index 627abca1..e610c252 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[7417] = { +static const unsigned char so[7433] = { 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 */ @@ -1046,9 +1046,11 @@ static const unsigned char so[7417] = { 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 */ }; -#define NUM_NID 1147 +#define NUM_NID 1149 static const ASN1_OBJECT nid_objs[NUM_NID] = { {"UNDEF", "undefined", NID_undef}, {"rsadsi", "RSA Data Security, Inc.", NID_rsadsi, 6, &so[0]}, @@ -2197,9 +2199,11 @@ static const ASN1_OBJECT nid_objs[NUM_NID] = { {"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]}, }; -#define NUM_SN 1138 +#define NUM_SN 1140 static const unsigned int sn_objs[NUM_SN] = { 364, /* "AD_DVCS" */ 419, /* "AES-128-CBC" */ @@ -2567,6 +2571,7 @@ static const unsigned int sn_objs[NUM_SN] = { 131, /* "codeSigning" */ 50, /* "contentType" */ 53, /* "countersignature" */ + 1147, /* "cpk" */ 153, /* "crlBag" */ 103, /* "crlDistributionPoints" */ 88, /* "crlNumber" */ @@ -3016,6 +3021,7 @@ static const unsigned int sn_objs[NUM_SN] = { 475, /* "otherMailbox" */ 876, /* "owner" */ 489, /* "pagerTelephoneNumber" */ + 1148, /* "paillier" */ 374, /* "path" */ 112, /* "pbeWithMD5AndCast5CBC" */ 499, /* "personalSignature" */ @@ -3341,7 +3347,7 @@ static const unsigned int sn_objs[NUM_SN] = { 1069, /* "xor-in-ecies" */ }; -#define NUM_LN 1138 +#define NUM_LN 1140 static const unsigned int ln_objs[NUM_LN] = { 363, /* "AD Time Stamping" */ 405, /* "ANSI X9.62" */ @@ -3681,6 +3687,7 @@ static const unsigned int ln_objs[NUM_LN] = { 50, /* "contentType" */ 53, /* "countersignature" */ 14, /* "countryName" */ + 1147, /* "cpk" */ 153, /* "crlBag" */ 884, /* "crossCertificatePair" */ 806, /* "cryptocom" */ @@ -4105,6 +4112,7 @@ static const unsigned int ln_objs[NUM_LN] = { 876, /* "owner" */ 935, /* "pSpecified" */ 489, /* "pagerTelephoneNumber" */ + 1148, /* "paillier" */ 782, /* "password based MAC" */ 374, /* "path" */ 621, /* "payment gateway capabilities" */ @@ -4483,7 +4491,7 @@ static const unsigned int ln_objs[NUM_LN] = { 1136, /* "zuc" */ }; -#define NUM_OBJ 1041 +#define NUM_OBJ 1043 static const unsigned int obj_objs[NUM_OBJ] = { 0, /* OBJ_undef 0 */ 181, /* OBJ_iso 1 */ @@ -4993,6 +5001,8 @@ 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 */ diff --git a/crypto/objects/obj_mac.num b/crypto/objects/obj_mac.num index 285aa5a0..a53c6b15 100644 --- a/crypto/objects/obj_mac.num +++ b/crypto/objects/obj_mac.num @@ -1144,3 +1144,5 @@ tate_pairing 1143 weil_pairing 1144 ate_pairing 1145 r_ate_pairing 1146 +cpk 1147 +paillier 1148 diff --git a/crypto/paillier/pai_err.c b/crypto/paillier/pai_err.c index 2024d018..64553a32 100644 --- a/crypto/paillier/pai_err.c +++ b/crypto/paillier/pai_err.c @@ -27,10 +27,14 @@ static ERR_STRING_DATA PAILLIER_str_functs[] = { {ERR_FUNC(PAILLIER_F_PAILLIER_ENCRYPT), "PAILLIER_encrypt"}, {ERR_FUNC(PAILLIER_F_PAILLIER_GENERATE_KEY), "PAILLIER_generate_key"}, {ERR_FUNC(PAILLIER_F_PAILLIER_NEW), "PAILLIER_new"}, + {ERR_FUNC(PAILLIER_F_PAILLIER_PUB_DECODE), "paillier_pub_decode"}, + {ERR_FUNC(PAILLIER_F_PKEY_PAILLIER_DECRYPT), "pkey_paillier_decrypt"}, + {ERR_FUNC(PAILLIER_F_PKEY_PAILLIER_ENCRYPT), "pkey_paillier_encrypt"}, {0, NULL} }; static ERR_STRING_DATA PAILLIER_str_reasons[] = { + {ERR_REASON(PAILLIER_R_BUFFER_TOO_SMALL), "buffer too small"}, {ERR_REASON(PAILLIER_R_GENERATE_PRIME_FAILED), "generate prime failed"}, {ERR_REASON(PAILLIER_R_INVALID_PLAINTEXT), "invalid plaintext"}, {ERR_REASON(PAILLIER_R_MALLOC_FAILED), "malloc failed"}, diff --git a/crypto/paillier/pai_pmeth.c b/crypto/paillier/pai_pmeth.c index 89f0673b..7591723b 100644 --- a/crypto/paillier/pai_pmeth.c +++ b/crypto/paillier/pai_pmeth.c @@ -135,7 +135,7 @@ static int pkey_paillier_decrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t * } if (!BN_bin2bn(in, (int)inlen, c)) { - PAILLIERerr(PAILLIER_F_PKEY_PAILLIER_ENCRYPT, ERR_R_BN_LIB); + PAILLIERerr(PAILLIER_F_PKEY_PAILLIER_DECRYPT, ERR_R_BN_LIB); goto end; } if (!PAILLIER_decrypt(m, c, key)) { diff --git a/include/openssl/obj_mac.h b/include/openssl/obj_mac.h index 230c5ee9..cd114936 100644 --- a/include/openssl/obj_mac.h +++ b/include/openssl/obj_mac.h @@ -4962,3 +4962,11 @@ #define SN_r_ate_pairing "r-ate-pairing" #define NID_r_ate_pairing 1146 #define OBJ_r_ate_pairing OBJ_ibcs1,3L,4L + +#define SN_cpk "cpk" +#define NID_cpk 1147 +#define OBJ_cpk OBJ_sm_scheme,1000L + +#define SN_paillier "paillier" +#define NID_paillier 1148 +#define OBJ_paillier OBJ_sm_scheme,1001L diff --git a/include/openssl/paillier.h b/include/openssl/paillier.h index 130c3918..d25a09b7 100644 --- a/include/openssl/paillier.h +++ b/include/openssl/paillier.h @@ -95,8 +95,12 @@ int ERR_load_PAILLIER_strings(void); # define PAILLIER_F_PAILLIER_ENCRYPT 104 # define PAILLIER_F_PAILLIER_GENERATE_KEY 105 # define PAILLIER_F_PAILLIER_NEW 106 +# define PAILLIER_F_PAILLIER_PUB_DECODE 107 +# define PAILLIER_F_PKEY_PAILLIER_DECRYPT 108 +# define PAILLIER_F_PKEY_PAILLIER_ENCRYPT 109 /* Reason codes. */ +# define PAILLIER_R_BUFFER_TOO_SMALL 104 # define PAILLIER_R_GENERATE_PRIME_FAILED 100 # define PAILLIER_R_INVALID_PLAINTEXT 101 # define PAILLIER_R_MALLOC_FAILED 102