mirror of https://github.com/vacp2p/nim-quic.git
Cleanup: install initial key for server at the right moment
This commit is contained in:
parent
4bdd74d9b6
commit
8c135eae81
|
@ -10,6 +10,18 @@ import settings
|
|||
var cryptoData: array[4096, uint8]
|
||||
|
||||
proc receiveClientInitial(connection: ptr ngtcp2_conn, dcid: ptr ngtcp2_cid, userData: pointer): cint {.cdecl.} =
|
||||
var initialKey: Key
|
||||
assert 0 == ngtcp2_conn_install_initial_key(
|
||||
connection,
|
||||
addr initialKey.aeadContext,
|
||||
addr initialKey.iv[0],
|
||||
addr initialKey.hpContext,
|
||||
addr initialKey.aeadContext,
|
||||
addr initialKey.iv[0],
|
||||
addr initialKey.hpContext,
|
||||
sizeof(initialKey.iv).uint
|
||||
)
|
||||
|
||||
var rxHandshakeKey: Key
|
||||
assert 0 == ngtcp2_conn_install_rx_handshake_key(
|
||||
connection,
|
||||
|
@ -111,16 +123,4 @@ proc setupServer*(path: ptr ngtcp2_path, sourceId: ptr ngtcp2_cid, destinationId
|
|||
nil
|
||||
)
|
||||
|
||||
var initialKey: Key
|
||||
assert 0 == ngtcp2_conn_install_initial_key(
|
||||
result,
|
||||
addr initialKey.aeadContext,
|
||||
addr initialKey.iv[0],
|
||||
addr initialKey.hpContext,
|
||||
addr initialKey.aeadContext,
|
||||
addr initialKey.iv[0],
|
||||
addr initialKey.hpContext,
|
||||
sizeof(initialKey.iv).uint
|
||||
)
|
||||
|
||||
ngtcp2_conn_set_aead_overhead(result, NGTCP2_FAKE_AEAD_OVERHEAD)
|
||||
|
|
Loading…
Reference in New Issue