1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

null crypto debugging

This commit is contained in:
dan 2023-03-03 11:04:25 -08:00
parent bc5a9dd559
commit 02ee0ec6cf
2 changed files with 16 additions and 21 deletions

View file

@ -1127,6 +1127,12 @@ namespace llarp::quic
ngtcp2_conn_handshake_completed(conn.get());
if (on_handshake_complete)
{
on_handshake_complete(*this);
on_handshake_complete = nullptr;
}
return 0;
}
@ -1235,26 +1241,6 @@ namespace llarp::quic
return 0;
}
/*
void
Connection::complete_handshake()
{
log::debug(logcat, "QUIC connection call ngtcp2_conn_handshake_completed");
endpoint.null_crypto.install_rx_key(conn.get());
if (not ngtcp2_conn_is_server(conn.get()))
{
if (not endpoint.null_crypto.install_tx_key(conn.get()))
log::debug(logcat, "Call to install_tx_key unsuccessful at {}", __LINE__);
}
ngtcp2_conn_handshake_completed(conn.get());
if (on_handshake_complete)
{
on_handshake_complete(*this);
on_handshake_complete = nullptr;
}
}
*/
// ngtcp2 doesn't expose the varint encoding, but it's fairly simple:
// 0bXXyyyyyy -- XX indicates the encoded size (00=1, 01=2, 10=4, 11=8) and the rest of the bits

View file

@ -71,6 +71,7 @@ namespace llarp::quic
bool
NullCrypto::install_tx_handshake_key(ngtcp2_conn* conn)
{
log::debug(logcat, "Calling {}", __PRETTY_FUNCTION__);
return ngtcp2_conn_install_tx_handshake_key(
conn, &null_aead_ctx, null_iv.data(), null_iv.size(), &null_cipher_ctx)
== 0;
@ -78,6 +79,7 @@ namespace llarp::quic
bool
NullCrypto::install_rx_handshake_key(ngtcp2_conn* conn)
{
log::debug(logcat, "Calling {}", __PRETTY_FUNCTION__);
return ngtcp2_conn_install_rx_handshake_key(
conn, &null_aead_ctx, null_iv.data(), null_iv.size(), &null_cipher_ctx)
== 0;
@ -85,6 +87,7 @@ namespace llarp::quic
bool
NullCrypto::install_tx_key(ngtcp2_conn* conn)
{
log::debug(logcat, "Calling {}", __PRETTY_FUNCTION__);
return ngtcp2_conn_install_tx_key(
conn,
null_iv.data(),
@ -99,7 +102,13 @@ namespace llarp::quic
NullCrypto::install_rx_key(ngtcp2_conn* conn)
{
return ngtcp2_conn_install_rx_key(
conn, nullptr, 0, &null_aead_ctx, null_iv.data(), null_iv.size(), &null_cipher_ctx)
conn,
nullptr,
0,
&null_aead_ctx,
null_iv.data(),
null_iv.size(),
&null_cipher_ctx)
== 0;
}