Define to allow badly formed ASN integers

Define: WOLFSSL_ASN_INT_LEAD_0_ANY
Allows positive integers to have a leading 0 byte.
DER/BER encoding specifies that leding 0 only on negative numbers
(highest bit of first octet set).
This commit is contained in:
Sean Parkinson
2020-05-28 08:50:21 +10:00
parent 1cc9a8ffbf
commit 8dee048b04

View File

@ -460,8 +460,10 @@ static int GetASNInt(const byte* input, word32* inOutIdx, int* len,
(*inOutIdx)++;
(*len)--;
#ifndef WOLFSSL_ASN_INT_LEAD_0_ANY
if (*len > 0 && (input[*inOutIdx] & 0x80) == 0)
return ASN_PARSE_E;
#endif
}
}