Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid using empty prototypes; support Clang 15 and XCode 14.3 #19

Merged
merged 3 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/archs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install packages
run: |
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -67,4 +67,4 @@ jobs:
make check

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
12 changes: 6 additions & 6 deletions include/cjose/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -119,15 +119,15 @@ 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
* not set, this function retursn a pointer to <tt>realloc</tt>.
*
* \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
Expand All @@ -137,15 +137,15 @@ 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
* not set, this function returns a pointer to <tt>free()</tt>.
*
* \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
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/cjose/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extern "C"
*
* \returns the implementation version number.
*/
const char *cjose_version();
const char *cjose_version(void);

#ifdef __cplusplus
}
Expand Down
14 changes: 7 additions & 7 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

#include <cjose/version.h>

const char *cjose_version() { return CJOSE_VERSION; }
const char *cjose_version(void) { return CJOSE_VERSION; }
2 changes: 1 addition & 1 deletion test/check_base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
4 changes: 2 additions & 2 deletions test/check_cjose.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
26 changes: 13 additions & 13 deletions test/check_cjose.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion test/check_concatkdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion test/check_header.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion test/check_jwe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion test/check_jwk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion test/check_jws.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
6 changes: 3 additions & 3 deletions test/check_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion test/check_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down