From b67d1c3350cb5ebce3d8cc42491ccf21a0e2e482 Mon Sep 17 00:00:00 2001
From: jsing <>
Date: Wed, 14 Feb 2018 16:32:06 +0000
Subject: 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.
---
 src/lib/libcrypto/Symbols.list |  2 ++
 src/lib/libcrypto/crypto.h     | 10 +++++++++-
 src/lib/libcrypto/cversion.c   | 14 +++++++++++++-
 3 files changed, 24 insertions(+), 2 deletions(-)

(limited to 'src/lib')

diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list
index 6dfd569e1f..0c437dc75f 100644
--- a/src/lib/libcrypto/Symbols.list
+++ b/src/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/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index 068415f693..90c2875349 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/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/src/lib/libcrypto/cversion.c b/src/lib/libcrypto/cversion.c
index 7ffa80ec26..b8b1a22a8a 100644
--- a/src/lib/libcrypto/cversion.c
+++ b/src/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();
+}
-- 
cgit v1.2.3-55-g6feb