Skip to content

Commit

Permalink
CLeanup jwt-common exports
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Collins <[email protected]>
  • Loading branch information
benmcollins committed Feb 12, 2025
1 parent 64a2f82 commit 67e875a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ set(JWT_SOURCES libjwt/base64.c
add_library(builder OBJECT)
target_sources(builder PRIVATE libjwt/jwt-common.c)
target_compile_definitions(builder PRIVATE JWT_BUILDER)
set_property(TARGET builder PROPERTY POSITION_INDEPENDENT_CODE ON)

add_library(checker OBJECT)
target_sources(checker PRIVATE libjwt/jwt-common.c)
target_compile_definitions(checker PRIVATE JWT_CHECKER)
set_property(TARGET checker PROPERTY POSITION_INDEPENDENT_CODE ON)

target_link_libraries(jwt PRIVATE builder checker)
target_link_libraries(jwt_static PRIVATE builder checker)
Expand Down
6 changes: 3 additions & 3 deletions libjwt/jwt-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jwt_common_t *FUNC(new)(void)
return __cmd;
}

int FUNC(setkey_check)(jwt_common_t *__cmd, const jwt_alg_t alg,
static int __setkey_check(jwt_common_t *__cmd, const jwt_alg_t alg,
const jwk_item_t *key)
{
if (__cmd == NULL)
Expand Down Expand Up @@ -103,7 +103,7 @@ int FUNC(setkey_check)(jwt_common_t *__cmd, const jwt_alg_t alg,
int FUNC(setkey)(jwt_common_t *__cmd, const jwt_alg_t alg,
const jwk_item_t *key)
{
if (FUNC(setkey_check)(__cmd, alg, key))
if (__setkey_check(__cmd, alg, key))
return 1;

__cmd->c.alg = alg;
Expand Down Expand Up @@ -465,7 +465,7 @@ char *FUNC(generate)(jwt_common_t *__cmd)
}

/* Callback may have changed this */
if (FUNC(setkey_check)(__cmd, config.alg, config.key)) {
if (__setkey_check(__cmd, config.alg, config.key)) {
jwt_write_error(__cmd, "Algorithm and key returned by callback invalid");
return NULL;
}
Expand Down
7 changes: 0 additions & 7 deletions libjwt/jwt-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,6 @@ JWT_NO_EXPORT
jwt_t *jwt_verify_complete(jwt_t *jwt, const jwt_config_t *config,
const char *token, unsigned int payload_len);

JWT_NO_EXPORT
int jwt_builder_setkey_check(jwt_builder_t *builder, const jwt_alg_t alg,
const jwk_item_t *key);
JWT_NO_EXPORT
int jwt_checker_setkey_check(jwt_checker_t *checker, const jwt_alg_t alg,
const jwk_item_t *key);

JWT_NO_EXPORT
char *jwt_encode_str(jwt_t *jwt);

Expand Down

0 comments on commit 67e875a

Please sign in to comment.