crypto_openssl_mgt.h (2340B)
1 /* Copyright (c) 2001, Matej Pfajfar. 2 * Copyright (c) 2001-2004, Roger Dingledine. 3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. 4 * Copyright (c) 2007-2021, The Tor Project, Inc. */ 5 /* See LICENSE for licensing information */ 6 7 /** 8 * \file crypto_openssl_mgt.h 9 * 10 * \brief Headers for crypto_openssl_mgt.c 11 **/ 12 13 #ifndef TOR_CRYPTO_OPENSSL_H 14 #define TOR_CRYPTO_OPENSSL_H 15 16 #include "orconfig.h" 17 18 #ifdef ENABLE_OPENSSL 19 #include <openssl/opensslv.h> 20 /* 21 Macro to create an arbitrary OpenSSL version number as used by 22 OPENSSL_VERSION_NUMBER or SSLeay(), since the actual numbers are a bit hard 23 to read. 24 25 Don't use this directly, instead use one of the other OPENSSL_V macros 26 below. 27 28 The format is: 4 bits major, 8 bits minor, 8 bits fix, 8 bits patch, 4 bit 29 status. 30 */ 31 #define OPENSSL_VER(a,b,c,d,e) \ 32 (((a)<<28) | \ 33 ((b)<<20) | \ 34 ((c)<<12) | \ 35 ((d)<< 4) | \ 36 (e)) 37 /** An openssl release number. For example, OPENSSL_V(0,9,8,'j') is the 38 * version for the released version of 0.9.8j */ 39 #define OPENSSL_V(a,b,c,d) \ 40 OPENSSL_VER((a),(b),(c),(d)-'a'+1,0xf) 41 /** An openssl release number for the first release in the series. For 42 * example, OPENSSL_V_NOPATCH(1,0,0) is the first released version of OpenSSL 43 * 1.0.0. */ 44 #define OPENSSL_V_NOPATCH(a,b,c) \ 45 OPENSSL_VER((a),(b),(c),0,0xf) 46 /** The first version that would occur for any alpha or beta in an openssl 47 * series. For example, OPENSSL_V_SERIES(0,9,8) is greater than any released 48 * 0.9.7, and less than any released 0.9.8. */ 49 #define OPENSSL_V_SERIES(a,b,c) \ 50 OPENSSL_VER((a),(b),(c),0,0) 51 52 void crypto_openssl_log_errors(int severity, const char *doing); 53 54 /* global openssl state */ 55 const char * crypto_openssl_get_version_str(void); 56 const char * crypto_openssl_get_header_version_str(void); 57 58 void crypto_openssl_early_init(void); 59 int crypto_openssl_late_init(int useAccel, const char *accelName, 60 const char *accelDir); 61 62 void crypto_openssl_thread_cleanup(void); 63 void crypto_openssl_global_cleanup(void); 64 65 #endif /* defined(ENABLE_OPENSSL) */ 66 67 #endif /* !defined(TOR_CRYPTO_OPENSSL_H) */