From a6bac74d4850d1a30e3aba405aaaea56044a2266 Mon Sep 17 00:00:00 2001 From: David Niehues <7667041+DavidNiehues@users.noreply.github.com> Date: Sun, 15 Dec 2024 21:31:00 +0100 Subject: [PATCH] docs(ciphers+cipher-traits):fix most broken doc-links in the ciphers and cipher-traits crates. Some links in the documentation of the ciphers and cipher-traits were broken or linked to private fields. This PR fixes most of these occasions and some more warnings in cargo doc. The reaming issues are links to chacha20poly1305_ietf, that are broken because the feature experiment_libcrux corresponding feature is enabled. Analogously, disabling the feature would lead to broken links to chacha20poly1305_ietf_libcrux. --- cipher-traits/src/kem.rs | 4 +++- ciphers/src/lib.rs | 7 ++++--- ciphers/src/subtle/blake2b.rs | 14 +++++++------- ciphers/src/subtle/mod.rs | 4 ++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/cipher-traits/src/kem.rs b/cipher-traits/src/kem.rs index d5391f4..f469ee4 100644 --- a/cipher-traits/src/kem.rs +++ b/cipher-traits/src/kem.rs @@ -8,7 +8,9 @@ //! encapsulation. //! //! The [Kem] Trait describes the basic API offered by a Key Encapsulation -//! Mechanism. Two implementations for it are provided, [StaticKEM] and [EphemeralKEM]. +//! Mechanism. Two implementations for it are provided: +//! [Kyber512](../../rosenpass_oqs/kyber_512/enum.Kyber512.html) and +//! [ClassicMceliece460896](../../rosenpass_oqs/classic_mceliece_460896/enum.ClassicMceliece460896.html). //! //! An example where Alice generates a keypair and gives her public key to Bob, for Bob to //! encapsulate a symmetric key and Alice to decapsulate it would look as follows. diff --git a/ciphers/src/lib.rs b/ciphers/src/lib.rs index ecb618d..6b6c67f 100644 --- a/ciphers/src/lib.rs +++ b/ciphers/src/lib.rs @@ -41,10 +41,11 @@ pub mod xaead { pub mod hash_domain; /// This crate includes two key encapsulation mechanisms. -/// Namely ClassicMceliece460896 (as [StaticKem]) and Kyber512 (as [EphemeralKem]). +/// Namely ClassicMceliece460896 (also referred to as `StaticKem` sometimes) and +/// Kyber512 (also referred to as `EphemeralKem` sometimes). /// -/// See [rosenpass_oqs::ClassicMceliece460896](rosenpass_oqs::ClassicMceliece460896) -/// and [rosenpass_oqs::Kyber512](rosenpass_oqs::Kyber512) for more details on the specific KEMS. +/// See [rosenpass_oqs::ClassicMceliece460896] +/// and [rosenpass_oqs::Kyber512] for more details on the specific KEMS. /// pub mod kem { pub use rosenpass_oqs::ClassicMceliece460896 as StaticKem; diff --git a/ciphers/src/subtle/blake2b.rs b/ciphers/src/subtle/blake2b.rs index c29a6e3..26dbf25 100644 --- a/ciphers/src/subtle/blake2b.rs +++ b/ciphers/src/subtle/blake2b.rs @@ -10,7 +10,7 @@ use rosenpass_to::{ops::copy_slice, with_destination, To}; use rosenpass_util::typenum2const; /// Specify that the used implementation of BLAKE2b is the MAC version of BLAKE2b -/// with output and key length of 32 bytes (see [Blake2bMac]). +/// with output and key length of 32 bytes (see [Blake2bMac]). type Impl = Blake2bMac; type KeyLen = ::KeySize; @@ -21,17 +21,17 @@ const KEY_LEN: usize = typenum2const! { KeyLen }; /// The output length for BLAKE2b supported by this API. Currently 32 Bytes. const OUT_LEN: usize = typenum2const! { OutLen }; -/// Minimal key length supported by this API (identical to [KEY_LEN]) +/// Minimal key length supported by this API. pub const KEY_MIN: usize = KEY_LEN; -/// maximal key length supported by this API (identical to [KEY_LEN]) +/// maximal key length supported by this API. pub const KEY_MAX: usize = KEY_LEN; -/// minimal output length supported by this API (identical [OUT_LEN]) +/// minimal output length supported by this API. pub const OUT_MIN: usize = OUT_LEN; -/// maximal output length supported by this API (identical [OUT_LEN]) +/// maximal output length supported by this API. pub const OUT_MAX: usize = OUT_LEN; -/// Hashes the given `data` with the [Blake2bMac] hash function under the given `key`. -/// The [KEY_LEN] and [OUT_LEN] are both set to 32 bytes (or 256 bits). +/// Hashes the given `data` with the [Blake2bMac] hash function under the given `key`. +/// The both the length of the output the length of the key 32 bytes (or 256 bits). /// /// # Examples /// diff --git a/ciphers/src/subtle/mod.rs b/ciphers/src/subtle/mod.rs index 179cf9e..7e9431b 100644 --- a/ciphers/src/subtle/mod.rs +++ b/ciphers/src/subtle/mod.rs @@ -1,7 +1,7 @@ /// This module provides the following cryptographic schemes: /// - [blake2b]: The blake2b hash function -/// - [chacha20poly1305_ietf]: The Chacha20Poly1305 AEAD as implemented in [RustCrypto](https://crates.io/crates/chacha20poly1305) (only used when the feature `experiment_libcrux` is disabled. -/// - [chacha20poly1305_ietf_libcrux]: The Chacha20Poly1305 AEAD as implemented in [libcrux](https://github.com/cryspen/libcrux) (only used when the feature `experiment_libcrux` is enabled. +/// - [chacha20poly1305_ietf]: The Chacha20Poly1305 AEAD as implemented in [RustCrypto](https://crates.io/crates/chacha20poly1305) (only used when the feature `experiment_libcrux` is disabled). +/// - [chacha20poly1305_ietf_libcrux]: The Chacha20Poly1305 AEAD as implemented in [libcrux](https://github.com/cryspen/libcrux) (only used when the feature `experiment_libcrux` is enabled). /// - [incorrect_hmac_blake2b]: An (incorrect) hmac based on [blake2b]. /// - [xchacha20poly1305_ietf] The Chacha20Poly1305 AEAD as implemented in [RustCrypto](https://crates.io/crates/chacha20poly1305) pub mod blake2b;