Fix the new PKCS8 header check in wc_CreatePKCS8Key to use the right input buffer.

This commit is contained in:
David Garske
2021-07-02 08:17:20 -07:00
parent b8ed577e9a
commit b344246549

View File

@@ -3065,8 +3065,8 @@ int wc_CreatePKCS8Key(byte* out, word32* outSz, byte* key, word32 keySz,
return BUFFER_E;
}
/* sanity check: make sure the out doesn't already have a PKCS 8 header */
if (ToTraditionalInline_ex(out, &keyIdx, *outSz, &tmpAlgId) >= 0) {
/* sanity check: make sure the key doesn't already have a PKCS 8 header */
if (ToTraditionalInline_ex(key, &keyIdx, keySz, &tmpAlgId) >= 0) {
(void)tmpAlgId;
return ASN_PARSE_E;
}