From d8bec5e0348bf2b5af795de9efa4e4706523ba8d Mon Sep 17 00:00:00 2001 From: Chris Conlon Date: Fri, 8 Mar 2019 09:13:22 -0800 Subject: [PATCH] add NULL param in CMS KARI OriginatorPublicKey parameters --- wolfcrypt/src/pkcs7.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/pkcs7.c b/wolfcrypt/src/pkcs7.c index 72b6c7ed1..0cdbe22e6 100644 --- a/wolfcrypt/src/pkcs7.c +++ b/wolfcrypt/src/pkcs7.c @@ -5164,8 +5164,11 @@ int wc_PKCS7_AddRecipient_KARI(PKCS7* pkcs7, const byte* cert, word32 certSz, origPubKeyStr + 1) + 2; totalSz += (origPubKeyStrSz + kari->senderKeyExportSz); - /* Originator AlgorithmIdentifier */ - origAlgIdSz = SetAlgoID(ECDSAk, origAlgId, oidKeyType, 0); + /* Originator AlgorithmIdentifier, params set to NULL for interop + compatibility */ + origAlgIdSz = SetAlgoID(ECDSAk, origAlgId, oidKeyType, 2); + origAlgId[origAlgIdSz++] = ASN_TAG_NULL; + origAlgId[origAlgIdSz++] = 0; totalSz += origAlgIdSz; /* outer OriginatorPublicKey IMPLICIT [1] */ @@ -5209,8 +5212,11 @@ int wc_PKCS7_AddRecipient_KARI(PKCS7* pkcs7, const byte* cert, word32 certSz, idx += origIdOrKeySeqSz; XMEMCPY(recip->recip + idx, origPubKeySeq, origPubKeySeqSz); idx += origPubKeySeqSz; + + /* AlgorithmIdentifier with NULL parameter */ XMEMCPY(recip->recip + idx, origAlgId, origAlgIdSz); idx += origAlgIdSz; + XMEMCPY(recip->recip + idx, origPubKeyStr, origPubKeyStrSz); idx += origPubKeyStrSz; /* ephemeral public key */