mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-10-24 04:09:07 +03:00
The session cache is shared by every CTX in the process, and a connection between a client and a server in the same process stores two entries under the same session ID, one per side. Both landed in the same row, so each connection used two of the row's three slots in the default cache. When the next connection's ID hashed to the same row, its two inserts wrapped around and overwrote the oldest entry of the first connection. Since the client caches its session in DoFinished(), after the server verified the Finished, the oldest entry is the server's, so the server could no longer resume the first session. That made test_session and test_session_handling in the CPython CI fail intermittently with session_reused False. Hash client entries into the row after the one their ID maps to, so the two sides of a connection never compete for the same row. This changes where a persisted cache keeps its client entries, but WOLFSSL_CACHE_VERSION 4 has not been in a release yet, so it covers the new mapping and caches saved by released builds (version 3) are still rejected on restore. The new test only builds with three or fewer sessions per row, since two connections cannot evict anything from a larger row, and reports a skip when it finds no pair of connections sharing a row.
190 lines
11 KiB
C
190 lines
11 KiB
C
/* test_tls.h
|
|
*
|
|
* Copyright (C) 2006-2026 wolfSSL Inc.
|
|
*
|
|
* This file is part of wolfSSL.
|
|
*
|
|
* wolfSSL is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* wolfSSL is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
|
*/
|
|
|
|
#ifndef TESTS_API_TEST_TLS_H
|
|
#define TESTS_API_TEST_TLS_H
|
|
|
|
int test_utils_memio_move_message(void);
|
|
int test_tls12_unexpected_ccs(void);
|
|
int test_tls12_early_server_ccs(void);
|
|
int test_tls13_unexpected_ccs(void);
|
|
int test_tls13_plaintext_record_version_ignored(void);
|
|
int test_tls_record_version_still_checked(void);
|
|
int test_tls_record_overflow_alert(void);
|
|
int test_tls_peer_name_mismatch_verify_cb(void);
|
|
int test_tls_peer_name_mismatch_verify_result(void);
|
|
int test_tls_get_peer_tmp_key(void);
|
|
int test_tls_get_negotiated_group(void);
|
|
int test_tls_alert_info_cb(void);
|
|
int test_tls_shutdown_in_init(void);
|
|
int test_tls_unknown_record_type_alert(void);
|
|
int test_tls12_curve_intersection(void);
|
|
int test_tls12_dhe_rsa_pss_sigalg(void);
|
|
int test_tls12_dhe_renegotiate_larger_prime(void);
|
|
int test_tls12_dhe_reuse_prime_check(void);
|
|
int test_tls12_ske_sig_param_binding(void);
|
|
int test_tls12_bad_cv_sig_content(void);
|
|
int test_tls13_curve_intersection(void);
|
|
int test_tls_certreq_order(void);
|
|
int test_tls12_certreq_odd_sigalgs(void);
|
|
int test_tls12_bad_cv_sig_alg(void);
|
|
int test_tls12_no_null_compression(void);
|
|
int test_tls12_ec_point_formats_no_uncompressed(void);
|
|
int test_tls12_ec_point_formats_no_uncompressed_non_ecc(void);
|
|
int test_tls_fallback_scsv(void);
|
|
int test_dhe_psk_max_premaster(void);
|
|
int test_dtls_fallback_scsv(void);
|
|
int test_dtls_fallback_scsv_no_downgrade(void);
|
|
int test_tls_fallback_scsv_no_downgrade(void);
|
|
int test_tls_fallback_scsv_no_downgrade_runtime_max(void);
|
|
int test_tls_no_acceptable_version_alert(void);
|
|
int test_tls_lesser_version_alerts(void);
|
|
int test_tls_version_mask_alert_record(void);
|
|
int test_tls_version_error_alert_mapping(void);
|
|
int test_tls12_etm_failed_resumption(void);
|
|
int test_tls12_resume_ticket_wrong_suite(void);
|
|
int test_tls12_resume_ticket_decline_fallback(void);
|
|
int test_tls12_ticket_dropped_on_bad_finished(void);
|
|
int test_tls12_ticket_cached_after_finished(void);
|
|
int test_tls12_empty_ticket_keeps_cached(void);
|
|
int test_tls12_session_cache_shared_row(void);
|
|
int test_tls12_server_hello_tls13_suite(void);
|
|
int test_tls12_client_hello_no_tls13_suites(void);
|
|
int test_tls_set_session_min_downgrade(void);
|
|
int test_tls12_session_id_resumption_sni_mismatch(void);
|
|
int test_tls13_session_resumption_sni_mismatch(void);
|
|
int test_tls13_resumption_with_alpn(void);
|
|
int test_tls12_session_id_resumption_alpn_mismatch(void);
|
|
int test_tls13_session_resumption_alpn_mismatch(void);
|
|
int test_tls_set_curves_list_ecc_fallback(void);
|
|
int test_tls12_corrupted_finished(void);
|
|
int test_tls12_peerauth_failsafe(void);
|
|
int test_tls12_ecdhe_ecdsa_rsa_client_cert(void);
|
|
int test_tls12_ecdhe_rsa_ecdsa_client_cert(void);
|
|
int test_tls12_ed25519_dev_private_key(void);
|
|
int test_tls12_ed448_dev_private_key(void);
|
|
int test_wolfSSL_alert_type_string(void);
|
|
int test_wolfSSL_alert_desc_string(void);
|
|
int test_tls12_chain_verify_cb(void);
|
|
int test_tls12_chain_verify_cb_server(void);
|
|
int test_tls13_chain_verify_cb_defer(void);
|
|
int test_tls13_chain_verify_cb_server(void);
|
|
int test_tls13_chain_verify_cb_reject(void);
|
|
int test_tls13_chain_verify_cb_success_rejects(void);
|
|
int test_tls12_chain_verify_cb_bad_der(void);
|
|
int test_tls12_chain_verify_cb_bad_chain(void);
|
|
int test_tls13_chain_verify_cb_postauth(void);
|
|
int test_chain_verify_cb_min_key(void);
|
|
int test_chain_verify_cb_dtls(void);
|
|
int test_chain_verify_cb_stapling(void);
|
|
int test_record_size_matches_build_message(void);
|
|
int test_record_size_preserves_build_msg_state(void);
|
|
int test_record_size_cache_invalidated_on_renegotiation(void);
|
|
int test_wolfSSL_get_shared_ciphers(void);
|
|
int test_tls12_aesgcm_record_nonce_unique(void);
|
|
int test_tls_param_flags_crl_check(void);
|
|
|
|
#define TEST_TLS_DECLS \
|
|
TEST_DECL_GROUP("tls", test_utils_memio_move_message), \
|
|
TEST_DECL_GROUP("tls", test_tls12_unexpected_ccs), \
|
|
TEST_DECL_GROUP("tls", test_tls12_early_server_ccs), \
|
|
TEST_DECL_GROUP("tls", test_tls13_unexpected_ccs), \
|
|
TEST_DECL_GROUP("tls", test_tls13_plaintext_record_version_ignored), \
|
|
TEST_DECL_GROUP("tls", test_tls_record_version_still_checked), \
|
|
TEST_DECL_GROUP("tls", test_tls_record_overflow_alert), \
|
|
TEST_DECL_GROUP("tls", test_tls_peer_name_mismatch_verify_cb), \
|
|
TEST_DECL_GROUP("tls", test_tls_peer_name_mismatch_verify_result), \
|
|
TEST_DECL_GROUP("tls", test_tls_get_peer_tmp_key), \
|
|
TEST_DECL_GROUP("tls", test_tls_get_negotiated_group), \
|
|
TEST_DECL_GROUP("tls", test_tls_alert_info_cb), \
|
|
TEST_DECL_GROUP("tls", test_tls_shutdown_in_init), \
|
|
TEST_DECL_GROUP("tls", test_tls_unknown_record_type_alert), \
|
|
TEST_DECL_GROUP("tls", test_tls12_curve_intersection), \
|
|
TEST_DECL_GROUP("tls", test_tls12_dhe_rsa_pss_sigalg), \
|
|
TEST_DECL_GROUP("tls", test_tls12_dhe_renegotiate_larger_prime), \
|
|
TEST_DECL_GROUP("tls", test_tls12_dhe_reuse_prime_check), \
|
|
TEST_DECL_GROUP("tls", test_tls12_ske_sig_param_binding), \
|
|
TEST_DECL_GROUP("tls", test_tls12_bad_cv_sig_content), \
|
|
TEST_DECL_GROUP("tls", test_tls13_curve_intersection), \
|
|
TEST_DECL_GROUP("tls", test_tls_certreq_order), \
|
|
TEST_DECL_GROUP("tls", test_tls12_certreq_odd_sigalgs), \
|
|
TEST_DECL_GROUP("tls", test_tls12_bad_cv_sig_alg), \
|
|
TEST_DECL_GROUP("tls", test_tls12_no_null_compression), \
|
|
TEST_DECL_GROUP("tls", test_tls12_ec_point_formats_no_uncompressed), \
|
|
TEST_DECL_GROUP("tls", \
|
|
test_tls12_ec_point_formats_no_uncompressed_non_ecc), \
|
|
TEST_DECL_GROUP("tls", test_tls_fallback_scsv), \
|
|
TEST_DECL_GROUP("tls", test_dtls_fallback_scsv), \
|
|
TEST_DECL_GROUP("tls", test_dtls_fallback_scsv_no_downgrade), \
|
|
TEST_DECL_GROUP("tls", test_tls_fallback_scsv_no_downgrade), \
|
|
TEST_DECL_GROUP("tls", test_tls_fallback_scsv_no_downgrade_runtime_max),\
|
|
TEST_DECL_GROUP("tls", test_tls_no_acceptable_version_alert), \
|
|
TEST_DECL_GROUP("tls", test_tls_lesser_version_alerts), \
|
|
TEST_DECL_GROUP("tls", test_tls_version_mask_alert_record), \
|
|
TEST_DECL_GROUP("tls", test_tls_version_error_alert_mapping), \
|
|
TEST_DECL_GROUP("tls", test_tls12_etm_failed_resumption), \
|
|
TEST_DECL_GROUP("tls", test_tls12_resume_ticket_wrong_suite), \
|
|
TEST_DECL_GROUP("tls", test_tls12_resume_ticket_decline_fallback), \
|
|
TEST_DECL_GROUP("tls", test_tls12_ticket_dropped_on_bad_finished), \
|
|
TEST_DECL_GROUP("tls", test_tls12_ticket_cached_after_finished), \
|
|
TEST_DECL_GROUP("tls", test_tls12_empty_ticket_keeps_cached), \
|
|
TEST_DECL_GROUP("tls", test_tls12_session_cache_shared_row), \
|
|
TEST_DECL_GROUP("tls", test_tls12_server_hello_tls13_suite), \
|
|
TEST_DECL_GROUP("tls", test_tls12_client_hello_no_tls13_suites), \
|
|
TEST_DECL_GROUP("tls", test_tls_set_session_min_downgrade), \
|
|
TEST_DECL_GROUP("tls", test_tls12_session_id_resumption_sni_mismatch), \
|
|
TEST_DECL_GROUP("tls", test_tls13_session_resumption_sni_mismatch), \
|
|
TEST_DECL_GROUP("tls", test_tls13_resumption_with_alpn), \
|
|
TEST_DECL_GROUP("tls", test_tls12_session_id_resumption_alpn_mismatch),\
|
|
TEST_DECL_GROUP("tls", test_tls13_session_resumption_alpn_mismatch), \
|
|
TEST_DECL_GROUP("tls", test_tls_set_curves_list_ecc_fallback), \
|
|
TEST_DECL_GROUP("tls", test_tls12_corrupted_finished), \
|
|
TEST_DECL_GROUP("tls", test_tls12_peerauth_failsafe), \
|
|
TEST_DECL_GROUP("tls", test_tls12_ecdhe_ecdsa_rsa_client_cert), \
|
|
TEST_DECL_GROUP("tls", test_tls12_ecdhe_rsa_ecdsa_client_cert), \
|
|
TEST_DECL_GROUP("tls", test_tls12_ed25519_dev_private_key), \
|
|
TEST_DECL_GROUP("tls", test_tls12_ed448_dev_private_key), \
|
|
TEST_DECL_GROUP("tls", test_wolfSSL_alert_type_string), \
|
|
TEST_DECL_GROUP("tls", test_wolfSSL_alert_desc_string), \
|
|
TEST_DECL_GROUP("tls", test_record_size_matches_build_message), \
|
|
TEST_DECL_GROUP("tls", \
|
|
test_record_size_preserves_build_msg_state), \
|
|
TEST_DECL_GROUP("tls", \
|
|
test_record_size_cache_invalidated_on_renegotiation), \
|
|
TEST_DECL_GROUP("tls", test_wolfSSL_get_shared_ciphers), \
|
|
TEST_DECL_GROUP("tls", test_tls12_aesgcm_record_nonce_unique), \
|
|
TEST_DECL_GROUP("tls", test_tls_param_flags_crl_check), \
|
|
TEST_DECL_GROUP("tls", test_dhe_psk_max_premaster), \
|
|
TEST_DECL_GROUP("tls", test_tls12_chain_verify_cb), \
|
|
TEST_DECL_GROUP("tls", test_tls12_chain_verify_cb_server), \
|
|
TEST_DECL_GROUP("tls", test_tls13_chain_verify_cb_defer), \
|
|
TEST_DECL_GROUP("tls", test_tls13_chain_verify_cb_server), \
|
|
TEST_DECL_GROUP("tls", test_tls13_chain_verify_cb_reject), \
|
|
TEST_DECL_GROUP("tls", test_tls13_chain_verify_cb_success_rejects), \
|
|
TEST_DECL_GROUP("tls", test_tls12_chain_verify_cb_bad_der), \
|
|
TEST_DECL_GROUP("tls", test_tls12_chain_verify_cb_bad_chain), \
|
|
TEST_DECL_GROUP("tls", test_tls13_chain_verify_cb_postauth), \
|
|
TEST_DECL_GROUP("tls", test_chain_verify_cb_min_key), \
|
|
TEST_DECL_GROUP("tls", test_chain_verify_cb_dtls), \
|
|
TEST_DECL_GROUP("tls", test_chain_verify_cb_stapling)
|
|
|
|
#endif /* TESTS_API_TEST_TLS_H */
|