Skip to content

Commit 7d54919

Browse files
Fix for CID 299649 checking on if ctx is null
1 parent 2978244 commit 7d54919

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/ssl.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6464,7 +6464,8 @@ static int ProcessBufferTryDecodeRsa(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
64646464
#ifdef WOLF_PRIVATE_KEY_ID
64656465
if ((ret != 0) && (devId != INVALID_DEVID
64666466
#ifdef HAVE_PK_CALLBACKS
6467-
|| wolfSSL_CTX_IsPrivatePkSet(ctx)
6467+
|| ((ssl == NULL) ? wolfSSL_CTX_IsPrivatePkSet(ctx) :
6468+
wolfSSL_CTX_IsPrivatePkSet(ssl->ctx))
64686469
#endif
64696470
)) {
64706471
word32 nSz;
@@ -6542,7 +6543,8 @@ static int ProcessBufferTryDecodeRsa(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
65426543
#ifdef WOLF_PRIVATE_KEY_ID
65436544
if (ret != 0 && (devId != INVALID_DEVID
65446545
#ifdef HAVE_PK_CALLBACKS
6545-
|| wolfSSL_CTX_IsPrivatePkSet(ctx)
6546+
|| ((ssl == NULL) ? wolfSSL_CTX_IsPrivatePkSet(ctx) :
6547+
wolfSSL_CTX_IsPrivatePkSet(ssl->ctx))
65466548
#endif
65476549
)) {
65486550
/* if using crypto or PK callbacks, try public key decode */
@@ -6623,7 +6625,8 @@ static int ProcessBufferTryDecodeEcc(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
66236625
#ifdef WOLF_PRIVATE_KEY_ID
66246626
if (ret != 0 && (devId != INVALID_DEVID
66256627
#ifdef HAVE_PK_CALLBACKS
6626-
|| wolfSSL_CTX_IsPrivatePkSet(ctx)
6628+
|| ((ssl == NULL) ? wolfSSL_CTX_IsPrivatePkSet(ctx) :
6629+
wolfSSL_CTX_IsPrivatePkSet(ssl->ctx))
66276630
#endif
66286631
)) {
66296632
/* if using crypto or PK callbacks, try public key decode */
@@ -6709,7 +6712,8 @@ static int ProcessBufferTryDecodeEd25519(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
67096712
#ifdef WOLF_PRIVATE_KEY_ID
67106713
if (ret != 0 && (devId != INVALID_DEVID
67116714
#ifdef HAVE_PK_CALLBACKS
6712-
|| wolfSSL_CTX_IsPrivatePkSet(ctx)
6715+
|| ((ssl == NULL) ? wolfSSL_CTX_IsPrivatePkSet(ctx) :
6716+
wolfSSL_CTX_IsPrivatePkSet(ssl->ctx))
67136717
#endif
67146718
)) {
67156719
/* if using crypto or PK callbacks, try public key decode */
@@ -6788,7 +6792,8 @@ static int ProcessBufferTryDecodeEd448(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
67886792
#ifdef WOLF_PRIVATE_KEY_ID
67896793
if (ret != 0 && (devId != INVALID_DEVID
67906794
#ifdef HAVE_PK_CALLBACKS
6791-
|| wolfSSL_CTX_IsPrivatePkSet(ctx)
6795+
|| ((ssl == NULL) ? wolfSSL_CTX_IsPrivatePkSet(ctx) :
6796+
wolfSSL_CTX_IsPrivatePkSet(ssl->ctx))
67926797
#endif
67936798
)) {
67946799
/* if using crypto or PK callbacks, try public key decode */

0 commit comments

Comments
 (0)