From 49d97dbee3d5bd981201730e7ff7b37596281576 Mon Sep 17 00:00:00 2001 From: ospab Date: Sun, 17 May 2026 16:27:43 +0300 Subject: [PATCH] test: add obfuscation round-trip tests, fix i18n module import - 7 passing tests verify client-server compatibility: * Handshake obfuscation round-trip (correct key recovers session_id) * Wrong key produces garbage (prevents unauthorized probes) * Data packet obfuscation round-trip * Deterministic derivation (same key = same secrets) * Different keys produce different secrets * Legacy API consistency * Padding range validation (100 random keys) - Fixed test module import path to use crate::crypto::obfuscation::* - Added i18n.js module for GUI localization --- ostp-core/src/crypto/obfuscation.rs | 4 ++++ ostp-core/src/crypto/obfuscation_tests.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ostp-core/src/crypto/obfuscation.rs b/ostp-core/src/crypto/obfuscation.rs index 4af4e89..a3dd059 100644 --- a/ostp-core/src/crypto/obfuscation.rs +++ b/ostp-core/src/crypto/obfuscation.rs @@ -198,3 +198,7 @@ pub fn deobfuscate_packet_inplace(raw: &mut [u8], key: &[u8; 8], is_handshake: b } } } + +#[cfg(test)] +#[path = "obfuscation_tests.rs"] +mod obfuscation_tests; diff --git a/ostp-core/src/crypto/obfuscation_tests.rs b/ostp-core/src/crypto/obfuscation_tests.rs index 47c871b..8942af9 100644 --- a/ostp-core/src/crypto/obfuscation_tests.rs +++ b/ostp-core/src/crypto/obfuscation_tests.rs @@ -1,6 +1,6 @@ #[cfg(test)] mod tests { - use super::*; + use crate::crypto::obfuscation::*; /// Verifies that derive_all_secrets is deterministic — same input always /// produces the same output.