embassy-crypto-driver

Crates

git

Versions

default

Flavors

Skip to main content

P256Lincomb

Trait P256Lincomb 

Source
pub trait P256Lincomb {
    // Required method
    fn lincomb(
        k1: P256Scalar,
        p1: P256AffinePoint,
        k2: P256Scalar,
        p2: P256AffinePoint,
    ) -> Option<P256AffinePoint>;
}
Expand description

P-256 double-base scalar multiplication accelerator (optional).

Computes k1 * p1 + k2 * p2 in one operation, which is what ECDSA verification needs; backends can use a combined ladder (Shamir’s trick).

§Contract

The caller guarantees k1 and k2 are in [0, n-1] and p1, p2 are valid on-curve affine points. A zero scalar contributes the identity. The sum can be the identity (when the non-zero terms cancel), which has no affine encoding; the implementation returns None in that case.

Must not have secret-dependent timing with respect to the scalars and points. Whether the result is the identity is not treated as secret.

Required Methods§

Source

fn lincomb( k1: P256Scalar, p1: P256AffinePoint, k2: P256Scalar, p2: P256AffinePoint, ) -> Option<P256AffinePoint>

k1 * p1 + k2 * p2, or None if the sum is the identity.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§