Skip to content

Commit a82828b

Browse files
committed
Zeroize RSA DER buffer in CTX_use_RSAPrivateKey before free
F-2145 wolfSSL_CTX_use_RSAPrivateKey staged the RSA private key DER (PKCS#1: n, e, d, p, q, dP, dQ, qInv) in a heap buffer and freed it without ForceZero. Zeroize before XFREE.
1 parent fa3feb7 commit a82828b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/ssl_load.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5365,6 +5365,9 @@ int wolfSSL_CTX_use_RSAPrivateKey(WOLFSSL_CTX* ctx, WOLFSSL_RSA* rsa)
53655365
}
53665366

53675367
/* Dispos of dynamically allocated data. */
5368+
if (der != NULL) {
5369+
ForceZero(der, (word32)derSize);
5370+
}
53685371
XFREE(der, NULL, DYNAMIC_TYPE_TMP_BUFFER);
53695372
return ret;
53705373
}

0 commit comments

Comments
 (0)