diff options
-rw-r--r-- | crypto/bn/bn_const.c | 12 | ||||
-rw-r--r-- | crypto/bn/bn_ctx.c | 2 | ||||
-rw-r--r-- | crypto/bn/bn_dh.c | 14 | ||||
-rw-r--r-- | crypto/bn/bn_prime.c | 8 | ||||
-rw-r--r-- | crypto/bn/bn_rand.c | 4 | ||||
-rw-r--r-- | crypto/bn/bn_rsa_fips186_4.c | 28 | ||||
-rw-r--r-- | crypto/dh/dh_rfc5114.c | 6 | ||||
-rw-r--r-- | crypto/ec/ec_cvt.c | 4 | ||||
-rw-r--r-- | crypto/ffc/ffc_dh.c | 9 | ||||
-rw-r--r-- | crypto/ffc/ffc_params_generate.c | 4 | ||||
-rw-r--r-- | crypto/rsa/rsa_sp800_56b_check.c | 11 | ||||
-rw-r--r-- | crypto/rsa/rsa_sp800_56b_gen.c | 8 | ||||
-rw-r--r-- | include/crypto/bn.h | 31 | ||||
-rw-r--r-- | include/crypto/bn_dh.h | 52 | ||||
-rw-r--r-- | test/bn_internal_test.c | 8 | ||||
-rw-r--r-- | test/evp_libctx_test.c | 6 | ||||
-rw-r--r-- | test/evp_pkey_provided_test.c | 8 |
17 files changed, 114 insertions, 101 deletions
diff --git a/crypto/bn/bn_const.c b/crypto/bn/bn_const.c index 7d0a9f901e..06a40d6fba 100644 --- a/crypto/bn/bn_const.c +++ b/crypto/bn/bn_const.c @@ -84,7 +84,7 @@ BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn) BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn) { - return COPY_BN(bn, _bignum_modp_1536_p); + return COPY_BN(bn, ossl_bignum_modp_1536_p); } /*- @@ -97,7 +97,7 @@ BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn) BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn) { - return COPY_BN(bn, _bignum_modp_2048_p); + return COPY_BN(bn, ossl_bignum_modp_2048_p); } /*- @@ -110,7 +110,7 @@ BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn) BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn) { - return COPY_BN(bn, _bignum_modp_3072_p); + return COPY_BN(bn, ossl_bignum_modp_3072_p); } /*- @@ -123,7 +123,7 @@ BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn) BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn) { - return COPY_BN(bn, _bignum_modp_4096_p); + return COPY_BN(bn, ossl_bignum_modp_4096_p); } /*- @@ -136,7 +136,7 @@ BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn) BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn) { - return COPY_BN(bn, _bignum_modp_6144_p); + return COPY_BN(bn, ossl_bignum_modp_6144_p); } /*- @@ -149,5 +149,5 @@ BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn) BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn) { - return COPY_BN(bn, _bignum_modp_8192_p); + return COPY_BN(bn, ossl_bignum_modp_8192_p); } diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c index 6234c51435..360b708221 100644 --- a/crypto/bn/bn_ctx.c +++ b/crypto/bn/bn_ctx.c @@ -249,7 +249,7 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx) return ret; } -OSSL_LIB_CTX *bn_get_libctx(BN_CTX *ctx) +OSSL_LIB_CTX *ossl_bn_get_libctx(BN_CTX *ctx) { if (ctx == NULL) return NULL; diff --git a/crypto/bn/bn_dh.c b/crypto/bn/bn_dh.c index 9f5b80cb8e..58f545642e 100644 --- a/crypto/bn/bn_dh.c +++ b/crypto/bn/bn_dh.c @@ -1003,15 +1003,17 @@ static const BN_ULONG ffdhe8192_q[] = { /* Macro to make a BIGNUM from static data */ -# define make_dh_bn(x) extern const BIGNUM _bignum_##x; \ - const BIGNUM _bignum_##x = { (BN_ULONG *) x, \ - OSSL_NELEM(x),\ - OSSL_NELEM(x),\ - 0, BN_FLG_STATIC_DATA }; +# define make_dh_bn(x) \ + extern const BIGNUM ossl_bignum_##x; \ + const BIGNUM ossl_bignum_##x = { \ + (BN_ULONG *) x, \ + OSSL_NELEM(x), \ + OSSL_NELEM(x), \ + 0, BN_FLG_STATIC_DATA }; static const BN_ULONG value_2 = 2; -const BIGNUM _bignum_const_2 = { +const BIGNUM ossl_bignum_const_2 = { (BN_ULONG *)&value_2, 1, 1, 0, BN_FLG_STATIC_DATA }; diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c index eba402d2f2..33a2c85129 100644 --- a/crypto/bn/bn_prime.c +++ b/crypto/bn/bn_prime.c @@ -62,7 +62,7 @@ static const BIGNUM _bignum_small_prime_factors = { BN_FLG_STATIC_DATA }; -const BIGNUM *bn_get0_small_factors(void) +const BIGNUM *ossl_bn_get0_small_factors(void) { return &_bignum_small_prime_factors; } @@ -308,7 +308,7 @@ static int bn_is_prime_int(const BIGNUM *w, int checks, BN_CTX *ctx, goto err; #endif - ret = bn_miller_rabin_is_prime(w, checks, ctx, cb, 0, &status); + ret = ossl_bn_miller_rabin_is_prime(w, checks, ctx, cb, 0, &status); if (!ret) goto err; ret = (status == BN_PRIMETEST_PROBABLY_PRIME); @@ -334,8 +334,8 @@ err: * * returns 0 if there was an error, otherwise it returns 1. */ -int bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx, - BN_GENCB *cb, int enhanced, int *status) +int ossl_bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx, + BN_GENCB *cb, int enhanced, int *status) { int i, j, a, ret = 0; BIGNUM *g, *w1, *w3, *x, *m, *z, *b; diff --git a/crypto/bn/bn_rand.c b/crypto/bn/bn_rand.c index 1f12e81fb7..79e44ab960 100644 --- a/crypto/bn/bn_rand.c +++ b/crypto/bn/bn_rand.c @@ -25,7 +25,7 @@ static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, { unsigned char *buf = NULL; int b, ret = 0, bit, bytes, mask; - OSSL_LIB_CTX *libctx = bn_get_libctx(ctx); + OSSL_LIB_CTX *libctx = ossl_bn_get_libctx(ctx); if (bits == 0) { if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) @@ -256,7 +256,7 @@ int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, unsigned char *k_bytes = NULL; int ret = 0; EVP_MD *md = NULL; - OSSL_LIB_CTX *libctx = bn_get_libctx(ctx); + OSSL_LIB_CTX *libctx = ossl_bn_get_libctx(ctx); if (mdctx == NULL) goto err; diff --git a/crypto/bn/bn_rsa_fips186_4.c b/crypto/bn/bn_rsa_fips186_4.c index ab1e1f14ae..a49166b9c3 100644 --- a/crypto/bn/bn_rsa_fips186_4.c +++ b/crypto/bn/bn_rsa_fips186_4.c @@ -45,7 +45,7 @@ static const BN_ULONG inv_sqrt_2_val[] = { BN_DEF(0x754ABE9FUL, 0x597D89B3UL), BN_DEF(0xF9DE6484UL, 0xB504F333UL) }; -const BIGNUM bn_inv_sqrt_2 = { +const BIGNUM ossl_bn_inv_sqrt_2 = { (BN_ULONG *)inv_sqrt_2_val, OSSL_NELEM(inv_sqrt_2_val), OSSL_NELEM(inv_sqrt_2_val), @@ -147,11 +147,12 @@ err: * cb An optional BIGNUM callback. * Returns: 1 on success otherwise it returns 0. */ -int bn_rsa_fips186_4_gen_prob_primes(BIGNUM *p, BIGNUM *Xpout, - BIGNUM *p1, BIGNUM *p2, - const BIGNUM *Xp, const BIGNUM *Xp1, - const BIGNUM *Xp2, int nlen, - const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb) +int ossl_bn_rsa_fips186_4_gen_prob_primes(BIGNUM *p, BIGNUM *Xpout, + BIGNUM *p1, BIGNUM *p2, + const BIGNUM *Xp, const BIGNUM *Xp1, + const BIGNUM *Xp2, int nlen, + const BIGNUM *e, BN_CTX *ctx, + BN_GENCB *cb) { int ret = 0; BIGNUM *p1i = NULL, *p2i = NULL, *Xp1i = NULL, *Xp2i = NULL; @@ -197,7 +198,8 @@ int bn_rsa_fips186_4_gen_prob_primes(BIGNUM *p, BIGNUM *Xpout, bn_rsa_fips186_4_aux_prime_max_sum_size_for_prob_primes(nlen)) goto err; /* (Steps 4.3/5.3) - generate prime */ - if (!bn_rsa_fips186_4_derive_prime(p, Xpout, Xp, p1i, p2i, nlen, e, ctx, cb)) + if (!ossl_bn_rsa_fips186_4_derive_prime(p, Xpout, Xp, p1i, p2i, nlen, e, + ctx, cb)) goto err; ret = 1; err: @@ -235,9 +237,10 @@ err: * Assumptions: * Y, X, r1, r2, e are not NULL. */ -int bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin, - const BIGNUM *r1, const BIGNUM *r2, int nlen, - const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb) +int ossl_bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin, + const BIGNUM *r1, const BIGNUM *r2, + int nlen, const BIGNUM *e, BN_CTX *ctx, + BN_GENCB *cb) { int ret = 0; int i, imax; @@ -270,9 +273,10 @@ int bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin, * We only have the first 256 bit of 1/sqrt(2) */ if (Xin == NULL) { - if (bits < BN_num_bits(&bn_inv_sqrt_2)) + if (bits < BN_num_bits(&ossl_bn_inv_sqrt_2)) goto err; - if (!BN_lshift(base, &bn_inv_sqrt_2, bits - BN_num_bits(&bn_inv_sqrt_2)) + if (!BN_lshift(base, &ossl_bn_inv_sqrt_2, + bits - BN_num_bits(&ossl_bn_inv_sqrt_2)) || !BN_lshift(range, BN_value_one(), bits) || !BN_sub(range, range, base)) goto err; diff --git a/crypto/dh/dh_rfc5114.c b/crypto/dh/dh_rfc5114.c index 4e7daaefc7..c578a89a58 100644 --- a/crypto/dh/dh_rfc5114.c +++ b/crypto/dh/dh_rfc5114.c @@ -32,9 +32,9 @@ DH *DH_get_##x(void) \ \ if (dh == NULL) \ return NULL; \ - dh->params.p = BN_dup(&_bignum_dh##x##_p); \ - dh->params.g = BN_dup(&_bignum_dh##x##_g); \ - dh->params.q = BN_dup(&_bignum_dh##x##_q); \ + dh->params.p = BN_dup(&ossl_bignum_dh##x##_p); \ + dh->params.g = BN_dup(&ossl_bignum_dh##x##_g); \ + dh->params.q = BN_dup(&ossl_bignum_dh##x##_q); \ if (dh->params.p == NULL || dh->params.q == NULL || dh->params.g == NULL) {\ DH_free(dh); \ return NULL; \ diff --git a/crypto/ec/ec_cvt.c b/crypto/ec/ec_cvt.c index c841ad741d..00a5c48c8f 100644 --- a/crypto/ec/ec_cvt.c +++ b/crypto/ec/ec_cvt.c @@ -54,7 +54,7 @@ EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, meth = EC_GFp_mont_method(); #endif - ret = ec_group_new_ex(bn_get_libctx(ctx), NULL, meth); + ret = ec_group_new_ex(ossl_bn_get_libctx(ctx), NULL, meth); if (ret == NULL) return NULL; @@ -75,7 +75,7 @@ EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, meth = EC_GF2m_simple_method(); - ret = ec_group_new_ex(bn_get_libctx(ctx), NULL, meth); + ret = ec_group_new_ex(ossl_bn_get_libctx(ctx), NULL, meth); if (ret == NULL) return NULL; diff --git a/crypto/ffc/ffc_dh.c b/crypto/ffc/ffc_dh.c index db472febb0..17888e9291 100644 --- a/crypto/ffc/ffc_dh.c +++ b/crypto/ffc/ffc_dh.c @@ -17,19 +17,22 @@ # define FFDHE(sz) { \ SN_ffdhe##sz, NID_ffdhe##sz, \ sz, \ - &_bignum_ffdhe##sz##_p, &_bignum_ffdhe##sz##_q, &_bignum_const_2, \ + &ossl_bignum_ffdhe##sz##_p, &ossl_bignum_ffdhe##sz##_q, \ + &ossl_bignum_const_2, \ } # define MODP(sz) { \ SN_modp_##sz, NID_modp_##sz, \ sz, \ - &_bignum_modp_##sz##_p, &_bignum_modp_##sz##_q, &_bignum_const_2 \ + &ossl_bignum_modp_##sz##_p, &ossl_bignum_modp_##sz##_q, \ + &ossl_bignum_const_2 \ } # define RFC5114(name, uid, sz, tag) { \ name, uid, \ sz, \ - &_bignum_dh##tag##_p, &_bignum_dh##tag##_q, &_bignum_dh##tag##_g \ + &ossl_bignum_dh##tag##_p, &ossl_bignum_dh##tag##_q, \ + &ossl_bignum_dh##tag##_g \ } #else diff --git a/crypto/ffc/ffc_params_generate.c b/crypto/ffc/ffc_params_generate.c index 2e50c2b801..e0ce7485cf 100644 --- a/crypto/ffc/ffc_params_generate.c +++ b/crypto/ffc/ffc_params_generate.c @@ -320,7 +320,7 @@ static int generate_q_fips186_4(BN_CTX *ctx, BIGNUM *q, const EVP_MD *evpmd, unsigned char md[EVP_MAX_MD_SIZE]; int mdsize = EVP_MD_size(evpmd); unsigned char *pmd; - OSSL_LIB_CTX *libctx = bn_get_libctx(ctx); + OSSL_LIB_CTX *libctx = ossl_bn_get_libctx(ctx); /* find q */ for (;;) { @@ -391,7 +391,7 @@ static int generate_q_fips186_2(BN_CTX *ctx, BIGNUM *q, const EVP_MD *evpmd, unsigned char buf2[EVP_MAX_MD_SIZE]; unsigned char md[EVP_MAX_MD_SIZE]; int i, r, ret = 0, m = *retm; - OSSL_LIB_CTX *libctx = bn_get_libctx(ctx); + OSSL_LIB_CTX *libctx = ossl_bn_get_libctx(ctx); /* find q */ for (;;) { diff --git a/crypto/rsa/rsa_sp800_56b_check.c b/crypto/rsa/rsa_sp800_56b_check.c index 173bc5e253..c2066236f9 100644 --- a/crypto/rsa/rsa_sp800_56b_check.c +++ b/crypto/rsa/rsa_sp800_56b_check.c @@ -92,7 +92,7 @@ int ossl_rsa_check_prime_factor_range(const BIGNUM *p, int nbits, BN_CTX *ctx) int shift; nbits >>= 1; - shift = nbits - BN_num_bits(&bn_inv_sqrt_2); + shift = nbits - BN_num_bits(&ossl_bn_inv_sqrt_2); /* Upper bound check */ if (BN_num_bits(p) != nbits) @@ -104,12 +104,12 @@ int ossl_rsa_check_prime_factor_range(const BIGNUM *p, int nbits, BN_CTX *ctx) goto err; /* set low = (√2)(2^(nbits/2 - 1) */ - if (!BN_copy(low, &bn_inv_sqrt_2)) + if (!BN_copy(low, &ossl_bn_inv_sqrt_2)) goto err; if (shift >= 0) { /* - * We don't have all the bits. bn_inv_sqrt_2 contains a rounded up + * We don't have all the bits. ossl_bn_inv_sqrt_2 contains a rounded up * value, so there is a very low probability that we'll reject a valid * value. */ @@ -329,12 +329,13 @@ int ossl_rsa_sp800_56b_check_public(const RSA *rsa) * The modulus is composite, but not a power of a prime. * The modulus has no factors smaller than 752. */ - if (!BN_gcd(gcd, rsa->n, bn_get0_small_factors(), ctx) || !BN_is_one(gcd)) { + if (!BN_gcd(gcd, rsa->n, ossl_bn_get0_small_factors(), ctx) + || !BN_is_one(gcd)) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_MODULUS); goto err; } - ret = bn_miller_rabin_is_prime(rsa->n, 0, ctx, NULL, 1, &status); + ret = ossl_bn_miller_rabin_is_prime(rsa->n, 0, ctx, NULL, 1, &status); if (ret != 1 || status != BN_PRIMETEST_COMPOSITE_NOT_POWER_OF_PRIME) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_MODULUS); ret = 0; diff --git a/crypto/rsa/rsa_sp800_56b_gen.c b/crypto/rsa/rsa_sp800_56b_gen.c index 3fffb3b80a..87fd4ad50c 100644 --- a/crypto/rsa/rsa_sp800_56b_gen.c +++ b/crypto/rsa/rsa_sp800_56b_gen.c @@ -121,13 +121,13 @@ int ossl_rsa_fips186_4_gen_prob_primes(RSA *rsa, RSA_ACVP_TEST *test, BN_set_flags(rsa->q, BN_FLG_CONSTTIME); /* (Step 4) Generate p, Xp */ - if (!bn_rsa_fips186_4_gen_prob_primes(rsa->p, Xpo, p1, p2, Xp, Xp1, Xp2, - nbits, e, ctx, cb)) + if (!ossl_bn_rsa_fips186_4_gen_prob_primes(rsa->p, Xpo, p1, p2, Xp, Xp1, Xp2, + nbits, e, ctx, cb)) goto err; for(;;) { /* (Step 5) Generate q, Xq*/ - if (!bn_rsa_fips186_4_gen_prob_primes(rsa->q, Xqo, q1, q2, Xq, Xq1, - Xq2, nbits, e, ctx, cb)) + if (!ossl_bn_rsa_fips186_4_gen_prob_primes(rsa->q, Xqo, q1, q2, Xq, Xq1, + Xq2, nbits, e, ctx, cb)) goto err; /* (Step 6) |Xp - Xq| > 2^(nbitlen/2 - 100) */ diff --git a/include/crypto/bn.h b/include/crypto/bn.h index eb42ccd0f5..cf69bea848 100644 --- a/include/crypto/bn.h +++ b/include/crypto/bn.h @@ -93,26 +93,25 @@ int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, #define BN_PRIMETEST_COMPOSITE_NOT_POWER_OF_PRIME 2 #define BN_PRIMETEST_PROBABLY_PRIME 3 -int bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx, - BN_GENCB *cb, int enhanced, int *status); +int ossl_bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx, + BN_GENCB *cb, int enhanced, int *status); -const BIGNUM *bn_get0_small_factors(void); +const BIGNUM *ossl_bn_get0_small_factors(void); -int bn_rsa_fips186_4_prime_MR_min_checks(int nbits); +int ossl_bn_rsa_fips186_4_gen_prob_primes(BIGNUM *p, BIGNUM *Xpout, + BIGNUM *p1, BIGNUM *p2, + const BIGNUM *Xp, const BIGNUM *Xp1, + const BIGNUM *Xp2, int nlen, + const BIGNUM *e, BN_CTX *ctx, + BN_GENCB *cb); -int bn_rsa_fips186_4_gen_prob_primes(BIGNUM *p, BIGNUM *Xpout, - BIGNUM *p1, BIGNUM *p2, - const BIGNUM *Xp, const BIGNUM *Xp1, - const BIGNUM *Xp2, int nlen, - const BIGNUM *e, BN_CTX *ctx, - BN_GENCB *cb); +int ossl_bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin, + const BIGNUM *r1, const BIGNUM *r2, + int nlen, const BIGNUM *e, BN_CTX *ctx, + BN_GENCB *cb); -int bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin, - const BIGNUM *r1, const BIGNUM *r2, int nlen, - const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb); +OSSL_LIB_CTX *ossl_bn_get_libctx(BN_CTX *ctx); -OSSL_LIB_CTX *bn_get_libctx(BN_CTX *ctx); - -extern const BIGNUM bn_inv_sqrt_2; +extern const BIGNUM ossl_bn_inv_sqrt_2; #endif diff --git a/include/crypto/bn_dh.h b/include/crypto/bn_dh.h index b900c36651..e0506b753e 100644 --- a/include/crypto/bn_dh.h +++ b/include/crypto/bn_dh.h @@ -8,36 +8,36 @@ */ #define declare_dh_bn(x) \ - extern const BIGNUM _bignum_dh##x##_p; \ - extern const BIGNUM _bignum_dh##x##_q; \ - extern const BIGNUM _bignum_dh##x##_g; \ + extern const BIGNUM ossl_bignum_dh##x##_p; \ + extern const BIGNUM ossl_bignum_dh##x##_q; \ + extern const BIGNUM ossl_bignum_dh##x##_g; \ declare_dh_bn(1024_160) declare_dh_bn(2048_224) declare_dh_bn(2048_256) -extern const BIGNUM _bignum_const_2; +extern const BIGNUM ossl_bignum_const_2; -extern const BIGNUM _bignum_ffdhe2048_p; -extern const BIGNUM _bignum_ffdhe3072_p; -extern const BIGNUM _bignum_ffdhe4096_p; -extern const BIGNUM _bignum_ffdhe6144_p; -extern const BIGNUM _bignum_ffdhe8192_p; -extern const BIGNUM _bignum_ffdhe2048_q; -extern const BIGNUM _bignum_ffdhe3072_q; -extern const BIGNUM _bignum_ffdhe4096_q; -extern const BIGNUM _bignum_ffdhe6144_q; -extern const BIGNUM _bignum_ffdhe8192_q; +extern const BIGNUM ossl_bignum_ffdhe2048_p; +extern const BIGNUM ossl_bignum_ffdhe3072_p; +extern const BIGNUM ossl_bignum_ffdhe4096_p; +extern const BIGNUM ossl_bignum_ffdhe6144_p; +extern const BIGNUM ossl_bignum_ffdhe8192_p; +extern const BIGNUM ossl_bignum_ffdhe2048_q; +extern const BIGNUM ossl_bignum_ffdhe3072_q; +extern const BIGNUM ossl_bignum_ffdhe4096_q; +extern const BIGNUM ossl_bignum_ffdhe6144_q; +extern const BIGNUM ossl_bignum_ffdhe8192_q; -extern const BIGNUM _bignum_modp_1536_p; -extern const BIGNUM _bignum_modp_2048_p; -extern const BIGNUM _bignum_modp_3072_p; -extern const BIGNUM _bignum_modp_4096_p; -extern const BIGNUM _bignum_modp_6144_p; -extern const BIGNUM _bignum_modp_8192_p; -extern const BIGNUM _bignum_modp_1536_q; -extern const BIGNUM _bignum_modp_2048_q; -extern const BIGNUM _bignum_modp_3072_q; -extern const BIGNUM _bignum_modp_4096_q; -extern const BIGNUM _bignum_modp_6144_q; -extern const BIGNUM _bignum_modp_8192_q; +extern const BIGNUM ossl_bignum_modp_1536_p; +extern const BIGNUM ossl_bignum_modp_2048_p; +extern const BIGNUM ossl_bignum_modp_3072_p; +extern const BIGNUM ossl_bignum_modp_4096_p; +extern const BIGNUM ossl_bignum_modp_6144_p; +extern const BIGNUM ossl_bignum_modp_8192_p; +extern const BIGNUM ossl_bignum_modp_1536_q; +extern const BIGNUM ossl_bignum_modp_2048_q; +extern const BIGNUM ossl_bignum_modp_3072_q; +extern const BIGNUM ossl_bignum_modp_4096_q; +extern const BIGNUM ossl_bignum_modp_6144_q; +extern const BIGNUM ossl_bignum_modp_8192_q; diff --git a/test/bn_internal_test.c b/test/bn_internal_test.c index 2dda2345cb..952369c7a1 100644 --- a/test/bn_internal_test.c +++ b/test/bn_internal_test.c @@ -34,7 +34,8 @@ static int test_is_prime_enhanced(void) /* test passing a prime returns the correct status */ && TEST_true(BN_set_word(bn, 11)) /* return extra parameters related to composite */ - && TEST_true(bn_miller_rabin_is_prime(bn, 10, ctx, NULL, 1, &status)) + && TEST_true(ossl_bn_miller_rabin_is_prime(bn, 10, ctx, NULL, 1, + &status)) && TEST_int_eq(status, BN_PRIMETEST_PROBABLY_PRIME); BN_free(bn); return ret; @@ -53,7 +54,8 @@ static int test_is_composite_enhanced(int id) ret = TEST_ptr(bn = BN_new()) /* negative tests for different composite numbers */ && TEST_true(BN_set_word(bn, composites[id])) - && TEST_true(bn_miller_rabin_is_prime(bn, 10, ctx, NULL, 1, &status)) + && TEST_true(ossl_bn_miller_rabin_is_prime(bn, 10, ctx, NULL, 1, + &status)) && TEST_int_ne(status, BN_PRIMETEST_PROBABLY_PRIME); BN_free(bn); @@ -78,7 +80,7 @@ static int test_bn_small_factors(void) if (p > 751) break; } - ret = TEST_BN_eq(bn_get0_small_factors(), b); + ret = TEST_BN_eq(ossl_bn_get0_small_factors(), b); err: BN_free(b); return ret; diff --git a/test/evp_libctx_test.c b/test/evp_libctx_test.c index 302ec2c9b1..bd0ddb7371 100644 --- a/test/evp_libctx_test.c +++ b/test/evp_libctx_test.c @@ -93,7 +93,8 @@ static int test_dsa_param_keygen(int tstid) * these 'safe primes' should not be used normally for dsa *. */ static const BIGNUM *bn[] = { - &_bignum_dh2048_256_p, &_bignum_dh2048_256_q, &_bignum_dh2048_256_g + &ossl_bignum_dh2048_256_p, &ossl_bignum_dh2048_256_q, + &ossl_bignum_dh2048_256_g }; /* @@ -201,7 +202,8 @@ err: static int test_dh_safeprime_param_keygen(int tstid) { static const BIGNUM *bn[] = { - &_bignum_ffdhe2048_p, &_bignum_ffdhe2048_q, &_bignum_const_2 + &ossl_bignum_ffdhe2048_p, &ossl_bignum_ffdhe2048_q, + &ossl_bignum_const_2 }; return do_dh_param_keygen(tstid, bn); } diff --git a/test/evp_pkey_provided_test.c b/test/evp_pkey_provided_test.c index e2c28d3565..fd0dcdd38a 100644 --- a/test/evp_pkey_provided_test.c +++ b/test/evp_pkey_provided_test.c @@ -523,11 +523,11 @@ static int test_fromdata_dh_named_group(void) &priv_out)) || !TEST_BN_eq(priv, priv_out) || !TEST_true(EVP_PKEY_get_bn_param(pk, OSSL_PKEY_PARAM_FFC_P, &p)) - || !TEST_BN_eq(&_bignum_ffdhe2048_p, p) + || !TEST_BN_eq(&ossl_bignum_ffdhe2048_p, p) || !TEST_true(EVP_PKEY_get_bn_param(pk, OSSL_PKEY_PARAM_FFC_Q, &q)) || !TEST_ptr(q) || !TEST_true(EVP_PKEY_get_bn_param(pk, OSSL_PKEY_PARAM_FFC_G, &g)) - || !TEST_BN_eq(&_bignum_const_2, g) + || !TEST_BN_eq(&ossl_bignum_const_2, g) || !TEST_false(EVP_PKEY_get_bn_param(pk, OSSL_PKEY_PARAM_FFC_COFACTOR, &j)) || !TEST_ptr_null(j) @@ -667,11 +667,11 @@ static int test_fromdata_dh_fips186_4(void) &priv_out)) || !TEST_BN_eq(priv, priv_out) || !TEST_true(EVP_PKEY_get_bn_param(pk, OSSL_PKEY_PARAM_FFC_P, &p)) - || !TEST_BN_eq(&_bignum_ffdhe2048_p, p) + || !TEST_BN_eq(&ossl_bignum_ffdhe2048_p, p) || !TEST_true(EVP_PKEY_get_bn_param(pk, OSSL_PKEY_PARAM_FFC_Q, &q)) || !TEST_ptr(q) || !TEST_true(EVP_PKEY_get_bn_param(pk, OSSL_PKEY_PARAM_FFC_G, &g)) - || !TEST_BN_eq(&_bignum_const_2, g) + || !TEST_BN_eq(&ossl_bignum_const_2, g) || !TEST_false(EVP_PKEY_get_bn_param(pk, OSSL_PKEY_PARAM_FFC_COFACTOR, &j)) || !TEST_ptr_null(j) |