Skip to content

Add cryptography-rs: Rust cryptography library#15347

Open
darrelllong wants to merge 1 commit intogoogle:masterfrom
darrelllong:add-cryptography-rs
Open

Add cryptography-rs: Rust cryptography library#15347
darrelllong wants to merge 1 commit intogoogle:masterfrom
darrelllong:add-cryptography-rs

Conversation

@darrelllong
Copy link
Copy Markdown

Project

Homepage: https://github.com/darrelllong/cryptography
Language: Rust
License: BSD 2-Clause

A pure-Rust implementation of classical and post-quantum cryptographic
primitives built from specifications, with no third-party crypto
dependencies.

Fuzz targets (39 total)

Block ciphers: AES, Camellia, CAST-128, DES/TDES, Grasshopper, Magma,
PRESENT, SEED, Serpent, Simon, SM4, Speck, Twofish

Stream ciphers: ChaCha20, Rabbit, Salsa20, SNOW 3G, ZUC

Post-quantum (NIST FIPS): ML-KEM (FIPS 203), ML-DSA (FIPS 204)

Public-key: ECDSA, EdDSA, ECDH, Ed25519, DSA, DH, ElGamal, EC-ElGamal,
Edwards-ElGamal, Paillier, Rabin, Cocks, Schmidt-Samoa, ECIES,
RSA-OAEP, RSA-PSS

Modes: GCM, EAX, CCM, OCB, ChaCha20-Poly1305, CBC, CTR, AES Key Wrap

Hash/MAC/KDF: MD5, SHA-1/2/3 family, HMAC, HKDF

CSPRNG: CTR_DRBG-AES-256

Invariants checked

Each target enforces correctness invariants (encrypt/decrypt roundtrip,
sign/verify roundtrip, Diffie-Hellman property, serialization roundtrip)
in addition to the standard no-panic-on-arbitrary-input guarantee.

Bugs already found

Initial fuzzing runs found three bugs that have been fixed:

  • Two integer overflows in DER parsing (pos + seq_len and pos + len
    with crafted large-length fields)
  • RSA-CRT subtraction underflow when q > p (panic in any private-key
    operation triggered by specific ciphertext inputs)

39 cargo-fuzz targets covering:
- Block ciphers: AES, Camellia, CAST-128, DES/TDES, Grasshopper, Magma,
  PRESENT, SEED, Serpent, Simon, SM4, Speck, Twofish
- Stream ciphers: ChaCha20, Rabbit, Salsa20, SNOW 3G, ZUC
- Post-quantum: ML-KEM (FIPS 203), ML-DSA (FIPS 204)
- Public-key: ECDSA, EdDSA, ECDH, Ed25519, DSA, DH, ElGamal,
  EC-ElGamal, Edwards-ElGamal, Paillier, Rabin, Cocks,
  Schmidt-Samoa, ECIES, RSA-OAEP, RSA-PSS
- Symmetric primitives: all AEAD modes (GCM, EAX, CCM, OCB,
  ChaCha20-Poly1305), CBC, CTR, and AES Key Wrap
- Hash/MAC/KDF: MD5, SHA-1/2/3 family, HMAC, HKDF
- CSPRNG: CTR_DRBG-AES-256

Each target enforces correctness invariants (encrypt/decrypt roundtrip,
sign/verify, DH property) in addition to no-panic on arbitrary input.
@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 12, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions
Copy link
Copy Markdown

darrelllong is integrating a new project:
- Main repo: https://github.com/darrelllong/cryptography
- Criticality score: 0.17148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant