From: Dmitry Belyavskiy Date: Thu, 6 Dec 2018 16:03:22 +0000 (+0300) Subject: New master API versioning. X-Git-Tag: v3.0.0~329 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=61afc2c3334e7e69598715548401078f350c45d1;p=openssl-gost%2Fengine.git New master API versioning. --- diff --git a/gost_ameth.c b/gost_ameth.c index 84f1491..df59520 100644 --- a/gost_ameth.c +++ b/gost_ameth.c @@ -21,13 +21,6 @@ #define PK_WRAP_PARAM "LEGACY_PK_WRAP" -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) -/* some functions have const'ed arguments since openssl-1.1.0 */ -# define OPENSSL110_const const -#else -# define OPENSSL110_const -#endif - /* * Pack bignum into byte buffer of given size, filling all leading bytes by * zeros @@ -139,9 +132,9 @@ static int gost_decode_nid_params(EVP_PKEY *pkey, int pkey_nid, int param_nid) * NID and parameters */ static int decode_gost_algor_params(EVP_PKEY *pkey, - OPENSSL110_const X509_ALGOR *palg) + const X509_ALGOR *palg) { - OPENSSL110_const ASN1_OBJECT *palg_obj = NULL; + const ASN1_OBJECT *palg_obj = NULL; int ptype = V_ASN1_UNDEF; int pkey_nid = NID_undef, param_nid = NID_undef; ASN1_STRING *pval = NULL; @@ -150,7 +143,7 @@ static int decode_gost_algor_params(EVP_PKEY *pkey, if (!pkey || !palg) return 0; - X509_ALGOR_get0(&palg_obj, &ptype, (OPENSSL110_const void **)&pval, palg); + X509_ALGOR_get0(&palg_obj, &ptype, (const void **)&pval, palg); if (ptype != V_ASN1_SEQUENCE) { GOSTerr(GOST_F_DECODE_GOST_ALGOR_PARAMS, GOST_R_BAD_KEY_PARAMETERS_FORMAT); @@ -339,14 +332,14 @@ static BIGNUM *unmask_priv_key(EVP_PKEY *pk, } static int priv_decode_gost(EVP_PKEY *pk, - OPENSSL110_const PKCS8_PRIV_KEY_INFO *p8inf) + const PKCS8_PRIV_KEY_INFO *p8inf) { const unsigned char *pkey_buf = NULL, *p = NULL; int priv_len = 0; BIGNUM *pk_num = NULL; int ret = 0; - OPENSSL110_const X509_ALGOR *palg = NULL; - OPENSSL110_const ASN1_OBJECT *palg_obj = NULL; + const X509_ALGOR *palg = NULL; + const ASN1_OBJECT *palg_obj = NULL; ASN1_INTEGER *priv_key = NULL; int expected_key_len = 32; @@ -511,7 +504,7 @@ static int print_gost_ec_pub(BIO *out, const EVP_PKEY *pkey, int indent) if (!pubkey || !group) goto err; - if (!EC_POINT_get_affine_coordinates_GFp(group, pubkey, X, Y, ctx)) { + if (!EC_POINT_get_affine_coordinates(group, pubkey, X, Y, ctx)) { GOSTerr(GOST_F_PRINT_GOST_EC_PUB, ERR_R_EC_LIB); goto err; } @@ -690,7 +683,7 @@ static int pub_decode_gost_ec(EVP_PKEY *pk, X509_PUBKEY *pub) X = BN_bin2bn(databuf + len, len, NULL); OPENSSL_free(databuf); pub_key = EC_POINT_new(group); - if (!EC_POINT_set_affine_coordinates_GFp(group, pub_key, X, Y, NULL)) { + if (!EC_POINT_set_affine_coordinates(group, pub_key, X, Y, NULL)) { GOSTerr(GOST_F_PUB_DECODE_GOST_EC, ERR_R_EC_LIB); EC_POINT_free(pub_key); BN_free(X); @@ -744,7 +737,7 @@ static int pub_encode_gost_ec(X509_PUBKEY *pub, const EVP_PKEY *pk) GOSTerr(GOST_F_PUB_ENCODE_GOST_EC, ERR_R_MALLOC_FAILURE); goto err; } - if (!EC_POINT_get_affine_coordinates_GFp(EC_KEY_get0_group(ec), + if (!EC_POINT_get_affine_coordinates(EC_KEY_get0_group(ec), pub_key, X, Y, NULL)) { GOSTerr(GOST_F_PUB_ENCODE_GOST_EC, ERR_R_INTERNAL_ERROR); goto err; @@ -920,9 +913,7 @@ int register_ameth_gost(int nid, EVP_PKEY_ASN1_METHOD **ameth, pkey_size_gost, pkey_bits_gost); EVP_PKEY_asn1_set_ctrl(*ameth, pkey_ctrl_gost); -#if OPENSSL_VERSION_NUMBER >= 0x10100000L EVP_PKEY_asn1_set_security_bits(*ameth, pkey_bits_gost); -#endif break; case NID_id_GostR3410_2012_256: case NID_id_GostR3410_2012_512: @@ -942,9 +933,7 @@ int register_ameth_gost(int nid, EVP_PKEY_ASN1_METHOD **ameth, pkey_size_gost, pkey_bits_gost); EVP_PKEY_asn1_set_ctrl(*ameth, pkey_ctrl_gost); -#if OPENSSL_VERSION_NUMBER >= 0x10100000L EVP_PKEY_asn1_set_security_bits(*ameth, pkey_bits_gost); -#endif break; case NID_id_Gost28147_89_MAC: EVP_PKEY_asn1_set_free(*ameth, mackey_free_gost); diff --git a/gost_ec_keyx.c b/gost_ec_keyx.c index 503d80b..2a858ac 100644 --- a/gost_ec_keyx.c +++ b/gost_ec_keyx.c @@ -56,7 +56,7 @@ static int VKO_compute_key(unsigned char *shared_key, size_t shared_key_size, GOSTerr(GOST_F_VKO_COMPUTE_KEY, GOST_R_ERROR_POINT_MUL); goto err; } - EC_POINT_get_affine_coordinates_GFp(EC_KEY_get0_group(priv_key), + EC_POINT_get_affine_coordinates(EC_KEY_get0_group(priv_key), pnt, X, Y, ctx); half_len = BN_num_bytes(order); diff --git a/gost_ec_sign.c b/gost_ec_sign.c index 114091c..be6f9b1 100644 --- a/gost_ec_sign.c +++ b/gost_ec_sign.c @@ -124,7 +124,7 @@ int fill_GOST_EC_params(EC_KEY *eckey, int nid) if (!BN_hex2bn(&x, params->x) || !BN_hex2bn(&y, params->y) - || !EC_POINT_set_affine_coordinates_GFp(grp, P, x, y, ctx) + || !EC_POINT_set_affine_coordinates(grp, P, x, y, ctx) || !BN_hex2bn(&q, params->q)) { GOSTerr(GOST_F_FILL_GOST_EC_PARAMS, ERR_R_INTERNAL_ERROR); goto end; @@ -247,7 +247,7 @@ ECDSA_SIG *gost_ec_sign(const unsigned char *dgst, int dlen, EC_KEY *eckey) GOSTerr(GOST_F_GOST_EC_SIGN, ERR_R_MALLOC_FAILURE); goto err; } - if (!EC_POINT_get_affine_coordinates_GFp(group, C, X, NULL, ctx)) { + if (!EC_POINT_get_affine_coordinates(group, C, X, NULL, ctx)) { GOSTerr(GOST_F_GOST_EC_SIGN, ERR_R_EC_LIB); goto err; } @@ -394,7 +394,7 @@ int gost_ec_verify(const unsigned char *dgst, int dgst_len, GOSTerr(GOST_F_GOST_EC_VERIFY, ERR_R_EC_LIB); goto err; } - if (!EC_POINT_get_affine_coordinates_GFp(group, C, X, NULL, ctx)) { + if (!EC_POINT_get_affine_coordinates(group, C, X, NULL, ctx)) { GOSTerr(GOST_F_GOST_EC_VERIFY, ERR_R_EC_LIB); goto err; } diff --git a/gost_lcl.h b/gost_lcl.h index 0c51fa1..6a6130a 100644 --- a/gost_lcl.h +++ b/gost_lcl.h @@ -21,7 +21,7 @@ # define GOST_PARAM_CRYPT_PARAMS 0 # define GOST_PARAM_PBE_PARAMS 1 # define GOST_PARAM_PK_FORMAT 2 -# define GOST_PARAM_MAX 2 +# define GOST_PARAM_MAX 3 # define GOST_CTRL_CRYPT_PARAMS (ENGINE_CMD_BASE+GOST_PARAM_CRYPT_PARAMS) # define GOST_CTRL_PBE_PARAMS (ENGINE_CMD_BASE+GOST_PARAM_PBE_PARAMS) # define GOST_CTRL_PK_FORMAT (ENGINE_CMD_BASE+GOST_PARAM_PK_FORMAT) diff --git a/test_curves.c b/test_curves.c index 7f36c75..ba1da89 100644 --- a/test_curves.c +++ b/test_curves.c @@ -129,7 +129,7 @@ static int parameter_test(struct test_curve *tc) T(p = BN_new()); T(a = BN_new()); T(b = BN_new()); - EC_GROUP_get_curve_GFp(group, p, a, b, ctx); + EC_GROUP_get_curve(group, p, a, b, ctx); print_bn("p", p); print_bn("a", a); print_bn("b", b); @@ -144,7 +144,7 @@ static int parameter_test(struct test_curve *tc) BIGNUM *x, *y; T(x = BN_new()); T(y = BN_new()); - T(EC_POINT_get_affine_coordinates_GFp(group, generator, x, y, ctx)); + T(EC_POINT_get_affine_coordinates(group, generator, x, y, ctx)); print_bn("x", x); print_bn("y", y); T(!BN_is_zero(y));