revert BN_CTX_init stub for older applications

This commit is contained in:
JacobBarthelmeh
2025-04-22 09:22:40 -06:00
parent 3ca444e0e1
commit 33da20c3ec
3 changed files with 25 additions and 0 deletions

View File

@@ -2382,6 +2382,27 @@ WOLFSSL_BN_CTX* wolfSSL_BN_CTX_new(void)
return ctx;
}
#ifndef NO_WOLFSSL_STUB
/* deprecated
*
* Initialize a BN context object.
* This function was removed in OpenSSL 1.1.0 and later.
* Keeping a stub function here for older applications that have BN_CTX_init()
* calls.
*
* @param [in] ctx Dummy BN context.
*/
void wolfSSL_BN_CTX_init(WOLFSSL_BN_CTX* ctx)
{
(void)ctx;
WOLFSSL_ENTER("wolfSSL_BN_CTX_init");
WOLFSSL_STUB("wolfSSL_BN_CTX_init");
WOLFSSL_MSG("wolfSSL_BN_CTX_init is deprecated");
}
#endif
/* Free a BN context object.
*
* @param [in] ctx BN context object.

View File

@@ -28725,6 +28725,9 @@ static int test_wolfSSL_BN_CTX(void)
ExpectNotNull(bn_ctx = BN_CTX_new());
/* No implementation. */
BN_CTX_init(NULL);
ExpectNull(BN_CTX_get(NULL));
ExpectNotNull(BN_CTX_get(bn_ctx));
ExpectNotNull(BN_CTX_get(bn_ctx));

View File

@@ -88,6 +88,7 @@ typedef struct WOLFSSL_BN_MONT_CTX WOLFSSL_BN_MONT_CTX;
typedef struct WOLFSSL_BN_GENCB WOLFSSL_BN_GENCB;
WOLFSSL_API WOLFSSL_BN_CTX* wolfSSL_BN_CTX_new(void);
WOLFSSL_API void wolfSSL_BN_CTX_init(WOLFSSL_BN_CTX* ctx);
WOLFSSL_API void wolfSSL_BN_CTX_free(WOLFSSL_BN_CTX* ctx);
WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_new(void);