mirror of https://github.com/vacp2p/nim-quic.git
Cleanup: install handshake keys for client at the right moment
This commit is contained in:
parent
a3cc283abf
commit
8e1a5ede7c
|
@ -39,6 +39,24 @@ proc receiveCryptoData(connection: ptr ngtcp2_conn, level: ngtcp2_crypto_level,
|
|||
params.original_dcid = randomId
|
||||
assert 0 == ngtcp2_conn_set_remote_transport_params(connection, addr params)
|
||||
|
||||
var rxHandshakeKey: Key
|
||||
assert 0 == ngtcp2_conn_install_rx_handshake_key(
|
||||
connection,
|
||||
addr rxHandshakeKey.aeadContext,
|
||||
addr rxHandshakeKey.iv[0],
|
||||
sizeof(rxHandshakeKey.iv).uint,
|
||||
addr rxHandshakeKey.hpContext
|
||||
)
|
||||
|
||||
var txHandshakeKey: Key
|
||||
assert 0 == ngtcp2_conn_install_tx_handshake_key(
|
||||
connection,
|
||||
addr txHandshakeKey.aeadContext,
|
||||
addr txHandshakeKey.iv[0],
|
||||
sizeof(txHandshakeKey.iv).uint,
|
||||
addr txHandshakeKey.hpContext
|
||||
)
|
||||
|
||||
var rxKey: Key
|
||||
assert 0 == ngtcp2_conn_install_rx_key(
|
||||
connection,
|
||||
|
@ -109,25 +127,6 @@ proc setupClient*(path: ptr ngtcp2_path, sourceId: ptr ngtcp2_cid, destinationId
|
|||
nil
|
||||
)
|
||||
|
||||
var rxHandshakeKey: Key
|
||||
assert 0 == ngtcp2_conn_install_rx_handshake_key(
|
||||
result,
|
||||
addr rxHandshakeKey.aeadContext,
|
||||
addr rxHandshakeKey.iv[0],
|
||||
sizeof(rxHandshakeKey.iv).uint,
|
||||
addr rxHandshakeKey.hpContext
|
||||
)
|
||||
|
||||
var txHandshakeKey: Key
|
||||
assert 0 == ngtcp2_conn_install_tx_handshake_key(
|
||||
result,
|
||||
addr txHandshakeKey.aeadContext,
|
||||
addr txHandshakeKey.iv[0],
|
||||
sizeof(txHandshakeKey.iv).uint,
|
||||
addr txHandshakeKey.hpContext
|
||||
)
|
||||
|
||||
|
||||
var retryAead: RetryAead
|
||||
ngtcp2_conn_set_retry_aead(result, addr retryAead.aead, addr retryAead.aeadContext)
|
||||
|
||||
|
|
Loading…
Reference in New Issue