summaryrefslogtreecommitdiff
path: root/lib/libssl
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2015-07-14 05:20:47 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2015-07-14 05:20:47 +0000
commit42c2ba106a36f62e1c265075da9b41ed9048ff42 (patch)
tree0bbdf0f84dec93dffade3a9a81fb79c9f4e79959 /lib/libssl
parentba3144c747369b746f586427561d1b1f3b732b7a (diff)
Convert ssl3_get_cipher_by_char to CBS.
ok miod@ jsing@
Diffstat (limited to 'lib/libssl')
-rw-r--r--lib/libssl/s3_lib.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libssl/s3_lib.c b/lib/libssl/s3_lib.c
index 79f680f527e..c838409bf7a 100644
--- a/lib/libssl/s3_lib.c
+++ b/lib/libssl/s3_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s3_lib.c,v 1.96 2015/05/25 21:35:35 guenther Exp $ */
+/* $OpenBSD: s3_lib.c,v 1.97 2015/07/14 05:20:46 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -155,6 +155,7 @@
#include <openssl/objects.h>
#include "ssl_locl.h"
+#include "bytestring.h"
#define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers) / sizeof(SSL_CIPHER))
@@ -2532,9 +2533,14 @@ ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void))
const SSL_CIPHER *
ssl3_get_cipher_by_char(const unsigned char *p)
{
+ CBS cipher;
uint16_t cipher_value;
- n2s(p, cipher_value);
+ /* We have to assume it is at least 2 bytes due to existing API. */
+ CBS_init(&cipher, p, 2);
+ if (!CBS_get_u16(&cipher, &cipher_value))
+ return NULL;
+
return ssl3_get_cipher_by_value(cipher_value);
}