|
53 | 53 | //! assert_eq!(&plaintext, b"plaintext message"); |
54 | 54 | //! ``` |
55 | 55 | //! |
| 56 | +//! ## In-place Usage (eliminates `alloc` requirement) |
| 57 | +//! |
| 58 | +//! This crate has an optional `alloc` feature which can be disabled in e.g. |
| 59 | +//! microcontroller environments that don't have a heap. |
| 60 | +//! |
| 61 | +//! The [`Aead::encrypt_in_place`][7] and [`Aead::decrypt_in_place`][8] |
| 62 | +//! methods accept any type that impls the [`aead::Buffer`][9] trait which |
| 63 | +//! contains the plaintext for encryption or ciphertext for decryption. |
| 64 | +//! |
| 65 | +//! Note that if you enable the `heapless` feature of the `aead` crate, |
| 66 | +//! you will receive an impl of `aead::Buffer` for the [`heapless::Vec`][10] |
| 67 | +//! type, which can then be passed as the `buffer` parameter to the |
| 68 | +//! in-place encrypt and decrypt methods. |
| 69 | +//! |
| 70 | +//! In `Cargo.toml`, add: |
| 71 | +//! |
| 72 | +//! ```toml |
| 73 | +//! [dependencies.aead] |
| 74 | +//! version = "0.2" |
| 75 | +//! default-features = false |
| 76 | +//! features = ["heapless"] |
| 77 | +//! |
| 78 | +//! [dependencies.aes-gcm-siv] |
| 79 | +//! version = "0.2" |
| 80 | +//! default-features = false |
| 81 | +//! ``` |
| 82 | +//! |
56 | 83 | //! [1]: https://en.wikipedia.org/wiki/AES-GCM-SIV |
57 | 84 | //! [2]: https://tools.ietf.org/html/rfc8452 |
58 | 85 | //! [3]: https://en.wikipedia.org/wiki/Authenticated_encryption |
59 | 86 | //! [4]: https://github.com/miscreant/meta/wiki/Nonce-Reuse-Misuse-Resistance |
60 | 87 | //! [5]: https://www.imperialviolet.org/2017/05/14/aesgcmsiv.html |
61 | 88 | //! [6]: https://codahale.com/towards-a-safer-footgun/ |
| 89 | +//! [7]: https://docs.rs/aead/latest/aead/trait.Aead.html#method.encrypt_in_place |
| 90 | +//! [8]: https://docs.rs/aead/latest/aead/trait.Aead.html#method.decrypt_in_place |
| 91 | +//! [9]: https://docs.rs/aead/latest/aead/trait.Buffer.html |
| 92 | +//! [10]: https://docs.rs/heapless/latest/heapless/struct.Vec.html |
62 | 93 |
|
63 | 94 | #![no_std] |
64 | 95 | #![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")] |
|
0 commit comments