1 /* 2 * %CopyrightBegin% 3 * 4 * Copyright Ericsson AB 2012-2017. All Rights Reserved. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 * %CopyrightEnd% 19 */ 20 21 #include <openssl/crypto.h> 22 #ifdef NEED_EVP_COMPATIBILITY_FUNCTIONS 23 # define CCB_FILE_LINE_ARGS 24 #else 25 # define CCB_FILE_LINE_ARGS , const char *file, int line 26 #endif 27 28 struct crypto_callbacks 29 { 30 size_t sizeof_me; 31 32 void* (*crypto_alloc)(size_t size CCB_FILE_LINE_ARGS); 33 void* (*crypto_realloc)(void* ptr, size_t size CCB_FILE_LINE_ARGS); 34 void (*crypto_free)(void* ptr CCB_FILE_LINE_ARGS); 35 36 /* openssl callbacks */ 37 #ifdef OPENSSL_THREADS 38 void (*locking_function)(int mode, int n, const char *file, int line); 39 unsigned long (*id_function)(void); 40 struct CRYPTO_dynlock_value* (*dyn_create_function)(const char *file, 41 int line); 42 void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value* ptr, 43 const char *file, int line); 44 void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *ptr, 45 const char *file, int line); 46 #endif /* OPENSSL_THREADS */ 47 }; 48 49 typedef struct crypto_callbacks* get_crypto_callbacks_t(int nlocks); 50 51 #ifndef HAVE_DYNAMIC_CRYPTO_LIB 52 struct crypto_callbacks* get_crypto_callbacks(int nlocks); 53 #endif 54 55