diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2021-02-19 19:15:41 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2021-02-26 10:32:22 +1000 |
commit | 94553e85b68af4513a8ee89cd2a0d4e044d75139 (patch) | |
tree | 2150abcbe848f0d1973b0186bd6864595e3f18a2 /crypto/bn | |
parent | 2d968951227acd422f0e712035de3216d47fc980 (diff) |
Fix external symbols for bn
Partial fix for #12964
This adds ossl_ names for symbols related to bn_*
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14296)
Diffstat (limited to 'crypto/bn')
-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 |
6 files changed, 37 insertions, 31 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; |