From 369e6a55a86b9ff7fb992506b3fdfab0ba509d8b Mon Sep 17 00:00:00 2001 From: jordan Date: Fri, 30 Aug 2024 18:46:19 -0500 Subject: [PATCH] Small cleanup. --- src/internal.c | 17 ++++++++--------- wolfcrypt/src/asn.c | 15 ++------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/internal.c b/src/internal.c index f34c7f6aee..f8adca9244 100644 --- a/src/internal.c +++ b/src/internal.c @@ -13217,7 +13217,14 @@ int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert) #endif /* KEEP_PEER_CERT || SESSION_CERTS */ #if defined(WOLFSSL_ACERT) -/* Copy parts X509 needs from Decoded cert, 0 on success */ +/* Copy a DecodedAcert structure to an X509_ACERT. + * + * @param [out] x509 the dst X509 acert structure + * @param [in] dAcert the src decoded acert structure + * + * @return 0 on success + * @return < 0 on error + * */ int CopyDecodedAcertToX509(WOLFSSL_X509_ACERT* x509, DecodedAcert* dAcert) { int ret = 0; @@ -13277,14 +13284,6 @@ int CopyDecodedAcertToX509(WOLFSSL_X509_ACERT* x509, DecodedAcert* dAcert) x509->sig.length = dAcert->sigLength; x509->sigOID = (int)dAcert->signatureOID; } -#if defined(OPENSSL_ALL) - wolfSSL_ASN1_OBJECT_free(x509->algor.algorithm); - if (!(x509->algor.algorithm = - wolfSSL_OBJ_nid2obj(oid2nid(dAcert->signatureOID, oidSigType)))) { - ret = PUBLIC_KEY_E; - WOLFSSL_ERROR_VERBOSE(ret); - } -#endif } /* if der contains original source buffer then store for potential diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 25fcfc1822..bb369c3b15 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -40375,13 +40375,6 @@ static int DecodeAcertGeneralName(const byte* input, word32* inOutIdx, byte tag, } #endif #endif /* IGNORE_NAME_CONSTRAINTS */ -#if defined(WOLFSSL_SEP) || defined(WOLFSSL_FPKI) - /* GeneralName choice: otherName */ - else if (tag == (ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED | ASN_OTHER_TYPE)) { - /* TODO: test data for code path */ - ret = DecodeOtherName(cert, input, &idx, idx + (word32)len); - } -#endif /* GeneralName choice: dNSName, x400Address, ediPartyName */ else { WOLFSSL_MSG("\tUnsupported name type, skipping"); @@ -40478,8 +40471,6 @@ static int DecodeAcertGeneralNames(const byte* input, word32 sz, DecodedAcert* c * serial CertificateSerialNumber, * issuerUID UniqueIdentifier OPTIONAL * } - * - * * */ static const ASNItem HolderASN[] = { @@ -40600,7 +40591,6 @@ static int DecodeHolder(const byte* input, word32 len, DecodedAcert* cert) * names. ACs conforming to this profile MUST omit the * baseCertificateID and objectDigestInfo fields. * - * * 4.1. X.509 Attribute Certificate Definition * * AttCertIssuer ::= CHOICE { @@ -40617,7 +40607,6 @@ static int DecodeHolder(const byte* input, word32 len, DecodedAcert* cert) * -- baseCertificateID and objectDigestInfo MUST * -- NOT be present in this profile * } - * * */ static const ASNItem AttCertIssuerASN[] = { @@ -40646,7 +40635,8 @@ enum { * @return ASN_UNKNOWN_OID_E when the OID cannot be verified. * @return MEMORY_E when dynamic memory allocation fails. * */ -static int DecodeAttCertIssuer(const byte* input, word32 len, DecodedAcert* cert) +static int DecodeAttCertIssuer(const byte* input, word32 len, + DecodedAcert* cert) { DECL_ASNGETDATA(dataASN, AttCertIssuerASN_Length); int ret = 0; @@ -40799,7 +40789,6 @@ enum { * - extensions * - attributes * - * * Returns 0 on success. * Returns negative error code on error/failure. * */