summaryrefslogtreecommitdiff
path: root/lib
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
commitc2649017c52d7aead867dff708fd929571cdb970 (patch)
treea517d8b04c84d23db20650010838bf7065e1e891 /lib
parent1a07b2280f93a53d9b01705ca09e4c7688905867 (diff)
Convert ssl3_get_cipher_by_char to CBS.
ok miod@ jsing@
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/src/ssl/s3_lib.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libssl/src/ssl/s3_lib.c b/lib/libssl/src/ssl/s3_lib.c
index 79f680f527e..c838409bf7a 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.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);
}