Skip to content

Commit 6f710aa

Browse files
committed
fix DH privkey leak and zero buffer
1 parent 0aae425 commit 6f710aa

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

wolfcrypt/src/port/kcapi/kcapi_dh.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ static int KcapiDh_SetPrivKey(DhKey* key)
127127
}
128128
}
129129

130-
XFREE(priv, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
130+
if (priv != NULL) {
131+
ForceZero(priv, len);
132+
XFREE(priv, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
133+
}
131134
return ret;
132135
}
133136
#endif

0 commit comments

Comments
 (0)