Crypto-View

Girish2052003/Girish-Nallan-Chakravathy-mini-tesla-authentication-challenge

Cryptographic posture

38 cryptographic locations: 5 quantum-vulnerable, 17 reduced-margin, 2 undetermined, 14 quantum-safe

2 imported cryptographic libraries are listed separately. 40 files analysed.

Quantum-vulnerable 5 Reduced margin 17 Could not be determined 2 Quantum-safe 14
To address10
Key establishment0
Inventory only2
Total findings40
What was analysed
Branch main
Commit 709eb41fb82a34fa28c4598e08573895d17948f0 docs: explain all Mini-TESLA code in beginner-friendly English (#5)
Committed 2026-10-13 12:06 UTC
Scanned 2026-10-29 11:53 UTC 21 days ago
Coverage 40 files, 10 python
5 test files not scanned

List of cryptographic assets

Ed25519255-bitother/Ed25519 Quantum-vulnerable 3 places See details

Ed25519 signing key

`Ed25519PrivateKey.generate()`. Signatures are not exposed to harvest-now-decrypt-later, but a quantum attacker can forge them once the curve falls.

A quantum computer of sufficient size breaks this completely. It has to be replaced, not tuned. Broken by Shor's algorithm on a cryptographically relevant quantum computer.

What to do. ML-DSA-65 (FIPS 204).

  1. demo.py:52 signing_key = Ed25519PrivateKey.generate()
  2. demo.py:72 attacker, signing_key=Ed25519PrivateKey.generate(),
  3. verification/check_bootstrap.py:41 key = Ed25519PrivateKey.generate()
py.cryptography.ed25519 ยท CWE-327
SHA-256 Reduced margin Renamed import 6 places See details

Call to code named for an algorithm

A call, construction or operation whose own name states the algorithm: a project's wrapper such as `Hash.sha256(data)`, `hmacSha256(key, msg)`, `getMD5()` or `new ScryptGenerator(..)`, a key type such as `new Ed25519PublicKey(bytes)`, or an operation on an object named for its algorithm, `sha256.digest()`. The library call inside the wrapper is reported where it is written; these are the places it is used.

This line calls code named after an encryption or hashing method.

What to do. Migrate the wrapper once, and these call sites follow it.

  1. src/mini_tesla/hsm.py:325 if not stdlib_hmac.compare_digest(_sha256(auth_keys[index]), previous):
  2. src/mini_tesla/hsm.py:349 candidate = _sha256(candidate)
  3. src/mini_tesla/hsm.py:398 chain[index - 1] = _sha256(chain[index])
  4. src/mini_tesla/hsm.py:479 mac = hmac.HMAC(key, hashes.SHA256())
  5. src/mini_tesla/hsm.py:552 candidate = _sha256(candidate)
  6. src/mini_tesla/hsm.py:607 mac = hmac.HMAC(self._disclosed_keys[interval], hashes.SHA256())
code.named-call
SHA-256 Reduced margin 1 place See details

Algorithm named by a constant

A library or project constant whose name is an algorithm, used in code: `JavaAlgorithm.SHA256`, `XMLCipher.AES_128`, Go `crypto.SHA256` and `x509.SHA256WithRSA`, `SignatureMethod.RSA_SHA256`. The holder's name has to say it holds algorithms, so an unrelated `Foo.AES` is left alone.

This line picks an algorithm by name.

What to do. The migration belongs to the operation that consumes the constant; this line is where the choice is written down.

code.algorithm-constant
SHA-256 Reduced margin 4 places See details

Hash function in use

`hashlib.sha256()` and friends. The digest is read from the call, so SHA-384 and above are inventory while the broken ones are reported separately.

A quantum computer weakens this but does not break it. Increasing the key or digest size restores the margin. Pre-image resistance falls to about 128 bits of quantum work. Adequate for most uses; SHA-384 restores the full margin where a signature must last decades.

What to do. SHA-256 as the floor, SHA-384 where the digest protects something long-lived.

  1. src/mini_tesla/hsm.py:117 return hashlib.sha256(data).digest()
  2. verification/check_invariants.py:140 candidate = hashlib.sha256(candidate).digest()
  3. verification/model/run_bootstrap_models.py:48 if hashlib.sha256(jar.read_bytes()).hexdigest() != JAR_SHA256:
  4. verification/model/run_models.py:52 if hashlib.sha256(jar.read_bytes()).hexdigest() != JAR_SHA256:
py.hashlib
AES Reduced margin 2 places See details

AES block cipher

`algorithms.AES(key)`. Symmetric encryption is not broken by a quantum computer; the key length is what matters. The key size is reported where it can be read.

This is the kind of encryption that quantum computers do not break. Using a longer key is enough.

What to do. Use a 256-bit key. No change of algorithm is required.

  1. src/mini_tesla/hsm.py:670 ciphertext = AESGCM(master_key).encrypt(nonce, plaintext, FILE_MAGIC)
  2. src/mini_tesla/hsm.py:782 plaintext = AESGCM(master_key).decrypt(nonce, ciphertext, FILE_MAGIC)
py.cryptography.aes
unknown Could not be determined 2 places See details

Cryptographic library in the dependency manifest

A dependency known to implement classical asymmetric cryptography. Its presence is inventory, not a finding about this codebase: the library may never be called with a quantum-vulnerable algorithm.

The project depends on a cryptography library. Listed so the inventory is complete; it is not by itself a problem.

What to do. Check the version. Several of these libraries have shipped ML-KEM and ML-DSA support since 2024, so the migration may need an upgrade rather than a replacement.

  1. pyproject.toml:26 "cryptography>=43,<47",
  2. requirements.txt:4 cryptography>=43,<47
dep.crypto-library
CSPRNG Quantum-safe 4 places See details

Random number generation

`secrets.token_bytes()`, `os.urandom()` or `ssl.RAND_bytes()`. Recorded so the inventory names its randomness source.

This is where the software gets its random numbers. Quantum computers do not weaken it.

What to do. No action. `random.random()` is a separate, present-day defect if it reaches key material.

  1. demo.py:146 receiver.process_disclosure(2, secrets.token_bytes(32))
  2. src/mini_tesla/hsm.py:390 chain[chain_length] = secrets.token_bytes(KEY_SIZE)
  3. src/mini_tesla/hsm.py:663 nonce = secrets.token_bytes(NONCE_SIZE)
  4. src/mini_tesla/setup.py:293 self._challenge = secrets.token_bytes(CHALLENGE_SIZE)
py.rng
HMAC Quantum-safe 3 places See details

Keyed hash in use

`hmac.new()` or `hmac.digest()`. Not broken by Shor and only marginally affected by Grover. Recorded so the inventory is complete.

This is a fingerprint proving a message was not altered. Quantum computers do not break it.

What to do. No action, unless the digest is MD5 or SHA-1.

  1. src/mini_tesla/hsm.py:479 mac = hmac.HMAC(key, hashes.SHA256())
  2. src/mini_tesla/hsm.py:607 mac = hmac.HMAC(self._disclosed_keys[interval], hashes.SHA256())
  3. verification/check_invariants.py:215 forged_tag = hmac.new(
py.hmac

Cryptographic assets

Algorithm Assessment What it means Occurrences
SHA-256 Reduced margin Pre-image resistance falls to about 128 bits of quantum work. Adequate for most uses; SHA-384 restores the full margin where a signature must last decades. 15
CSPRNG Quantum-safe A cryptographically secure random number generator provided by the platform. Not weakened by a quantum computer. 8
HMAC Quantum-safe A keyed MAC is not affected by Shor and only marginally by Grover. 6
Ed25519 Quantum-vulnerable Broken by Shor's algorithm on a cryptographically relevant quantum computer. 5
AES Reduced margin Grover's algorithm halves the effective strength; the parameter, not the design, is the problem. The key size was not visible at this call site, so the weaker case is assumed. 2
unknown Could not be determined The algorithm could not be established from the source - chosen at runtime, or decided somewhere this scan does not reach. 2

Imported cryptographic libraries

Library Files
cryptography pyca/cryptography 2
hashlib the standard digests, including the broken ones 4
cryptography pyca/cryptography 2
secrets the platform random source 4
hmac keyed message authentication 3