From e4c793b78d678c6eb90dbd32137c3547faa6721d Mon Sep 17 00:00:00 2001 From: Roberto Guimaraes Date: Mon, 26 Feb 2024 09:32:00 -0700 Subject: [PATCH] cosmetic: rename function so it does not read as a test run clang-format against lib/picotls.c and t/picotls.c --- lib/picotls.c | 15 ++++++++------- t/picotls.c | 12 +++++++----- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/picotls.c b/lib/picotls.c index f866f0ec..34e6b5e3 100644 --- a/lib/picotls.c +++ b/lib/picotls.c @@ -5131,14 +5131,15 @@ int ptls_export(ptls_t *tls, ptls_buffer_t *output) if (tls->state != PTLS_STATE_SERVER_POST_HANDSHAKE) return PTLS_ERROR_LIBRARY; return export_tls13_params(output, tls->is_server, tls->is_psk_handshake, tls->cipher_suite, tls->client_random, - tls->server_name, negotiated_protocol, tls->traffic_protection.enc.secret, tls->traffic_protection.enc.seq, - tls->traffic_protection.dec.secret, tls->traffic_protection.dec.seq); + tls->server_name, negotiated_protocol, tls->traffic_protection.enc.secret, + tls->traffic_protection.enc.seq, tls->traffic_protection.dec.secret, + tls->traffic_protection.dec.seq); } else { return export_tls12_params(output, tls->is_server, tls->is_psk_handshake, tls->cipher_suite, tls->client_random, - tls->server_name, negotiated_protocol, tls->traffic_protection.enc.secret, - tls->traffic_protection.enc.secret + PTLS_MAX_SECRET_SIZE, tls->traffic_protection.enc.seq, - tls->traffic_protection.enc.tls12_enc_record_iv, tls->traffic_protection.dec.secret, - tls->traffic_protection.dec.secret + PTLS_MAX_SECRET_SIZE, tls->traffic_protection.dec.seq); + tls->server_name, negotiated_protocol, tls->traffic_protection.enc.secret, + tls->traffic_protection.enc.secret + PTLS_MAX_SECRET_SIZE, tls->traffic_protection.enc.seq, + tls->traffic_protection.enc.tls12_enc_record_iv, tls->traffic_protection.dec.secret, + tls->traffic_protection.dec.secret + PTLS_MAX_SECRET_SIZE, tls->traffic_protection.dec.seq); } } @@ -5261,7 +5262,7 @@ int ptls_import(ptls_context_t *ctx, ptls_t **tls, ptls_iovec_t params) goto Exit; (*tls)->key_schedule = key_schedule_new((*tls)->cipher_suite, (*tls)->ctx->cipher_suites, (*tls)->ech.aead != NULL); (*tls)->state = PTLS_STATE_SERVER_POST_HANDSHAKE; - goto Exit; + goto Exit; default: ret = PTLS_ALERT_ILLEGAL_PARAMETER; break; diff --git a/t/picotls.c b/t/picotls.c index d50fb4d9..e07f9722 100644 --- a/t/picotls.c +++ b/t/picotls.c @@ -891,14 +891,14 @@ static void aead_keys_cmp(ptls_t *src, ptls_t *dst, const char **err) ok(memcmp(src_keys[dec_idx].iv, dst_keys[dec_idx].iv, PTLS_MAX_IV_SIZE) == 0); } -static ptls_t *test_alloc_and_migrate_tls_context(ptls_t *prev_tls) +static ptls_t *alloc_and_migrate_tls_context(ptls_t *prev_tls) { ptls_buffer_t sess_data; ptls_buffer_init(&sess_data, "", 0); int r = ptls_export(prev_tls, &sess_data); assert(r == 0); ptls_t *tls = NULL; - r = ptls_import(ctx_peer, &tls, (ptls_iovec_t){ .base = sess_data.base, .len = sess_data.off }); + r = ptls_import(ctx_peer, &tls, (ptls_iovec_t){.base = sess_data.base, .len = sess_data.off}); assert(r == 0); const char *err = NULL; @@ -906,7 +906,8 @@ static ptls_t *test_alloc_and_migrate_tls_context(ptls_t *prev_tls) return tls; } -static void test_handshake(ptls_iovec_t ticket, int mode, int expect_ticket, int check_ch, int require_client_authentication, int transfer_session) +static void test_handshake(ptls_iovec_t ticket, int mode, int expect_ticket, int check_ch, int require_client_authentication, + int transfer_session) { ptls_t *client, *server; ptls_handshake_properties_t client_hs_prop = {{{{NULL}, ticket}}}, server_hs_prop = {{{{NULL}}}}; @@ -1113,7 +1114,7 @@ static void test_handshake(ptls_iovec_t ticket, int mode, int expect_ticket, int ok(ptls_handshake_is_complete(server)); decbuf.off = 0; cbuf.off = 0; - server = test_alloc_and_migrate_tls_context(original_server); + server = alloc_and_migrate_tls_context(original_server); ret = ptls_send(server, &sbuf, resp, strlen(resp)); ok(ret == 0); @@ -1348,7 +1349,8 @@ static void test_resumption_impl(int different_preferred_key_share, int require_ ctx_peer->encrypt_ticket = &et; ctx->save_ticket = &st; - test_handshake(saved_ticket, different_preferred_key_share ? TEST_HANDSHAKE_2RTT : TEST_HANDSHAKE_1RTT, 1, 0, 0, transfer_session); + test_handshake(saved_ticket, different_preferred_key_share ? TEST_HANDSHAKE_2RTT : TEST_HANDSHAKE_1RTT, 1, 0, 0, + transfer_session); ok(server_sc_callcnt == 1); ok(saved_ticket.base != NULL);