Skip to content

Commit 33da20c

Browse files
revert BN_CTX_init stub for older applications
1 parent 3ca444e commit 33da20c

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/ssl_bn.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,6 +2382,27 @@ WOLFSSL_BN_CTX* wolfSSL_BN_CTX_new(void)
23822382
return ctx;
23832383
}
23842384

2385+
2386+
#ifndef NO_WOLFSSL_STUB
2387+
/* deprecated
2388+
*
2389+
* Initialize a BN context object.
2390+
* This function was removed in OpenSSL 1.1.0 and later.
2391+
* Keeping a stub function here for older applications that have BN_CTX_init()
2392+
* calls.
2393+
*
2394+
* @param [in] ctx Dummy BN context.
2395+
*/
2396+
void wolfSSL_BN_CTX_init(WOLFSSL_BN_CTX* ctx)
2397+
{
2398+
(void)ctx;
2399+
WOLFSSL_ENTER("wolfSSL_BN_CTX_init");
2400+
WOLFSSL_STUB("wolfSSL_BN_CTX_init");
2401+
WOLFSSL_MSG("wolfSSL_BN_CTX_init is deprecated");
2402+
}
2403+
#endif
2404+
2405+
23852406
/* Free a BN context object.
23862407
*
23872408
* @param [in] ctx BN context object.

tests/api.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28725,6 +28725,9 @@ static int test_wolfSSL_BN_CTX(void)
2872528725

2872628726
ExpectNotNull(bn_ctx = BN_CTX_new());
2872728727

28728+
/* No implementation. */
28729+
BN_CTX_init(NULL);
28730+
2872828731
ExpectNull(BN_CTX_get(NULL));
2872928732
ExpectNotNull(BN_CTX_get(bn_ctx));
2873028733
ExpectNotNull(BN_CTX_get(bn_ctx));

wolfssl/openssl/bn.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ typedef struct WOLFSSL_BN_MONT_CTX WOLFSSL_BN_MONT_CTX;
8888
typedef struct WOLFSSL_BN_GENCB WOLFSSL_BN_GENCB;
8989

9090
WOLFSSL_API WOLFSSL_BN_CTX* wolfSSL_BN_CTX_new(void);
91+
WOLFSSL_API void wolfSSL_BN_CTX_init(WOLFSSL_BN_CTX* ctx);
9192
WOLFSSL_API void wolfSSL_BN_CTX_free(WOLFSSL_BN_CTX* ctx);
9293

9394
WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_new(void);

0 commit comments

Comments
 (0)