Skip to content

Commit 39a4780

Browse files
authored
Merge pull request #7870 from anhu/pkcs7_correct_issuer
Ensure correct issuer is copied into PKCS7 struct during verification
2 parents 8b57e3e + 498dada commit 39a4780

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

wolfcrypt/src/pkcs7.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4187,14 +4187,18 @@ static int wc_PKCS7_EcdsaVerify(PKCS7* pkcs7, byte* sig, int sigSz,
41874187
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
41884188
#endif
41894189

4190-
FreeDecodedCert(dCert);
4191-
wc_ecc_free(key);
4192-
41934190
if (ret == 0 && res == 1) {
41944191
/* found signer that successfully verified signature */
41954192
verified = 1;
4193+
XMEMCPY(pkcs7->issuerSubjKeyId, dCert->extSubjKeyId, KEYID_SIZE);
41964194
pkcs7->verifyCert = pkcs7->cert[i];
41974195
pkcs7->verifyCertSz = pkcs7->certSz[i];
4196+
}
4197+
4198+
wc_ecc_free(key);
4199+
FreeDecodedCert(dCert);
4200+
4201+
if (ret == 0 && res == 1) {
41984202
break;
41994203
}
42004204
}

0 commit comments

Comments
 (0)