1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

crypto: Fix compilation for OpenSSL without deprecated APIs

Added missing bn.h include.

Made engine.h include conditional, otherwise it would fail.

DSA_generate_parameters was deprecated long before 1.1.0.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2018-11-07 18:07:30 -08:00
committed by Andreas Schneider
parent aa899f8ec0
commit 61cac32288
3 changed files with 6 additions and 2 deletions

View File

@@ -10,9 +10,12 @@
#include "config.h" #include "config.h"
#include <string.h> #include <string.h>
#include <openssl/engine.h>
#include "libcrypto-compat.h" #include "libcrypto-compat.h"
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
static void *OPENSSL_zalloc(size_t num) static void *OPENSSL_zalloc(size_t num)
{ {
void *ret = OPENSSL_malloc(num); void *ret = OPENSSL_malloc(num);

View File

@@ -10,6 +10,7 @@
#include <openssl/dh.h> #include <openssl/dh.h>
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/hmac.h> #include <openssl/hmac.h>
#include <openssl/bn.h>
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);

View File

@@ -516,7 +516,7 @@ int pki_key_generate_rsa(ssh_key key, int parameter){
int pki_key_generate_dss(ssh_key key, int parameter){ int pki_key_generate_dss(ssh_key key, int parameter){
int rc; int rc;
#if OPENSSL_VERSION_NUMBER > 0x10100000L #if OPENSSL_VERSION_NUMBER > 0x00908000L
key->dsa = DSA_new(); key->dsa = DSA_new();
if (key->dsa == NULL) { if (key->dsa == NULL) {
return SSH_ERROR; return SSH_ERROR;