From b16b61f6bc0e22b13f8a233691ca810fe9926301 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 23 Feb 2022 17:24:41 +0100 Subject: [PATCH] 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. --- Userland/Libraries/LibCrypto/ASN1/DER.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibCrypto/ASN1/DER.cpp b/Userland/Libraries/LibCrypto/ASN1/DER.cpp index 9f3b51f160..846327c553 100644 --- a/Userland/Libraries/LibCrypto/ASN1/DER.cpp +++ b/Userland/Libraries/LibCrypto/ASN1/DER.cpp @@ -100,7 +100,7 @@ Result Decoder::decode_boolean(ReadonlyBytes data) if (data.size() != 1) return DecodeError::InvalidInputFormat; - return data[0] == 0; + return data[0] != 0; } Result Decoder::decode_arbitrary_sized_integer(ReadonlyBytes data)