xref: /aosp_15_r20/external/vboot_reference/host/include/openssl_compat.h (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1 /* Copyright 2017 The ChromiumOS Authors
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 #ifndef VBOOT_REFERENCE_OPENSSL_COMPAT_H_
7 #define VBOOT_REFERENCE_OPENSSL_COMPAT_H_
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif  /* __cplusplus */
12 
13 #include <openssl/rsa.h>
14 
15 #if OPENSSL_VERSION_NUMBER < 0x10100000L
16 
RSA_get0_key(const RSA * rsa,const BIGNUM ** n,const BIGNUM ** e,const BIGNUM ** d)17 static inline void RSA_get0_key(const RSA *rsa, const BIGNUM **n,
18 				const BIGNUM **e, const BIGNUM **d)
19 {
20 	if (n != NULL)
21 		*n = rsa->n;
22 	if (e != NULL)
23 		*e = rsa->e;
24 	if (d != NULL)
25 		*d = rsa->d;
26 }
27 
28 #endif  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
29 
30 #ifdef __cplusplus
31 }
32 #endif  /* __cplusplus */
33 
34 #endif  /* VBOOT_REFERENCE_OPENSSL_COMPAT_H_ */
35