Skip to main content
This is unreleased documentation for the main (development) branch of crypto-glue.

aes_kw/
lib.rs

1#![no_std]
2#![doc = include_str!("../README.md")]
3#![doc(
4    html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
5    html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
6)]
7#![cfg_attr(docsrs, feature(doc_cfg))]
8#![forbid(unsafe_code)]
9#![warn(missing_docs, rust_2018_idioms)]
10
11#[cfg(feature = "oid")]
12mod oid;
13
14mod ctx;
15mod error;
16mod kw;
17mod kwp;
18
19use aes::cipher::consts::U8;
20use aes::cipher::typenum::Unsigned;
21pub use error::{Error, IntegrityCheckFailed};
22pub use kw::AesKw;
23pub use kwp::AesKwp;
24
25pub use aes;
26pub use aes::cipher;
27pub use aes::cipher::{KeyInit, common::InnerInit};
28
29#[cfg(feature = "zeroize")]
30pub use zeroize;
31
32/// AES-128 key wrapping
33pub type KwAes128 = AesKw<aes::Aes128>;
34/// AES-192 key wrapping
35pub type KwAes192 = AesKw<aes::Aes192>;
36/// AES-256 key wrapping
37pub type KwAes256 = AesKw<aes::Aes256>;
38
39/// AES-128 key wrapping
40pub type KwpAes128 = AesKwp<aes::Aes128>;
41/// AES-192 key wrapping
42pub type KwpAes192 = AesKwp<aes::Aes192>;
43/// AES-256 key wrapping
44pub type KwpAes256 = AesKwp<aes::Aes256>;
45
46/// Size of an AES-KW and AES-KWP initialization vector in bytes represented as a `typenum` type.
47pub type IvLen = U8;
48/// Size of an AES-KW and AES-KWP initialization vector in bytes.
49///
50/// This value is equal to "semiblock" size. From NIST SP 800-38F ยง 4.1:
51///
52/// > semiblock: given a block cipher, a bit string whose length is half of the block size.
53pub const IV_LEN: usize = IvLen::USIZE;