From b4d8ae6f39ff2ded10621922d24e574845e23ece Mon Sep 17 00:00:00 2001 From: jsing <> Date: Mon, 11 Aug 2014 01:06:22 +0000 Subject: Provide a ssl3_get_cipher_by_id() function that allows ciphers to be looked up by their ID. For one, this avoids an ugly mess in ssl_sess.c, where the cipher value is manually written into a buffer, just so the cipher can be located using ssl3_get_cipher_by_char(). ok bcook@ miod@ --- src/lib/libssl/ssl_sess.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/lib/libssl/ssl_sess.c') diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c index d4fa5a618f..8e285ea9b1 100644 --- a/src/lib/libssl/ssl_sess.c +++ b/src/lib/libssl/ssl_sess.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_sess.c,v 1.39 2014/08/10 14:42:56 jsing Exp $ */ +/* $OpenBSD: ssl_sess.c,v 1.40 2014/08/11 01:06:22 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -558,18 +558,7 @@ ssl_get_prev_session(SSL *s, unsigned char *session_id, int len, } if (ret->cipher == NULL) { - unsigned char buf[5], *p; - unsigned long l; - - p = buf; - l = ret->cipher_id; - l2n(l, p); - - if ((ret->ssl_version >> 8) >= SSL3_VERSION_MAJOR) - ret->cipher = ssl3_get_cipher_by_char(&buf[2]); - else - ret->cipher = ssl3_get_cipher_by_char(&buf[1]); - + ret->cipher = ssl3_get_cipher_by_id(ret->cipher_id); if (ret->cipher == NULL) goto err; } -- cgit v1.2.3-55-g6feb