Skip to main content

FfiPsaBackend

Struct FfiPsaBackend 

Source
pub struct FfiPsaBackend;
Expand description

Implements the PSA backend trait for FFI-backed targets.

Implementations§

Source§

impl FfiPsaBackend

Source

pub fn new() -> Self

Creates a new FFI-backed backend adapter.

§Arguments
  • () - This constructor has no parameters.
§Returns

A default FfiPsaBackend instance.

Source

pub fn has_ffi_shims(&self) -> bool

Returns whether this build includes direct PSA FFI shims.

§Arguments
  • self - Backend instance for capability checks.
§Returns

true when the mbedtls-psa-ffi feature is enabled, otherwise false.

Trait Implementations§

Source§

impl Clone for FfiPsaBackend

Source§

fn clone(&self) -> FfiPsaBackend

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 Debug for FfiPsaBackend

Source§

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

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

impl Default for FfiPsaBackend

Source§

fn default() -> FfiPsaBackend

Returns the “default value” for a type. Read more
Source§

impl PsaCryptoBackend for FfiPsaBackend

Source§

fn sign(&self, request: &KeySignRequest<'_>) -> Result<Vec<u8>>

Signs input digest bytes using a key handle and algorithm selected in request.

§Arguments
  • self - Backend instance receiving sign request dispatch.
  • request - Sign request carrying key handle, algorithm, and digest bytes.
§Returns

Signature bytes if supported by this backend implementation.

§Errors

Returns Error::UnsupportedFeature until concrete FFI hooks are linked.

Source§

fn decrypt(&self, request: &KeyDecryptRequest<'_>) -> Result<Vec<u8>>

Decrypts ciphertext bytes using a key handle and requested mechanism.

§Arguments
  • self - Backend instance receiving decrypt request dispatch.
  • request - Decrypt request containing handle, algorithm, and ciphertext.
§Returns

Decrypted plaintext bytes if backend supports this operation.

§Errors

Returns Error::UnsupportedFeature until concrete FFI hooks are linked.

Source§

fn derive(&self, request: &KeyDeriveRequest<'_>) -> Result<Vec<u8>>

Derives shared-secret bytes for a key handle and peer public key.

§Arguments
  • self - Backend instance receiving derive request dispatch.
  • request - Derive request with handle, algorithm, and peer public bytes.
§Returns

Shared secret bytes derived by the configured algorithm.

§Errors

Returns Error::UnsupportedFeature until concrete FFI hooks are linked.

Source§

fn random(&self, out: &mut [u8]) -> Result<()>

Fills the output buffer with random bytes from PSA entropy source.

§Arguments
  • self - Backend instance receiving random generation request.
  • out - Mutable byte slice to fill with random output.
§Returns

Ok(()) when random bytes were produced.

§Errors

Returns Error::UnsupportedFeature until concrete FFI hooks are linked.

Source§

fn sha256(&self, input: &[u8]) -> Result<[u8; 32]>

Computes SHA-256 digest for the input payload.

§Arguments
  • self - Backend instance receiving hash request dispatch.
  • input - Bytes to hash with SHA-256.
§Returns

A 32-byte SHA-256 digest.

§Errors

Returns Error::UnsupportedFeature until concrete FFI hooks are linked.

Source§

fn aes_gcm_encrypt( &self, request: &AeadEncryptRequest<'_>, ) -> Result<AeadEncryptResponse>

Encrypts plaintext bytes with AES-GCM and returns ciphertext plus tag.

§Arguments
  • self - Backend instance receiving AEAD encryption request.
  • request - AES-GCM request with key, nonce, AAD, and plaintext.
§Returns

Ciphertext and 16-byte tag on successful encryption.

§Errors

Returns Error::UnsupportedFeature until concrete FFI hooks are linked.

Auto Trait Implementations§

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.