[PATCH 2/4] cert: fix -std=c23 build failure

Sergei Trofimovich <[email protected]> Sun, 17 Nov 2024 00:18:12 +0000
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
gcc-15 switched to -std=c23 by default:

    https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff
259b06c212

As a result `ell` fails the build as:

    ell/cert.c:390:32: error: incompatible types when returning type '_Bool' but 'const uint8_t *' {aka 'const unsigned char *'} was expected
      390 |                         return false;
          |                                ^~~~~
---
 ell/cert.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ell/cert.c b/ell/cert.c
index 38bb01a..19a6556 100644
--- a/ell/cert.c
+++ b/ell/cert.c
@@ -387,13 +387,13 @@ const uint8_t *cert_get_extension(struct l_cert *cert,
 
 		seq = asn1_der_find_elem(ext, end - ext, 0, &tag, &len);
 		if (unlikely(!seq || tag != ASN1_ID_SEQUENCE))
-			return false;
+			return NULL;
 
 		ext = seq + len;
 
 		oid = asn1_der_find_elem(seq, len, 0, &tag, &oid_len);
 		if (unlikely(!oid || tag != ASN1_ID_OID))
-			return false;
+			return NULL;
 
 		if (!asn1_oid_eq(ext_id, oid_len, oid))
 			continue;
@@ -403,7 +403,7 @@ const uint8_t *cert_get_extension(struct l_cert *cert,
 
 		if (data && tag == ASN1_ID_BOOLEAN) {
 			if (data_len != 1)
-				return false;
+				return NULL;
 
 			critical = *data != 0;	/* Tolerate BER booleans */
 
@@ -411,7 +411,7 @@ const uint8_t *cert_get_extension(struct l_cert *cert,
 		}
 
 		if (unlikely(!data || tag != ASN1_ID_OCTET_STRING))
-			return false;
+			return NULL;
 
 		if (out_critical)
 			*out_critical = critical;
-- 
2.47.0