|
46 | 46 |
|
47 | 47 | #define CIPHER_SUITES_MAX_LENGTH (UINT16_MAX - 2)
|
48 | 48 | #define NUM_OF_CIPHER_SUITES_TO_DROP 150
|
49 |
| -#define MAXIMUM_NUM_OF_CIPHER_SUITES (CIPHER_SUITES_MAX_LENGTH / S2N_TLS_CIPHER_SUITE_LEN) |
| 49 | +#define MAX_CIPHER_SUITE_COUNT (CIPHER_SUITES_MAX_LENGTH / S2N_TLS_CIPHER_SUITE_LEN) |
50 | 50 | /* Drop 150 cipher suites from max, so that the total handshake message length won't exceed 64KB */
|
51 |
| -#define REDUCED_CIPHER_SUITE_COUNT (MAXIMUM_NUM_OF_CIPHER_SUITES - NUM_OF_CIPHER_SUITES_TO_DROP) |
| 51 | +#define REDUCED_CIPHER_SUITE_COUNT (MAX_CIPHER_SUITE_COUNT - NUM_OF_CIPHER_SUITES_TO_DROP) |
52 | 52 | /* Reducing cipher suites by 150 creates approximately 300 bytes margin below maximum handshake length */
|
53 | 53 | #define ESTIMATED_MAX_HANDSHAKE_LENGTH_MARGIN (NUM_OF_CIPHER_SUITES_TO_DROP * S2N_TLS_CIPHER_SUITE_LEN)
|
54 | 54 |
|
@@ -2036,9 +2036,9 @@ int main(int argc, char **argv)
|
2036 | 2036 |
|
2037 | 2037 | EXPECT_SUCCESS(s2n_config_add_cert_chain_and_key_to_store(server_config, chain_and_key));
|
2038 | 2038 |
|
2039 |
| - struct s2n_cipher_suite *test_cipher_suites[MAXIMUM_NUM_OF_CIPHER_SUITES] = { 0 }; |
| 2039 | + struct s2n_cipher_suite *test_cipher_suites[MAX_CIPHER_SUITE_COUNT] = { 0 }; |
2040 | 2040 |
|
2041 |
| - for (int i = 0; i < MAXIMUM_NUM_OF_CIPHER_SUITES; i++) { |
| 2041 | + for (int i = 0; i < MAX_CIPHER_SUITE_COUNT; i++) { |
2042 | 2042 | test_cipher_suites[i] = &s2n_rsa_with_aes_128_gcm_sha256;
|
2043 | 2043 | }
|
2044 | 2044 |
|
@@ -2082,10 +2082,10 @@ int main(int argc, char **argv)
|
2082 | 2082 | s2n_blocked_status blocked = S2N_NOT_BLOCKED;
|
2083 | 2083 |
|
2084 | 2084 | /* Write Client Hello into io_pair.server_in */
|
2085 |
| - s2n_negotiate(client, &blocked); |
| 2085 | + EXPECT_FAILURE_WITH_ERRNO(s2n_negotiate(client, &blocked), S2N_ERR_IO_BLOCKED); |
2086 | 2086 |
|
2087 | 2087 | /* The size of Client Hello exceeds S2N_MAXIMUM_HANDSHAKE_MESSAGE_LENGTH */
|
2088 |
| - EXPECT_TRUE(io_pair.server_in.write_cursor > S2N_MAXIMUM_HANDSHAKE_MESSAGE_LENGTH); |
| 2088 | + EXPECT_TRUE(s2n_stuffer_data_available(&io_pair.server_in) > S2N_MAXIMUM_HANDSHAKE_MESSAGE_LENGTH); |
2089 | 2089 | EXPECT_ERROR_WITH_ERRNO(s2n_negotiate_test_server_and_client_until_message(server, client, SERVER_HELLO), S2N_ERR_BAD_MESSAGE);
|
2090 | 2090 |
|
2091 | 2091 | /* handshake.io shouldn't be tainted after sending and receiving large client hello */
|
|
0 commit comments