esp_hal::ecc

Struct Ecc

Source
pub struct Ecc<'d, DM: Mode> { /* private fields */ }
Expand description

The ECC Accelerator driver instance

Implementations§

Source§

impl<'d> Ecc<'d, Blocking>

Source

pub fn new(ecc: impl Peripheral<P = ECC> + 'd) -> Self

Create a new instance in crate::Blocking mode.

Source§

impl<DM: Mode> Ecc<'_, DM>

Source

pub fn reset(&mut self)

Resets the ECC peripheral.

Source

pub fn affine_point_multiplication( &mut self, curve: &EllipticCurve, k: &[u8], x: &mut [u8], y: &mut [u8], ) -> Result<(), Error>

§Base point multiplication

Base Point Multiplication can be represented as: (Q_x, Q_y) = k * (P_x, P_y)

Output is stored in x and y.

§Error

This function will return an error if any bitlength value is different from the bitlength of the prime fields of the curve.

Source

pub fn affine_point_verification( &mut self, curve: &EllipticCurve, x: &[u8], y: &[u8], ) -> Result<(), Error>

§Base Point Verification

Base Point Verification can be used to verify if a point (Px, Py) is on a selected elliptic curve.

§Error

This function will return an error if any bitlength value is different from the bitlength of the prime fields of the curve.

This function will return an error if the point is not on the selected elliptic curve.

Source

pub fn affine_point_verification_multiplication( &mut self, curve: &EllipticCurve, k: &[u8], x: &mut [u8], y: &mut [u8], ) -> Result<(), Error>

§Base Point Verification + Base Point Multiplication

In this working mode, ECC first verifies if Point (P_x, P_y) is on the selected elliptic curve or not. If yes, then perform the multiplication: (Q_x, Q_y) = k * (P_x, P_y)

Output is stored in x and y.

§Error

This function will return an error if any bitlength value is different from the bitlength of the prime fields of the curve.

This function will return an error if the point is not on the selected elliptic curve.

Source

pub fn jacobian_point_multiplication( &mut self, curve: &EllipticCurve, k: &mut [u8], x: &mut [u8], y: &mut [u8], ) -> Result<(), Error>

§Jacobian Point Multiplication

Jacobian Point Multiplication can be represented as: (Q_x, Q_y, Q_z) = k * (P_x, P_y, 1)

Output is stored in x, y, and k.

§Error

This function will return an error if any bitlength value is different from the bitlength of the prime fields of the curve.

Source

pub fn jacobian_point_verification( &mut self, curve: &EllipticCurve, x: &[u8], y: &[u8], z: &[u8], ) -> Result<(), Error>

§Jacobian Point Verification

Jacobian Point Verification can be used to verify if a point (Q_x, Q_y, Q_z) is on a selected elliptic curve.

§Error

This function will return an error if any bitlength value is different from the bitlength of the prime fields of the curve.

This function will return an error if the point is not on the selected elliptic curve.

Source

pub fn affine_point_verification_jacobian_multiplication( &mut self, curve: &EllipticCurve, k: &mut [u8], x: &mut [u8], y: &mut [u8], ) -> Result<(), Error>

§Base Point Verification + Jacobian Point Multiplication

In this working mode, ECC first verifies if Point (Px, Py) is on the selected elliptic curve or not. If yes, then perform the multiplication: (Q_x, Q_y, Q_z) = k * (P_x, P_y, 1)

Output is stored in x, y, and k.

§Error

This function will return an error if any bitlength value is different from the bitlength of the prime fields of the curve.

This function will return an error if the point is not on the selected elliptic curve.

Trait Implementations§

Source§

impl InterruptConfigurable for Ecc<'_, Blocking>

Source§

fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Set the interrupt handler Read more

Auto Trait Implementations§

§

impl<'d, DM> Freeze for Ecc<'d, DM>

§

impl<'d, DM> RefUnwindSafe for Ecc<'d, DM>
where DM: RefUnwindSafe,

§

impl<'d, DM> Send for Ecc<'d, DM>
where DM: Send,

§

impl<'d, DM> Sync for Ecc<'d, DM>
where DM: Sync,

§

impl<'d, DM> Unpin for Ecc<'d, DM>
where DM: Unpin,

§

impl<'d, DM> !UnwindSafe for Ecc<'d, DM>

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> 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.