From 4621f88441f0f536c399a7da290598b8285a3dee Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 8 Nov 2019 00:06:09 +0900 Subject: [PATCH] Follow ngtcp2 API update --- src/h2load.h | 3 ++- src/h2load_quic.cc | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/h2load.h b/src/h2load.h index 928578aa..b6ef65c8 100644 --- a/src/h2load.h +++ b/src/h2load.h @@ -467,7 +467,8 @@ struct Client { int quic_stream_close(int64_t stream_id, uint64_t app_error_code); int quic_stream_reset(int64_t stream_id, uint64_t app_error_code); int quic_extend_max_local_streams(); - int quic_update_key(); + int quic_update_key(uint8_t *rx_key, uint8_t *rx_iv, uint8_t *tx_key, + uint8_t *tx_iv); int quic_on_key(ngtcp2_crypto_level level, const uint8_t *rx_secret, const uint8_t *tx_secret, size_t secretlen); diff --git a/src/h2load_quic.cc b/src/h2load_quic.cc index 2cbb0178..3398cb18 100644 --- a/src/h2load_quic.cc +++ b/src/h2load_quic.cc @@ -223,10 +223,11 @@ int get_new_connection_id(ngtcp2_conn *conn, ngtcp2_cid *cid, uint8_t *token, } // namespace namespace { -int update_key(ngtcp2_conn *conn, void *user_data) { +int update_key(ngtcp2_conn *conn, uint8_t *rx_key, uint8_t *rx_iv, + uint8_t *tx_key, uint8_t *tx_iv, void *user_data) { auto c = static_cast(user_data); - if (c->quic_update_key() != 0) { + if (c->quic_update_key(rx_key, rx_iv, tx_key, tx_iv) != 0) { return NGTCP2_ERR_CALLBACK_FAILURE; } @@ -234,13 +235,14 @@ int update_key(ngtcp2_conn *conn, void *user_data) { } } // namespace -int Client::quic_update_key() { +int Client::quic_update_key(uint8_t *rx_key, uint8_t *rx_iv, uint8_t *tx_key, + uint8_t *tx_iv) { std::array rx_secret, tx_secret; - if (ngtcp2_crypto_update_and_install_key( - quic.conn, rx_secret.data(), tx_secret.data(), nullptr, nullptr, - nullptr, nullptr, quic.rx_secret.data(), quic.tx_secret.data(), - quic.rx_secret.size()) != 0) { + if (ngtcp2_crypto_update_key(quic.conn, rx_secret.data(), tx_secret.data(), + rx_key, rx_iv, tx_key, tx_iv, + quic.rx_secret.data(), quic.tx_secret.data(), + quic.rx_secret.size()) != 0) { return -1; }