diff options
author | jsing <> | 2020-09-11 17:36:27 +0000 |
---|---|---|
committer | jsing <> | 2020-09-11 17:36:27 +0000 |
commit | 188f2a73ec9cc4314b9998227079cccb89e8677a (patch) | |
tree | 62dedc456145da98fc6ed3e6c1be5685fe0e1232 /src/lib/libssl/ssl_srvr.c | |
parent | 044cfc226bee4d04817ab4f4d3a6b1d0ab4db4ed (diff) | |
download | openbsd-188f2a73ec9cc4314b9998227079cccb89e8677a.tar.gz openbsd-188f2a73ec9cc4314b9998227079cccb89e8677a.tar.bz2 openbsd-188f2a73ec9cc4314b9998227079cccb89e8677a.zip |
Remove cipher_list_by_id.
When parsing a cipher string, a cipher list is created, before being
duplicated and sorted - the second copy being stored as cipher_list_by_id.
This is done only so that a client can ensure that the cipher selected by
a server is in the cipher list. This is pretty pointless given that most
clients are short-lived and that we already had to iterate over the cipher
list in order to build the client hello. Additionally, any update to the
cipher list requires that cipher_list_by_id also be updated and kept in
sync.
Remove all of this and replace it with a simple linear scan - the overhead
of duplicating and sorting the cipher list likely exceeds that of a simple
linear scan over the cipher list (64 maximum, more typically ~9 or so).
ok beck@ tb@
Diffstat (limited to 'src/lib/libssl/ssl_srvr.c')
-rw-r--r-- | src/lib/libssl/ssl_srvr.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c index 745b15aad0..cbf7c180b5 100644 --- a/src/lib/libssl/ssl_srvr.c +++ b/src/lib/libssl/ssl_srvr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_srvr.c,v 1.81 2020/08/31 14:04:51 tb Exp $ */ | 1 | /* $OpenBSD: ssl_srvr.c,v 1.82 2020/09/11 17:36:27 jsing 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 | * |
@@ -1096,11 +1096,7 @@ ssl3_get_client_hello(SSL *s) | |||
1096 | s->session->cipher = pref_cipher; | 1096 | s->session->cipher = pref_cipher; |
1097 | 1097 | ||
1098 | sk_SSL_CIPHER_free(s->cipher_list); | 1098 | sk_SSL_CIPHER_free(s->cipher_list); |
1099 | sk_SSL_CIPHER_free(s->internal->cipher_list_by_id); | ||
1100 | |||
1101 | s->cipher_list = sk_SSL_CIPHER_dup(s->session->ciphers); | 1099 | s->cipher_list = sk_SSL_CIPHER_dup(s->session->ciphers); |
1102 | s->internal->cipher_list_by_id = | ||
1103 | sk_SSL_CIPHER_dup(s->session->ciphers); | ||
1104 | } | 1100 | } |
1105 | } | 1101 | } |
1106 | 1102 | ||