Fix external symbols for bn
authorShane Lontis <shane.lontis@oracle.com>
Fri, 19 Feb 2021 09:15:41 +0000 (19:15 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Fri, 26 Feb 2021 00:32:22 +0000 (10:32 +1000)
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)

17 files changed:
crypto/bn/bn_const.c
crypto/bn/bn_ctx.c
crypto/bn/bn_dh.c
crypto/bn/bn_prime.c
crypto/bn/bn_rand.c
crypto/bn/bn_rsa_fips186_4.c
crypto/dh/dh_rfc5114.c
crypto/ec/ec_cvt.c
crypto/ffc/ffc_dh.c
crypto/ffc/ffc_params_generate.c
crypto/rsa/rsa_sp800_56b_check.c
crypto/rsa/rsa_sp800_56b_gen.c
include/crypto/bn.h
include/crypto/bn_dh.h
test/bn_internal_test.c
test/evp_libctx_test.c
test/evp_pkey_provided_test.c

index 7d0a9f901e59fa4150d3d594fec06c2a0755c0cc..06a40d6fba3fdf16cdeda57d513e19fc38708a6b 100644 (file)
@@ -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);
 }
index 6234c51435d37ac009d98a3e2cacd66ebacb748f..360b7082213dac4bed52c1990824a91bf11a8b01 100644 (file)
@@ -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;
index 9f5b80cb8e12fa25d17a226c76179b4b7dc27ab5..58f545642e21143c6edb761d593feb6374212abf 100644 (file)
@@ -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
 };
 
index eba402d2f2ad03e0a873677a7c4284d28cc0cd47..33a2c85129dd06991b750807dc1317c0e2a6d9ea 100644 (file)
@@ -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;
index 1f12e81fb71bc804d013366631b3c081a04e7ada..79e44ab96093ccf5e20b7143b237e53dafbf56b4 100644 (file)
@@ -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;
index ab1e1f14ae3496b66fe38c6dde5c8a1c8789ea98..a49166b9c3ef30a7705240ff0ff3b173d76f1a8e 100644 (file)
@@ -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;
index 4e7daaefc7cf24731f684ed14e629a3dfafeb527..c578a89a5838d1bd6849e4a2b8671bc836ed9245 100644 (file)
@@ -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; \
index c841ad741da42578d5e05c4c0267c5fe84035775..00a5c48c8f6bd79d47e2c7e289513fdc91ef8895 100644 (file)
@@ -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;
 
index db472febb0a91b0ae9c24f11c0829dbd3dcca09b..17888e9291b49dca74d034a2a545bc2c54759c19 100644 (file)
 # 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
index 2e50c2b80193bf14b5bba11ffb6f2e4d68404f3e..e0ce7485cf48cb1663ea06bc0b7231c47b412dab 100644 (file)
@@ -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 (;;) {
index 173bc5e253cf1d71f171f8f1bcf9e80d638cf034..c2066236f9fc50404ae992a917ac88253b191781 100644 (file)
@@ -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;
index 3fffb3b80af3d8aa91337515ded9f41299d44f8f..87fd4ad50c0113ea22eb78a8ceb6d7339e3e42ba 100644 (file)
@@ -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) */
index eb42ccd0f5b6e350b242dcfcd2517665ce6bd742..cf69bea848f1c7b64ca24aa187b30d0cf18007fd 100644 (file)
@@ -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
index b900c36651f2de0be9f3868bd29f84d32c4bb7c5..e0506b753ebf2b3fd89c648637e0c081c74e6378 100644 (file)
@@ -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;
index 2dda2345cbc9d7b3576a64bfb1279536b12710bd..952369c7a10622f3a0005563680e08d6cd8ec203 100644 (file)
@@ -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;
index 302ec2c9b1b5d72015f3e0ff54b7af9e14597796..bd0ddb73717aa67b09711dcf3ef9302aab1fb1a7 100644 (file)
@@ -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);
 }
index e2c28d3565badfd8768a016d0228d40019a1e3f1..fd0dcdd38a4549b79efa36359c4597d89b204e38 100644 (file)
@@ -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)