Skip to content

Commit

Permalink
Refactored path message serialization
Browse files Browse the repository at this point in the history
- DRYing out message serialization across path message types
  • Loading branch information
dr7ana committed Oct 25, 2024
1 parent 0805844 commit de4843c
Show file tree
Hide file tree
Showing 18 changed files with 442 additions and 471 deletions.
2 changes: 1 addition & 1 deletion external/oxen-libquic
7 changes: 5 additions & 2 deletions llarp/crypto/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,12 @@ namespace llarp
}

void crypto::derive_decrypt_outer_wrapping(
const Ed25519SecretKey& local_sk, const PubKey& remote, const SymmNonce& nonce, uspan encrypted)
const Ed25519SecretKey& local_sk,
SharedSecret& shared,
const PubKey& remote,
const SymmNonce& nonce,
uspan encrypted)
{
SharedSecret shared;
// derive shared secret using ephemeral pubkey and our secret key (and nonce)
if (!crypto::dh_server(shared, remote, local_sk, nonce))
{
Expand Down
6 changes: 5 additions & 1 deletion llarp/crypto/crypto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ namespace llarp
/// pubkey and the provided nonce. The encrypted payload is mutated in-place. Will throw on failure of either
/// the server DH derivation or the xchacha20 payload mutation
void derive_decrypt_outer_wrapping(
const Ed25519SecretKey& local, const PubKey& remote, const SymmNonce& nonce, uspan encrypted);
const Ed25519SecretKey& local,
SharedSecret& shared,
const PubKey& remote,
const SymmNonce& nonce,
uspan encrypted);

bool make_scalar(AlignedBuffer<32>& out, const PubKey& k, uint64_t i);

Expand Down
8 changes: 7 additions & 1 deletion llarp/handlers/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ namespace llarp::handlers

_running = false;

if (_cc_publisher)
{
log::debug(logcat, "ClientContact publish ticker stopped!");
_cc_publisher->stop();
}

Lock_t l{paths_mutex};

_sessions.stop_sessions(send_close);
Expand Down Expand Up @@ -145,7 +151,7 @@ namespace llarp::handlers
true);
}
else
log::debug(logcat, "SessionEndpoint configured to NOT publish ClientContact...");
log::info(logcat, "SessionEndpoint configured to NOT publish ClientContact...");
}

void SessionEndpoint::resolve_ons_mappings()
Expand Down
Loading

0 comments on commit de4843c

Please sign in to comment.