9892c8c5b35907f0e85de7250a3cfae970cb3b38
[feed/packages.git] / libs / libssh / patches / 0013-crypto-Fix-compilation-for-OpenSSL-without-deprecate.patch
1 From 8349ff1ec3d001aa85cc94a9004509cca8ebf036 Mon Sep 17 00:00:00 2001
2 From: Rosen Penev <rosenp@gmail.com>
3 Date: Wed, 7 Nov 2018 17:17:53 -0800
4 Subject: [PATCH] crypto: Fix compilation for OpenSSL without deprecated
5 APIs
6
7 Added missing bn.h include.
8
9 Made engine.h include conditional, otherwise it would fail.
10
11 DSA_generate_parameters was deprecated long before 1.1.0.
12
13 Signed-off-by: Rosen Penev <rosenp@gmail.com>
14 ---
15 src/libcrypto-compat.c | 5 ++++-
16 src/libcrypto-compat.h | 1 +
17 src/pki_crypto.c | 2 +-
18 3 files changed, 6 insertions(+), 2 deletions(-)
19
20 diff --git a/src/libcrypto-compat.c b/src/libcrypto-compat.c
21 index 4b1f36a5..b8b4f11a 100644
22 --- a/src/libcrypto-compat.c
23 +++ b/src/libcrypto-compat.c
24 @@ -8,9 +8,12 @@
25 */
26
27 #include <string.h>
28 -#include <openssl/engine.h>
29 #include "libcrypto-compat.h"
30
31 +#ifndef OPENSSL_NO_ENGINE
32 +#include <openssl/engine.h>
33 +#endif
34 +
35 static void *OPENSSL_zalloc(size_t num)
36 {
37 void *ret = OPENSSL_malloc(num);
38 diff --git a/src/libcrypto-compat.h b/src/libcrypto-compat.h
39 index 21542c65..00e4f2a3 100644
40 --- a/src/libcrypto-compat.h
41 +++ b/src/libcrypto-compat.h
42 @@ -10,6 +10,7 @@
43 #include <openssl/dh.h>
44 #include <openssl/evp.h>
45 #include <openssl/hmac.h>
46 +#include <openssl/bn.h>
47
48 int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
49 int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
50 diff --git a/src/pki_crypto.c b/src/pki_crypto.c
51 index d9f7753a..c1aac409 100644
52 --- a/src/pki_crypto.c
53 +++ b/src/pki_crypto.c
54 @@ -451,7 +451,7 @@ int pki_key_generate_rsa(ssh_key key, int parameter){
55
56 int pki_key_generate_dss(ssh_key key, int parameter){
57 int rc;
58 -#if OPENSSL_VERSION_NUMBER > 0x10100000L
59 +#if OPENSSL_VERSION_NUMBER > 0x00908000L
60 key->dsa = DSA_new();
61 if (key->dsa == NULL) {
62 return SSH_ERROR;
63 --
64 2.19.1
65