|
35 | 35 | #define mbedtls_free free |
36 | 36 | #endif |
37 | 37 |
|
38 | | -#include "mbedtls/debug.h" |
39 | 38 | #include "mbedtls/ssl.h" |
40 | 39 | #include "mbedtls/ssl_internal.h" |
| 40 | +#include "mbedtls/debug.h" |
| 41 | +#include "mbedtls/error.h" |
41 | 42 |
|
42 | 43 | #if defined(MBEDTLS_USE_PSA_CRYPTO) |
43 | 44 | #include "mbedtls/psa_util.h" |
@@ -402,7 +403,7 @@ static void ssl_write_ecjpake_kkpp_ext( mbedtls_ssl_context *ssl, |
402 | 403 | unsigned char *buf, |
403 | 404 | size_t *olen ) |
404 | 405 | { |
405 | | - int ret; |
| 406 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
406 | 407 | unsigned char *p = buf; |
407 | 408 | const unsigned char *end = ssl->out_msg + MBEDTLS_SSL_OUT_CONTENT_LEN; |
408 | 409 | size_t kkpp_len; |
@@ -766,7 +767,7 @@ static void ssl_write_alpn_ext( mbedtls_ssl_context *ssl, |
766 | 767 | */ |
767 | 768 | static int ssl_generate_random( mbedtls_ssl_context *ssl ) |
768 | 769 | { |
769 | | - int ret; |
| 770 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
770 | 771 | unsigned char *p = ssl->handshake->randbytes; |
771 | 772 | #if defined(MBEDTLS_HAVE_TIME) |
772 | 773 | mbedtls_time_t t; |
@@ -858,7 +859,7 @@ static int ssl_validate_ciphersuite( const mbedtls_ssl_ciphersuite_t * suite_inf |
858 | 859 |
|
859 | 860 | static int ssl_write_client_hello( mbedtls_ssl_context *ssl ) |
860 | 861 | { |
861 | | - int ret; |
| 862 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
862 | 863 | size_t i, n, olen, ext_len = 0; |
863 | 864 | unsigned char *buf; |
864 | 865 | unsigned char *p, *q; |
@@ -1470,7 +1471,7 @@ static int ssl_parse_ecjpake_kkpp( mbedtls_ssl_context *ssl, |
1470 | 1471 | const unsigned char *buf, |
1471 | 1472 | size_t len ) |
1472 | 1473 | { |
1473 | | - int ret; |
| 1474 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
1474 | 1475 |
|
1475 | 1476 | if( ssl->handshake->ciphersuite_info->key_exchange != |
1476 | 1477 | MBEDTLS_KEY_EXCHANGE_ECJPAKE ) |
@@ -2384,7 +2385,7 @@ static int ssl_write_encrypted_pms( mbedtls_ssl_context *ssl, |
2384 | 2385 | size_t offset, size_t *olen, |
2385 | 2386 | size_t pms_offset ) |
2386 | 2387 | { |
2387 | | - int ret; |
| 2388 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
2388 | 2389 | size_t len_bytes = ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ? 0 : 2; |
2389 | 2390 | unsigned char *p = ssl->handshake->premaster + pms_offset; |
2390 | 2391 | mbedtls_pk_context * peer_pk; |
@@ -2531,7 +2532,7 @@ static int ssl_parse_signature_algorithm( mbedtls_ssl_context *ssl, |
2531 | 2532 | defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) |
2532 | 2533 | static int ssl_get_ecdh_params_from_cert( mbedtls_ssl_context *ssl ) |
2533 | 2534 | { |
2534 | | - int ret; |
| 2535 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
2535 | 2536 | const mbedtls_ecp_keypair *peer_key; |
2536 | 2537 | mbedtls_pk_context * peer_pk; |
2537 | 2538 |
|
@@ -2582,7 +2583,7 @@ static int ssl_get_ecdh_params_from_cert( mbedtls_ssl_context *ssl ) |
2582 | 2583 |
|
2583 | 2584 | static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl ) |
2584 | 2585 | { |
2585 | | - int ret; |
| 2586 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
2586 | 2587 | const mbedtls_ssl_ciphersuite_t *ciphersuite_info = |
2587 | 2588 | ssl->handshake->ciphersuite_info; |
2588 | 2589 | unsigned char *p = NULL, *end = NULL; |
@@ -2971,7 +2972,7 @@ static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl ) |
2971 | 2972 | #else /* MBEDTLS_KEY_EXCHANGE__CERT_REQ_ALLOWED__ENABLED */ |
2972 | 2973 | static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl ) |
2973 | 2974 | { |
2974 | | - int ret; |
| 2975 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
2975 | 2976 | unsigned char *buf; |
2976 | 2977 | size_t n = 0; |
2977 | 2978 | size_t cert_type_len = 0, dn_len = 0; |
@@ -3135,7 +3136,7 @@ static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl ) |
3135 | 3136 |
|
3136 | 3137 | static int ssl_parse_server_hello_done( mbedtls_ssl_context *ssl ) |
3137 | 3138 | { |
3138 | | - int ret; |
| 3139 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
3139 | 3140 |
|
3140 | 3141 | MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse server hello done" ) ); |
3141 | 3142 |
|
@@ -3174,7 +3175,7 @@ static int ssl_parse_server_hello_done( mbedtls_ssl_context *ssl ) |
3174 | 3175 |
|
3175 | 3176 | static int ssl_write_client_key_exchange( mbedtls_ssl_context *ssl ) |
3176 | 3177 | { |
3177 | | - int ret; |
| 3178 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
3178 | 3179 |
|
3179 | 3180 | size_t header_len; |
3180 | 3181 | size_t content_len; |
@@ -3595,7 +3596,7 @@ static int ssl_write_certificate_verify( mbedtls_ssl_context *ssl ) |
3595 | 3596 | { |
3596 | 3597 | const mbedtls_ssl_ciphersuite_t *ciphersuite_info = |
3597 | 3598 | ssl->handshake->ciphersuite_info; |
3598 | | - int ret; |
| 3599 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
3599 | 3600 |
|
3600 | 3601 | MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write certificate verify" ) ); |
3601 | 3602 |
|
@@ -3790,7 +3791,7 @@ static int ssl_write_certificate_verify( mbedtls_ssl_context *ssl ) |
3790 | 3791 | #if defined(MBEDTLS_SSL_SESSION_TICKETS) |
3791 | 3792 | static int ssl_parse_new_session_ticket( mbedtls_ssl_context *ssl ) |
3792 | 3793 | { |
3793 | | - int ret; |
| 3794 | + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; |
3794 | 3795 | uint32_t lifetime; |
3795 | 3796 | size_t ticket_len; |
3796 | 3797 | unsigned char *ticket; |
|
0 commit comments