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

+1 -1
View File
@@ -23,7 +23,7 @@ An API name that appears only inside a comment or inside a string literal is not
| Python | `cryptography.hazmat` (`rsa`, `ec`, `dsa`, `dh`, `ed25519`, `x25519`, `padding`, `hashes`, `algorithms`/`modes`, AEAD classes); PyCryptodome (`Crypto`/`Cryptodome`: `RSA`, `DSA`, `ECC`, ciphers and modes, `PKCS1_OAEP`, `pss`, `DSS`, hash `.new`); `hashlib` (including `hashlib.new` and `pbkdf2_hmac`); `hmac` with `digestmod`; `ecdsa`; PyJWT / python-jose algorithms; `oqs` (liboqs-python); `ssl` protocol constants and `TLSVersion` |
| Java | `KeyPairGenerator`, `Signature`, `Cipher`, `KeyAgreement`, `MessageDigest`, `Mac`, `KeyGenerator`, `KeyFactory`, `SecretKeyFactory`, `KEM`, `SSLContext` `getInstance("...")`; `ECGenParameterSpec`, `NamedParameterSpec`; `setEnabledProtocols`; JSSE system properties (`jdk.tls.namedGroups`, protocol lists); Bouncy Castle imports and post-quantum parameter sets (`org.bouncycastle.pqc`, `MLKEMParameters`, `MLDSAParameters`, `SLHDSAParameters`, `FalconParameters`, ...) |
| Go | imports of `crypto/rsa`, `crypto/ecdsa`, `crypto/elliptic`, `crypto/ecdh`, `crypto/ed25519`, `crypto/md5`, `crypto/sha1`, `crypto/des`, `crypto/rc4`, `crypto/mlkem`, `crypto/tls`, `golang.org/x/crypto/...`, go-ethereum `crypto`, CIRCL ML-KEM/ML-DSA; calls with parameters (`rsa.GenerateKey` size, `ecdsa.GenerateKey` curve, `hmac.New` hash, `mlkem.GenerateKey768`); `tls.Config` `MinVersion`, `MaxVersion`, `CurvePreferences` (including `tls.X25519MLKEM768`) |
| Rust | `use`/`extern crate` resolution of names to crates; static calls `Type::method` (`Sha256::new`, `SigningKey::generate`, `Aes256Gcm::new_from_slice`, `RsaPrivateKey::new(rng, 2048)`, `MlDsa65::key_gen`, `MlKem768::generate`); generic parameters (`Hmac::<Sha256>`, `Hkdf::<Sha512>`, `type HmacSha256 = Hmac<Sha256>`, `SigningKey::<Sha2_128s>`); path functions (`blake3::hash`, `pbkdf2::pbkdf2_hmac::<Sha256>`, `pqcrypto_kyber::kyber1024::keypair`, `rustls::crypto::ring::default_provider`); `ring` constants (`aead::AES_256_GCM`, `signature::ED25519`, `agreement::X25519`); `jsonwebtoken::Algorithm::*`, `oqs::Algorithm::*`, libsignal `kem::KeyType::Kyber1024`; RustCrypto modes (`ecb::Encryptor<Aes128>`, `cbc::Decryptor<Aes256>`); `snow` Noise patterns (`Noise_XX_25519_ChaChaPoly_SHA256`); `openssl` (`MessageDigest::*`, `Cipher::*`, `Rsa::generate`, `EcKey::generate` + `Nid`, `PKey::generate_ed25519`, `set_min_proto_version`); `secp256k1` `.sign_ecdsa`/`.sign_schnorr` |
| Rust | `use`/`extern crate` resolution of names to crates; static calls `Type::method` (`Sha256::new`, `SigningKey::generate`, `Aes256Gcm::new_from_slice`, `RsaPrivateKey::new(rng, 2048)`, `MlDsa65::key_gen`, `MlKem768::generate`); generic parameters (`Hmac::<Sha256>`, `Hkdf::<Sha512>`, `type HmacSha256 = Hmac<Sha256>`, `SigningKey::<Sha2_128s>`); path functions (`blake3::hash`, `pbkdf2::pbkdf2_hmac::<Sha256>`, `pqcrypto_kyber::kyber1024::keypair`, `rustls::crypto::ring::default_provider`); `ring` constants (`aead::AES_256_GCM`, `signature::ED25519`, `agreement::X25519`); `jsonwebtoken::Algorithm::*`, `oqs::Algorithm::*`, libsignal `kem::KeyType::Kyber1024`; RustCrypto modes (`ecb::Encryptor<Aes128>`, `cbc::Decryptor<Aes256>`); `snow` Noise patterns (`Noise_XX_25519_ChaChaPoly_SHA256`); `openssl` (`MessageDigest::*`, `Cipher::*`, `Rsa::generate`, `EcKey::generate` + `Nid`, `PKey::generate_ed25519`, `set_min_proto_version`); `secp256k1` `.sign_ecdsa`/`.sign_schnorr`; libcrux (`libcrux_ml_kem::mlkem1024::generate_key_pair`, `libcrux_ml_dsa::ml_dsa_65::sign`); a name brought in by a glob import (`use libsignal_protocol::*`) is resolved by trying the glob-imported crates in order |
| Any text file | complete PEM blocks: certificates (parsed for subject, validity and key algorithm), public keys, private keys |
| Manifests | `package.json`, `requirements*.txt`, `pyproject.toml`, `pom.xml`, `build.gradle(.kts)`, `go.mod`, `Cargo.toml`: cryptographic libraries that are declared |
+67 -20
View File
@@ -60,6 +60,11 @@ const CRATE = {
pqcrypto_hqc: { ofera: 'HQC', grupuri: ['HQC'] },
pqcrypto_classicmceliece: { ofera: 'Classic McEliece (NIST round 4, not standardized)', grupuri: ['UNKNOWN'] },
oqs: { ofera: 'liboqs: post-quantum KEMs and signatures', grupuri: ['MLKEM', 'MLDSA', 'FALCON', 'PREPQ', 'HQC', 'UNKNOWN'] },
libcrux_ml_kem: { ofera: 'ML-KEM (libcrux, formally verified; used under libsignal)', grupuri: ['MLKEM'] },
libcrux_ml_dsa: { ofera: 'ML-DSA (libcrux)', grupuri: ['MLDSA'] },
libcrux_sha3: { ofera: 'SHA3 and SHAKE (libcrux)', grupuri: ['HASH'] },
libcrux_kem: { ofera: 'KEMs (libcrux: ML-KEM, X25519, hybrids)', grupuri: ['MLKEM', 'XDH', 'HYBRID-KEX'] },
spqr: { ofera: "Signal's post-quantum ratchet (SPQR, ML-KEM based)", grupuri: ['MLKEM'] },
libsignal_protocol: { ofera: 'Signal sessions: Curve25519 identity and prekeys, Kyber prekeys (PQXDH), Double Ratchet', grupuri: ['XDH', 'PREPQ', 'MLKEM', 'LIB-MULTI'] },
ring: { ofera: 'ring: AES-GCM, ChaCha20-Poly1305, SHA-2, HMAC, HKDF, PBKDF2, Ed25519, ECDSA P-256/P-384, RSA, X25519, ECDH', grupuri: ['HASH', 'MAC', 'KDF', 'CIPHER', 'EDDSA', 'ECDSA', 'RSA', 'XDH', 'ECDH'] },
openssl: { ofera: 'OpenSSL bindings', grupuri: ['HASH', 'CIPHER', 'RSA', 'EC', 'ECDSA', 'EDDSA', 'XDH', 'TLS'] },
@@ -90,6 +95,7 @@ for (const [crate, tipuri] of Object.entries({
x25519_dalek: ['StaticSecret', 'EphemeralSecret', 'ReusableSecret'],
curve25519_dalek: ['RistrettoPoint', 'EdwardsPoint', 'MontgomeryPoint'],
ml_kem: ['MlKem512', 'MlKem768', 'MlKem1024'], ml_dsa: ['MlDsa44', 'MlDsa65', 'MlDsa87'],
libcrux_ml_kem: ['MlKem512KeyPair', 'MlKem768KeyPair', 'MlKem1024KeyPair', 'MlKem512PublicKey', 'MlKem768PublicKey', 'MlKem1024PublicKey', 'MlKem512PrivateKey', 'MlKem768PrivateKey', 'MlKem1024PrivateKey', 'MlKem512Ciphertext', 'MlKem768Ciphertext', 'MlKem1024Ciphertext'],
libsignal_protocol: ['PreKeyBundle', 'IdentityKeyPair', 'SignalProtocolAddress', 'KyberPreKeyRecord'],
arti_client: ['TorClient'],
})) for (const t of tipuri) UNIC[t] = crate;
@@ -184,36 +190,46 @@ export function detecteazaRust(ctx) {
ctx.adauga(pos, api, fel, curat, { bucata });
};
// o cale scrisa in cod (prefixul `a::b::`) sau un nume de tip -> calea completa prin `use`
const rezolvaCale = (prefix, tip) => {
// o cale scrisa in cod (prefixul `a::b::`) sau un nume de tip -> caile posibile, in ordine: prin `use`, prin numele unic al
// tipului, apoi prin fiecare crate adus cu `use crate::*` (un import glob nu spune ce nume aduce; se incearca si se accepta
// primul care are un inteles acolo). Un prefix din propriul crate (crate::, self::, super::) nu se incearca nicaieri.
const caiPentru = (seg) => {
const r = [];
if (CRATE[seg[0]]) r.push(seg);
for (const g of globuri) if (CRATE[g]) r.push([g, ...seg]);
return r;
};
const candidati = (prefix, tip) => {
const seg = prefix ? prefix.split('::').filter(Boolean) : [];
if (seg.length) {
if (RADACINI_PROPRII.has(seg[0])) return null;
if (RADACINI_PROPRII.has(seg[0])) return [];
const u = locale.get(seg[0]);
const cale = u ? [...u.cale, ...seg.slice(1)] : seg;
return CRATE[cale[0]] ? { crate: cale[0], cale: [...cale, tip] } : null;
if (u) return CRATE[u.crate] ? [{ crate: u.crate, cale: [...u.cale, ...seg.slice(1), tip] }] : [];
return caiPentru(seg).map((c) => ({ crate: c[0], cale: [...c, tip] }));
}
const u = locale.get(tip);
if (u) return CRATE[u.crate] ? { crate: u.crate, cale: u.cale } : null;
if (UNIC[tip]) return { crate: UNIC[tip], cale: [UNIC[tip], tip] };
return null;
if (u) return CRATE[u.crate] ? [{ crate: u.crate, cale: u.cale }] : [];
if (UNIC[tip]) return [{ crate: UNIC[tip], cale: [UNIC[tip], tip] }];
return [...globuri].filter((g) => CRATE[g]).map((g) => ({ crate: g, cale: [g, tip] }));
};
const rezolvaCale = (prefix, tip) => candidati(prefix, tip)[0] || null;
// 1. apelurile statice Tip::metoda, cu sau fara turbofish (Hmac::<Sha256>::new_from_slice)
const RE_STATIC = /(?<![\w:])((?:[A-Za-z_]\w*::)*)([A-Z]\w*)\s*(?:::\s*<([^;{}()=]*?)>)?\s*::\s*([a-z_]\w*)\b/g;
for (const m of ctx.potriviri(RE_STATIC)) {
const [intreg, prefix, tip, generic, metoda] = m;
const r = rezolvaCale(prefix, tip);
const cand = candidati(prefix, tip);
let r = null; let activ = null;
for (const c of cand) { const a = activStatic(c, metoda, generic, ctx, m); if (a) { r = c; activ = a; break; } }
if (!r) {
if (!prefix && /^(SigningKey|VerifyingKey|KeyPair|Keypair|SecretKey|PublicKey|Signature)$/.test(tip) && CTOR.test(metoda) && !locale.has(tip) && !proprii.has(tip)) {
if (!cand.length && !prefix && /^(SigningKey|VerifyingKey|KeyPair|Keypair|SecretKey|PublicKey|Signature)$/.test(tip) && CTOR.test(metoda) && !locale.has(tip) && !proprii.has(tip)) {
// nume ambiguu, fara `use` care sa spuna crate-ul: nu se ghiceste
const tipuriLocale = new RegExp(`\\b(struct|enum|type|trait)\\s+${tip}\\b`).test(ctx.code);
if (!tipuriLocale) ctx.adauga(m.index, `${tip}::${metoda}`, 'call', { grup: 'UNKNOWN', nume: `${tip} (crate not resolved)`, motiv: `${tip}::${metoda} with no \`use\` in this file naming its crate: it may be Ed25519 (ed25519-dalek), ML-DSA (ml-dsa), SLH-DSA (slh-dsa), ECDSA (p256, k256) or RSA (rsa).` }, { bucata: intreg });
}
continue;
}
const activ = activStatic(r, metoda, generic, ctx, m);
if (activ) adauga(r.crate, m.index, `${prefix}${tip}::${metoda}`, 'call', activ, intreg + (activ.bucataExtra || ''));
adauga(r.crate, m.index, `${prefix}${tip}::${metoda}`, 'call', activ, intreg + (activ.bucataExtra || ''));
}
// 2. aliasuri de tip cu parametru generic: type HmacSha256 = Hmac<Sha256>; type Kdf = Hkdf<Sha512>;
@@ -230,11 +246,13 @@ export function detecteazaRust(ctx) {
// rustls::crypto::ring::default_provider(), libsignal_protocol::process_prekey_bundle(...)
for (const m of ctx.potriviri(/(?<![\w:.])((?:[a-z_]\w*::)+)([a-z_]\w*)\s*(?:::\s*<([^;{}()=]*?)>)?\s*\(/g)) {
const seg = m[1].split('::').filter(Boolean);
if (RADACINI_PROPRII.has(seg[0])) continue;
const u = locale.get(seg[0]);
const cale = u ? [...u.cale, ...seg.slice(1), m[2]] : [...seg, m[2]];
if (RADACINI_PROPRII.has(cale[0]) || !CRATE[cale[0]]) continue;
const activ = activFunctie(cale, m[3], ctx, m);
if (activ) adauga(cale[0], m.index, cale.join('::'), 'call', activ, m[0].trim() + (activ.bucataExtra || ''));
const cai = u ? (CRATE[u.crate] ? [[...u.cale, ...seg.slice(1), m[2]]] : []) : caiPentru(seg).map((c) => [...c, m[2]]);
for (const cale of cai) {
const activ = activFunctie(cale, m[3], ctx, m);
if (activ) { adauga(cale[0], m.index, cale.join('::'), 'call', activ, m[0].trim() + (activ.bucataExtra || '')); break; }
}
}
// functii importate direct: use pbkdf2::pbkdf2_hmac; use blake3::hash; use libsignal_protocol::process_prekey_bundle;
for (const [local, u] of locale) {
@@ -251,10 +269,11 @@ export function detecteazaRust(ctx) {
const seg = m[1].split('::').filter(Boolean);
if (RADACINI_PROPRII.has(seg[0])) continue;
const u = locale.get(seg[0]);
const cale = u ? [...u.cale, ...seg.slice(1)] : seg;
if (!CRATE[cale[0]]) continue;
const activ = activConstanta(cale, m[2], ctx, m);
if (activ) adauga(cale[0], m.index, `${cale.join('::')}::${m[2]}`, activ.fel || 'config', activ, m[0]);
const cai = u ? (CRATE[u.crate] ? [[...u.cale, ...seg.slice(1)]] : []) : caiPentru(seg);
for (const cale of cai) {
const activ = activConstanta(cale, m[2], ctx, m);
if (activ) { adauga(cale[0], m.index, `${cale.join('::')}::${m[2]}`, activ.fel || 'config', activ, m[0]); break; }
}
}
// variante importate direct (use jsonwebtoken::Algorithm; Algorithm::RS256) si tipuri parametru PQ scrise singure
for (const m of ctx.potriviri(/(?<![\w:])([A-Z]\w*)::([A-Z][A-Za-z0-9_]*)\b(?!\s*::|\s*\()/g)) {
@@ -440,6 +459,12 @@ function activStatic(r, metoda, generic, ctx, m) {
}
case 'libsignal_protocol':
if (tip === 'PreKeyBundle' && metoda === 'new') return { grup: 'LIB-MULTI', nume: 'libsignal session setup (X3DH/PQXDH)', motiv: 'libsignal prekey bundle: Curve25519 identity and signed prekey; a Kyber prekey in the bundle makes the session PQXDH (hybrid). Which prekeys the bundle carries is decided at run time.' };
if (cale.includes('kem') && /^(KeyPair|PublicKey|SecretKey)$/.test(tip)) {
// perechea KEM a lui libsignal (prekey-ul PQXDH): tipul ei e argumentul KeyType; cand e pe acelasi rand, constanta poarta
// constatarea (pasul 4); cand nu e, nu se ghiceste intre Kyber si ML-KEM
if (/KeyType\s*::\s*\w+/.test(ctx.code.slice(m.index, m.index + 200))) return null;
return { grup: 'UNKNOWN', nume: 'libsignal KEM key pair', motiv: 'libsignal kem::KeyPair: the key type (Kyber-1024 or ML-KEM) is the KeyType argument, not visible on this line.' };
}
if (/^(IdentityKeyPair|KeyPair|PrivateKey)$/.test(tip) && /^(generate|new|from_private_key_bytes|deserialize)$/.test(metoda)) return { grup: 'XDH', nume: 'X25519', functii: ['keygen'], nota: 'libsignal identity and prekey keys are Curve25519 (signatures over them are XEdDSA).' };
if (tip === 'KyberPreKeyRecord' || tip === 'KeyType') return null;
return null;
@@ -477,6 +502,14 @@ function activStatic(r, metoda, generic, ctx, m) {
case 'arti_client':
if (tip === 'TorClient') return { grup: 'UNKNOWN', nume: 'Tor client (arti)', motiv: 'Tor circuit and channel cryptography is negotiated with the relays by the Tor protocol version in use, not visible in this file.' };
return null;
case 'libcrux_ml_kem': {
const k = /MlKem(512|768|1024)/.exec(tip) || /mlkem(512|768|1024)/.exec(cale.join('::'));
return k ? { grup: 'MLKEM', param: k[1], functii: fn(/generate/.test(metoda) ? 'keygen' : /encaps/.test(metoda) ? 'encapsulate' : /decaps/.test(metoda) ? 'decapsulate' : 'other') } : null;
}
case 'libcrux_ml_dsa': {
const k = /MLDSA(44|65|87)|ml_dsa_(44|65|87)/.exec(tip + ' ' + cale.join('::'));
return k ? { grup: 'MLDSA', param: k[1] || k[2], functii: fn(rol) } : null;
}
case 'jsonwebtoken':
return null; // variantele Algorithm (pasul 4)
default:
@@ -505,6 +538,20 @@ function activFunctie(cale, generic, ctx, m) {
if (fnume === 'default_provider' && modul === 'ring') return { grup: 'XDH', nume: 'X25519', functii: ['keygen'], nota: 'rustls with the ring provider: ring implements no ML-KEM, so the key-exchange groups are X25519, P-256 and P-384 only (no X25519MLKEM768).' };
if (fnume === 'default_provider' && modul === 'aws_lc_rs') return { grup: 'UNKNOWN', nume: 'rustls aws-lc-rs provider', motiv: 'rustls with the aws-lc-rs provider: X25519MLKEM768 is offered by default from rustls 0.23.22 (and only with the prefer-post-quantum feature before 0.23.22); the rustls version is in Cargo.lock, not here.' };
return null;
case 'libcrux_ml_kem': {
const k = /^mlkem(512|768|1024)$/.exec(modul || '');
if (!k || !/^(generate_key_pair|encapsulate|decapsulate|validate_public_key|validate_private_key)$/.test(fnume)) return null;
return { grup: 'MLKEM', param: k[1], functii: [/generate/.test(fnume) ? 'keygen' : /encaps/.test(fnume) ? 'encapsulate' : /decaps/.test(fnume) ? 'decapsulate' : 'other'] };
}
case 'libcrux_ml_dsa': {
const k = /^ml_dsa_(44|65|87)$/.exec(modul || '');
if (!k || !/^(generate_key_pair|sign|verify|sign_pre_hashed_shake128|verify_pre_hashed_shake128)$/.test(fnume)) return null;
return { grup: 'MLDSA', param: k[1], functii: [/generate/.test(fnume) ? 'keygen' : /^sign/.test(fnume) ? 'sign' : 'verify'] };
}
case 'libcrux_sha3': {
const k = /^(sha224|sha256|sha384|sha512|shake128|shake256)$/.exec(fnume);
return k ? { grup: 'HASH', hash: k[1].startsWith('shake') ? k[1].toUpperCase() : 'SHA3-' + k[1].slice(3), functii: ['digest'] } : null;
}
case 'libsignal_protocol':
if (fnume === 'process_prekey_bundle') return { grup: 'LIB-MULTI', nume: 'libsignal session setup (X3DH/PQXDH)', motiv: 'libsignal session setup from a prekey bundle: Curve25519 identity and signed prekey; a Kyber prekey in the bundle makes the session PQXDH (hybrid). Which prekeys the bundle carries is decided at run time.' };
return null;
+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');