summaryrefslogtreecommitdiff
path: root/lib/libssl/ssl_srvr.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2024-07-22 14:47:16 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2024-07-22 14:47:16 +0000
commite6065260dd1596e38b7b82be002176dd9f757395 (patch)
treeccb8b8aa4c5d6e6ea82408b5db128a62f2d3f98a /lib/libssl/ssl_srvr.c
parentbdafe3a616f11ff098f323d47d25d1c8e7647c88 (diff)
Use cipher suite values instead of IDs.
OpenSSL has had the concept of cipher IDs, which were a way of working around overlapping cipher suite values between SSLv2 and SSLv3. Given that we no longer have to deal with this issue, replace the use of IDs with cipher suite values. In particular, this means that we can stop mapping back and forth between the two, simplifying things considerably. While here, remove the 'valid' member of the SSL_CIPHER. The ssl3_ciphers[] table is no longer mutable, meaning that ciphers cannot be disabled at runtime (and we have `#if 0' if we want to do it at compile time). Clean up the comments and add/update RFC references for cipher suites. ok tb@
Diffstat (limited to 'lib/libssl/ssl_srvr.c')
-rw-r--r--lib/libssl/ssl_srvr.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/libssl/ssl_srvr.c b/lib/libssl/ssl_srvr.c
index be6bd7402ca..302b6bdf0f9 100644
--- a/lib/libssl/ssl_srvr.c
+++ b/lib/libssl/ssl_srvr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_srvr.c,v 1.164 2024/07/20 04:04:23 jsing Exp $ */
+/* $OpenBSD: ssl_srvr.c,v 1.165 2024/07/22 14:47:15 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -651,7 +651,7 @@ ssl3_accept(SSL *s)
goto end;
s->s3->hs.state = SSL3_ST_SW_FINISHED_A;
s->init_num = 0;
- s->session->cipher_id = s->s3->hs.cipher->id;
+ s->session->cipher_value = s->s3->hs.cipher->value;
if (!tls1_setup_key_block(s)) {
ret = -1;
@@ -781,7 +781,6 @@ ssl3_get_client_hello(SSL *s)
uint8_t comp_method;
int comp_null;
int i, j, al, ret, cookie_valid = 0;
- unsigned long id;
SSL_CIPHER *c;
STACK_OF(SSL_CIPHER) *ciphers = NULL;
const SSL_METHOD *method;
@@ -978,11 +977,10 @@ ssl3_get_client_hello(SSL *s)
/* XXX - CBS_len(&cipher_suites) will always be zero here... */
if (s->hit && CBS_len(&cipher_suites) > 0) {
j = 0;
- id = s->session->cipher_id;
for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
c = sk_SSL_CIPHER_value(ciphers, i);
- if (c->id == id) {
+ if (c->value == s->session->cipher_value) {
j = 1;
break;
}
@@ -1127,9 +1125,9 @@ ssl3_get_client_hello(SSL *s)
goto fatal_err;
}
s->s3->hs.cipher = c;
- s->session->cipher_id = s->s3->hs.cipher->id;
+ s->session->cipher_value = s->s3->hs.cipher->value;
} else {
- s->s3->hs.cipher = ssl3_get_cipher_by_id(s->session->cipher_id);
+ s->s3->hs.cipher = ssl3_get_cipher_by_value(s->session->cipher_value);
if (s->s3->hs.cipher == NULL)
goto fatal_err;
}
@@ -1269,8 +1267,7 @@ ssl3_send_server_hello(SSL *s)
goto err;
/* Cipher suite. */
- if (!CBB_add_u16(&server_hello,
- ssl3_cipher_get_value(s->s3->hs.cipher)))
+ if (!CBB_add_u16(&server_hello, s->s3->hs.cipher->value))
goto err;
/* Compression method (null). */