Skip to content

Commit 27ffadb

Browse files
committed
add probe to observe ech selection
1 parent 161b08e commit 27ffadb

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/picotls.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2713,6 +2713,8 @@ static int client_ech_select_hello(ptls_t *tls, ptls_iovec_t message, size_t con
27132713
key_schedule_select_outer(tls->key_schedule);
27142714

27152715
Exit:
2716+
PTLS_PROBE(ECH_SELECTION, tls, tls->ech.accepted);
2717+
PTLS_LOG_CONN(ech_selection, tls, { PTLS_LOG_ELEMENT_BOOL(is_ech, tls->ech.accepted); });
27162718
ptls_clear_memory(confirm_hash_expected, sizeof(confirm_hash_expected));
27172719
return ret;
27182720
}
@@ -4264,6 +4266,10 @@ static int server_handle_hello(ptls_t *tls, ptls_message_emitter_t *emitter, ptl
42644266
ch->ech.cipher_suite, ch->ech.enc, ptls_iovec_init(ech_info_prefix, sizeof(ech_info_prefix)))) != NULL)
42654267
tls->ech.config_id = ch->ech.config_id;
42664268
}
4269+
if (!is_second_flight) {
4270+
PTLS_PROBE(ECH_SELECTION, tls, tls->ech.aead != NULL);
4271+
PTLS_LOG_CONN(ech_selection, tls, { PTLS_LOG_ELEMENT_BOOL(is_ech, tls->ech.aead != NULL); });
4272+
}
42674273
if (tls->ech.aead != NULL) {
42684274
/* now that AEAD context is available, create AAD and decrypt inner CH */
42694275
if ((ech.encoded_ch_inner = malloc(ch->ech.payload.len - tls->ech.aead->algo->tag_size)) == NULL ||

picotls-probes.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ provider picotls {
2626
probe client_random(struct st_ptls_t *tls, const void *bytes);
2727
probe receive_message(struct st_ptls_t *tls, uint8_t message, const void *bytes, size_t len, int result);
2828
probe new_secret(struct st_ptls_t *tls, const char *label, const char *secret_hex);
29+
probe ech_selection(struct st_ptls_t *tls, int is_ech);
2930
};

0 commit comments

Comments
 (0)