]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Use proper compiler features abstraction for older compilers
authorKelvin Lee <kiyolee@gmail.com>
Mon, 20 Apr 2026 09:08:59 +0000 (19:08 +1000)
committerNikola Pajkovsky <nikolap@openssl.org>
Wed, 22 Apr 2026 07:22:48 +0000 (09:22 +0200)
"inline" -> "ossl_inline"
"__func__" -> "OPENSSL_FUNC"
"snprintf" -> "BIO_snprintf"

CLA: trivial
Fixes: 8e9771cf2259 "Use stub declarations in engine.h"
Fixes: da8f09846b98 "Add ASN1_BIT_STRING_get_length()"
Fixes: 74d47c8e66e0 "Provide ASN1_BIT_STRING_set1()"
Fixes: 7debe0ddeff7 "ECH external APIs"
Fixes: 4af71a77387c "ECH CLI implementation"
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Apr 22 07:22:57 2026
(Merged from https://github.com/openssl/openssl/pull/30901)

include/openssl/engine.h
test/asn1_string_test.c
test/base64_simdutf_test.c
test/ech_test.c

index 95dd466ee3a35cd779d7c11de7f385434412a3cc..b9d97e2083b18858edee4df1ef3c8d021231dd40 100644 (file)
 
 #define ENGINE_FUNC(ret_type, name, args, default_val) \
     OSSL_DEPRECATED_MESSAGE(#name ENGINE_INFO_MSG)     \
-    static inline ret_type name args                   \
+    static ossl_inline ret_type name args              \
     {                                                  \
         return default_val; /* stub return */          \
     }
 
 #define ENGINE_FUNC_NOARGS(ret_type, name, default_val) \
     OSSL_DEPRECATED_MESSAGE(#name ENGINE_INFO_MSG)      \
-    static inline ret_type name(void)                   \
+    static ossl_inline ret_type name(void)              \
     {                                                   \
         return default_val; /* stub return */           \
     }
 
 #define ENGINE_VOID_FUNC(name, args)               \
     OSSL_DEPRECATED_MESSAGE(#name ENGINE_INFO_MSG) \
-    static inline void name args                   \
+    static ossl_inline void name args              \
     {                                              \
     }
 
 #define ENGINE_VOID_FUNC_NOARGS(name)              \
     OSSL_DEPRECATED_MESSAGE(#name ENGINE_INFO_MSG) \
-    static inline void name(void)                  \
+    static ossl_inline void name(void)             \
     {                                              \
     }
 #else /* OPENSSL_ENGINE_STUBS */
index 648dc1916b581e750c1f2fb7e17702e24ab7f6a7..c3886b25b5e926a7a0bb65f85ba1abc80c288703 100644 (file)
@@ -225,14 +225,14 @@ abs_get_length_test(const struct abs_get_length_test *tbl, int idx)
 
     p = test->der;
     if (!TEST_ptr(abs = d2i_ASN1_BIT_STRING(NULL, &p, test->der_len))) {
-        TEST_info("%s, (idx=%d) - d2i_ASN1_BIT_STRING faled", __func__, idx);
+        TEST_info("%s, (idx=%d) - d2i_ASN1_BIT_STRING faled", OPENSSL_FUNC, idx);
         goto err;
     }
 
     ret = ASN1_BIT_STRING_get_length(abs, &length, &unused_bits);
     if (!TEST_int_eq(test->valid, ret)) {
         TEST_info("%s (idx=%d): %s ASN1_BIT_STRING_get_length want %d, got %d\n",
-            __func__, idx, test->descr, test->valid, ret);
+            OPENSSL_FUNC, idx, test->descr, test->valid, ret);
         goto err;
     }
     if (!test->valid)
@@ -240,7 +240,7 @@ abs_get_length_test(const struct abs_get_length_test *tbl, int idx)
 
     if (!TEST_size_t_eq(length, test->length)
         || !TEST_int_eq(unused_bits, test->unused_bits)) {
-        TEST_info("%s: (idx=%d) %s: want (%zu, %d), got (%zu, %d)\n", __func__,
+        TEST_info("%s: (idx=%d) %s: want (%zu, %d), got (%zu, %d)\n", OPENSSL_FUNC,
             idx, test->descr, test->length, test->unused_bits, length,
             unused_bits);
         goto err;
@@ -615,14 +615,14 @@ abs_set1_test(const struct abs_set1_test *tbl, int idx)
     int success = 0;
 
     if (!TEST_ptr(abs = ASN1_BIT_STRING_new())) {
-        TEST_info("%s: (idx = %d) %s ASN1_BIT_STRING_new()", __func__, idx, test->descr);
+        TEST_info("%s: (idx = %d) %s ASN1_BIT_STRING_new()", OPENSSL_FUNC, idx, test->descr);
         goto err;
     }
 
     ret = ASN1_BIT_STRING_set1(abs, test->data, test->length, test->unused_bits);
     if (!TEST_int_eq(ret, test->valid)) {
         TEST_info("%s: (idx = %d) %s ASN1_BIT_STRING_set1(): want %d, got %d",
-            __func__, idx, test->descr, test->valid, ret);
+            OPENSSL_FUNC, idx, test->descr, test->valid, ret);
         goto err;
     }
 
@@ -632,14 +632,14 @@ abs_set1_test(const struct abs_set1_test *tbl, int idx)
     der = NULL;
     if (!TEST_int_eq((der_len = i2d_ASN1_BIT_STRING(abs, &der)), test->der_len)) {
         TEST_info("%s: (idx=%d), %s i2d_ASN1_BIT_STRING(): want %d, got %d",
-            __func__, idx, test->descr, test->der_len, der_len);
+            OPENSSL_FUNC, idx, test->descr, test->der_len, der_len);
         if (der_len < 0)
             der_len = 0;
         goto err;
     }
 
     if (!TEST_mem_eq(der, der_len, test->der, test->der_len)) {
-        TEST_info("%s: (idx = %d)  %s DER mismatch", __func__, idx, test->descr);
+        TEST_info("%s: (idx = %d)  %s DER mismatch", OPENSSL_FUNC, idx, test->descr);
         goto err;
     }
 
index 3b3b0726b9670e678cb913ebd00395a00804df9b..2842e13cc245b8ac8cf1372e93d832b0e8233497 100644 (file)
@@ -32,7 +32,7 @@ static void fuzz_fill_encode_ctx(EVP_ENCODE_CTX *ctx, int max_fill)
         ctx->enc_data[i] = (unsigned char)(rand() & 0xFF);
     ctx->line_num = rand() % (EVP_ENCODE_B64_LENGTH + 1);
 }
-static inline uint32_t next_u32(uint32_t *state)
+static ossl_inline uint32_t next_u32(uint32_t *state)
 {
     *state = (*state * 1664525u) + 1013904223u;
     return *state;
index 49bc26ad47da26b5a358dcbe821c1c7bcb7d18f0..9a0214c98810dcf756c1d487a9e0fe54d91a1273 100644 (file)
@@ -1060,7 +1060,7 @@ static int ech_test_file_read(int run)
     fullname = OPENSSL_malloc(fnlen);
     if (fullname == NULL)
         goto end;
-    snprintf(fullname, fnlen, "%s/%s", certsdir, ft->fname);
+    BIO_snprintf(fullname, fnlen, "%s/%s", certsdir, ft->fname);
     if (verbose)
         TEST_info("testing read of %s", fullname);
     in = BIO_new_file(fullname, "r");
@@ -1320,7 +1320,7 @@ static int test_ech_roundtrip_helper(int idx, int combo)
     aeadind = idx % aeadsz;
     /* initialise early data stuff, just in case */
     memset(ed, 'A', sizeof(ed));
-    snprintf(suitestr, 100, "%s,%s,%s", kem_str_list[kemind],
+    BIO_snprintf(suitestr, 100, "%s,%s,%s", kem_str_list[kemind],
         kdf_str_list[kdfind], aead_str_list[aeadind]);
     if (verbose)
         TEST_info("Doing: iter: %d, suite: %s", idx, suitestr);