Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certificates: ECC signature algorithm parameter #7903

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions wolfcrypt/src/asn.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ ASN Options:
* which is discouraged by X.690 specification - default values shall not
* be encoded.
* NO_TIME_SIGNEDNESS_CHECK: Disabled the time_t signedness check.
* WOLFSSL_ECC_SIGALG_PARAMS_NULL_ALLOWED: Allows the ECDSA/EdDSA signature
* algorithms in certificates to have NULL parameter instead of empty.
* DO NOT enable this unless required for interoperability.
*/

#include <wolfssl/wolfcrypt/error-crypt.h>
Expand Down Expand Up @@ -22089,16 +22092,20 @@ static int DecodeCertInternal(DecodedCert* cert, int verify, int* criticalExt,
}
/* Parameters not allowed after ECDSA or EdDSA algorithm OID. */
else if (IsSigAlgoECC(cert->signatureOID)) {
if ((dataASN[X509CERTASN_IDX_SIGALGO_PARAMS_NULL].tag != 0)
#ifdef WC_RSA_PSS
|| (dataASN[X509CERTASN_IDX_SIGALGO_PARAMS].tag != 0)
#ifndef WOLFSSL_ECC_SIGALG_PARAMS_NULL_ALLOWED
if (dataASN[X509CERTASN_IDX_SIGALGO_PARAMS_NULL].tag != 0) {
WOLFSSL_ERROR_VERBOSE(ASN_PARSE_E);
ret = ASN_PARSE_E;
}
#endif
) {
#ifdef WC_RSA_PSS
if (dataASN[X509CERTASN_IDX_SIGALGO_PARAMS].tag != 0) {
WOLFSSL_ERROR_VERBOSE(ASN_PARSE_E);
ret = ASN_PARSE_E;
}
#endif
}
#ifdef WC_RSA_PSS
#ifdef WC_RSA_PSS
/* Check parameters starting with a SEQUENCE. */
else if (dataASN[X509CERTASN_IDX_SIGALGO_PARAMS].tag != 0) {
word32 oid = dataASN[X509CERTASN_IDX_SIGALGO_OID].data.oid.sum;
Expand Down Expand Up @@ -22140,7 +22147,7 @@ static int DecodeCertInternal(DecodedCert* cert, int verify, int* criticalExt,
cert->sigParamsLength = sigAlgParamsSz;
}
}
#endif
#endif
}
if ((ret == 0) && (!done)) {
pubKeyEnd = dataASN[X509CERTASN_IDX_TBS_ISSUERUID].offset;
Expand Down