From 6462420bc08d290040b65cd657178ea158e83571 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sat, 7 Feb 2015 05:46:01 +0000 Subject: 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@ --- src/lib/libssl/s3_clnt.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/lib/libssl/s3_clnt.c') diff --git a/src/lib/libssl/s3_clnt.c b/src/lib/libssl/s3_clnt.c index b2c7517598..9b52691015 100644 --- a/src/lib/libssl/s3_clnt.c +++ b/src/lib/libssl/s3_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3_clnt.c,v 1.106 2015/02/06 09:58:52 jsing Exp $ */ +/* $OpenBSD: s3_clnt.c,v 1.107 2015/02/07 05:46:01 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -773,7 +773,7 @@ ssl3_get_server_hello(SSL *s) const SSL_CIPHER *c; unsigned char *p, *q, *d; int i, al, ok; - unsigned int j, cipher_id; + unsigned int j; uint16_t cipher_value; long n; unsigned long alg_k; @@ -844,7 +844,6 @@ ssl3_get_server_hello(SSL *s) /* Get the cipher value. */ q = p + j; n2s(q, cipher_value); - cipher_id = SSL3_CK_ID | cipher_value; /* * Check if we want to resume the session based on external @@ -856,8 +855,8 @@ ssl3_get_server_hello(SSL *s) if (s->tls_session_secret_cb(s, s->session->master_key, &s->session->master_key_length, NULL, &pref_cipher, s->tls_session_secret_cb_arg)) { - s->session->cipher = pref_cipher ? - pref_cipher : ssl3_get_cipher_by_id(cipher_id); + s->session->cipher = pref_cipher ? pref_cipher : + ssl3_get_cipher_by_value(cipher_value); s->s3->flags |= SSL3_FLAGS_CCS_OK; } } @@ -892,8 +891,7 @@ ssl3_get_server_hello(SSL *s) } p += j; - c = ssl3_get_cipher_by_id(cipher_id); - if (c == NULL) { + if ((c = ssl3_get_cipher_by_value(cipher_value)) == NULL) { /* unknown cipher */ al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, -- cgit v1.2.3-55-g6feb