OpenDDS  Snapshot(2023/04/28-20:55)
OpenSSL_legacy.h
Go to the documentation of this file.
1 /*
2  * Distributed under the OpenDDS License.
3  * See: http://www.opendds.org/license.html
4  */
5 
6 /**
7  * Macros and other helpers to allow OpenDDS Security library to work with
8  * OpenSSL 1.0, as it was written to use OpenSSL 1.1.
9  */
10 
11 #ifndef OPENDDS_DCPS_SECURITY_OPENSSL_LEGACY_H
12 #define OPENDDS_DCPS_SECURITY_OPENSSL_LEGACY_H
13 
14 #if OPENSSL_VERSION_NUMBER < 0x10100000L
15 
16 #define OPENSSL_V_1_0
17 
18 #define EVP_MD_CTX_new EVP_MD_CTX_create
19 #define EVP_MD_CTX_free EVP_MD_CTX_destroy
20 #define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_CCM_GET_TAG
21 
22 inline int RSA_bits(const RSA* r)
23 {
24  return BN_num_bits(r->n);
25 }
26 
27 inline void DH_get0_key(const DH* dh, const BIGNUM** pub_key, const BIGNUM** priv_key)
28 {
29  if (pub_key) {
30  *pub_key = dh->pub_key;
31  }
32  if (priv_key) {
33  *priv_key = dh->priv_key;
34  }
35 }
36 
37 #elif OPENSSL_VERSION_NUMBER < 0x30000000L
38 #define OPENSSL_V_1_1
39 #else
40 #define OPENSSL_V_3_0
41 #endif // OPENSSL_VERSION_NUMBER < 0x10100000L
42 
43 #endif
void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
int RSA_bits(const RSA *r)