From e56c806dff0ae66f30d26ebdb514f9d08886961b Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 3 Mar 2010 14:34:56 +0100 Subject: [PATCH] Fix OpenSSL 1.x problem in crypto.c on Fedora 12 --- bacula/autoconf/configure.in | 3 ++- bacula/src/lib/crypto.c | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 6c478d1faa..fbe2d5fe3a 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -1208,6 +1208,8 @@ fi if test "$support_crypto" = "no"; then OPENSSL_LIBS="" OPENSSL_INC="" +else + AC_CHECK_LIB(ssl, EVP_PKEY_encrypt_old, AC_DEFINE(HAVE_OPENSSLv1, 1, [Set if have OpenSSL version 1.x])) fi AC_MSG_RESULT([$support_tls]) @@ -3289,4 +3291,3 @@ then echo " upgrade it in order to avoid problems with Batch insert mode" echo fi - diff --git a/bacula/src/lib/crypto.c b/bacula/src/lib/crypto.c index 25b1d44a5c..fb52c254b9 100644 --- a/bacula/src/lib/crypto.c +++ b/bacula/src/lib/crypto.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2005-2007 Free Software Foundation Europe e.V. + Copyright (C) 2005-2010 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -30,8 +30,6 @@ * * Author: Landon Fuller * - * Version $Id$ - * * This file was contributed to the Bacula project by Landon Fuller. * * Landon Fuller has been granted a perpetual, worldwide, non-exclusive, @@ -49,6 +47,15 @@ #include "jcr.h" #include +/** + * For OpenSSL version 1.x, EVP_PKEY_encrypt no longer + * exists. It was not an official API. + */ +#ifdef HAVE_OPENSSLv1 +#define EVP_PKEY_encrypt EVP_PKEY_encrypt_old +#define EVP_PKEY_decrypt EVP_PKEY_decrypt_old +#endif + /* * Bacula ASN.1 Syntax * @@ -309,7 +316,7 @@ typedef struct PEM_CB_Context { */ static ASN1_OCTET_STRING *openssl_cert_keyid(X509 *cert) { X509_EXTENSION *ext; - X509V3_EXT_METHOD *method; + const X509V3_EXT_METHOD *method; ASN1_OCTET_STRING *keyid; int i; #if (OPENSSL_VERSION_NUMBER >= 0x0090800FL) -- 2.39.5