embassy-crypto-driver

Crates

git

Versions

default

Flavors

Skip to main content

P256ScalarInvert

Trait P256ScalarInvert 

Source
pub trait P256ScalarInvert {
    // Required methods
    fn invert(k: P256Scalar) -> P256Scalar;
    fn invert_vartime(k: P256Scalar) -> P256Scalar;
}
Expand description

P-256 scalar field inversion accelerator (optional).

ECDSA signing and verification each need one inversion modulo the curve order. embassy-crypto routes to this trait only when its driver-p256-scalar-invert feature is NOT enabled.

§Contract

The caller guarantees k is in the range [1, n-1], where n is the curve order, so the inverse always exists. The result is canonical, in the same range.

Required Methods§

Source

fn invert(k: P256Scalar) -> P256Scalar

k^-1 mod n. Must not have secret-dependent timing: k may be secret.

Source

fn invert_vartime(k: P256Scalar) -> P256Scalar

k^-1 mod n, variable time. Callers only pass public values.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§