mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 03:34:39 +02:00
Merge pull request #8960 from ribes96/certwrite-custext
When creating a Cert from a WOLFSSL_X509, account for custom extensions
This commit is contained in:
20
src/x509.c
20
src/x509.c
@@ -10737,6 +10737,26 @@ static int CertFromX509(Cert* cert, WOLFSSL_X509* x509)
|
||||
cert->altSigValLen = x509->altSigValLen;
|
||||
cert->altSigValCrit = x509->altSigValCrit;
|
||||
#endif /* WOLFSSL_DUAL_ALG_CERTS */
|
||||
|
||||
#if defined(WOLFSSL_ASN_TEMPLATE) && defined(WOLFSSL_CUSTOM_OID) && \
|
||||
defined(HAVE_OID_ENCODING)
|
||||
|
||||
if ((x509->customExtCount < 0) ||
|
||||
(x509->customExtCount >= NUM_CUSTOM_EXT)) {
|
||||
WOLFSSL_MSG("Bad value for customExtCount.");
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
for (i = 0; i < x509->customExtCount; i++) {
|
||||
if (wc_SetCustomExtension(cert, x509->custom_exts[i].crit,
|
||||
x509->custom_exts[i].oid, x509->custom_exts[i].val,
|
||||
x509->custom_exts[i].valSz))
|
||||
{
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
}
|
||||
#endif /* WOLFSSL_ASN_TEMPLATE && WOLFSSL_CUSTOM_OID && HAVE_OID_ENCODING */
|
||||
|
||||
#endif /* WOLFSSL_CERT_EXT */
|
||||
|
||||
#ifdef WOLFSSL_CERT_REQ
|
||||
|
Reference in New Issue
Block a user