diff --git a/.github/workflows/archs.yml b/.github/workflows/archs.yml index e45db38..3f2144c 100644 --- a/.github/workflows/archs.yml +++ b/.github/workflows/archs.yml @@ -21,8 +21,8 @@ jobs: distro: ubuntu20.04 steps: - - uses: actions/checkout@v2.4.0 - - uses: uraimo/run-on-arch-action@v2.1.1 + - uses: actions/checkout@v3 + - uses: uraimo/run-on-arch-action@v2 name: Build id: build with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b54bd2e..d3f7746 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Dependencies run: | sudo apt-get update -y diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 80ef397..59f970e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install packages run: | @@ -42,7 +42,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -53,7 +53,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) #- name: Autobuild - # uses: github/codeql-action/autobuild@v1 + # uses: github/codeql-action/autobuild@v2 # âšī¸ Command-line programs to run using the OS shell. # đ https://git.io/JvXDl @@ -67,4 +67,4 @@ jobs: make check - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index e509493..33c1247 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Release Notes # +* avoid using empty prototypes; support Clang 15 and XCode 14.3 + <a name="v0.6.2.2"></a> ## [v0.6.2.2](https://github.com/OpenIDC/cjose/compare/v0.6.2.1...v0.6.2.2) (2023-07-12) * use fixed authentication tag length of 16 octets in AES GCM decryption (https://github.com/cisco/cjose/issues/125) diff --git a/include/cjose/util.h b/include/cjose/util.h index c8e6f07..ba9eba8 100644 --- a/include/cjose/util.h +++ b/include/cjose/util.h @@ -109,7 +109,7 @@ void cjose_set_alloc_ex_funcs(cjose_alloc3_fn_t alloc3, cjose_realloc3_fn_t real * * \returns The configured allocator function */ -cjose_alloc_fn_t cjose_get_alloc(); +cjose_alloc_fn_t cjose_get_alloc(void); /** * Retrieves the configured enhanced allocator function. If an enhanced @@ -119,7 +119,7 @@ cjose_alloc_fn_t cjose_get_alloc(); * * \returns The configured enhanced allocator function */ -cjose_alloc3_fn_t cjose_get_alloc3(); +cjose_alloc3_fn_t cjose_get_alloc3(void); /** * Retrieve the configured reallocator function. If a reallocator function is @@ -127,7 +127,7 @@ cjose_alloc3_fn_t cjose_get_alloc3(); * * \returns The configured reallocator function */ -cjose_realloc_fn_t cjose_get_realloc(); +cjose_realloc_fn_t cjose_get_realloc(void); /** * Retrieves the configured enhanced reallocator function. If an enhanced @@ -137,7 +137,7 @@ cjose_realloc_fn_t cjose_get_realloc(); * * \returns The configured enhanced allocator function */ -cjose_realloc3_fn_t cjose_get_realloc3(); +cjose_realloc3_fn_t cjose_get_realloc3(void); /** * Retrieves the configured deallocator function. If a deallocator function is @@ -145,7 +145,7 @@ cjose_realloc3_fn_t cjose_get_realloc3(); * * \returns The configured deallocator function */ -cjose_dealloc_fn_t cjose_get_dealloc(); +cjose_dealloc_fn_t cjose_get_dealloc(void); /** * Retrieves the configured enhanced deallocator function. If an enhanced @@ -155,7 +155,7 @@ cjose_dealloc_fn_t cjose_get_dealloc(); * * \returns The configured enhanced allocator function */ -cjose_dealloc3_fn_t cjose_get_dealloc3(); +cjose_dealloc3_fn_t cjose_get_dealloc3(void); /** * Compares the first n bytes of the memory areas s1 and s2 in constant time. diff --git a/include/cjose/version.h.in b/include/cjose/version.h.in index f814ad3..e908199 100644 --- a/include/cjose/version.h.in +++ b/include/cjose/version.h.in @@ -29,7 +29,7 @@ extern "C" * * \returns the implementation version number. */ -const char *cjose_version(); +const char *cjose_version(void); #ifdef __cplusplus } diff --git a/src/util.c b/src/util.c index 3c22d7a..a180d11 100644 --- a/src/util.c +++ b/src/util.c @@ -46,7 +46,7 @@ void cjose_dealloc3_default(void *p, const char *file, int line) cjose_get_dealloc()(p); } -static void cjose_apply_allocs() +static void cjose_apply_allocs(void) { // set upstream json_set_alloc_funcs(cjose_get_alloc(), cjose_get_dealloc()); @@ -83,14 +83,14 @@ void cjose_set_alloc_ex_funcs(cjose_alloc3_fn_t alloc3, cjose_realloc3_fn_t real cjose_apply_allocs(); } -cjose_alloc_fn_t cjose_get_alloc() { return (!_alloc) ? malloc : _alloc; } -cjose_alloc3_fn_t cjose_get_alloc3() { return (!_alloc3) ? cjose_alloc3_default : _alloc3; } +cjose_alloc_fn_t cjose_get_alloc(void) { return (!_alloc) ? malloc : _alloc; } +cjose_alloc3_fn_t cjose_get_alloc3(void) { return (!_alloc3) ? cjose_alloc3_default : _alloc3; } -cjose_realloc_fn_t cjose_get_realloc() { return (!_realloc) ? realloc : _realloc; } -cjose_realloc3_fn_t cjose_get_realloc3() { return (!_realloc3) ? cjose_realloc3_default : _realloc3; } +cjose_realloc_fn_t cjose_get_realloc(void) { return (!_realloc) ? realloc : _realloc; } +cjose_realloc3_fn_t cjose_get_realloc3(void) { return (!_realloc3) ? cjose_realloc3_default : _realloc3; } -cjose_dealloc_fn_t cjose_get_dealloc() { return (!_dealloc) ? free : _dealloc; } -cjose_dealloc3_fn_t cjose_get_dealloc3() { return (!_dealloc3) ? cjose_dealloc3_default : _dealloc3; } +cjose_dealloc_fn_t cjose_get_dealloc(void) { return (!_dealloc) ? free : _dealloc; } +cjose_dealloc3_fn_t cjose_get_dealloc3(void) { return (!_dealloc3) ? cjose_dealloc3_default : _dealloc3; } int cjose_const_memcmp(const uint8_t *a, const uint8_t *b, const size_t size) { diff --git a/src/version.c b/src/version.c index 7d3f1f5..01d2e57 100644 --- a/src/version.c +++ b/src/version.c @@ -7,4 +7,4 @@ #include <cjose/version.h> -const char *cjose_version() { return CJOSE_VERSION; } +const char *cjose_version(void) { return CJOSE_VERSION; } diff --git a/test/check_base64.c b/test/check_base64.c index abfe762..14f08d1 100644 --- a/test/check_base64.c +++ b/test/check_base64.c @@ -429,7 +429,7 @@ START_TEST(test_cjose_base64url_decode) } END_TEST -Suite *cjose_base64_suite() +Suite *cjose_base64_suite(void) { Suite *suite = suite_create("base64"); diff --git a/test/check_cjose.c b/test/check_cjose.c index edc42ac..4861336 100644 --- a/test/check_cjose.c +++ b/test/check_cjose.c @@ -8,14 +8,14 @@ #include <openssl/err.h> #include <openssl/evp.h> -Suite *cjose_suite() +Suite *cjose_suite(void) { Suite *suite = suite_create("CJOSE"); return suite; } -int main() +int main(void) { // initialize "OpenSSL" crypto ERR_load_crypto_strings(); diff --git a/test/check_cjose.h b/test/check_cjose.h index 1aece30..07a1cdd 100644 --- a/test/check_cjose.h +++ b/test/check_cjose.h @@ -9,24 +9,24 @@ #include <check.h> -Suite *cjose_version_suite(); -Suite *cjose_util_suite(); -Suite *cjose_base64_suite(); -Suite *cjose_jwk_suite(); -Suite *cjose_jwe_suite(); -Suite *cjose_jws_suite(); -Suite *cjose_header_suite(); -Suite *cjose_utils_suite(); -Suite *cjose_concatkdf_suite(); +Suite *cjose_version_suite(void); +Suite *cjose_util_suite(void); +Suite *cjose_base64_suite(void); +Suite *cjose_jwk_suite(void); +Suite *cjose_jwe_suite(void); +Suite *cjose_jws_suite(void); +Suite *cjose_header_suite(void); +Suite *cjose_utils_suite(void); +Suite *cjose_concatkdf_suite(void); #define _ck_assert_bin(X, OP, Y, LEN) \ do \ { \ - const uint8_t *_chk_x = (X); \ - const uint8_t *_chk_y = (Y); \ - const size_t _chk_len = (LEN); \ + const void *_chk_x = (X); \ + const void *_chk_y = (Y); \ + const unsigned int _chk_len = (LEN); \ ck_assert_msg(0 OP memcmp(_chk_x, _chk_y, _chk_len), \ - "Assertion '" #X #OP #Y "' failed: " #LEN "==%z, " #X "==0x%zx, " #Y "==0x%zx", _chk_len, _chk_x, _chk_y); \ + "Assertion '" #X #OP #Y "' failed: " #LEN "==%u, " #X "==0x%p, " #Y "==0x%p", _chk_len, _chk_x, _chk_y); \ } while (0); #define ck_assert_bin_eq(X, Y, LEN) _ck_assert_bin(X, ==, Y, LEN) diff --git a/test/check_concatkdf.c b/test/check_concatkdf.c index c63db37..f7c7fb2 100644 --- a/test/check_concatkdf.c +++ b/test/check_concatkdf.c @@ -194,7 +194,7 @@ START_TEST(test_cjose_concatkdf_derive_moreinfo) ck_assert_bin_eq(derived, expected, keylen); } END_TEST -Suite *cjose_concatkdf_suite() +Suite *cjose_concatkdf_suite(void) { Suite *suite = suite_create("concatkdf"); diff --git a/test/check_header.c b/test/check_header.c index 621998f..3202a5a 100644 --- a/test/check_header.c +++ b/test/check_header.c @@ -106,7 +106,7 @@ START_TEST(test_cjose_header_set_get_raw) } END_TEST -Suite *cjose_header_suite() +Suite *cjose_header_suite(void) { Suite *suite = suite_create("header"); diff --git a/test/check_jwe.c b/test/check_jwe.c index 39621b1..02ed0c7 100644 --- a/test/check_jwe.c +++ b/test/check_jwe.c @@ -1416,7 +1416,7 @@ START_TEST(test_cjose_jwe_multiple_recipients) } END_TEST -Suite *cjose_jwe_suite() +Suite *cjose_jwe_suite(void) { Suite *suite = suite_create("jwe"); diff --git a/test/check_jwk.c b/test/check_jwk.c index baae7d7..f8f1a0c 100644 --- a/test/check_jwk.c +++ b/test/check_jwk.c @@ -1423,7 +1423,7 @@ START_TEST(test_cjose_jwk_get_and_set_kid) } END_TEST -Suite *cjose_jwk_suite() +Suite *cjose_jwk_suite(void) { Suite *suite = suite_create("jwk"); diff --git a/test/check_jws.c b/test/check_jws.c index 81747b1..1a2ef7c 100644 --- a/test/check_jws.c +++ b/test/check_jws.c @@ -975,7 +975,7 @@ START_TEST(test_cjose_jws_none) } END_TEST -Suite *cjose_jws_suite() +Suite *cjose_jws_suite(void) { Suite *suite = suite_create("jws"); diff --git a/test/check_util.c b/test/check_util.c index 8a7feaa..c391cf9 100644 --- a/test/check_util.c +++ b/test/check_util.c @@ -30,7 +30,7 @@ static void test_dealloc(void *ptr) free(ptr); } -static void test_alloc_reset() +static void test_alloc_reset(void) { _test_alloc_in_amt = 0; _test_alloc_in_ptr = _test_alloc_out_ptr = NULL; @@ -110,7 +110,7 @@ static void *_test_alloc3_in_ptr; static const char *_test_alloc3_in_file; static int _test_alloc3_in_line; static void *_test_alloc3_out_ptr; -static void test_alloc3_reset() +static void test_alloc3_reset(void) { test_alloc_reset(); _test_alloc3_in_amt = 0; @@ -238,7 +238,7 @@ START_TEST(test_cjose_set_allocators_ex) } END_TEST -Suite *cjose_util_suite() +Suite *cjose_util_suite(void) { Suite *suite = suite_create("util"); diff --git a/test/check_version.c b/test/check_version.c index 2b26c26..1a1e903 100644 --- a/test/check_version.c +++ b/test/check_version.c @@ -19,7 +19,7 @@ START_TEST(test_cjose_version_fn) } END_TEST -Suite *cjose_version_suite() +Suite *cjose_version_suite(void) { Suite *suite = suite_create("version");