diff options
author | jsing <> | 2015-02-07 05:46:01 +0000 |
---|---|---|
committer | jsing <> | 2015-02-07 05:46:01 +0000 |
commit | 6462420bc08d290040b65cd657178ea158e83571 (patch) | |
tree | 4ee0fc11a8214e89b48aa090fc5491c12b1793be /src/lib/libssl/s3_lib.c | |
parent | 6b246d35bb311ef0726da2113541c9a56921791f (diff) | |
download | openbsd-6462420bc08d290040b65cd657178ea158e83571.tar.gz openbsd-6462420bc08d290040b65cd657178ea158e83571.tar.bz2 openbsd-6462420bc08d290040b65cd657178ea158e83571.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 '')
-rw-r--r-- | src/lib/libssl/s3_lib.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c index a1428907ac..aae497abed 100644 --- a/src/lib/libssl/s3_lib.c +++ b/src/lib/libssl/s3_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s3_lib.c,v 1.93 2015/02/07 04:17:11 jsing Exp $ */ | 1 | /* $OpenBSD: s3_lib.c,v 1.94 2015/02/07 05:46:01 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 | * |
@@ -2532,30 +2532,19 @@ ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void)) | |||
2532 | const SSL_CIPHER * | 2532 | const SSL_CIPHER * |
2533 | ssl3_get_cipher_by_char(const unsigned char *p) | 2533 | ssl3_get_cipher_by_char(const unsigned char *p) |
2534 | { | 2534 | { |
2535 | const SSL_CIPHER *cp; | 2535 | uint16_t cipher_value; |
2536 | unsigned long id; | ||
2537 | SSL_CIPHER c; | ||
2538 | 2536 | ||
2539 | id = 0x03000000L | ((unsigned long)p[0] << 8L) | (unsigned long)p[1]; | 2537 | n2s(p, cipher_value); |
2540 | c.id = id; | 2538 | return ssl3_get_cipher_by_value(cipher_value); |
2541 | cp = OBJ_bsearch_ssl_cipher_id(&c, ssl3_ciphers, SSL3_NUM_CIPHERS); | ||
2542 | if (cp == NULL || cp->valid == 0) | ||
2543 | return NULL; | ||
2544 | else | ||
2545 | return cp; | ||
2546 | } | 2539 | } |
2547 | 2540 | ||
2548 | int | 2541 | int |
2549 | ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p) | 2542 | ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p) |
2550 | { | 2543 | { |
2551 | long l; | ||
2552 | |||
2553 | if (p != NULL) { | 2544 | if (p != NULL) { |
2554 | l = c->id; | 2545 | if ((c->id & ~SSL3_CK_VALUE_MASK) != SSL3_CK_ID) |
2555 | if ((l & 0xff000000) != 0x03000000) | ||
2556 | return (0); | 2546 | return (0); |
2557 | p[0] = ((unsigned char)(l >> 8L)) & 0xFF; | 2547 | s2n(ssl3_cipher_get_value(c), p); |
2558 | p[1] = ((unsigned char)(l)) & 0xFF; | ||
2559 | } | 2548 | } |
2560 | return (2); | 2549 | return (2); |
2561 | } | 2550 | } |