summaryrefslogtreecommitdiff
path: root/src/lib/libssl/s3_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/s3_lib.c')
-rw-r--r--src/lib/libssl/s3_lib.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 9ac02f3e1b..1ae2d047bc 100644
--- a/src/lib/libssl/s3_lib.c
+++ b/src/lib/libssl/s3_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_lib.c,v 1.247 2023/11/29 13:29:34 tb Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.248 2023/11/29 13:39:34 tb 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 *
@@ -150,6 +150,7 @@
150 150
151#include <limits.h> 151#include <limits.h>
152#include <stdio.h> 152#include <stdio.h>
153#include <stdlib.h>
153 154
154#include <openssl/bn.h> 155#include <openssl/bn.h>
155#include <openssl/curve25519.h> 156#include <openssl/curve25519.h>
@@ -1413,18 +1414,26 @@ ssl3_get_cipher(unsigned int u)
1413 return (NULL); 1414 return (NULL);
1414} 1415}
1415 1416
1417static int
1418ssl3_cipher_id_cmp(const void *id, const void *cipher)
1419{
1420 unsigned long a = *(const unsigned long *)id;
1421 unsigned long b = ((const SSL_CIPHER *)cipher)->id;
1422
1423 return a < b ? -1 : a > b;
1424}
1425
1416const SSL_CIPHER * 1426const SSL_CIPHER *
1417ssl3_get_cipher_by_id(unsigned long id) 1427ssl3_get_cipher_by_id(unsigned long id)
1418{ 1428{
1419 const SSL_CIPHER *cp; 1429 const SSL_CIPHER *cipher;
1420 SSL_CIPHER c;
1421 1430
1422 c.id = id; 1431 cipher = bsearch(&id, ssl3_ciphers, SSL3_NUM_CIPHERS, sizeof(*cipher),
1423 cp = OBJ_bsearch_ssl_cipher_id(&c, ssl3_ciphers, SSL3_NUM_CIPHERS); 1432 ssl3_cipher_id_cmp);
1424 if (cp != NULL && cp->valid == 1) 1433 if (cipher != NULL && cipher->valid == 1)
1425 return (cp); 1434 return cipher;
1426 1435
1427 return (NULL); 1436 return NULL;
1428} 1437}
1429 1438
1430const SSL_CIPHER * 1439const SSL_CIPHER *