forked from wolfSSL/wolfssl
Patch from Jacob. When parsing a certificate name, if an item is unknown, its NID is set to 0. Don't try to add NID's of 0.
This commit is contained in:
@@ -5564,7 +5564,6 @@ int GetName(DecodedCert* cert, int nameType, int maxIdx)
|
|||||||
#if (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) && \
|
#if (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) && \
|
||||||
!defined(WOLFCRYPT_ONLY)
|
!defined(WOLFCRYPT_ONLY)
|
||||||
WOLFSSL_X509_NAME* dName;
|
WOLFSSL_X509_NAME* dName;
|
||||||
int nid = NID_undef;
|
|
||||||
#endif /* OPENSSL_EXTRA */
|
#endif /* OPENSSL_EXTRA */
|
||||||
|
|
||||||
WOLFSSL_MSG("Getting Cert Name");
|
WOLFSSL_MSG("Getting Cert Name");
|
||||||
@@ -5639,6 +5638,10 @@ int GetName(DecodedCert* cert, int nameType, int maxIdx)
|
|||||||
int copyLen = 0;
|
int copyLen = 0;
|
||||||
int strLen = 0;
|
int strLen = 0;
|
||||||
byte id = 0;
|
byte id = 0;
|
||||||
|
#if (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) \
|
||||||
|
&& !defined(WOLFCRYPT_ONLY)
|
||||||
|
int nid = NID_undef;
|
||||||
|
#endif /* OPENSSL_EXTRA */
|
||||||
|
|
||||||
if (GetSet(cert->source, &cert->srcIdx, &dummy, maxIdx) < 0) {
|
if (GetSet(cert->source, &cert->srcIdx, &dummy, maxIdx) < 0) {
|
||||||
WOLFSSL_MSG("Cert name lacks set header, trying sequence");
|
WOLFSSL_MSG("Cert name lacks set header, trying sequence");
|
||||||
@@ -6028,12 +6031,14 @@ int GetName(DecodedCert* cert, int nameType, int maxIdx)
|
|||||||
}
|
}
|
||||||
#if (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) && \
|
#if (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) && \
|
||||||
!defined(WOLFCRYPT_ONLY)
|
!defined(WOLFCRYPT_ONLY)
|
||||||
|
if (nid != NID_undef) {
|
||||||
if (wolfSSL_X509_NAME_add_entry_by_NID(dName, nid, MBSTRING_UTF8,
|
if (wolfSSL_X509_NAME_add_entry_by_NID(dName, nid, MBSTRING_UTF8,
|
||||||
&cert->source[cert->srcIdx], strLen, -1, -1) !=
|
&cert->source[cert->srcIdx], strLen, -1, -1) !=
|
||||||
WOLFSSL_SUCCESS) {
|
WOLFSSL_SUCCESS) {
|
||||||
wolfSSL_X509_NAME_free(dName);
|
wolfSSL_X509_NAME_free(dName);
|
||||||
return ASN_PARSE_E;
|
return ASN_PARSE_E;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif /* OPENSSL_EXTRA */
|
#endif /* OPENSSL_EXTRA */
|
||||||
cert->srcIdx += strLen;
|
cert->srcIdx += strLen;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user