summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libssl/s3_lib.c10
-rw-r--r--src/lib/libssl/src/ssl/s3_lib.c10
2 files changed, 16 insertions, 4 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 79f680f527..c838409bf7 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.96 2015/05/25 21:35:35 guenther Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.97 2015/07/14 05:20:46 doug 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 *
@@ -155,6 +155,7 @@
155#include <openssl/objects.h> 155#include <openssl/objects.h>
156 156
157#include "ssl_locl.h" 157#include "ssl_locl.h"
158#include "bytestring.h"
158 159
159#define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers) / sizeof(SSL_CIPHER)) 160#define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers) / sizeof(SSL_CIPHER))
160 161
@@ -2532,9 +2533,14 @@ ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void))
2532const SSL_CIPHER * 2533const SSL_CIPHER *
2533ssl3_get_cipher_by_char(const unsigned char *p) 2534ssl3_get_cipher_by_char(const unsigned char *p)
2534{ 2535{
2536 CBS cipher;
2535 uint16_t cipher_value; 2537 uint16_t cipher_value;
2536 2538
2537 n2s(p, cipher_value); 2539 /* We have to assume it is at least 2 bytes due to existing API. */
2540 CBS_init(&cipher, p, 2);
2541 if (!CBS_get_u16(&cipher, &cipher_value))
2542 return NULL;
2543
2538 return ssl3_get_cipher_by_value(cipher_value); 2544 return ssl3_get_cipher_by_value(cipher_value);
2539} 2545}
2540 2546
diff --git a/src/lib/libssl/src/ssl/s3_lib.c b/src/lib/libssl/src/ssl/s3_lib.c
index 79f680f527..c838409bf7 100644
--- a/src/lib/libssl/src/ssl/s3_lib.c
+++ b/src/lib/libssl/src/ssl/s3_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_lib.c,v 1.96 2015/05/25 21:35:35 guenther Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.97 2015/07/14 05:20:46 doug 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 *
@@ -155,6 +155,7 @@
155#include <openssl/objects.h> 155#include <openssl/objects.h>
156 156
157#include "ssl_locl.h" 157#include "ssl_locl.h"
158#include "bytestring.h"
158 159
159#define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers) / sizeof(SSL_CIPHER)) 160#define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers) / sizeof(SSL_CIPHER))
160 161
@@ -2532,9 +2533,14 @@ ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void))
2532const SSL_CIPHER * 2533const SSL_CIPHER *
2533ssl3_get_cipher_by_char(const unsigned char *p) 2534ssl3_get_cipher_by_char(const unsigned char *p)
2534{ 2535{
2536 CBS cipher;
2535 uint16_t cipher_value; 2537 uint16_t cipher_value;
2536 2538
2537 n2s(p, cipher_value); 2539 /* We have to assume it is at least 2 bytes due to existing API. */
2540 CBS_init(&cipher, p, 2);
2541 if (!CBS_get_u16(&cipher, &cipher_value))
2542 return NULL;
2543
2538 return ssl3_get_cipher_by_value(cipher_value); 2544 return ssl3_get_cipher_by_value(cipher_value);
2539} 2545}
2540 2546