@@ -12543,13 +12543,13 @@ int CheckForAltNames(DecodedCert* dCert, const char* domain, word32 domainLen,
1254312543 while (altName) {
1254412544 WOLFSSL_MSG("\tindividual AltName check");
1254512545
12546- #if defined(OPENSSL_ALL) || defined( WOLFSSL_IP_ALT_NAME)
12546+ #ifdef WOLFSSL_IP_ALT_NAME
1254712547 if (altName->type == ASN_IP_TYPE) {
1254812548 buf = altName->ipString;
1254912549 len = (word32)XSTRLEN(buf);
1255012550 }
1255112551 else
12552- #endif /* OPENSSL_ALL || WOLFSSL_IP_ALT_NAME */
12552+ #endif /* WOLFSSL_IP_ALT_NAME */
1255312553 {
1255412554 buf = altName->name;
1255512555 len = (word32)altName->len;
@@ -12820,6 +12820,7 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
1282012820int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert)
1282112821{
1282212822 int ret = 0;
12823+ int minSz;
1282312824
1282412825 if (x509 == NULL || dCert == NULL ||
1282512826 dCert->subjectCNLen < 0)
@@ -12869,49 +12870,45 @@ int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert)
1286912870#endif /* WOLFSSL_CERT_REQ */
1287012871
1287112872#ifdef WOLFSSL_SEP
12872- {
12873- int minSz = min(dCert->deviceTypeSz, EXTERNAL_SERIAL_SIZE);
12874- if (minSz > 0) {
12875- x509->deviceTypeSz = minSz;
12876- XMEMCPY(x509->deviceType, dCert->deviceType, minSz);
12877- }
12878- else
12879- x509->deviceTypeSz = 0;
12880- minSz = min(dCert->hwTypeSz, EXTERNAL_SERIAL_SIZE);
12881- if (minSz > 0) {
12882- x509->hwTypeSz = minSz;
12883- XMEMCPY(x509->hwType, dCert->hwType, minSz);
12884- }
12885- else
12886- x509->hwTypeSz = 0;
12887- minSz = min(dCert->hwSerialNumSz, EXTERNAL_SERIAL_SIZE);
12888- if (minSz > 0) {
12889- x509->hwSerialNumSz = minSz;
12890- XMEMCPY(x509->hwSerialNum, dCert->hwSerialNum, minSz);
12891- }
12892- else
12893- x509->hwSerialNumSz = 0;
12873+ minSz = min(dCert->deviceTypeSz, EXTERNAL_SERIAL_SIZE);
12874+ if (minSz > 0) {
12875+ x509->deviceTypeSz = minSz;
12876+ XMEMCPY(x509->deviceType, dCert->deviceType, minSz);
12877+ }
12878+ else
12879+ x509->deviceTypeSz = 0;
12880+ minSz = min(dCert->hwTypeSz, EXTERNAL_SERIAL_SIZE);
12881+ if (minSz > 0) {
12882+ x509->hwTypeSz = minSz;
12883+ XMEMCPY(x509->hwType, dCert->hwType, minSz);
12884+ }
12885+ else
12886+ x509->hwTypeSz = 0;
12887+ minSz = min(dCert->hwSerialNumSz, EXTERNAL_SERIAL_SIZE);
12888+ if (minSz > 0) {
12889+ x509->hwSerialNumSz = minSz;
12890+ XMEMCPY(x509->hwSerialNum, dCert->hwSerialNum, minSz);
1289412891 }
12892+ else
12893+ x509->hwSerialNumSz = 0;
1289512894#endif /* WOLFSSL_SEP */
12896- {
12897- int minSz;
12898- if (dCert->beforeDateLen > 0) {
12899- minSz = (int)min(dCert->beforeDate[1], MAX_DATE_SZ);
12900- x509->notBefore.type = dCert->beforeDate[0];
12901- x509->notBefore.length = minSz;
12902- XMEMCPY(x509->notBefore.data, &dCert->beforeDate[2], minSz);
12903- }
12904- else
12905- x509->notBefore.length = 0;
12906- if (dCert->afterDateLen > 0) {
12907- minSz = (int)min(dCert->afterDate[1], MAX_DATE_SZ);
12908- x509->notAfter.type = dCert->afterDate[0];
12909- x509->notAfter.length = minSz;
12910- XMEMCPY(x509->notAfter.data, &dCert->afterDate[2], minSz);
12911- }
12912- else
12913- x509->notAfter.length = 0;
12895+
12896+ if (dCert->beforeDateLen > 0) {
12897+ minSz = (int)min(dCert->beforeDate[1], MAX_DATE_SZ);
12898+ x509->notBefore.type = dCert->beforeDate[0];
12899+ x509->notBefore.length = minSz;
12900+ XMEMCPY(x509->notBefore.data, &dCert->beforeDate[2], minSz);
12901+ }
12902+ else
12903+ x509->notBefore.length = 0;
12904+ if (dCert->afterDateLen > 0) {
12905+ minSz = (int)min(dCert->afterDate[1], MAX_DATE_SZ);
12906+ x509->notAfter.type = dCert->afterDate[0];
12907+ x509->notAfter.length = minSz;
12908+ XMEMCPY(x509->notAfter.data, &dCert->afterDate[2], minSz);
1291412909 }
12910+ else
12911+ x509->notAfter.length = 0;
1291512912
1291612913 if (dCert->publicKey != NULL && dCert->pubKeySize != 0) {
1291712914 x509->pubKey.buffer = (byte*)XMALLOC(
@@ -13050,7 +13047,7 @@ int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert)
1305013047 ret = MEMORY_E;
1305113048 }
1305213049 }
13053- #if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
13050+ #ifdef WOLFSSL_ASN_CA_ISSUER
1305413051 if (dCert->extAuthInfoCaIssuer != NULL && dCert->extAuthInfoCaIssuerSz > 0) {
1305513052 x509->authInfoCaIssuer = (byte*)XMALLOC(dCert->extAuthInfoCaIssuerSz, x509->heap,
1305613053 DYNAMIC_TYPE_X509_EXT);
@@ -13136,10 +13133,10 @@ int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert)
1313613133 #ifndef IGNORE_NETSCAPE_CERT_TYPE
1313713134 x509->nsCertType = dCert->nsCertType;
1313813135 #endif
13139- #if defined( WOLFSSL_SEP) || defined(WOLFSSL_QT)
13136+ #ifdef WOLFSSL_SEP
1314013137 x509->certPolicySet = dCert->extCertPolicySet;
1314113138 x509->certPolicyCrit = dCert->extCertPolicyCrit;
13142- #endif /* WOLFSSL_SEP || WOLFSSL_QT */
13139+ #endif
1314313140 #ifdef WOLFSSL_CERT_EXT
1314413141 {
1314513142 int i;
0 commit comments