lhash.h (2075B)
1 /* lhash.h 2 * 3 * Copyright (C) 2006-2025 wolfSSL Inc. 4 * 5 * This file is part of wolfSSL. 6 * 7 * wolfSSL is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * wolfSSL is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA 20 */ 21 22 /* lhash.h for openSSL */ 23 24 #ifndef WOLFSSL_lhash_H_ 25 #define WOLFSSL_lhash_H_ 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 #include <wolfssl/openssl/ssl.h> 32 33 #ifdef OPENSSL_ALL 34 #define IMPLEMENT_LHASH_HASH_FN(name, type) \ 35 unsigned long wolfSSL_##name##_LHASH_HASH(const void *arg) \ 36 { \ 37 const type *a = arg; \ 38 return name##_hash(a); \ 39 } 40 #define IMPLEMENT_LHASH_COMP_FN(name, type) \ 41 int wolfSSL_##name##_LHASH_COMP(const void *p1, const void *p2) \ 42 { \ 43 const type *_p1 = p1; \ 44 const type *_p2 = p2; \ 45 return name##_cmp(_p1, _p2); \ 46 } 47 48 #define LHASH_HASH_FN(name) wolfSSL_##name##_LHASH_HASH 49 #define LHASH_COMP_FN(name) wolfSSL_##name##_LHASH_COMP 50 51 WOLFSSL_API unsigned long wolfSSL_LH_strhash(const char *str); 52 53 WOLFSSL_API void *wolfSSL_lh_retrieve(WOLFSSL_STACK *sk, void *data); 54 55 #define lh_strhash wolfSSL_LH_strhash 56 57 #endif 58 59 60 #ifdef __cplusplus 61 } /* extern "C" */ 62 #endif 63 64 #endif /* WOLFSSL_lhash_H_ */