diff options
author | 2015-02-07 05:46:01 +0000 | |
---|---|---|
committer | 2015-02-07 05:46:01 +0000 | |
commit | c8ee8471a1d2bb9c6bdfa6fd0c6d254b9aaa933d (patch) | |
tree | 4ec20e07426ae97fa7cc1b5ff524e5e3f257d2ac /lib/libssl/src/ssl/s3_lib.c | |
parent | keep this in sync a bit with userland by putting static on functions (diff) | |
download | wireguard-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/src/ssl/s3_lib.c')
-rw-r--r-- | lib/libssl/src/ssl/s3_lib.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/lib/libssl/src/ssl/s3_lib.c b/lib/libssl/src/ssl/s3_lib.c index a1428907ac9..aae497abede 100644 --- a/lib/libssl/src/ssl/s3_lib.c +++ b/lib/libssl/src/ssl/s3_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3_lib.c,v 1.93 2015/02/07 04:17:11 jsing Exp $ */ +/* $OpenBSD: s3_lib.c,v 1.94 2015/02/07 05:46:01 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -2532,30 +2532,19 @@ ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void)) const SSL_CIPHER * ssl3_get_cipher_by_char(const unsigned char *p) { - const SSL_CIPHER *cp; - unsigned long id; - SSL_CIPHER c; + uint16_t cipher_value; - id = 0x03000000L | ((unsigned long)p[0] << 8L) | (unsigned long)p[1]; - c.id = id; - cp = OBJ_bsearch_ssl_cipher_id(&c, ssl3_ciphers, SSL3_NUM_CIPHERS); - if (cp == NULL || cp->valid == 0) - return NULL; - else - return cp; + n2s(p, cipher_value); + return ssl3_get_cipher_by_value(cipher_value); } int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p) { - long l; - if (p != NULL) { - l = c->id; - if ((l & 0xff000000) != 0x03000000) + if ((c->id & ~SSL3_CK_VALUE_MASK) != SSL3_CK_ID) return (0); - p[0] = ((unsigned char)(l >> 8L)) & 0xFF; - p[1] = ((unsigned char)(l)) & 0xFF; + s2n(ssl3_cipher_get_value(c), p); } return (2); } |