From 94f405704f483f293297bdc611644e10b5a2ce11 Mon Sep 17 00:00:00 2001 From: Gabriela Moldovan Date: Mon, 26 Jun 2023 15:47:25 +0100 Subject: [PATCH] llcrypto: Add `Panics`, `Availability` docs for convert_ed25519_to_curve25519_private. --- crates/tor-llcrypto/src/pk/keymanip.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/tor-llcrypto/src/pk/keymanip.rs b/crates/tor-llcrypto/src/pk/keymanip.rs index 397713f85..4886ce89c 100644 --- a/crates/tor-llcrypto/src/pk/keymanip.rs +++ b/crates/tor-llcrypto/src/pk/keymanip.rs @@ -126,6 +126,18 @@ pub fn convert_curve25519_to_ed25519_private( /// yield an [`ExpandedKeypair`](pk::ed25519::ExpandedKeypair) that is _not_ identical to the /// expanded version of the original [`Keypair`](pk::ed25519::Keypair): the lower halves (the keys) of /// the expanded key pairs will be the same, but their upper halves (the nonces) will be different. +/// +/// # Panics +/// +/// If the `debug_assertions` feature is enabled, this function will double-check that the key it +/// is about to return is clamped. +/// +/// This panic should be impossible unless we have upgraded x25519-dalek without auditing this +/// function. +/// +/// # Availability +/// +/// This function is only available when the `keymgr` feature is enabled. #[cfg(any(test, feature = "keymgr"))] pub fn convert_ed25519_to_curve25519_private( keypair: &pk::ed25519::Keypair,