fix ERR_add_error_vdata() for use with multiple args/calls
[openssl.git] / crypto / bn / bn_ctx.c
index 882f3bc06e6a09fbba23c21f15f48674e43f91e2..a60c7442a48c2f3ce0e44d037c0d9bdfef48d598 100644 (file)
@@ -143,10 +143,12 @@ BN_CTX *BN_CTX_new_ex(OPENSSL_CTX *ctx)
     return ret;
 }
 
+#ifndef FIPS_MODE
 BN_CTX *BN_CTX_new(void)
 {
     return BN_CTX_new_ex(NULL);
 }
+#endif
 
 BN_CTX *BN_CTX_secure_new_ex(OPENSSL_CTX *ctx)
 {
@@ -157,15 +159,18 @@ BN_CTX *BN_CTX_secure_new_ex(OPENSSL_CTX *ctx)
     return ret;
 }
 
+#ifndef FIPS_MODE
 BN_CTX *BN_CTX_secure_new(void)
 {
     return BN_CTX_secure_new_ex(NULL);
 }
+#endif
 
 void BN_CTX_free(BN_CTX *ctx)
 {
     if (ctx == NULL)
         return;
+#ifndef FIPS_MODE
     OSSL_TRACE_BEGIN(BN_CTX) {
         BN_POOL_ITEM *pool = ctx->pool.head;
         BIO_printf(trc_out,
@@ -180,6 +185,7 @@ void BN_CTX_free(BN_CTX *ctx)
         }
         BIO_printf(trc_out, "\n");
     } OSSL_TRACE_END(BN_CTX);
+#endif
     BN_STACK_finish(&ctx->stack);
     BN_POOL_finish(&ctx->pool);
     OPENSSL_free(ctx);
@@ -245,6 +251,8 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx)
 
 OPENSSL_CTX *bn_get_lib_ctx(BN_CTX *ctx)
 {
+    if (ctx == NULL)
+        return NULL;
     return ctx->libctx;
 }