@@ -12540,13 +12540,13 @@ int CheckForAltNames(DecodedCert* dCert, const char* domain, word32 domainLen,
1254012540 while (altName) {
1254112541 WOLFSSL_MSG("\tindividual AltName check");
1254212542
12543- #if defined(OPENSSL_ALL) || defined( WOLFSSL_IP_ALT_NAME)
12543+ #ifdef WOLFSSL_IP_ALT_NAME
1254412544 if (altName->type == ASN_IP_TYPE) {
1254512545 buf = altName->ipString;
1254612546 len = (word32)XSTRLEN(buf);
1254712547 }
1254812548 else
12549- #endif /* OPENSSL_ALL || WOLFSSL_IP_ALT_NAME */
12549+ #endif /* WOLFSSL_IP_ALT_NAME */
1255012550 {
1255112551 buf = altName->name;
1255212552 len = (word32)altName->len;
@@ -12817,6 +12817,7 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
1281712817int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert)
1281812818{
1281912819 int ret = 0;
12820+ int minSz;
1282012821
1282112822 if (x509 == NULL || dCert == NULL ||
1282212823 dCert->subjectCNLen < 0)
@@ -12866,49 +12867,45 @@ int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert)
1286612867#endif /* WOLFSSL_CERT_REQ */
1286712868
1286812869#ifdef WOLFSSL_SEP
12869- {
12870- int minSz = min(dCert->deviceTypeSz, EXTERNAL_SERIAL_SIZE);
12871- if (minSz > 0) {
12872- x509->deviceTypeSz = minSz;
12873- XMEMCPY(x509->deviceType, dCert->deviceType, minSz);
12874- }
12875- else
12876- x509->deviceTypeSz = 0;
12877- minSz = min(dCert->hwTypeSz, EXTERNAL_SERIAL_SIZE);
12878- if (minSz > 0) {
12879- x509->hwTypeSz = minSz;
12880- XMEMCPY(x509->hwType, dCert->hwType, minSz);
12881- }
12882- else
12883- x509->hwTypeSz = 0;
12884- minSz = min(dCert->hwSerialNumSz, EXTERNAL_SERIAL_SIZE);
12885- if (minSz > 0) {
12886- x509->hwSerialNumSz = minSz;
12887- XMEMCPY(x509->hwSerialNum, dCert->hwSerialNum, minSz);
12888- }
12889- else
12890- x509->hwSerialNumSz = 0;
12870+ minSz = min(dCert->deviceTypeSz, EXTERNAL_SERIAL_SIZE);
12871+ if (minSz > 0) {
12872+ x509->deviceTypeSz = minSz;
12873+ XMEMCPY(x509->deviceType, dCert->deviceType, minSz);
12874+ }
12875+ else
12876+ x509->deviceTypeSz = 0;
12877+ minSz = min(dCert->hwTypeSz, EXTERNAL_SERIAL_SIZE);
12878+ if (minSz > 0) {
12879+ x509->hwTypeSz = minSz;
12880+ XMEMCPY(x509->hwType, dCert->hwType, minSz);
12881+ }
12882+ else
12883+ x509->hwTypeSz = 0;
12884+ minSz = min(dCert->hwSerialNumSz, EXTERNAL_SERIAL_SIZE);
12885+ if (minSz > 0) {
12886+ x509->hwSerialNumSz = minSz;
12887+ XMEMCPY(x509->hwSerialNum, dCert->hwSerialNum, minSz);
1289112888 }
12889+ else
12890+ x509->hwSerialNumSz = 0;
1289212891#endif /* WOLFSSL_SEP */
12893- {
12894- int minSz;
12895- if (dCert->beforeDateLen > 0) {
12896- minSz = (int)min(dCert->beforeDate[1], MAX_DATE_SZ);
12897- x509->notBefore.type = dCert->beforeDate[0];
12898- x509->notBefore.length = minSz;
12899- XMEMCPY(x509->notBefore.data, &dCert->beforeDate[2], minSz);
12900- }
12901- else
12902- x509->notBefore.length = 0;
12903- if (dCert->afterDateLen > 0) {
12904- minSz = (int)min(dCert->afterDate[1], MAX_DATE_SZ);
12905- x509->notAfter.type = dCert->afterDate[0];
12906- x509->notAfter.length = minSz;
12907- XMEMCPY(x509->notAfter.data, &dCert->afterDate[2], minSz);
12908- }
12909- else
12910- x509->notAfter.length = 0;
12892+
12893+ if (dCert->beforeDateLen > 0) {
12894+ minSz = (int)min(dCert->beforeDate[1], MAX_DATE_SZ);
12895+ x509->notBefore.type = dCert->beforeDate[0];
12896+ x509->notBefore.length = minSz;
12897+ XMEMCPY(x509->notBefore.data, &dCert->beforeDate[2], minSz);
12898+ }
12899+ else
12900+ x509->notBefore.length = 0;
12901+ if (dCert->afterDateLen > 0) {
12902+ minSz = (int)min(dCert->afterDate[1], MAX_DATE_SZ);
12903+ x509->notAfter.type = dCert->afterDate[0];
12904+ x509->notAfter.length = minSz;
12905+ XMEMCPY(x509->notAfter.data, &dCert->afterDate[2], minSz);
1291112906 }
12907+ else
12908+ x509->notAfter.length = 0;
1291212909
1291312910 if (dCert->publicKey != NULL && dCert->pubKeySize != 0) {
1291412911 x509->pubKey.buffer = (byte*)XMALLOC(
@@ -13047,7 +13044,7 @@ int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert)
1304713044 ret = MEMORY_E;
1304813045 }
1304913046 }
13050- #if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
13047+ #ifdef WOLFSSL_ASN_CA_ISSUER
1305113048 if (dCert->extAuthInfoCaIssuer != NULL && dCert->extAuthInfoCaIssuerSz > 0) {
1305213049 x509->authInfoCaIssuer = (byte*)XMALLOC(dCert->extAuthInfoCaIssuerSz, x509->heap,
1305313050 DYNAMIC_TYPE_X509_EXT);
@@ -13133,10 +13130,10 @@ int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert)
1313313130 #ifndef IGNORE_NETSCAPE_CERT_TYPE
1313413131 x509->nsCertType = dCert->nsCertType;
1313513132 #endif
13136- #if defined( WOLFSSL_SEP) || defined(WOLFSSL_QT)
13133+ #ifdef WOLFSSL_SEP
1313713134 x509->certPolicySet = dCert->extCertPolicySet;
1313813135 x509->certPolicyCrit = dCert->extCertPolicyCrit;
13139- #endif /* WOLFSSL_SEP || WOLFSSL_QT */
13136+ #endif
1314013137 #ifdef WOLFSSL_CERT_EXT
1314113138 {
1314213139 int i;
0 commit comments