crypto-inventory 0.3.0: glob imports resolved, libcrux and spqr, libsignal KEM key pairs; control-plane: a key agreement or client-side TLS called by the application itself is not routed to the TLS gateway (planner 35/35, B1 negative control 4/4)

This commit is contained in:
Aere Network committed 2026-10-18 05:59:35 +03:00
1 parent f2f6217b4c
commit f971fa9e28
11 files changed
+161 -30

No files matched your search

+2 -2
View File
@@ -27,8 +27,8 @@ const MUTATII = [
{
nume: 'SigningKey clasificat dupa nume, nu dupa crate-ul din use (Rust)',
fisier: 'lib/detect-rust.mjs',
ancora: "if (u) return CRATE[u.crate] ? { crate: u.crate, cale: u.cale } : null;",
cu: "if (u) return { crate: 'ed25519_dalek', cale: ['ed25519_dalek', tip] };",
ancora: "if (u) return CRATE[u.crate] ? [{ crate: u.crate, cale: u.cale }] : [];",
cu: "if (u) return [{ crate: 'ed25519_dalek', cale: ['ed25519_dalek', tip] }];",
tinta: 'rust: acelasi nume de tip e clasificat dupa crate-ul din use (SigningKey)',
martor: B,
},
@@ -0,0 +1,16 @@
// Fixtura: Rust cu import glob (`use crate::*`): un nume nerezolvat prin `use` se incearca pe crate-urile aduse cu `*`, in ordinea
// lor, si se accepta primul care are un inteles acolo. Si libcrux (ML-KEM, ML-DSA), bibliotecile de sub libsignal.
use libsignal_protocol::*;
use libcrux_ml_kem::mlkem1024;
use libcrux_ml_dsa::ml_dsa_65;
use rand::rngs::OsRng;
pub fn chei(randomness: [u8; 64], msg: &[u8]) {
let mut rng = OsRng;
let kyber = kem::KeyPair::generate(kem::KeyType::Kyber1024, &mut rng); // EXPECT: Kyber-1024 | quantum-safe
let identity = IdentityKeyPair::generate(&mut rng); // EXPECT: X25519 | quantum-vulnerable
let kp = mlkem1024::generate_key_pair(randomness); // EXPECT: ML-KEM-1024 | quantum-safe
let (ct, ss) = mlkem1024::encapsulate(kp.public_key(), randomness[..32].try_into().unwrap()); // EXPECT: ML-KEM-1024 | quantum-safe
let sig = ml_dsa_65::sign(&ml_dsa_65::generate_key_pair(randomness).signing_key, msg, b"", randomness[..32].try_into().unwrap()); // EXPECT: ML-DSA-65 | quantum-safe
let _ = (kyber, identity, ct, ss, sig);
}
+11 -2
View File
@@ -18,8 +18,8 @@ const lx = await import(pathToFileURL(join(dirname(CALE_MODUL), 'lib', 'lexer.mj
const CA_JSON = process.argv.includes('--json');
// numarul total de marcaje EXPECT scrise de mana in fixturi; o schimbare aici se face constient
const MARCAJE_ASTEPTATE = 123;
const FISIERE_CU_MARCAJE = ['js/node-crypto.mjs', 'js/webcrypto.js', 'js/biblioteci.ts', 'js/tls.cjs', 'python/crypto_py.py', 'java/Crypto.java', 'go/crypto.go', 'rust/cripto.rs', 'rust/ambiguu.rs', 'negative/variabile.js'];
const MARCAJE_ASTEPTATE = 128;
const FISIERE_CU_MARCAJE = ['js/node-crypto.mjs', 'js/webcrypto.js', 'js/biblioteci.ts', 'js/tls.cjs', 'python/crypto_py.py', 'java/Crypto.java', 'go/crypto.go', 'rust/cripto.rs', 'rust/ambiguu.rs', 'rust/glob.rs', 'negative/variabile.js'];
const probe = [];
const proba = (nume, fn) => probe.push({ nume, fn });
@@ -226,6 +226,15 @@ proba('rust: acelasi nume de tip e clasificat dupa crate-ul din use (SigningKey)
asigura(a.length === 1 && a[0].classification === 'unknown' && /ed25519-dalek/.test(a[0].reason) && /ml-dsa/.test(a[0].reason), `fara use: ${JSON.stringify(a.map((x) => [x.name, x.classification]))}`);
});
proba('rust: un import glob (use crate::*) rezolva numele nerezolvate pe crate-ul lui, iar perechea KEM a lui libsignal nu e Curve25519', () => {
const g = gasiriDin(scan(FIX), 'rust/glob.rs');
const k = g.find((x) => x.line === 10);
asigura(k && k.name === 'Kyber-1024' && /kem::KeyType::Kyber1024$/.test(k.api) && g.filter((x) => x.line === 10).length === 1, `kem::KeyPair::generate(KeyType::Kyber1024): ${JSON.stringify(g.filter((x) => x.line === 10).map((x) => [x.name, x.api]))}`);
const i = g.find((x) => x.line === 11);
asigura(i && i.name === 'X25519' && /IdentityKeyPair/.test(i.api), `IdentityKeyPair prin glob: ${JSON.stringify(i && [i.name, i.api])}`);
asigura(g.filter((x) => x.name === 'ML-KEM-1024').length === 2 && g.filter((x) => x.name === 'ML-DSA-65').length === 1, `libcrux: ${JSON.stringify(g.map((x) => x.line + ' ' + x.name))}`);
});
proba('rust: importul fara apel e dovada slaba (unknown), importul cu apel in acelasi fisier nu se raporteaza', () => {
const g = gasiriDin(scan(FIX), 'rust/cripto.rs');
const imp = g.filter((x) => x.evidenceKind === 'import');