From b3442465494b3cecafcdfcad8ae96a9cd76786fd Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 2 Jul 2021 08:17:20 -0700 Subject: [PATCH] Fix the new PKCS8 header check in `wc_CreatePKCS8Key` to use the right input buffer. --- wolfcrypt/src/asn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; }