From 3a94b192e7c26a9092dae24d992de50398beaa1a Mon Sep 17 00:00:00 2001 From: jsing Date: Wed, 14 Feb 2018 16:32:06 +0000 Subject: [PATCH] Start providing parts of the OpenSSL 1.1 API. This will ease the burden on ports and others trying to make software work with LibreSSL, while avoiding #ifdef mazes. Note that we are not removing 1.0.1 API or making things opaque, hence software written to use the older APIs will continue to work, as will software written to use the 1.1 API (as more functionality become available). Discussed at length with deraadt@ and others. --- lib/libcrypto/Symbols.list | 2 ++ lib/libcrypto/crypto.h | 10 +++++++++- lib/libcrypto/cversion.c | 14 +++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index 6dfd569e1fd..0c437dc75f3 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -1832,6 +1832,8 @@ OTHERNAME_new OpenSSLDie OpenSSL_add_all_ciphers OpenSSL_add_all_digests +OpenSSL_version +OpenSSL_version_num PBE2PARAM_free PBE2PARAM_it PBE2PARAM_new diff --git a/lib/libcrypto/crypto.h b/lib/libcrypto/crypto.h index 068415f693b..90c2875349e 100644 --- a/lib/libcrypto/crypto.h +++ b/lib/libcrypto/crypto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.h,v 1.41 2017/04/29 21:48:43 jsing Exp $ */ +/* $OpenBSD: crypto.h,v 1.42 2018/02/14 16:32:06 jsing Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -330,6 +330,14 @@ int CRYPTO_is_mem_check_on(void); CRYPTO_malloc_locked((int)num,__FILE__,__LINE__) #define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr) +const char *OpenSSL_version(int type); +#define OPENSSL_VERSION 0 +#define OPENSSL_CFLAGS 1 +#define OPENSSL_BUILT_ON 2 +#define OPENSSL_PLATFORM 3 +#define OPENSSL_DIR 4 +#define OPENSSL_ENGINES_DIR 5 +unsigned long OpenSSL_version_num(void); const char *SSLeay_version(int type); unsigned long SSLeay(void); diff --git a/lib/libcrypto/cversion.c b/lib/libcrypto/cversion.c index 7ffa80ec264..b8b1a22a8a8 100644 --- a/lib/libcrypto/cversion.c +++ b/lib/libcrypto/cversion.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cversion.c,v 1.15 2014/07/11 11:42:28 jsing Exp $ */ +/* $OpenBSD: cversion.c,v 1.16 2018/02/14 16:32:06 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -84,3 +84,15 @@ SSLeay(void) { return (SSLEAY_VERSION_NUMBER); } + +const char * +OpenSSL_version(int t) +{ + return SSLeay_version(t); +} + +unsigned long +OpenSSL_version_num(void) +{ + return SSLeay(); +} -- 2.20.1