diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/ssl_srvr.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c index 745fd6d83a..b9b2c58705 100644 --- a/src/lib/libssl/ssl_srvr.c +++ b/src/lib/libssl/ssl_srvr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_srvr.c,v 1.43 2018/08/24 17:30:32 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_srvr.c,v 1.44 2018/08/24 17:44:22 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 | * |
| @@ -846,13 +846,26 @@ ssl3_get_client_hello(SSL *s) | |||
| 846 | 846 | ||
| 847 | CBS_init(&cbs, s->internal->init_msg, n); | 847 | CBS_init(&cbs, s->internal->init_msg, n); |
| 848 | 848 | ||
| 849 | /* Parse client hello up until the extensions (if any). */ | ||
| 850 | if (!CBS_get_u16(&cbs, &client_version)) | ||
| 851 | goto truncated; | ||
| 852 | if (!CBS_get_bytes(&cbs, &client_random, SSL3_RANDOM_SIZE)) | ||
| 853 | goto truncated; | ||
| 854 | if (!CBS_get_u8_length_prefixed(&cbs, &session_id)) | ||
| 855 | goto truncated; | ||
| 856 | if (SSL_IS_DTLS(s)) { | ||
| 857 | if (!CBS_get_u8_length_prefixed(&cbs, &cookie)) | ||
| 858 | goto truncated; | ||
| 859 | } | ||
| 860 | if (!CBS_get_u16_length_prefixed(&cbs, &cipher_suites)) | ||
| 861 | goto truncated; | ||
| 862 | if (!CBS_get_u8_length_prefixed(&cbs, &compression_methods)) | ||
| 863 | goto truncated; | ||
| 864 | |||
| 849 | /* | 865 | /* |
| 850 | * Use version from inside client hello, not from record header. | 866 | * Use version from inside client hello, not from record header. |
| 851 | * (may differ: see RFC 2246, Appendix E, second paragraph) | 867 | * (may differ: see RFC 2246, Appendix E, second paragraph) |
| 852 | */ | 868 | */ |
| 853 | if (!CBS_get_u16(&cbs, &client_version)) | ||
| 854 | goto truncated; | ||
| 855 | |||
| 856 | if (ssl_max_shared_version(s, client_version, &shared_version) != 1) { | 869 | if (ssl_max_shared_version(s, client_version, &shared_version) != 1) { |
| 857 | SSLerror(s, SSL_R_WRONG_VERSION_NUMBER); | 870 | SSLerror(s, SSL_R_WRONG_VERSION_NUMBER); |
| 858 | if ((s->client_version >> 8) == SSL3_VERSION_MAJOR && | 871 | if ((s->client_version >> 8) == SSL3_VERSION_MAJOR && |
| @@ -877,19 +890,12 @@ ssl3_get_client_hello(SSL *s) | |||
| 877 | } | 890 | } |
| 878 | s->method = method; | 891 | s->method = method; |
| 879 | 892 | ||
| 880 | if (!CBS_get_bytes(&cbs, &client_random, SSL3_RANDOM_SIZE)) | ||
| 881 | goto truncated; | ||
| 882 | if (!CBS_get_u8_length_prefixed(&cbs, &session_id)) | ||
| 883 | goto truncated; | ||
| 884 | |||
| 885 | /* | 893 | /* |
| 886 | * If we require cookies (DTLS) and this ClientHello doesn't | 894 | * If we require cookies (DTLS) and this ClientHello does not contain |
| 887 | * contain one, just return since we do not want to | 895 | * one, just return since we do not want to allocate any memory yet. |
| 888 | * allocate any memory yet. So check cookie length... | 896 | * So check cookie length... |
| 889 | */ | 897 | */ |
| 890 | if (SSL_IS_DTLS(s)) { | 898 | if (SSL_IS_DTLS(s)) { |
| 891 | if (!CBS_get_u8_length_prefixed(&cbs, &cookie)) | ||
| 892 | goto truncated; | ||
| 893 | if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) { | 899 | if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) { |
| 894 | if (CBS_len(&cookie) == 0) | 900 | if (CBS_len(&cookie) == 0) |
| 895 | return (1); | 901 | return (1); |
| @@ -979,9 +985,6 @@ ssl3_get_client_hello(SSL *s) | |||
| 979 | } | 985 | } |
| 980 | } | 986 | } |
| 981 | 987 | ||
| 982 | if (!CBS_get_u16_length_prefixed(&cbs, &cipher_suites)) | ||
| 983 | goto truncated; | ||
| 984 | |||
| 985 | /* XXX - This logic seems wrong... */ | 988 | /* XXX - This logic seems wrong... */ |
| 986 | if (CBS_len(&cipher_suites) == 0 && CBS_len(&session_id) != 0) { | 989 | if (CBS_len(&cipher_suites) == 0 && CBS_len(&session_id) != 0) { |
| 987 | /* we need a cipher if we are not resuming a session */ | 990 | /* we need a cipher if we are not resuming a session */ |
| @@ -1020,9 +1023,6 @@ ssl3_get_client_hello(SSL *s) | |||
| 1020 | } | 1023 | } |
| 1021 | } | 1024 | } |
| 1022 | 1025 | ||
| 1023 | if (!CBS_get_u8_length_prefixed(&cbs, &compression_methods)) | ||
| 1024 | goto truncated; | ||
| 1025 | |||
| 1026 | comp_null = 0; | 1026 | comp_null = 0; |
| 1027 | while (CBS_len(&compression_methods) > 0) { | 1027 | while (CBS_len(&compression_methods) > 0) { |
| 1028 | if (!CBS_get_u8(&compression_methods, &comp_method)) | 1028 | if (!CBS_get_u8(&compression_methods, &comp_method)) |
