pub trait Cal {
type DhProvider: DhProvider;
type AeadProvider: AeadProvider;
type HashProvider: HashProvider;
type HmacProvider: HmacProvider;
// Required methods
fn dh(&mut self) -> &mut Self::DhProvider;
fn aead(&mut self) -> &mut Self::AeadProvider;
fn hash(&mut self) -> &mut Self::HashProvider;
fn hmac(&mut self) -> &mut Self::HmacProvider;
}Expand description
Cryptographic abstraction provider that encompasses all features abstracted by the embedded-cal.
To ease implementation and give better access to its aspects, this does not have a list of supertraits, but rather various associated types and acccessors to them.
These allow passing on full portions of the feature set between implementations. Common choices for the associated type and the corresponding accessor implementation are:
-
type XxxProvider = Self/self, when an object does provide that functionality. -
type XxxProvider = Self::Base/self.base.xxx(), when an extender does not touch that functionality at all and merely forwards it to whatever is being extended. -
type XxxProvider = embedded_cal::empty::EmptyCal/&mut self.empty, when a non-extender (typically a hardware module) does not implement something at all.Note that to keep the types reasonably simple, the accessors are
fn(&mut Self) -> &mut Self::XxxProvider, which requires an existing (albeit zero-sized)EmptyCal, which is most easily provided by adding one as a field to theSelfstruct. (The alternative would be to go throughAsMutindirections or use lifetime-generic associated types liketype XxxProvider<'t> = &mut Self/= Empty, and that is not only unergonomic, it also hinders restraining them inwhereclauses).
Required Associated Types§
Sourcetype DhProvider: DhProvider
type DhProvider: DhProvider
The non-supertrait responsible for key establishment.
type AeadProvider: AeadProvider
type HashProvider: HashProvider
type HmacProvider: HmacProvider
Required Methods§
fn dh(&mut self) -> &mut Self::DhProvider
fn aead(&mut self) -> &mut Self::AeadProvider
fn hash(&mut self) -> &mut Self::HashProvider
fn hmac(&mut self) -> &mut Self::HmacProvider
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".