embassy-crypto-driver

Crates

git

Versions

default

Flavors

Skip to main content

Crate embassy_crypto_driver

Crate embassy_crypto_driver 

Source
Expand description

§embassy-crypto-driver

embassy-crypto provides universal optimized implementations of cryptographic functions, targeted for embedded systems. This crate defines the driver interface for these functions.

Hardware-agnostic crypto driver unitraits for the Embassy ecosystem.

This crate defines a set of unitrait! traits that abstract over hardware-accelerated (or software) cryptographic operations. Each trait declares an opaque context type and a set of functions with stable C linkage symbols, allowing exactly one driver implementation to be selected at link time.

§Supported Operations

§Digests

  • Md5, Sha1, Sha224, Sha256, Sha384, Sha512, Sha512_224, Sha512_256

§HMAC

  • HmacSha1, HmacSha224, HmacSha256, HmacSha384, HmacSha512, HmacSha512_224, HmacSha512_256

§Block Ciphers

  • Aes128Ecb, Aes256Ecb — ECB mode
  • Aes128Cbc, Aes256Cbc — CBC mode

§AEAD

  • Aes128Gcm, Aes256Gcm — GCM mode
  • Aes128Ccm, Aes256Ccm — CCM mode

§Elliptic Curve (P256)

  • P256Ecdh — key generation, public-key derivation, and shared-secret computation for TLS and Bluetooth LE Secure Connections
  • P256Ecdsa — sign and verify pre-hashed digests for TLS certificate authentication

§Elliptic Curve (P384)

  • P384Ecdh — key generation, public-key derivation, and shared-secret computation for TLS
  • P384Ecdsa — sign and verify pre-hashed digests for TLS certificate authentication

§X25519 (Curve25519)

  • X25519 — key generation, public-key derivation, and X25519 shared-secret computation for TLS 1.3 ECDHE

§High-level EC operations

  • P256Ec — combined P-256 ECDH + ECDSA unitrait serving embassy-crypto’s asymmetric module
  • P384Ec — combined P-384 ECDH + ECDSA unitrait serving embassy-crypto’s asymmetric::p384 module

§Driver Registration

A HAL crate registers itself by invoking the generated *_impl! macro for each supported algorithm. Only one crate in the dependency tree may register a driver for any given algorithm; otherwise linking will fail.

Macros§

aes128cbc_impl
aes128ccm_impl
aes128cmac_impl
aes128ctr_impl
aes128ecb_impl
aes128gcm_impl
aes256cbc_impl
aes256ccm_impl
aes256cmac_impl
aes256ctr_impl
aes256ecb_impl
aes256gcm_impl
hmac_sha1_impl
hmac_sha224_impl
hmac_sha256_impl
hmac_sha384_impl
hmac_sha512_224_impl
hmac_sha512_256_impl
hmac_sha512_impl
md5_impl
p256_ec_impl
p256_lincomb_impl
p256_scalar_invert_impl
p256_scalar_mul_impl
p384_ec_impl
p384_lincomb_impl
p384_scalar_invert_impl
p384_scalar_mul_impl
sha1_impl
sha224_impl
sha256_impl
sha384_impl
sha512_224_impl
sha512_256_impl
sha512_impl
x25519_impl

Structs§

