df995a003d
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libssh?expand=0&rev=d54088acd3a6df64c2b48b502a614e33
72 lines
3.0 KiB
Diff
72 lines
3.0 KiB
Diff
From 3daf1760a18c091159338fc9077fa71bfbd726a1 Mon Sep 17 00:00:00 2001
|
|
From: Andreas Schneider <asn@cryptomilk.org>
|
|
Date: Sun, 6 Nov 2016 15:43:31 +0100
|
|
Subject: [PATCH] cmake: Use configure check for CRYPTO_ctr128_encrypt
|
|
|
|
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
|
|
---
|
|
ConfigureChecks.cmake | 4 ++++
|
|
config.h.cmake | 3 +++
|
|
src/libcrypto.c | 6 +++---
|
|
3 files changed, 10 insertions(+), 3 deletions(-)
|
|
|
|
Index: libssh-0.7.5/ConfigureChecks.cmake
|
|
===================================================================
|
|
--- libssh-0.7.5.orig/ConfigureChecks.cmake 2017-09-15 11:35:09.493600110 +0200
|
|
+++ libssh-0.7.5/ConfigureChecks.cmake 2017-09-15 11:35:09.505600299 +0200
|
|
@@ -95,6 +95,10 @@ if (OPENSSL_FOUND)
|
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
|
check_function_exists(CRYPTO_THREADID_set_callback HAVE_OPENSSL_CRYPTO_THREADID_SET_CALLBACK)
|
|
+
|
|
+ set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
|
+ set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
|
+ check_function_exists(CRYPTO_ctr128_encrypt HAVE_OPENSSL_CRYPTO_CTR128_ENCRYPT)
|
|
endif()
|
|
|
|
if (CMAKE_HAVE_PTHREAD_H)
|
|
Index: libssh-0.7.5/config.h.cmake
|
|
===================================================================
|
|
--- libssh-0.7.5.orig/config.h.cmake 2017-09-15 11:35:09.493600110 +0200
|
|
+++ libssh-0.7.5/config.h.cmake 2017-09-15 11:35:09.505600299 +0200
|
|
@@ -79,6 +79,9 @@
|
|
/* Define to 1 if you have the `CRYPTO_THREADID_set_callback' function. */
|
|
#cmakedefine HAVE_OPENSSL_CRYPTO_THREADID_SET_CALLBACK 1
|
|
|
|
+/* Define to 1 if you have the `CRYPTO_ctr128_encrypt' function. */
|
|
+#cmakedefine HAVE_OPENSSL_CRYPTO_CTR128_ENCRYPT 1
|
|
+
|
|
/* Define to 1 if you have the `snprintf' function. */
|
|
#cmakedefine HAVE_SNPRINTF 1
|
|
|
|
Index: libssh-0.7.5/src/libcrypto.c
|
|
===================================================================
|
|
--- libssh-0.7.5.orig/src/libcrypto.c 2017-09-15 11:35:09.473599793 +0200
|
|
+++ libssh-0.7.5/src/libcrypto.c 2017-09-15 11:35:09.505600299 +0200
|
|
@@ -41,6 +41,8 @@
|
|
#include <openssl/dsa.h>
|
|
#include <openssl/rsa.h>
|
|
#include <openssl/hmac.h>
|
|
+#include <openssl/evp.h>
|
|
+#include <openssl/modes.h>
|
|
#include <openssl/opensslv.h>
|
|
#include <openssl/rand.h>
|
|
#include "libcrypto-compat.h"
|
|
@@ -458,11 +460,12 @@ static void aes_ctr128_encrypt(struct ss
|
|
* Same for num, which is being used to store the current offset in blocksize in CTR
|
|
* function.
|
|
*/
|
|
-# if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
|
- CRYPTO_ctr128_encrypt(in, out, len, &cipher->aes_key->key, cipher->aes_key->IV, tmp_buffer, &num, (block128_f)AES_encrypt);
|
|
-# else
|
|
+#ifdef HAVE_OPENSSL_CRYPTO_CTR128_ENCRYPT
|
|
+ CRYPTO_ctr128_encrypt(in, out, len, cipher->key, cipher->IV, tmp_buffer, &num, (block128_f)AES_encrypt);
|
|
+#else
|
|
+
|
|
AES_ctr128_encrypt(in, out, len, cipher->key, cipher->IV, tmp_buffer, &num);
|
|
-# endif /* OPENSSL_VERSION_NUMBER >= 0x10100000L */
|
|
+#endif /* HAVE_OPENSSL_CRYPTO_CTR128_ENCRYPT */
|
|
}
|
|
#endif /* BROKEN_AES_CTR */
|
|
#endif /* HAS_AES */
|