Merge pull request #6168 from anhu/WOLFSSL_RELAXED_ASN_PARSING

Relaxed parsing of explicit ECC public key
This commit is contained in:
Sean Parkinson
2023-03-08 08:20:04 +10:00
committed by GitHub

View File

@ -31143,11 +31143,13 @@ static int EccSpecifiedECDomainDecode(const byte* input, word32 inSz,
if ((ret == 0) && (version < 1 || version > 3)) { if ((ret == 0) && (version < 1 || version > 3)) {
ret = ASN_PARSE_E; ret = ASN_PARSE_E;
} }
#ifndef WOLFSSL_NO_ASN_STRICT
/* Only version 2 and above can have a seed. */ /* Only version 2 and above can have a seed. */
if ((ret == 0) && (dataASN[ECCSPECIFIEDASN_IDX_PARAM_SEED].tag != 0) && if ((ret == 0) && (dataASN[ECCSPECIFIEDASN_IDX_PARAM_SEED].tag != 0) &&
(version < 2)) { (version < 2)) {
ret = ASN_PARSE_E; ret = ASN_PARSE_E;
} }
#endif
/* Only version 2 and above can have a hash algorithm. */ /* Only version 2 and above can have a hash algorithm. */
if ((ret == 0) && (dataASN[ECCSPECIFIEDASN_IDX_HASH_SEQ].tag != 0) && if ((ret == 0) && (dataASN[ECCSPECIFIEDASN_IDX_HASH_SEQ].tag != 0) &&
(version < 2)) { (version < 2)) {