From fa9a0a4b491e68754ab0e9f1148f9116169eeeb0 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Thu, 5 Nov 2020 09:06:02 -0600 Subject: [PATCH 1/2] Copy raw subject to issuer --- wolfcrypt/src/asn.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 565ea9b41..085c7a440 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -15190,12 +15190,12 @@ int wc_SetIssuerRaw(Cert* cert, const byte* der, int derSz) } if (ret >= 0) { - if ((((DecodedCert*)cert->decodedCert)->issuerRaw) && - (((DecodedCert*)cert->decodedCert)->issuerRawLen <= + if ((((DecodedCert*)cert->decodedCert)->subjectRaw) && + (((DecodedCert*)cert->decodedCert)->subjectRawLen <= (int)sizeof(CertName))) { XMEMCPY(cert->issRaw, - ((DecodedCert*)cert->decodedCert)->issuerRaw, - ((DecodedCert*)cert->decodedCert)->issuerRawLen); + ((DecodedCert*)cert->decodedCert)->subjectRaw, + ((DecodedCert*)cert->decodedCert)->subjectRawLen); } #ifndef WOLFSSL_CERT_GEN_CACHE wc_SetCert_Free(cert); From a92e31f6cb5ffbfa6f4603515afb98401101c32e Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Thu, 5 Nov 2020 14:47:10 -0600 Subject: [PATCH 2/2] Fix from review --- wolfcrypt/src/asn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 085c7a440..65fd29d41 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -15193,6 +15193,7 @@ int wc_SetIssuerRaw(Cert* cert, const byte* der, int derSz) if ((((DecodedCert*)cert->decodedCert)->subjectRaw) && (((DecodedCert*)cert->decodedCert)->subjectRawLen <= (int)sizeof(CertName))) { + /* Copy the subject to the issuer field */ XMEMCPY(cert->issRaw, ((DecodedCert*)cert->decodedCert)->subjectRaw, ((DecodedCert*)cert->decodedCert)->subjectRawLen);