Skip to main content

self_test

Function self_test 

Source
pub fn self_test() -> Result<(), CryptoError>
Expand description

Re-runs the module’s known-answer self-tests (CASTs) on demand.

Refuses with CryptoError::SelfTestUnavailable where the backend does not expose them (the 3.x line), whether or not the module is in FIPS mode; otherwise with CryptoError::NotFips unless it is. Ok means every CAST re-ran and passed in a FIPS-mode module. The module’s integrity test is not re-run.

By default a known-answer mismatch aborts the process before this returns. CryptoError::SelfTest is a failure the module reported instead, such as an operation that failed during a test, though some operation failures abort as well: treat the module as failed. Call this at start-up or from an operator action, never on a request path.