LibCrypto: Fix inverted boolean decoded error in ASN.1

ASN.1 encodes booleans as false is zero and true is non-zero. The
decoder currently returned true when the boolean was zero.

Since this decoder was barely used it did not cause any problems,
however for support of other certificate extensions the correct version
is required.
This commit is contained in:
Michiel Visser 2022-02-23 17:24:41 +01:00 committed by Ali Mohammad Pur
parent 5a60bed88b
commit b16b61f6bc
Notes: sideshowbarker 2024-07-17 11:45:02 +09:00

View File

@ -100,7 +100,7 @@ Result<bool, DecodeError> Decoder::decode_boolean(ReadonlyBytes data)
if (data.size() != 1)
return DecodeError::InvalidInputFormat;
return data[0] == 0;
return data[0] != 0;
}
Result<UnsignedBigInteger, DecodeError> Decoder::decode_arbitrary_sized_integer(ReadonlyBytes data)