1 From 69176c8602e29f4bd30457240374800d88dc39ed Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sat, 14 Apr 2018 22:39:34 +0200
4 Subject: [PATCH] rsa-sign: add support for libressl
7 lib/rsa/rsa-sign.c | 15 +++++++++------
8 1 file changed, 9 insertions(+), 6 deletions(-)
10 --- a/lib/rsa/rsa-sign.c
11 +++ b/lib/rsa/rsa-sign.c
13 #define HAVE_ERR_REMOVE_THREAD_STATE
16 -#if OPENSSL_VERSION_NUMBER < 0x10100000L
17 +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
18 + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL)
19 static void RSA_get0_key(const RSA *r,
20 const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
22 @@ -300,7 +301,8 @@ static int rsa_init(void)
26 -#if OPENSSL_VERSION_NUMBER < 0x10100000L
27 +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
28 + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL)
29 ret = SSL_library_init();
31 ret = OPENSSL_init_ssl(0, NULL);
32 @@ -309,7 +311,7 @@ static int rsa_init(void)
33 fprintf(stderr, "Failure to init SSL library\n");
36 -#if OPENSSL_VERSION_NUMBER < 0x10100000L
37 +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
38 SSL_load_error_strings();
40 OpenSSL_add_all_algorithms();
41 @@ -355,7 +357,7 @@ err_set_rsa:
45 -#if OPENSSL_VERSION_NUMBER < 0x10100000L
46 +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
50 @@ -363,7 +365,7 @@ err_engine_by_id:
52 static void rsa_remove(void)
54 -#if OPENSSL_VERSION_NUMBER < 0x10100000L
55 +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
56 CRYPTO_cleanup_all_ex_data();
58 #ifdef HAVE_ERR_REMOVE_THREAD_STATE
59 @@ -433,7 +435,8 @@ static int rsa_sign_with_key(RSA *rsa, s
60 ret = rsa_err("Could not obtain signature");
63 - #if OPENSSL_VERSION_NUMBER < 0x10100000L
64 + #if OPENSSL_VERSION_NUMBER < 0x10100000L || \
65 + defined(LIBRESSL_VERSION_NUMBER)
66 EVP_MD_CTX_cleanup(context);
68 EVP_MD_CTX_reset(context);