Skip to main content

Error

Enum Error 

Source
pub enum Error {
    NotOperational {
        current: State,
    },
    SelfTestFailed {
        test: &'static str,
    },
    ConditionalTestFailed {
        reason: &'static str,
    },
    AlreadyInitialized,
    InvalidInput,
    AlgorithmRestricted {
        service: Service,
    },
    NotImplemented,
}
Expand description

Errors surfaced by the module boundary.

Every variant is constructed with a &'static str description so that formatting is allocation-free; this lets the module report failures even from no_std contexts and from within the self-test runner itself.

Variants§

§

NotOperational

A service was invoked while the module was not in the Operational state.

Fields

§current: State

The state the module was actually in when the call arrived.

§

SelfTestFailed

A power-up self-test failed. The module is now in the Error state.

Fields

§test: &'static str

Name of the failing test, supplied by its SelfTest implementation.

§

ConditionalTestFailed

A conditional self-test (e.g. DRBG CRNGT, pairwise consistency) failed during operation. The module is now in the Error state.

Fields

§reason: &'static str

Short description of the failing check.

§

AlreadyInitialized

initialize was called while the module was already past PowerOff. This is not itself a FIPS violation — it just means a second caller raced with the first. The first call’s outcome is authoritative; the race loser should read state to find out.

§

InvalidInput

A cryptographic service was called with input bytes that do not encode a valid domain element (for example, a scalar that is zero or not less than the group order, or a point that is not a canonical encoding on the curve). This is distinct from a self-test failure: the module is still operational; the caller supplied out-of-range bytes. Algorithm primitives should return this rather than silently substituting a default.

§

AlgorithmRestricted

A service was invoked that is not permitted under the active AlgorithmProfile. The module is still operational — the algorithm exists but is restricted by policy. Switch to a less restrictive profile (which requires a process restart) or use an alternative algorithm that is permitted.

Fields

§service: Service

The specific service that was blocked.

§

NotImplemented

A service was invoked for an algorithm that exists in the Service enum but whose implementation has not yet been completed. Stub crates return this. The algorithm is recognized by the profile system and its gate will pass if the profile permits it, but the actual cryptographic operation is not yet available.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Error

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Error

Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Error) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.