#[non_exhaustive]pub enum Error {
Show 26 variants
InvalidParameter,
InvalidSignatureOrTag,
SessionNotFound,
SessionExpired,
Busy,
Codec(Error),
InvalidScalar,
ConfirmationTagMismatch,
UnexpectedMessage {
expected: PaseMessageKind,
got: PaseMessageKind,
},
PinDerivationFailed,
KeyDerivationFailed,
PbkdfIterationsTooLow(u32),
PbkdfIterationsTooHigh {
iterations: u32,
max: u32,
},
PbkdfSaltLengthInvalid(usize),
HandshakeIncomplete,
InvalidPeerNocChain(Error),
FabricIdMismatch {
peer: u64,
local: u64,
},
PeerNodeIdMismatch(u64, u64),
EphemeralKeyGenerationFailed,
EncryptedBlobDecryptionFailed,
EncryptionFailed,
PeerSignatureInvalid,
ResumptionMacMismatch,
Rng,
SigningFailed(SignerError),
UnexpectedCaseMessage {
expected: CaseMessageKind,
got: CaseMessageKind,
},
}Expand description
All errors matter-crypto can produce in M3 (PASE). M4 (CASE) will
extend this enum; #[non_exhaustive] keeps that addition non-breaking.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidParameter
Spec §3.10.5 status code: peer’s parameter was malformed or out of range.
InvalidSignatureOrTag
Spec §3.10.5 status code: peer’s signature or confirmation tag did not validate.
SessionNotFound
Spec §3.10.5 status code: referenced session does not exist.
SessionExpired
Spec §3.10.5 status code: referenced session has expired.
Busy
Spec §3.10.5 status code: peer is busy.
Codec(Error)
TLV codec error propagated from matter-codec.
InvalidScalar
SPAKE2+ scalar was zero or out of range after sampling/reduction.
ConfirmationTagMismatch
Confirmation tag did not match in constant-time compare.
We never tell the peer which tag failed — that itself would be a side-channel. Local-only abort.
UnexpectedMessage
Caller invoked a state-machine method that doesn’t match the
current expected message (e.g., handle_pake3 before handle_pake2).
Fields
expected: PaseMessageKindThe next message kind the state machine was expecting.
got: PaseMessageKindThe kind the caller tried to feed.
PinDerivationFailed
PIN-to-w0/w1 derivation failed.
KeyDerivationFailed
Generic HKDF/KDF operation failed (e.g., ring returned an error for an output-length or expand call that should succeed for all valid inputs).
Used by operational identity derivations such as
crate::derive_compressed_fabric_id.
PbkdfIterationsTooLow(u32)
PBKDF iteration count below the Matter spec minimum (1000).
PbkdfIterationsTooHigh
PBKDF iteration count above the accepted ceiling.
The iteration count is peer-controlled and is fed directly into
PBKDF2-HMAC-SHA256 (one HMAC pass per iteration). A malicious or
spoofed PASE responder could advertise an inflated count
(up to u32::MAX) to force the commissioner into billions of HMAC
rounds — a single-threaded CPU denial-of-service per handshake. We
reject anything above the Matter spec’s published maximum (100000)
before any key derivation runs.
Fields
PbkdfSaltLengthInvalid(usize)
PBKDF salt length outside [16, 32] bytes per Matter spec §3.10.3.
HandshakeIncomplete
finish() called before the handshake completed all phases.
InvalidPeerNocChain(Error)
Peer’s NOC chain failed validation against the trusted RCAC roots.
FabricIdMismatch
Peer’s NOC carried a FabricId attribute that does not match the
FabricId we expected (i.e., the peer is on a different fabric).
Fields
PeerNodeIdMismatch(u64, u64)
Peer’s NOC carried a NodeId attribute that does not match the
NodeId we expected.
EphemeralKeyGenerationFailed
Ephemeral P-256 keypair generation failed (RNG failure or repeated zero scalars).
EncryptedBlobDecryptionFailed
AEAD decryption of an encrypted blob (Sigma2 or Sigma3 ciphertext) failed — corrupt ciphertext, wrong key, or wrong nonce.
EncryptionFailed
AEAD encryption failed — cipher initialisation rejected the key, or the underlying AES-CCM encrypt call failed. Not expected in practice for the spec-bounded key and message sizes.
PeerSignatureInvalid
Peer’s ECDSA signature over the SIGMA transcript did not verify.
ResumptionMacMismatch
Resumption MAC tag (sigma2_resume_mic / sigma3_resume_mic) did
not verify in constant time.
Rng
Secure random generation failed.
SigningFailed(SignerError)
CaseSigner returned a SignerError.
UnexpectedCaseMessage
Caller fed a CASE state machine a message that doesn’t match its
current expected-inbound kind (e.g., calling handle_sigma2 before
start has been invoked).
A separate variant from Error::UnexpectedMessage keeps M3 PASE
callers unchanged while surfacing the correct
crate::case::CaseMessageKind.
Fields
expected: CaseMessageKindThe message kind the state machine was waiting for.
got: CaseMessageKindThe kind the caller tried to supply.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()