1//! This crate defines a set of traits which describe the functionality of
2//! [block ciphers][1], [block modes][2], and [stream ciphers][3].
3//!
4//! [1]: https://en.wikipedia.org/wiki/Block_cipher
5//! [2]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation
6//! [3]: https://en.wikipedia.org/wiki/Stream_cipher
7
8#![no_std]
9#![cfg_attr(docsrs, feature(doc_cfg))]
10#![doc(
11 html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
12 html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
13)]
14#![warn(missing_docs, rust_2018_idioms)]
15
16pub use crypto_common;
17pub use inout;
18
19#[cfg(all(feature = "block-padding", feature = "alloc"))]
20extern crate alloc;
21
22#[cfg(feature = "std")]
23extern crate std;
24
25#[cfg(feature = "rand_core")]
26#[cfg_attr(docsrs, doc(cfg(feature = "rand_core")))]
27pub use crypto_common::rand_core;
28
29#[cfg(feature = "block-padding")]
30#[cfg_attr(docsrs, doc(cfg(feature = "block-padding")))]
31pub use inout::block_padding;
32
33#[cfg(feature = "zeroize")]
34#[cfg_attr(docsrs, doc(cfg(feature = "zeroize")))]
35pub use zeroize;
36
37#[cfg(feature = "dev")]
38pub use blobby;
39
40mod block;
41#[cfg(feature = "dev")]
42mod dev;
43mod errors;
44mod stream;
45mod stream_core;
46mod stream_wrapper;
47
48pub use crate::{block::*, errors::*, stream::*, stream_core::*, stream_wrapper::*};
49pub use crypto_common::{
50 generic_array,
51 typenum::{self, consts},
52 AlgorithmName, Block, InnerIvInit, InvalidLength, Iv, IvSizeUser, Key, KeyInit, KeyIvInit,
53 KeySizeUser, ParBlocks, ParBlocksSizeUser,
54};
55
56/// Trait for loading current IV state.
57pub trait IvState: IvSizeUser {
58 /// Returns current IV state.
59 fn iv_state(&self) -> Iv<Self>;
60}
61