summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2014-01-17 17:32:30 +1100
committerDarren Tucker <dtucker@zip.com.au>2014-01-17 17:32:30 +1100
commitd23a91ffb289d3553a58b7a60cec39fba9f0f506 (patch)
tree458da6bcc5e923cb1976f3d882061185548ed935
parent868ea1ea1c1bfdbee5dbad78f81999c5983ecf31 (diff)
- (dtucker) [configure.ac digest.c openbsd-compat/openssl-compat.c
openbsd-compat/openssl-compat.h] Add compatibility layer for older openssl versions. ok djm@
-rw-r--r--ChangeLog3
-rw-r--r--configure.ac8
-rw-r--r--digest.c2
-rw-r--r--openbsd-compat/openssl-compat.c30
-rw-r--r--openbsd-compat/openssl-compat.h18
5 files changed, 57 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1bf7e0dca..be044b947 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,9 @@
28 [sandbox-systrace.c ssh-sandbox.h sshd.c] Support preauth sandboxing 28 [sandbox-systrace.c ssh-sandbox.h sshd.c] Support preauth sandboxing
29 using the Capsicum API introduced in FreeBSD 10. Patch by Dag-Erling 29 using the Capsicum API introduced in FreeBSD 10. Patch by Dag-Erling
30 Smorgrav, updated by Loganaden Velvindron @ AfriNIC; ok dtucker@ 30 Smorgrav, updated by Loganaden Velvindron @ AfriNIC; ok dtucker@
31 - (dtucker) [configure.ac digest.c openbsd-compat/openssl-compat.c
32 openbsd-compat/openssl-compat.h] Add compatibility layer for older
33 openssl versions. ok djm@
31 34
3220140118 3520140118
33 - (djm) OpenBSD CVS Sync 36 - (djm) OpenBSD CVS Sync
diff --git a/configure.ac b/configure.ac
index f14e177fc..2ac3afa38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
1# $Id: configure.ac,v 1.550 2014/01/17 05:47:04 djm Exp $ 1# $Id: configure.ac,v 1.551 2014/01/17 06:32:30 dtucker Exp $
2# 2#
3# Copyright (c) 1999-2004 Damien Miller 3# Copyright (c) 1999-2004 Damien Miller
4# 4#
@@ -15,7 +15,7 @@
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 16
17AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) 17AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
18AC_REVISION($Revision: 1.550 $) 18AC_REVISION($Revision: 1.551 $)
19AC_CONFIG_SRCDIR([ssh.c]) 19AC_CONFIG_SRCDIR([ssh.c])
20AC_LANG([C]) 20AC_LANG([C])
21 21
@@ -2357,6 +2357,10 @@ AC_LINK_IFELSE(
2357AC_CHECK_FUNCS([ \ 2357AC_CHECK_FUNCS([ \
2358 BN_is_prime_ex \ 2358 BN_is_prime_ex \
2359 DSA_generate_parameters_ex \ 2359 DSA_generate_parameters_ex \
2360 EVP_DigestInit_ex \
2361 EVP_DigestFinal_ex \
2362 EVP_MD_CTX_init \
2363 EVP_MD_CTX_cleanup \
2360 HMAC_CTX_init \ 2364 HMAC_CTX_init \
2361 RSA_generate_key_ex \ 2365 RSA_generate_key_ex \
2362 RSA_get_default_method \ 2366 RSA_get_default_method \
diff --git a/digest.c b/digest.c
index 7d7f73579..d6004e7de 100644
--- a/digest.c
+++ b/digest.c
@@ -24,6 +24,8 @@
24 24
25#include <openssl/evp.h> 25#include <openssl/evp.h>
26 26
27#include "openbsd-compat/openssl-compat.h"
28
27#include "buffer.h" 29#include "buffer.h"
28#include "digest.h" 30#include "digest.h"
29 31
diff --git a/openbsd-compat/openssl-compat.c b/openbsd-compat/openssl-compat.c
index 5189cab61..52c7183f1 100644
--- a/openbsd-compat/openssl-compat.c
+++ b/openbsd-compat/openssl-compat.c
@@ -1,4 +1,4 @@
1/* $Id: openssl-compat.c,v 1.14 2011/05/10 01:13:38 dtucker Exp $ */ 1/* $Id: openssl-compat.c,v 1.15 2014/01/17 06:32:31 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2005 Darren Tucker <dtucker@zip.com.au> 4 * Copyright (c) 2005 Darren Tucker <dtucker@zip.com.au>
@@ -59,6 +59,34 @@ ssh_EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *evp)
59} 59}
60#endif 60#endif
61 61
62#ifndef HAVE_EVP_DIGESTINIT_EX
63int
64EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *md, void *engine)
65{
66 if (engine != NULL)
67 fatal("%s: ENGINE is not supported", __func__);
68# ifdef OPENSSL_EVP_DIGESTUPDATE_VOID
69 EVP_DigestInit(ctx, md);
70 return 1;
71# else
72 return EVP_DigestInit(ctx, md);
73# endif
74}
75#endif
76
77#ifndef HAVE_EVP_DISESTFINAL_EX
78int
79EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s)
80{
81# ifdef OPENSSL_EVP_DIGESTUPDATE_VOID
82 EVP_DigestFinal(ctx, md, s);
83 return 1;
84# else
85 return EVP_DigestFinal(ctx, md, s);
86# endif
87}
88#endif
89
62#ifdef OPENSSL_EVP_DIGESTUPDATE_VOID 90#ifdef OPENSSL_EVP_DIGESTUPDATE_VOID
63int 91int
64ssh_EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt) 92ssh_EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt)
diff --git a/openbsd-compat/openssl-compat.h b/openbsd-compat/openssl-compat.h
index e7439b4e7..021ea98f5 100644
--- a/openbsd-compat/openssl-compat.h
+++ b/openbsd-compat/openssl-compat.h
@@ -1,4 +1,4 @@
1/* $Id: openssl-compat.h,v 1.24 2013/02/12 00:00:40 djm Exp $ */ 1/* $Id: openssl-compat.h,v 1.25 2014/01/17 06:32:31 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2005 Darren Tucker <dtucker@zip.com.au> 4 * Copyright (c) 2005 Darren Tucker <dtucker@zip.com.au>
@@ -148,6 +148,14 @@ int DSA_generate_parameters_ex(DSA *, int, const unsigned char *, int, int *,
148int RSA_generate_key_ex(RSA *, int, BIGNUM *, void *); 148int RSA_generate_key_ex(RSA *, int, BIGNUM *, void *);
149# endif 149# endif
150 150
151# ifndef HAVE_EVP_DIGESTINIT_EX
152int EVP_DigestInit_ex(EVP_MD_CTX *, const EVP_MD *, void *);
153# endif
154
155# ifndef HAVE_EVP_DISESTFINAL_EX
156int EVP_DigestFinal_ex(EVP_MD_CTX *, unsigned char *, unsigned int *);
157# endif
158
151int ssh_EVP_CipherInit(EVP_CIPHER_CTX *, const EVP_CIPHER *, unsigned char *, 159int ssh_EVP_CipherInit(EVP_CIPHER_CTX *, const EVP_CIPHER *, unsigned char *,
152 unsigned char *, int); 160 unsigned char *, int);
153int ssh_EVP_Cipher(EVP_CIPHER_CTX *, char *, char *, int); 161int ssh_EVP_Cipher(EVP_CIPHER_CTX *, char *, char *, int);
@@ -158,5 +166,13 @@ void ssh_OpenSSL_add_all_algorithms(void);
158# define HMAC_CTX_init(a) 166# define HMAC_CTX_init(a)
159# endif 167# endif
160 168
169# ifndef HAVE_EVP_MD_CTX_INIT
170# define EVP_MD_CTX_init(a)
171# endif
172
173# ifndef HAVE_EVP_MD_CTX_CLEANUP
174# define EVP_MD_CTX_cleanup(a)
175# endif
176
161#endif /* SSH_DONT_OVERLOAD_OPENSSL_FUNCS */ 177#endif /* SSH_DONT_OVERLOAD_OPENSSL_FUNCS */
162 178