summaryrefslogtreecommitdiffstats
path: root/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2015-02-07 05:46:01 +0000
committerjsing <jsing@openbsd.org>2015-02-07 05:46:01 +0000
commitc8ee8471a1d2bb9c6bdfa6fd0c6d254b9aaa933d (patch)
tree4ec20e07426ae97fa7cc1b5ff524e5e3f257d2ac /lib/libssl/ssl_lib.c
parentkeep this in sync a bit with userland by putting static on functions (diff)
downloadwireguard-openbsd-c8ee8471a1d2bb9c6bdfa6fd0c6d254b9aaa933d.tar.xz
wireguard-openbsd-c8ee8471a1d2bb9c6bdfa6fd0c6d254b9aaa933d.zip
Clean up the {get,put}_cipher_by_char() implementations. Also use
ssl3_get_cipher_by_value() in other parts of the code where it simplifies things. ok doug@
Diffstat (limited to 'lib/libssl/ssl_lib.c')
-rw-r--r--lib/libssl/ssl_lib.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c
index 5bf43623fc8..8ecb37d1be6 100644
--- a/lib/libssl/ssl_lib.c
+++ b/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_lib.c,v 1.95 2015/01/22 09:12:57 reyk Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.96 2015/02/07 05:46:01 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1420,7 +1420,6 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
const SSL_CIPHER *c;
STACK_OF(SSL_CIPHER) *sk;
int i;
- unsigned int cipher_id;
uint16_t cipher_value;
if (s->s3)
@@ -1442,10 +1441,9 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
for (i = 0; i < num; i += SSL3_CIPHER_VALUE_SIZE) {
n2s(p, cipher_value);
- cipher_id = SSL3_CK_ID | cipher_value;
/* Check for SCSV */
- if (s->s3 && cipher_id == SSL3_CK_SCSV) {
+ if (s->s3 && (SSL3_CK_ID | cipher_value) == SSL3_CK_SCSV) {
/* SCSV is fatal if renegotiating. */
if (s->renegotiate) {
SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,
@@ -1459,8 +1457,7 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
continue;
}
- c = ssl3_get_cipher_by_id(cipher_id);
- if (c != NULL) {
+ if ((c = ssl3_get_cipher_by_value(cipher_value)) != NULL) {
if (!sk_SSL_CIPHER_push(sk, c)) {
SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,
ERR_R_MALLOC_FAILURE);