diff options
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r-- | src/lib/libssl/ssl_lib.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index bf94321eea..b3f4210266 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_lib.c,v 1.79 2014/08/10 14:42:56 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.80 2014/08/11 01:10:42 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 | * |
@@ -1407,13 +1407,12 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num, | |||
1407 | { | 1407 | { |
1408 | const SSL_CIPHER *c; | 1408 | const SSL_CIPHER *c; |
1409 | STACK_OF(SSL_CIPHER) *sk; | 1409 | STACK_OF(SSL_CIPHER) *sk; |
1410 | int i, n; | 1410 | int i; |
1411 | 1411 | ||
1412 | if (s->s3) | 1412 | if (s->s3) |
1413 | s->s3->send_connection_binding = 0; | 1413 | s->s3->send_connection_binding = 0; |
1414 | 1414 | ||
1415 | n = ssl3_put_cipher_by_char(NULL, NULL); | 1415 | if ((num % SSL3_CIPHER_VALUE_SIZE) != 0) { |
1416 | if ((num % n) != 0) { | ||
1417 | SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, | 1416 | SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, |
1418 | SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST); | 1417 | SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST); |
1419 | return (NULL); | 1418 | return (NULL); |
@@ -1425,11 +1424,10 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num, | |||
1425 | sk_SSL_CIPHER_zero(sk); | 1424 | sk_SSL_CIPHER_zero(sk); |
1426 | } | 1425 | } |
1427 | 1426 | ||
1428 | for (i = 0; i < num; i += n) { | 1427 | for (i = 0; i < num; i += SSL3_CIPHER_VALUE_SIZE) { |
1429 | /* Check for SCSV */ | 1428 | /* Check for SCSV */ |
1430 | if (s->s3 && (n != 3 || !p[0]) && | 1429 | if (s->s3 && (p[0] == ((SSL3_CK_SCSV >> 8) & 0xff)) && |
1431 | (p[n - 2] == ((SSL3_CK_SCSV >> 8) & 0xff)) && | 1430 | (p[1] == (SSL3_CK_SCSV & 0xff))) { |
1432 | (p[n - 1] == (SSL3_CK_SCSV & 0xff))) { | ||
1433 | /* SCSV fatal if renegotiating */ | 1431 | /* SCSV fatal if renegotiating */ |
1434 | if (s->renegotiate) { | 1432 | if (s->renegotiate) { |
1435 | SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, | 1433 | SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, |
@@ -1440,12 +1438,12 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num, | |||
1440 | goto err; | 1438 | goto err; |
1441 | } | 1439 | } |
1442 | s->s3->send_connection_binding = 1; | 1440 | s->s3->send_connection_binding = 1; |
1443 | p += n; | 1441 | p += SSL3_CIPHER_VALUE_SIZE; |
1444 | continue; | 1442 | continue; |
1445 | } | 1443 | } |
1446 | 1444 | ||
1447 | c = ssl3_get_cipher_by_char(p); | 1445 | c = ssl3_get_cipher_by_char(p); |
1448 | p += n; | 1446 | p += SSL3_CIPHER_VALUE_SIZE; |
1449 | if (c != NULL) { | 1447 | if (c != NULL) { |
1450 | if (!sk_SSL_CIPHER_push(sk, c)) { | 1448 | if (!sk_SSL_CIPHER_push(sk, c)) { |
1451 | SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, | 1449 | SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, |