summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2020-09-16 07:25:15 +0000
committerschwarze <>2020-09-16 07:25:15 +0000
commit4d4b6ca21abb045b3f6584cc35a22ad4ab7a719a (patch)
tree69c80e1d01b983672f00b41accbb03cdf34a436f
parent9118930a1739225789e932d31d639b1e1d796806 (diff)
downloadopenbsd-4d4b6ca21abb045b3f6584cc35a22ad4ab7a719a.tar.gz
openbsd-4d4b6ca21abb045b3f6584cc35a22ad4ab7a719a.tar.bz2
openbsd-4d4b6ca21abb045b3f6584cc35a22ad4ab7a719a.zip
Let SSL_CTX_get_ciphers(NULL) return NULL rather than crash
for compatibility with OpenSSL and for consistency with neighbouring functions; suggested by jsing@ after i documented the crash; OK jsing@.
-rw-r--r--src/lib/libssl/man/SSL_get_ciphers.39
-rw-r--r--src/lib/libssl/ssl_lib.c4
2 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/libssl/man/SSL_get_ciphers.3 b/src/lib/libssl/man/SSL_get_ciphers.3
index 598e954456..8030f0bbb1 100644
--- a/src/lib/libssl/man/SSL_get_ciphers.3
+++ b/src/lib/libssl/man/SSL_get_ciphers.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_ciphers.3,v 1.10 2020/09/16 07:11:14 schwarze Exp $ 1.\" $OpenBSD: SSL_get_ciphers.3,v 1.11 2020/09/16 07:25:15 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 3.\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
4.\" 4.\"
@@ -176,12 +176,11 @@ is called on that context object.
176.Fn SSL_CTX_get_ciphers 176.Fn SSL_CTX_get_ciphers
177returns an internal pointer to a list of ciphers or 177returns an internal pointer to a list of ciphers or
178.Dv NULL 178.Dv NULL
179if no ciphers are available. 179if
180If
181.Fa ctx 180.Fa ctx
182is 181is
183.Dv NULL , 182.Dv NULL
184calling this function crashes the program. 183or if no ciphers are available.
185The returned pointer becomes invalid when 184The returned pointer becomes invalid when
186.Fa ctx 185.Fa ctx
187is destroyed or when 186is destroyed or when
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 828aa3a08d..73bc05e967 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.228 2020/09/15 11:47:49 jsing Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.229 2020/09/16 07:25:15 schwarze 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 *
@@ -1336,6 +1336,8 @@ SSL_get_cipher_list(const SSL *s, int n)
1336STACK_OF(SSL_CIPHER) * 1336STACK_OF(SSL_CIPHER) *
1337SSL_CTX_get_ciphers(const SSL_CTX *ctx) 1337SSL_CTX_get_ciphers(const SSL_CTX *ctx)
1338{ 1338{
1339 if (ctx == NULL)
1340 return NULL;
1339 return ctx->cipher_list; 1341 return ctx->cipher_list;
1340} 1342}
1341 1343