summaryrefslogtreecommitdiffstats
path: root/lib/libssl/s3_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-08-11 01:06:22 +0000
committerjsing <jsing@openbsd.org>2014-08-11 01:06:22 +0000
commitba83acf62b74ac38323cdf014409e05439e107e0 (patch)
tree9d1a129b8545cc245157d4e66ca887803cb26ad1 /lib/libssl/s3_lib.c
parentWrite the core file of a non-suid process into the current directory (diff)
downloadwireguard-openbsd-ba83acf62b74ac38323cdf014409e05439e107e0.tar.xz
wireguard-openbsd-ba83acf62b74ac38323cdf014409e05439e107e0.zip
Provide a ssl3_get_cipher_by_id() function that allows ciphers to be looked
up by their ID. For one, this avoids an ugly mess in ssl_sess.c, where the cipher value is manually written into a buffer, just so the cipher can be located using ssl3_get_cipher_by_char(). ok bcook@ miod@
Diffstat (limited to 'lib/libssl/s3_lib.c')
-rw-r--r--lib/libssl/s3_lib.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/libssl/s3_lib.c b/lib/libssl/s3_lib.c
index acb35a8f25f..1d84effeeab 100644
--- a/lib/libssl/s3_lib.c
+++ b/lib/libssl/s3_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s3_lib.c,v 1.75 2014/08/10 15:06:15 jsing Exp $ */
+/* $OpenBSD: s3_lib.c,v 1.76 2014/08/11 01:06:22 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1873,6 +1873,19 @@ ssl3_get_cipher(unsigned int u)
return (NULL);
}
+const SSL_CIPHER *
+ssl3_get_cipher_by_id(unsigned int id)
+{
+ const SSL_CIPHER *cp;
+ SSL_CIPHER c;
+
+ c.id = id;
+ cp = OBJ_bsearch_ssl_cipher_id(&c, ssl3_ciphers, SSL3_NUM_CIPHERS);
+ if (cp != NULL && cp->valid == 1)
+ return (cp);
+ return (NULL);
+}
+
int
ssl3_pending(const SSL *s)
{