Aes128CbcImpl
The global Aes128Cbc implementation.
Aes128CbcImplDecryptContext
Opaque storage for the decryptor’s key schedule and chaining state.
Aes128CbcImplEncryptContext
Opaque storage for the encryptor’s key schedule and chaining state.
Aes128CcmImpl
The global Aes128Ccm implementation.
Aes128CcmImplContext
Opaque storage for the implementation’s key schedule.
Aes128CmacImpl
The global Aes128Cmac implementation.
Aes128CmacImplContext
Opaque storage for the implementation’s CMAC state.
Aes128CtrImpl
The global Aes128Ctr implementation.
Aes128CtrImplContext
Opaque storage for key schedule, counter state, and partial-block buffer.
Aes128EcbImpl
The global Aes128Ecb implementation.
Aes128EcbImplContext
Opaque storage for the implementation’s key schedule.
Aes128GcmImpl
The global Aes128Gcm implementation.
Aes128GcmImplContext
Opaque storage for the implementation’s key schedule.
Aes256CbcImpl
The global Aes256Cbc implementation.
Aes256CbcImplDecryptContext
Opaque storage for the decryptor’s key schedule and chaining state.
Aes256CbcImplEncryptContext
Opaque storage for the encryptor’s key schedule and chaining state.
Aes256CcmImpl
The global Aes256Ccm implementation.
Aes256CcmImplContext
Opaque storage for the implementation’s key schedule.
Aes256CmacImpl
The global Aes256Cmac implementation.
Aes256CmacImplContext
Opaque storage for the implementation’s CMAC state.
Aes256CtrImpl
The global Aes256Ctr implementation.
Aes256CtrImplContext
Aes256EcbImpl
The global Aes256Ecb implementation.
Aes256EcbImplContext
Opaque storage for the implementation’s key schedule.
Aes256GcmImpl
The global Aes256Gcm implementation.
Aes256GcmImplContext
Opaque storage for the implementation’s key schedule.
HmacSha1Impl
The global HmacSha1 implementation.
HmacSha1ImplContext
Opaque storage for the implementation’s hash state.
HmacSha224Impl
The global HmacSha224 implementation.
HmacSha224ImplContext
Opaque storage for the implementation’s hash state.
HmacSha256Impl
The global HmacSha256 implementation.
HmacSha256ImplContext
Opaque storage for the implementation’s hash state.
HmacSha384Impl
The global HmacSha384 implementation.
HmacSha384ImplContext
Opaque storage for the implementation’s hash state.
HmacSha512Impl
The global HmacSha512 implementation.
HmacSha512ImplContext
Opaque storage for the implementation’s hash state.
HmacSha512_224Impl
The global HmacSha512_224 implementation.
HmacSha512_224ImplContext
Opaque storage for the implementation’s hash state.
HmacSha512_256Impl
The global HmacSha512_256 implementation.
HmacSha512_256ImplContext
Opaque storage for the implementation’s hash state.
InOutBuf
A lightweight I/O buffer abstraction without depending on the RustCrypto inout crate.
Md5Impl
The global Md5 implementation.
Md5ImplContext
Opaque storage for the implementation’s hash state.
NotEqualError
Error returned when a pair of input/output slices have unequal lengths.
P256AffinePoint
Canonical P-256 affine point: big-endian (x, y), uncompressed.
P256EcImpl
The global P256Ec implementation.
P256LincombImpl
The global P256Lincomb implementation.
P256Scalar
Canonical P-256 scalar: big-endian, 32 bytes.
P256ScalarInvertImpl
The global P256ScalarInvert implementation.
P256ScalarMulImpl
The global P256ScalarMul implementation.
P256Signature
Raw P-256 ECDSA signature: canonical (r, s), each 32 bytes big-endian.
P384AffinePoint
Canonical P-384 affine point: big-endian (x, y), uncompressed.
P384EcImpl
The global P384Ec implementation.
P384LincombImpl
The global P384Lincomb implementation.
P384Scalar
Canonical P-384 scalar: big-endian, 48 bytes.
P384ScalarInvertImpl
The global P384ScalarInvert implementation.
P384ScalarMulImpl
The global P384ScalarMul implementation.
P384Signature
Sha1Impl
The global Sha1 implementation.
Sha1ImplContext
Opaque storage for the implementation’s hash state.
Sha224Impl
The global Sha224 implementation.
Sha224ImplContext
Opaque storage for the implementation’s hash state.
Sha256Impl
The global Sha256 implementation.
Sha256ImplContext
Opaque storage for the implementation’s hash state.
Sha384Impl
The global Sha384 implementation.
Sha384ImplContext
Opaque storage for the implementation’s hash state.
Sha512Impl
The global Sha512 implementation.
Sha512ImplContext
Opaque storage for the implementation’s hash state.
Sha512_224Impl
The global Sha512_224 implementation.
Sha512_224ImplContext
Opaque storage for the implementation’s hash state.
Sha512_256Impl
The global Sha512_256 implementation.
Sha512_256ImplContext
Opaque storage for the implementation’s hash state.
X25519Impl
The global X25519 implementation.
X25519PrivateKey
An X25519 private key: 32-byte Curve25519 scalar, little-endian.
X25519PublicKey
An X25519 public key: 32-byte Curve25519 u-coordinate, little-endian (RFC 7748).

Enums§

CryptoError
Error type for crypto operations.

Traits§

Aes128Cbc
AES-128 CBC block cipher trait.
Aes128Ccm
AES-128 CCM AEAD trait.
Aes128Cmac
AES-128 CMAC (Cipher-based Message Authentication Code) trait.
Aes128Ctr
AES-128 CTR stream cipher trait.
Aes128Ecb
AES-128 ECB block cipher trait.
Aes128Gcm
AES-128 GCM AEAD trait.
Aes256Cbc
AES-256 CBC block cipher trait.
Aes256Ccm
AES-256 CCM AEAD trait.
Aes256Cmac
AES-256 CMAC (Cipher-based Message Authentication Code) trait.
Aes256Ctr
AES-256 CTR stream cipher trait.
Aes256Ecb
AES-256 ECB block cipher trait.
Aes256Gcm
AES-256 GCM AEAD trait.
HmacSha1
Sha1 trait
HmacSha224
Sha224 trait
HmacSha256
Sha256 trait
HmacSha384
Sha384 trait
HmacSha512
Sha512 trait
HmacSha512_224
Sha512_224 trait
HmacSha512_256
Sha512_256 trait
Md5
Md5 trait
P256Ec
High-level P-256 operations for TLS 1.3 and BLE Secure Connections.
P256Lincomb
P-256 double-base scalar multiplication accelerator (optional).
P256ScalarInvert
P-256 scalar field inversion accelerator (optional).
P256ScalarMul
P-256 scalar multiplication accelerator.
P384Ec
High-level P-384 operations for TLS 1.3.
P384Lincomb
P-384 double-base scalar multiplication accelerator (optional).
P384ScalarInvert
P-384 scalar field inversion accelerator (optional).
P384ScalarMul
P-384 scalar multiplication accelerator.
Rng
Caller-provided entropy source for crypto operations that need fresh randomness (ECDSA nonces, ephemeral key generation).
Sha1
Sha1 trait
Sha224
Sha224 trait
Sha256
Sha256 trait
Sha384
Sha384 trait
Sha512
Sha512 trait
Sha512_224
Sha512_224 trait
Sha512_256
Sha512_256 trait
X25519
X25519 (Curve25519) ECDH operations for TLS 1.3.