diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 658c17fb5..7644b7d94 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -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; }