l8w8jwt
Loading...
Searching...
No Matches
util.h
Go to the documentation of this file.
1/*
2 Copyright 2020 Raphael Beck
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
23#ifndef L8W8JWT_UTIL_H
24#define L8W8JWT_UTIL_H
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include <stdlib.h>
31#include <stddef.h>
32#include "version.h"
33
44L8W8JWT_API int l8w8jwt_hexstr2bin(const char* hexstr, size_t hexstr_length, unsigned char* output, size_t output_size, size_t* output_length);
45
53L8W8JWT_API int l8w8jwt_strncmpic(const char* str1, const char* str2, size_t n);
54
62L8W8JWT_API int l8w8jwt_memcmp(const void* mem1, const void* mem2, size_t n);
63
64#ifndef L8W8JWT_PLATFORM_MALLOC_ALT
69#define L8W8JWT_PLATFORM_MALLOC_ALT 0
70#endif
71
72#ifndef L8W8JWT_PLATFORM_CALLOC_ALT
77#define L8W8JWT_PLATFORM_CALLOC_ALT 0
78#endif
79
80#ifndef L8W8JWT_PLATFORM_REALLOC_ALT
85#define L8W8JWT_PLATFORM_REALLOC_ALT 0
86#endif
87
88#if L8W8JWT_PLATFORM_MALLOC_ALT
89extern void *(*l8w8jwt_malloc) (size_t size);
90#else
91#define l8w8jwt_malloc malloc
92#endif
93
94#if L8W8JWT_PLATFORM_CALLOC_ALT
95extern void *(*l8w8jwt_calloc) (size_t nmemb, size_t size);
96#else
97#define l8w8jwt_calloc calloc
98#endif
99
100#if L8W8JWT_PLATFORM_REALLOC_ALT
101extern void *(*l8w8jwt_realloc) (void *ptr, size_t size);
102#else
103#define l8w8jwt_realloc realloc
104#endif
105
106#ifdef __cplusplus
107} // extern "C"
108#endif
109
110#endif // L8W8JWT_UTIL_H
L8W8JWT_API int l8w8jwt_strncmpic(const char *str1, const char *str2, size_t n)
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_memcmp(const void *mem1, const void *mem2, size_t n)
l8w8jwt version checking.