summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/s3_lib.c25
-rw-r--r--src/lib/libssl/ssl_lib.c29
-rw-r--r--src/lib/libssl/ssl_local.h4
3 files changed, 19 insertions, 39 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 *
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 5cd0e82f89..ce14ce710a 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.316 2023/11/25 12:05:08 tb Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.317 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 *
@@ -3638,30 +3638,3 @@ SSL_set_quic_use_legacy_codepoint(SSL *ssl, int use_legacy)
3638 /* Not supported. */ 3638 /* Not supported. */
3639} 3639}
3640LSSL_ALIAS(SSL_set_quic_use_legacy_codepoint); 3640LSSL_ALIAS(SSL_set_quic_use_legacy_codepoint);
3641
3642static int
3643ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b)
3644{
3645 long l;
3646
3647 l = a->id - b->id;
3648 if (l == 0L)
3649 return (0);
3650 else
3651 return ((l > 0) ? 1:-1);
3652}
3653
3654static int
3655ssl_cipher_id_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)
3656{
3657 SSL_CIPHER const *a = a_;
3658 SSL_CIPHER const *b = b_;
3659 return ssl_cipher_id_cmp(a, b);
3660}
3661
3662SSL_CIPHER *
3663OBJ_bsearch_ssl_cipher_id(SSL_CIPHER *key, SSL_CIPHER const *base, int num)
3664{
3665 return (SSL_CIPHER *)OBJ_bsearch_(key, base, num, sizeof(SSL_CIPHER),
3666 ssl_cipher_id_cmp_BSEARCH_CMP_FN);
3667}
diff --git a/src/lib/libssl/ssl_local.h b/src/lib/libssl/ssl_local.h
index 3c5fb204b0..a2c2588c38 100644
--- a/src/lib/libssl/ssl_local.h
+++ b/src/lib/libssl/ssl_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_local.h,v 1.10 2023/11/29 13:29:34 tb Exp $ */ 1/* $OpenBSD: ssl_local.h,v 1.11 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 *
@@ -1304,8 +1304,6 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int include_ticket);
1304int ssl_get_new_session(SSL *s, int session); 1304int ssl_get_new_session(SSL *s, int session);
1305int ssl_get_prev_session(SSL *s, CBS *session_id, CBS *ext_block, 1305int ssl_get_prev_session(SSL *s, CBS *session_id, CBS *ext_block,
1306 int *alert); 1306 int *alert);
1307SSL_CIPHER *OBJ_bsearch_ssl_cipher_id(SSL_CIPHER *key, SSL_CIPHER const *base,
1308 int num);
1309int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *ciphers, CBB *cbb); 1307int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *ciphers, CBB *cbb);
1310STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, CBS *cbs); 1308STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, CBS *cbs);
1311STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth, 1309STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,