diff --git a/aws-lc-rs/Cargo.toml b/aws-lc-rs/Cargo.toml index 768d9f3a7bb..8e04755b684 100644 --- a/aws-lc-rs/Cargo.toml +++ b/aws-lc-rs/Cargo.toml @@ -22,6 +22,10 @@ exclude = [ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[package.metadata.docs.rs] +features = ["fips"] +rustc-args = ["--cfg", "docsrs"] + [features] alloc = [] default = ["aws-lc-sys", "alloc", "ring-io", "ring-sig-verify"] diff --git a/aws-lc-rs/src/ec.rs b/aws-lc-rs/src/ec.rs index 97f8ea9b2ca..87e12cac1bd 100644 --- a/aws-lc-rs/src/ec.rs +++ b/aws-lc-rs/src/ec.rs @@ -141,6 +141,7 @@ unsafe impl Sync for PublicKey {} impl VerificationAlgorithm for EcdsaVerificationAlgorithm { #[inline] + #[cfg_attr(docsrs, doc(cfg(feature = "ring-sig-verify")))] #[cfg(feature = "ring-sig-verify")] fn verify( &self, diff --git a/aws-lc-rs/src/ed25519.rs b/aws-lc-rs/src/ed25519.rs index e58049ac381..3ddbbb07381 100644 --- a/aws-lc-rs/src/ed25519.rs +++ b/aws-lc-rs/src/ed25519.rs @@ -39,6 +39,7 @@ impl sealed::Sealed for EdDSAParameters {} impl VerificationAlgorithm for EdDSAParameters { #[inline] + #[cfg_attr(docsrs, doc(cfg(feature = "ring-sig-verify")))] #[cfg(feature = "ring-sig-verify")] fn verify( &self, diff --git a/aws-lc-rs/src/error.rs b/aws-lc-rs/src/error.rs index edf4457548a..6451d510bb7 100644 --- a/aws-lc-rs/src/error.rs +++ b/aws-lc-rs/src/error.rs @@ -218,6 +218,7 @@ impl From<()> for KeyRejected { } } +#[cfg_attr(docsrs, doc(cfg(any(feature = "ring-sig-verify", feature = "ring-io"))))] #[cfg(any(feature = "ring-sig-verify", feature = "ring-io"))] impl From for Unspecified { fn from(_: untrusted::EndOfInput) -> Self { diff --git a/aws-lc-rs/src/lib.rs b/aws-lc-rs/src/lib.rs index b6aba0f9e26..84179ac3107 100644 --- a/aws-lc-rs/src/lib.rs +++ b/aws-lc-rs/src/lib.rs @@ -91,6 +91,7 @@ //! and deploy them into AWS Regions. #![warn(missing_docs)] +#![cfg_attr(docsrs, feature(doc_cfg))] #[cfg(feature = "fips")] extern crate aws_lc_fips_sys as aws_lc; @@ -106,6 +107,7 @@ pub mod digest; pub mod error; pub mod hkdf; pub mod hmac; +#[cfg_attr(docsrs, doc(cfg(feature = "ring-io")))] #[cfg(feature = "ring-io")] pub mod io; pub mod pbkdf2; @@ -148,6 +150,7 @@ pub fn init() { }); } +#[cfg_attr(docsrs, doc(cfg(feature = "fips")))] #[cfg(feature = "fips")] /// Panics if the underlying implementation is not FIPS, otherwise it returns. /// diff --git a/aws-lc-rs/src/rsa.rs b/aws-lc-rs/src/rsa.rs index 576e7cf135c..83249b8f789 100644 --- a/aws-lc-rs/src/rsa.rs +++ b/aws-lc-rs/src/rsa.rs @@ -188,6 +188,7 @@ impl RsaKeyPair { } impl VerificationAlgorithm for RsaParameters { + #[cfg_attr(docsrs, doc(cfg(feature = "ring-sig-verify")))] #[cfg(feature = "ring-sig-verify")] fn verify( &self, @@ -438,6 +439,7 @@ impl AsRef<[u8]> for RsaSubjectPublicKey { } } +#[cfg_attr(docsrs, doc(cfg(feature = "ring-io")))] #[cfg(feature = "ring-io")] impl RsaSubjectPublicKey { /// The public modulus (n). diff --git a/aws-lc-rs/src/signature.rs b/aws-lc-rs/src/signature.rs index 0276789ed3b..31a1a24dcdb 100644 --- a/aws-lc-rs/src/signature.rs +++ b/aws-lc-rs/src/signature.rs @@ -313,6 +313,7 @@ pub trait VerificationAlgorithm: Debug + Sync + sealed::Sealed { // /// # Errors /// `error::Unspecified` if inputs not verified. + #[cfg_attr(docsrs, doc(cfg(feature = "ring-sig-verify")))] #[cfg(feature = "ring-sig-verify")] #[deprecated(note = "please use `VerificationAlgorithm::verify_sig` instead")] fn verify(