Skip to content

Commit

Permalink
[~] Fix key update error & add interop mode in demo_client
Browse files Browse the repository at this point in the history
  • Loading branch information
cherylsy committed Nov 7, 2023
1 parent b7ed2b6 commit 362d9bc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
13 changes: 11 additions & 2 deletions demo/demo_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ typedef struct xqc_demo_cli_quic_config_s {

uint8_t mp_version;

/* support interop test */
int is_interop_mode;

} xqc_demo_cli_quic_config_t;


Expand Down Expand Up @@ -1575,6 +1578,7 @@ xqc_demo_cli_init_conneciton_settings(xqc_conn_settings_t* settings,
settings->standby_path_probe_timeout = 1000;
settings->multipath_version = args->quic_cfg.mp_version;
settings->mp_ping_on = 1;
settings->is_interop_mode = args->quic_cfg.is_interop_mode;
if (args->req_cfg.throttled_req != -1) {
settings->enable_stream_rate_limit = 1;
settings->recv_rate_bytes_per_sec = 0;
Expand Down Expand Up @@ -1706,6 +1710,7 @@ xqc_demo_cli_usage(int argc, char *argv[])
" -u key update packet threshold\n"
" -d do not save responses to files\n"
" -M enable multipath\n"
" -o use interop mode\n"
" -i interface to create a path. For instance, we can use '-i lo -i lo' to create two paths via lo.\n"
" -w waiting N ms to start the first request.\n"
" -P enable MPQUIC to return ACK_MPs on any paths.\n"
Expand All @@ -1728,7 +1733,7 @@ void
xqc_demo_cli_parse_args(int argc, char *argv[], xqc_demo_cli_client_args_t *args)
{
int ch = 0;
while ((ch = getopt(argc, argv, "a:p:c:Ct:S:0m:A:D:l:L:k:K:U:u:dMi:w:Ps:bZ:NQT:R:V:I:n:eE")) != -1) {
while ((ch = getopt(argc, argv, "a:p:c:Ct:S:0m:A:D:l:L:k:K:U:u:dMoi:w:Ps:bZ:NQT:R:V:I:n:eE")) != -1) {
switch (ch) {
/* server ip */
case 'a':
Expand Down Expand Up @@ -1869,7 +1874,11 @@ xqc_demo_cli_parse_args(int argc, char *argv[], xqc_demo_cli_client_args_t *args
printf("option multipath on\n");
args->net_cfg.multipath = 1;
break;


case 'o':
printf("set interop mode\n");
args->quic_cfg.is_interop_mode = 1;
break;
case 'i':
printf("option adding interface: %s\n", optarg);
if (args->net_cfg.ifcnt < MAX_PATH_CNT) {
Expand Down
1 change: 1 addition & 0 deletions demo/demo_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,7 @@ xqc_demo_svr_parse_args(int argc, char *argv[], xqc_demo_svr_args_t *args)
case 'i':
printf("set interop mode\n");
args->quic_cfg.is_interop_mode = 1;
break;

case 'M':
printf("option multipath enabled\n");
Expand Down
4 changes: 2 additions & 2 deletions scripts/xquic_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ do_compile "XQC_OPENSSL_IS_BORINGSSL"
run_test_case

#run babassl
do_compile
run_test_case
# do_compile
# run_test_case

run_gcov
output_summary
Expand Down
6 changes: 5 additions & 1 deletion src/tls/xqc_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,11 @@ xqc_crypto_derive_updated_keys(xqc_crypto_t *crypto, xqc_key_type_t type)
static uint8_t LABEL[] = "quic ku";
uint8_t dest_buf[XQC_MAX_KNP_LEN];

ret = xqc_hkdf_expand_label(dest_buf, XQC_MAX_KNP_LEN,
if (current_ckm->secret.len > XQC_MAX_KNP_LEN) {
return -XQC_TLS_UPDATE_KEY_ERROR;
}

ret = xqc_hkdf_expand_label(dest_buf, current_ckm->secret.len,
current_ckm->secret.base, current_ckm->secret.len,
LABEL, xqc_lengthof(LABEL), &crypto->md);
if (ret != XQC_OK) {
Expand Down
4 changes: 2 additions & 2 deletions src/transport/xqc_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ xqc_conn_init_trans_settings(xqc_connection_t *conn)

/* set local default setting values */
if (conn->conn_settings.is_interop_mode) {
ls->max_streams_bidi = 16;
ls->max_streams_uni = 16;
ls->max_streams_bidi = 128;
ls->max_streams_uni = 128;

} else {
ls->max_streams_bidi = 1024;
Expand Down

0 comments on commit 362d9bc

Please sign in to comment.