mirror of https://github.com/wolfSSL/wolfssh.git
Add zeroization in wolfSSH_ProcessBuffer
parent
3f03a851c5
commit
90c0ee6a7c
|
|
@ -2418,6 +2418,11 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx,
|
|||
else
|
||||
ret = wc_CertPemToDer(in, inSz, der, inSz, wcType);
|
||||
if (ret < 0) {
|
||||
if (type == BUFTYPE_PRIVKEY) {
|
||||
/* wc_KeyPemToDer may have written partial key material;
|
||||
* zeroize before free on the private-key path. */
|
||||
ForceZero(der, inSz);
|
||||
}
|
||||
WFREE(der, heap, dynamicType);
|
||||
return WS_BAD_FILE_E;
|
||||
}
|
||||
|
|
@ -2433,8 +2438,10 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx,
|
|||
if (type == BUFTYPE_PRIVKEY) {
|
||||
ret = IdentifyAsn1Key(der, derSz, 1, ctx->heap, NULL);
|
||||
if (ret < 0) {
|
||||
if (der != NULL)
|
||||
if (der != NULL) {
|
||||
ForceZero(der, derSz);
|
||||
WFREE(der, heap, dynamicType);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
keyId = (byte)ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue