feat: add ratchet, streaming, SU3 reseed, and router floodfill
- Add ratchet/ with ECIES-X25519-AEAD-Ratchet (Proposal 144), Garlic cloves, and ECIES DatabaseLookup replies - Add streaming/ with Ed25519-signed I2P Streaming (SYN/ACK/NACK/CLOSE/RESET, retransmit, window) and Repliable/Raw Datagrams - Add common/su3.mbt to parse and verify reseed .su3 bundles - Add Elligator2 encoding in crypto/ and OfflineSignature support in LeaseSet2 (flags bit 0) - Router: NTCP2 peer pool, floodfill NetDB crawl, transit tunnel relay, and Garlic/Streaming bridge - cmd/router: add --peer-dir, --su3, --reseed, --floodfill, --no-clock-skew - cmd/client: add --dest for persistent destination keys - Mark Phase 6 complete in README and document the transport scope (NTCP2 only, no SSU2)
This commit is contained in:
1 parent
8eafa11b22
commit
ae72b00323
54 files changed
+9607
-704
No files matched your search
@@ -238,3 +238,51 @@ test "aes256 FIPS-197 Appendix C.3 and SP 800-38A CBC vectors" {
|
||||
assert_eq(ct2, expected_ct2)
|
||||
assert_eq(@crypto.aes256_cbc_decrypt(key2, iv2, ct2), pt2)
|
||||
}
|
||||
|
||||
///|
|
||||
test "curve25519 elligator2 encode/decode reference vectors and properties" {
|
||||
// Reference vector cross-checked with Python F_p implementation
|
||||
let priv_key = @encoding.hex_decode(
|
||||
"dd8464b2cad5dc7381309cc5d57c9d421a58b7a0648eedb387543a594c1988ac",
|
||||
)
|
||||
let pub_u = @crypto.x25519_public_key(priv_key)
|
||||
assert_eq(
|
||||
@encoding.hex_encode(pub_u),
|
||||
"85d7ef41e7a6ded4d12312f796c30183a6325a56b734ae7fd19e416b7a47196b",
|
||||
)
|
||||
let rf = match @crypto.elligator2_encode(pub_u, high_bits=b'\xc0') {
|
||||
Some(r) => r
|
||||
None => fail("expected Elligator2 encode to succeed")
|
||||
}
|
||||
assert_eq(
|
||||
@encoding.hex_encode(rf),
|
||||
"0da9aad9ab2472b3d50db797d9d880adcb5c2440ed0db37eb30076f208ab23c2",
|
||||
)
|
||||
assert_eq(@crypto.elligator2_decode(rf), pub_u)
|
||||
|
||||
let rt = match
|
||||
@crypto.elligator2_encode(pub_u, high_bits=b'\x80', tweak_sign=true) {
|
||||
Some(r) => r
|
||||
None => fail("expected Elligator2 tweaked encode to succeed")
|
||||
}
|
||||
assert_eq(
|
||||
@encoding.hex_encode(rt),
|
||||
"631c48beab8932fafe3e39ee45099a29e8a461c08bdfb037baf33ac61d42a090",
|
||||
)
|
||||
assert_eq(@crypto.elligator2_decode(rt), pub_u)
|
||||
|
||||
// Sweep 40 keys and verify round-trip for every encodable key
|
||||
let mut encodable_count = 0
|
||||
for i = 0; i < 40; i = i + 1 {
|
||||
let seed = @crypto.sha256(Bytes::make(4, i.to_byte()))
|
||||
let pk = @crypto.x25519_public_key(seed)
|
||||
match @crypto.elligator2_encode(pk, high_bits=b'\xc0') {
|
||||
Some(rep) => {
|
||||
encodable_count += 1
|
||||
assert_eq(@crypto.elligator2_decode(rep), pk)
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
}
|
||||
assert_true(encodable_count >= 10)
|
||||
}
|
||||
Reference in new issue
Block a user