zig/lib/std/crypto/errors.zig
Frank Denis ce355e0ba5
Add ML-DSA post-quantum signatures (#25862)
ML-DSA is a post-quantum signature scheme that was recently
standardized by NIST.

Keys and signatures are pretty large, not making it a drop-in
replacement for classical signature schemes.

But if you are shipping keys that may still be used in 10 years
or whenever large quantum computers able to break ECC arrive,
it that ever happens, and you don't have the ability to replace
these keys, ML-DSA is for you.

Performance is great, verification is faster than Ed25519 / ECDSA.

I tried manual vectorization, but it wasn't worth it, the compiler
does at good job at auto-vectorization already.
2025-11-10 14:11:30 +01:00

41 lines
1.8 KiB
Zig

/// MAC verification failed - The tag doesn't verify for the given ciphertext and secret key
pub const AuthenticationError = error{AuthenticationFailed};
/// The requested output length is too long for the chosen algorithm
pub const OutputTooLongError = error{OutputTooLong};
/// Finite field operation returned the identity element
pub const IdentityElementError = error{IdentityElement};
/// Encoded input cannot be decoded
pub const EncodingError = error{InvalidEncoding};
/// The signature doesn't verify for the given message and public key
pub const SignatureVerificationError = error{SignatureVerificationFailed};
/// Both a public and secret key have been provided, but they are incompatible
pub const KeyMismatchError = error{KeyMismatch};
/// Encoded input is not in canonical form
pub const NonCanonicalError = error{NonCanonical};
/// Square root has no solutions
pub const NotSquareError = error{NotSquare};
/// Verification string doesn't match the provided password and parameters
pub const PasswordVerificationError = error{PasswordVerificationFailed};
/// Parameters would be insecure to use
pub const WeakParametersError = error{WeakParameters};
/// Public key would be insecure to use
pub const WeakPublicKeyError = error{WeakPublicKey};
/// Point is not in the prime order group
pub const UnexpectedSubgroupError = error{UnexpectedSubgroup};
/// Context string is too long
pub const ContextTooLongError = error{ContextTooLong};
/// Any error related to cryptography operations
pub const Error = AuthenticationError || OutputTooLongError || IdentityElementError || EncodingError || SignatureVerificationError || KeyMismatchError || NonCanonicalError || NotSquareError || PasswordVerificationError || WeakParametersError || WeakPublicKeyError || UnexpectedSubgroupError || ContextTooLongError;