diff options
Diffstat (limited to 'src/lib/libssl/ssl_srvr.c')
-rw-r--r-- | src/lib/libssl/ssl_srvr.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c index 06ad42c8ff..0408dab660 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.92 2021/02/20 08:22:55 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_srvr.c,v 1.93 2021/02/20 14:03:50 tb 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 | * |
@@ -741,7 +741,7 @@ ssl3_accept(SSL *s) | |||
741 | } | 741 | } |
742 | skip = 0; | 742 | skip = 0; |
743 | } | 743 | } |
744 | end: | 744 | end: |
745 | /* BIO_flush(s->wbio); */ | 745 | /* BIO_flush(s->wbio); */ |
746 | s->internal->in_handshake--; | 746 | s->internal->in_handshake--; |
747 | if (cb != NULL) | 747 | if (cb != NULL) |
@@ -819,11 +819,11 @@ ssl3_get_client_hello(SSL *s) | |||
819 | 819 | ||
820 | /* Parse client hello up until the extensions (if any). */ | 820 | /* Parse client hello up until the extensions (if any). */ |
821 | if (!CBS_get_u16(&cbs, &client_version)) | 821 | if (!CBS_get_u16(&cbs, &client_version)) |
822 | goto truncated; | 822 | goto decode_err; |
823 | if (!CBS_get_bytes(&cbs, &client_random, SSL3_RANDOM_SIZE)) | 823 | if (!CBS_get_bytes(&cbs, &client_random, SSL3_RANDOM_SIZE)) |
824 | goto truncated; | 824 | goto decode_err; |
825 | if (!CBS_get_u8_length_prefixed(&cbs, &session_id)) | 825 | if (!CBS_get_u8_length_prefixed(&cbs, &session_id)) |
826 | goto truncated; | 826 | goto decode_err; |
827 | if (CBS_len(&session_id) > SSL3_SESSION_ID_SIZE) { | 827 | if (CBS_len(&session_id) > SSL3_SESSION_ID_SIZE) { |
828 | al = SSL_AD_ILLEGAL_PARAMETER; | 828 | al = SSL_AD_ILLEGAL_PARAMETER; |
829 | SSLerror(s, SSL_R_SSL3_SESSION_ID_TOO_LONG); | 829 | SSLerror(s, SSL_R_SSL3_SESSION_ID_TOO_LONG); |
@@ -831,12 +831,12 @@ ssl3_get_client_hello(SSL *s) | |||
831 | } | 831 | } |
832 | if (SSL_is_dtls(s)) { | 832 | if (SSL_is_dtls(s)) { |
833 | if (!CBS_get_u8_length_prefixed(&cbs, &cookie)) | 833 | if (!CBS_get_u8_length_prefixed(&cbs, &cookie)) |
834 | goto truncated; | 834 | goto decode_err; |
835 | } | 835 | } |
836 | if (!CBS_get_u16_length_prefixed(&cbs, &cipher_suites)) | 836 | if (!CBS_get_u16_length_prefixed(&cbs, &cipher_suites)) |
837 | goto truncated; | 837 | goto decode_err; |
838 | if (!CBS_get_u8_length_prefixed(&cbs, &compression_methods)) | 838 | if (!CBS_get_u8_length_prefixed(&cbs, &compression_methods)) |
839 | goto truncated; | 839 | goto decode_err; |
840 | 840 | ||
841 | /* | 841 | /* |
842 | * Use version from inside client hello, not from record header. | 842 | * Use version from inside client hello, not from record header. |
@@ -1003,7 +1003,7 @@ ssl3_get_client_hello(SSL *s) | |||
1003 | comp_null = 0; | 1003 | comp_null = 0; |
1004 | while (CBS_len(&compression_methods) > 0) { | 1004 | while (CBS_len(&compression_methods) > 0) { |
1005 | if (!CBS_get_u8(&compression_methods, &comp_method)) | 1005 | if (!CBS_get_u8(&compression_methods, &comp_method)) |
1006 | goto truncated; | 1006 | goto decode_err; |
1007 | if (comp_method == 0) | 1007 | if (comp_method == 0) |
1008 | comp_null = 1; | 1008 | comp_null = 1; |
1009 | } | 1009 | } |
@@ -1144,13 +1144,13 @@ ssl3_get_client_hello(SSL *s) | |||
1144 | ret = cookie_valid ? 2 : 1; | 1144 | ret = cookie_valid ? 2 : 1; |
1145 | 1145 | ||
1146 | if (0) { | 1146 | if (0) { |
1147 | truncated: | 1147 | decode_err: |
1148 | al = SSL_AD_DECODE_ERROR; | 1148 | al = SSL_AD_DECODE_ERROR; |
1149 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); | 1149 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); |
1150 | f_err: | 1150 | f_err: |
1151 | ssl3_send_alert(s, SSL3_AL_FATAL, al); | 1151 | ssl3_send_alert(s, SSL3_AL_FATAL, al); |
1152 | } | 1152 | } |
1153 | err: | 1153 | err: |
1154 | sk_SSL_CIPHER_free(ciphers); | 1154 | sk_SSL_CIPHER_free(ciphers); |
1155 | 1155 | ||
1156 | return (ret); | 1156 | return (ret); |
@@ -1738,7 +1738,7 @@ ssl3_get_client_kex_rsa(SSL *s, CBS *cbs) | |||
1738 | p = pms; | 1738 | p = pms; |
1739 | 1739 | ||
1740 | if (!CBS_get_u16_length_prefixed(cbs, &enc_pms)) | 1740 | if (!CBS_get_u16_length_prefixed(cbs, &enc_pms)) |
1741 | goto truncated; | 1741 | goto decode_err; |
1742 | if (CBS_len(cbs) != 0 || CBS_len(&enc_pms) != RSA_size(rsa)) { | 1742 | if (CBS_len(cbs) != 0 || CBS_len(&enc_pms) != RSA_size(rsa)) { |
1743 | SSLerror(s, SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG); | 1743 | SSLerror(s, SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG); |
1744 | goto err; | 1744 | goto err; |
@@ -1792,7 +1792,7 @@ ssl3_get_client_kex_rsa(SSL *s, CBS *cbs) | |||
1792 | 1792 | ||
1793 | return (1); | 1793 | return (1); |
1794 | 1794 | ||
1795 | truncated: | 1795 | decode_err: |
1796 | al = SSL_AD_DECODE_ERROR; | 1796 | al = SSL_AD_DECODE_ERROR; |
1797 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); | 1797 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); |
1798 | f_err: | 1798 | f_err: |
@@ -1814,9 +1814,9 @@ ssl3_get_client_kex_dhe(SSL *s, CBS *cbs) | |||
1814 | DH *dh; | 1814 | DH *dh; |
1815 | 1815 | ||
1816 | if (!CBS_get_u16_length_prefixed(cbs, &dh_Yc)) | 1816 | if (!CBS_get_u16_length_prefixed(cbs, &dh_Yc)) |
1817 | goto truncated; | 1817 | goto decode_err; |
1818 | if (CBS_len(cbs) != 0) | 1818 | if (CBS_len(cbs) != 0) |
1819 | goto truncated; | 1819 | goto decode_err; |
1820 | 1820 | ||
1821 | if (S3I(s)->tmp.dh == NULL) { | 1821 | if (S3I(s)->tmp.dh == NULL) { |
1822 | al = SSL_AD_HANDSHAKE_FAILURE; | 1822 | al = SSL_AD_HANDSHAKE_FAILURE; |
@@ -1865,7 +1865,7 @@ ssl3_get_client_kex_dhe(SSL *s, CBS *cbs) | |||
1865 | 1865 | ||
1866 | return (1); | 1866 | return (1); |
1867 | 1867 | ||
1868 | truncated: | 1868 | decode_err: |
1869 | al = SSL_AD_DECODE_ERROR; | 1869 | al = SSL_AD_DECODE_ERROR; |
1870 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); | 1870 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); |
1871 | f_err: | 1871 | f_err: |
@@ -2011,9 +2011,9 @@ ssl3_get_client_kex_gost(SSL *s, CBS *cbs) | |||
2011 | 2011 | ||
2012 | /* Decrypt session key */ | 2012 | /* Decrypt session key */ |
2013 | if (!CBS_get_asn1(cbs, &gostblob, CBS_ASN1_SEQUENCE)) | 2013 | if (!CBS_get_asn1(cbs, &gostblob, CBS_ASN1_SEQUENCE)) |
2014 | goto truncated; | 2014 | goto decode_err; |
2015 | if (CBS_len(cbs) != 0) | 2015 | if (CBS_len(cbs) != 0) |
2016 | goto truncated; | 2016 | goto decode_err; |
2017 | if (EVP_PKEY_decrypt(pkey_ctx, premaster_secret, &outlen, | 2017 | if (EVP_PKEY_decrypt(pkey_ctx, premaster_secret, &outlen, |
2018 | CBS_data(&gostblob), CBS_len(&gostblob)) <= 0) { | 2018 | CBS_data(&gostblob), CBS_len(&gostblob)) <= 0) { |
2019 | SSLerror(s, SSL_R_DECRYPTION_FAILED); | 2019 | SSLerror(s, SSL_R_DECRYPTION_FAILED); |
@@ -2039,7 +2039,7 @@ ssl3_get_client_kex_gost(SSL *s, CBS *cbs) | |||
2039 | else | 2039 | else |
2040 | goto err; | 2040 | goto err; |
2041 | 2041 | ||
2042 | truncated: | 2042 | decode_err: |
2043 | al = SSL_AD_DECODE_ERROR; | 2043 | al = SSL_AD_DECODE_ERROR; |
2044 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); | 2044 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); |
2045 | ssl3_send_alert(s, SSL3_AL_FATAL, al); | 2045 | ssl3_send_alert(s, SSL3_AL_FATAL, al); |
@@ -2183,7 +2183,7 @@ ssl3_get_cert_verify(SSL *s) | |||
2183 | uint16_t sigalg_value; | 2183 | uint16_t sigalg_value; |
2184 | 2184 | ||
2185 | if (!CBS_get_u16(&cbs, &sigalg_value)) | 2185 | if (!CBS_get_u16(&cbs, &sigalg_value)) |
2186 | goto truncated; | 2186 | goto decode_err; |
2187 | if ((sigalg = ssl_sigalg(sigalg_value, tls12_sigalgs, | 2187 | if ((sigalg = ssl_sigalg(sigalg_value, tls12_sigalgs, |
2188 | tls12_sigalgs_len)) == NULL || | 2188 | tls12_sigalgs_len)) == NULL || |
2189 | (md = sigalg->md()) == NULL) { | 2189 | (md = sigalg->md()) == NULL) { |
@@ -2324,7 +2324,7 @@ ssl3_get_cert_verify(SSL *s) | |||
2324 | 2324 | ||
2325 | ret = 1; | 2325 | ret = 1; |
2326 | if (0) { | 2326 | if (0) { |
2327 | truncated: | 2327 | decode_err: |
2328 | al = SSL_AD_DECODE_ERROR; | 2328 | al = SSL_AD_DECODE_ERROR; |
2329 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); | 2329 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); |
2330 | f_err: | 2330 | f_err: |
@@ -2381,7 +2381,7 @@ ssl3_get_client_certificate(SSL *s) | |||
2381 | } | 2381 | } |
2382 | 2382 | ||
2383 | if (n < 0) | 2383 | if (n < 0) |
2384 | goto truncated; | 2384 | goto decode_err; |
2385 | 2385 | ||
2386 | CBS_init(&cbs, s->internal->init_msg, n); | 2386 | CBS_init(&cbs, s->internal->init_msg, n); |
2387 | 2387 | ||
@@ -2392,7 +2392,7 @@ ssl3_get_client_certificate(SSL *s) | |||
2392 | 2392 | ||
2393 | if (!CBS_get_u24_length_prefixed(&cbs, &client_certs) || | 2393 | if (!CBS_get_u24_length_prefixed(&cbs, &client_certs) || |
2394 | CBS_len(&cbs) != 0) | 2394 | CBS_len(&cbs) != 0) |
2395 | goto truncated; | 2395 | goto decode_err; |
2396 | 2396 | ||
2397 | while (CBS_len(&client_certs) > 0) { | 2397 | while (CBS_len(&client_certs) > 0) { |
2398 | CBS cert; | 2398 | CBS cert; |
@@ -2470,13 +2470,13 @@ ssl3_get_client_certificate(SSL *s) | |||
2470 | 2470 | ||
2471 | ret = 1; | 2471 | ret = 1; |
2472 | if (0) { | 2472 | if (0) { |
2473 | truncated: | 2473 | decode_err: |
2474 | al = SSL_AD_DECODE_ERROR; | 2474 | al = SSL_AD_DECODE_ERROR; |
2475 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); | 2475 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); |
2476 | f_err: | 2476 | f_err: |
2477 | ssl3_send_alert(s, SSL3_AL_FATAL, al); | 2477 | ssl3_send_alert(s, SSL3_AL_FATAL, al); |
2478 | } | 2478 | } |
2479 | err: | 2479 | err: |
2480 | X509_free(x); | 2480 | X509_free(x); |
2481 | sk_X509_pop_free(sk, X509_free); | 2481 | sk_X509_pop_free(sk, X509_free); |
2482 | 2482 | ||