summaryrefslogtreecommitdiff
path: root/src/lib/libssl
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl')
-rw-r--r--src/lib/libssl/Makefile7
-rw-r--r--src/lib/libssl/bio_ssl.c5
-rw-r--r--src/lib/libssl/hidden/openssl/ssl.h31
-rw-r--r--src/lib/libssl/hidden/ssl_namespace.h37
4 files changed, 78 insertions, 2 deletions
diff --git a/src/lib/libssl/Makefile b/src/lib/libssl/Makefile
index 1788cd75a3..a6ee26a667 100644
--- a/src/lib/libssl/Makefile
+++ b/src/lib/libssl/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.77 2022/08/17 07:39:19 jsing Exp $ 1# $OpenBSD: Makefile,v 1.78 2022/11/11 11:25:18 beck Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4.ifndef NOMAN 4.ifndef NOMAN
@@ -16,6 +16,9 @@ CFLAGS+= -Wall -Wundef
16CFLAGS+= -Werror 16CFLAGS+= -Werror
17.endif 17.endif
18CFLAGS+= -DLIBRESSL_INTERNAL 18CFLAGS+= -DLIBRESSL_INTERNAL
19.ifdef NAMESPACE
20CFLAGS+= -DLIBRESSL_NAMESPACE
21.endif
19.ifdef TLS1_3 22.ifdef TLS1_3
20CFLAGS+= -DLIBRESSL_HAS_TLS1_3_CLIENT 23CFLAGS+= -DLIBRESSL_HAS_TLS1_3_CLIENT
21CFLAGS+= -DLIBRESSL_HAS_TLS1_3_SERVER 24CFLAGS+= -DLIBRESSL_HAS_TLS1_3_SERVER
@@ -24,7 +27,9 @@ CFLAGS+= -DLIBRESSL_HAS_TLS1_3_SERVER
24CFLAGS+= -DTLS13_DEBUG 27CFLAGS+= -DTLS13_DEBUG
25.endif 28.endif
26CFLAGS+= -I${.CURDIR} 29CFLAGS+= -I${.CURDIR}
30CFLAGS+= -I${.CURDIR}/../libcrypto/hidden
27CFLAGS+= -I${.CURDIR}/../libcrypto/bio 31CFLAGS+= -I${.CURDIR}/../libcrypto/bio
32CFLAGS+= -I${.CURDIR}/hidden
28 33
29LDADD+= -L${BSDOBJDIR}/lib/libcrypto -lcrypto 34LDADD+= -L${BSDOBJDIR}/lib/libcrypto -lcrypto
30 35
diff --git a/src/lib/libssl/bio_ssl.c b/src/lib/libssl/bio_ssl.c
index 04dd22f16d..d6974cdb24 100644
--- a/src/lib/libssl/bio_ssl.c
+++ b/src/lib/libssl/bio_ssl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_ssl.c,v 1.35 2022/10/05 21:16:14 tb Exp $ */ 1/* $OpenBSD: bio_ssl.c,v 1.36 2022/11/11 11:25:18 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -103,6 +103,7 @@ BIO_f_ssl(void)
103{ 103{
104 return (&methods_sslp); 104 return (&methods_sslp);
105} 105}
106LSSL_ALIAS(BIO_f_ssl)
106 107
107static int 108static int
108ssl_new(BIO *bi) 109ssl_new(BIO *bi)
@@ -532,6 +533,7 @@ BIO_new_ssl_connect(SSL_CTX *ctx)
532 BIO_free(ssl); 533 BIO_free(ssl);
533 return (NULL); 534 return (NULL);
534} 535}
536LSSL_ALIAS(BIO_new_ssl_connect)
535 537
536BIO * 538BIO *
537BIO_new_ssl(SSL_CTX *ctx, int client) 539BIO_new_ssl(SSL_CTX *ctx, int client)
@@ -556,6 +558,7 @@ BIO_new_ssl(SSL_CTX *ctx, int client)
556 BIO_free(ret); 558 BIO_free(ret);
557 return (NULL); 559 return (NULL);
558} 560}
561LSSL_ALIAS(BIO_new_ssl)
559 562
560int 563int
561BIO_ssl_copy_session_id(BIO *t, BIO *f) 564BIO_ssl_copy_session_id(BIO *t, BIO *f)
diff --git a/src/lib/libssl/hidden/openssl/ssl.h b/src/lib/libssl/hidden/openssl/ssl.h
new file mode 100644
index 0000000000..540c6e7652
--- /dev/null
+++ b/src/lib/libssl/hidden/openssl/ssl.h
@@ -0,0 +1,31 @@
1/* $OpenBSD: ssl.h,v 1.1 2022/11/11 11:25:18 beck Exp $ */
2/*
3 * Copyright (c) 2022 Philip Guenther <guenther@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _LIBSSL_SSL_H_
19#define _LIBSSL_SSL_H_
20
21#include_next <openssl/ssl.h>
22#include "ssl_namespace.h"
23
24LSSL_USED(BIO_f_ssl);
25LSSL_USED(BIO_new_ssl);
26LSSL_USED(BIO_new_ssl_connect);
27LSSL_UNUSED(BIO_new_buffer_ssl_connect);
28LSSL_UNUSED(BIO_ssl_copy_session_id);
29LSSL_UNUSED(BIO_ssl_shutdown);
30
31#endif /* _LIBSSL_SSL_H_ */
diff --git a/src/lib/libssl/hidden/ssl_namespace.h b/src/lib/libssl/hidden/ssl_namespace.h
new file mode 100644
index 0000000000..803f3e66be
--- /dev/null
+++ b/src/lib/libssl/hidden/ssl_namespace.h
@@ -0,0 +1,37 @@
1/* $OpenBSD: ssl_namespace.h,v 1.1 2022/11/11 11:25:18 beck Exp $ */
2/*
3 * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _LIBSSL_SSL_NAMESPACE_H_
19#define _LIBSSL_SSL_NAMESPACE_H_
20
21/*
22 * If marked as 'used', then internal calls use the name with prefix "_lssl_"
23 * and we alias that to the normal name.
24 */
25
26#ifdef LIBRESSL_NAMESPACE
27#define LSSL_UNUSED(x) typeof(x) x __attribute__((deprecated))
28#define LSSL_USED(x) __attribute__((visibility("hidden"))) \
29 typeof(x) x asm("_lssl_"#x)
30#define LSSL_ALIAS(x) asm(".global "#x"; "#x" = _lssl_"#x);
31#else
32#define LSSL_UNUSED(x)
33#define LSSL_USED(x)
34#define LSSL_ALIAS(x)
35#endif
36
37#endif /* _LIBSSL_SSL_NAMESPACE_H_ */