From 35fe8dad0493a48455315948e53b074b49d85269 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 25 Nov 2023 11:21:51 +0100 Subject: [PATCH] Fix declaration/implementation mismatch --- src/thirdparty/jwt/include/base64.h | 4 ++-- src/thirdparty/jwt/include/claim.h | 6 +++--- src/thirdparty/jwt/include/util.h | 2 +- src/thirdparty/mbedtls/asn1parse.c | 3 ++- src/thirdparty/mbedtls/include/mbedtls/asn1.h | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/thirdparty/jwt/include/base64.h b/src/thirdparty/jwt/include/base64.h index f3124fc8..2fa71771 100644 --- a/src/thirdparty/jwt/include/base64.h +++ b/src/thirdparty/jwt/include/base64.h @@ -51,7 +51,7 @@ extern "C" { * * @return Return code as defined in retcodes.h */ -L8W8JWT_API int l8w8jwt_base64_encode(int url, const uint8_t* data, size_t data_length, char** out, size_t* out_length); +L8W8JWT_API int l8w8jwt_base64_encode(const int url, const uint8_t* data, const size_t data_length, char** out, size_t* out_length); /** * Decodes a base-64 encoded string to an array of bytes.

@@ -68,7 +68,7 @@ L8W8JWT_API int l8w8jwt_base64_encode(int url, const uint8_t* data, size_t data_ * * @return Return code as defined in retcodes.h */ -L8W8JWT_API int l8w8jwt_base64_decode(int url, const char* data, size_t data_length, uint8_t** out, size_t* out_length); +L8W8JWT_API int l8w8jwt_base64_decode(const int url, const char* data, const size_t data_length, uint8_t** out, size_t* out_length); #ifdef __cplusplus } // extern "C" diff --git a/src/thirdparty/jwt/include/claim.h b/src/thirdparty/jwt/include/claim.h index 0b55acad..b9bf18d2 100644 --- a/src/thirdparty/jwt/include/claim.h +++ b/src/thirdparty/jwt/include/claim.h @@ -117,7 +117,7 @@ struct l8w8jwt_claim * @param claims The claims to free. * @param claims_count The size of the passed claims array. */ -L8W8JWT_API void l8w8jwt_free_claims(struct l8w8jwt_claim* claims, size_t claims_count); +L8W8JWT_API void l8w8jwt_free_claims(struct l8w8jwt_claim* claims, const size_t claims_count); /** * Writes a bunch of JWT claims into a chillbuff stringbuilder.

@@ -127,7 +127,7 @@ L8W8JWT_API void l8w8jwt_free_claims(struct l8w8jwt_claim* claims, size_t claims * @param claims_count The claims array size. * @return Return code as specified inside retcodes.h */ -L8W8JWT_API int l8w8jwt_write_claims(struct chillbuff* stringbuilder, struct l8w8jwt_claim* claims, size_t claims_count); +L8W8JWT_API int l8w8jwt_write_claims(struct chillbuff* stringbuilder, struct l8w8jwt_claim* claims, const size_t claims_count); /** * Gets a claim by key from a l8w8jwt_claim array. @@ -137,7 +137,7 @@ L8W8JWT_API int l8w8jwt_write_claims(struct chillbuff* stringbuilder, struct l8w * @param key_length The claim key's string length. * @return The found claim; NULL if no such claim was found in the array. */ -L8W8JWT_API struct l8w8jwt_claim* l8w8jwt_get_claim(struct l8w8jwt_claim* claims, size_t claims_count, const char* key, size_t key_length); +L8W8JWT_API struct l8w8jwt_claim* l8w8jwt_get_claim(struct l8w8jwt_claim* claims, const size_t claims_count, const char* key, const size_t key_length); #ifdef __cplusplus } // extern "C" diff --git a/src/thirdparty/jwt/include/util.h b/src/thirdparty/jwt/include/util.h index 7bd4d479..ef986795 100644 --- a/src/thirdparty/jwt/include/util.h +++ b/src/thirdparty/jwt/include/util.h @@ -40,7 +40,7 @@ extern "C" { * @param output_length [OPTIONAL] Where to write the output array length into. This is always gonna be hexstr_length / 2, but you can still choose to write it out just to be sure. If you want to omit this: no problem.. just pass NULL! * @return 0 if conversion succeeded. 1 if one or more required arguments were NULL or invalid. 2 if the hexadecimal string is in an invalid format (e.g. not divisible by 2). 3 if output buffer size was insufficient (needs to be at least (hexstr_length / 2) + 1 bytes). */ -L8W8JWT_API int l8w8jwt_hexstr2bin(const char* hexstr, size_t hexstr_length, unsigned char* output, size_t output_size, size_t* output_length); +L8W8JWT_API int l8w8jwt_hexstr2bin(const char* hexstr, const size_t hexstr_length, unsigned char* output, const size_t output_size, size_t* output_length); /** * Compares two strings ignoring UPPER vs. lowercase. diff --git a/src/thirdparty/mbedtls/asn1parse.c b/src/thirdparty/mbedtls/asn1parse.c index d257ef43..3cd34605 100644 --- a/src/thirdparty/mbedtls/asn1parse.c +++ b/src/thirdparty/mbedtls/asn1parse.c @@ -377,9 +377,10 @@ static int asn1_get_sequence_of_cb(void *ctx, int mbedtls_asn1_get_sequence_of(unsigned char **p, const unsigned char *end, mbedtls_asn1_sequence *cur, - int tag) + const int tag) { asn1_get_sequence_of_cb_ctx_t cb_ctx = { tag, cur }; + memset(cur, 0, sizeof(mbedtls_asn1_sequence)); return mbedtls_asn1_traverse_sequence_of( p, end, 0xFF, tag, 0, 0, diff --git a/src/thirdparty/mbedtls/include/mbedtls/asn1.h b/src/thirdparty/mbedtls/include/mbedtls/asn1.h index e15aeb3f..b07983be 100644 --- a/src/thirdparty/mbedtls/include/mbedtls/asn1.h +++ b/src/thirdparty/mbedtls/include/mbedtls/asn1.h @@ -410,7 +410,7 @@ int mbedtls_asn1_get_bitstring_null(unsigned char **p, int mbedtls_asn1_get_sequence_of(unsigned char **p, const unsigned char *end, mbedtls_asn1_sequence *cur, - int tag); + const int tag); /** * \brief Free a heap-allocated linked list presentation of * an ASN.1 sequence, including the first element.