Skip to content

Commit e6f8de7

Browse files
authored
Merge pull request wolfSSL#8699 from JacobBarthelmeh/bn
revert BN_CTX_init stub for older applications
2 parents 25cd009 + 9da9817 commit e6f8de7

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28737,6 +28737,7 @@ static int test_wolfSSL_BN_CTX(void)
2873728737
/* No implementation. */
2873828738
BN_CTX_start(NULL);
2873928739
BN_CTX_start(bn_ctx);
28740+
BN_CTX_init(NULL);
2874028741
#endif
2874128742

2874228743
BN_CTX_free(NULL);

wolfssl/openssl/bn.h

Lines changed: 2 additions & 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);
@@ -215,6 +216,7 @@ typedef WOLFSSL_BN_GENCB BN_GENCB;
215216

216217
#ifndef NO_WOLFSSL_BN_CTX
217218
#define BN_CTX_new wolfSSL_BN_CTX_new
219+
#define BN_CTX_init wolfSSL_BN_CTX_init
218220
#define BN_CTX_free wolfSSL_BN_CTX_free
219221
#else
220222
#define BN_CTX_new() ((BN_CTX*)-1)

0 commit comments

Comments
 (0)