summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_mult.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-07-03 18:30:03 +0200
committerMatt Caswell <matt@openssl.org>2019-08-06 12:19:07 +0200
commita9612d6c034f47c4788c67d85651d0cd58c3faf7 (patch)
treeb3af6481b8c7a2a50b8834c3cec70841ae739f95 /crypto/ec/ec_mult.c
parentCorrect the Extended Master Secret string for EBCDIC (diff)
downloadopenssl-a9612d6c034f47c4788c67d85651d0cd58c3faf7.tar.xz
openssl-a9612d6c034f47c4788c67d85651d0cd58c3faf7.zip
Make the EC code available from inside the FIPS provider
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> (Merged from https://github.com/openssl/openssl/pull/9380)
Diffstat (limited to 'crypto/ec/ec_mult.c')
-rw-r--r--crypto/ec/ec_mult.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/crypto/ec/ec_mult.c b/crypto/ec/ec_mult.c
index 968125f3cd..be4f230623 100644
--- a/crypto/ec/ec_mult.c
+++ b/crypto/ec/ec_mult.c
@@ -815,12 +815,14 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
{
const EC_POINT *generator;
EC_POINT *tmp_point = NULL, *base = NULL, **var;
- BN_CTX *new_ctx = NULL;
const BIGNUM *order;
size_t i, bits, w, pre_points_per_block, blocksize, numblocks, num;
EC_POINT **points = NULL;
EC_PRE_COMP *pre_comp;
int ret = 0;
+#ifndef FIPS_MODE
+ BN_CTX *new_ctx = NULL;
+#endif
/* if there is an old EC_PRE_COMP object, throw it away */
EC_pre_comp_free(group);
@@ -833,11 +835,12 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
goto err;
}
- if (ctx == NULL) {
+#ifndef FIPS_MODE
+ if (ctx == NULL)
ctx = new_ctx = BN_CTX_new();
- if (ctx == NULL)
- goto err;
- }
+#endif
+ if (ctx == NULL)
+ goto err;
BN_CTX_start(ctx);
@@ -949,7 +952,9 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
err:
BN_CTX_end(ctx);
+#ifndef FIPS_MODE
BN_CTX_free(new_ctx);
+#endif
EC_ec_pre_comp_free(pre_comp);
if (points) {
EC_POINT **p;