Skip to content

Commit

Permalink
Improve API reference documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail committed Nov 2, 2023
1 parent 7cacce6 commit 789812a
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions aws-lc-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
1 change: 1 addition & 0 deletions aws-lc-rs/src/ec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions aws-lc-rs/src/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions aws-lc-rs/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ 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<untrusted::EndOfInput> for Unspecified {
fn from(_: untrusted::EndOfInput) -> Self {
Expand Down
3 changes: 3 additions & 0 deletions aws-lc-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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.
///
Expand Down
4 changes: 2 additions & 2 deletions aws-lc-rs/src/rsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ use crate::signature::{KeyPair, VerificationAlgorithm};
use crate::{cbs, digest, rand, test};
#[cfg(feature = "fips")]
use aws_lc::RSA_check_fips;
#[cfg(not(feature = "fips"))]
use aws_lc::RSA_check_key;
use aws_lc::{
EVP_DigestSign, EVP_DigestSignInit, EVP_DigestVerify, EVP_DigestVerifyInit,
EVP_PKEY_CTX_set_rsa_padding, EVP_PKEY_CTX_set_rsa_pss_saltlen, EVP_PKEY_assign_RSA,
Expand Down Expand Up @@ -188,6 +186,7 @@ impl RsaKeyPair {
}

impl VerificationAlgorithm for RsaParameters {
#[cfg_attr(docsrs, doc(cfg(feature = "ring-sig-verify")))]
#[cfg(feature = "ring-sig-verify")]
fn verify(
&self,
Expand Down Expand Up @@ -438,6 +437,7 @@ impl AsRef<[u8]> for RsaSubjectPublicKey {
}
}

#[cfg_attr(docsrs, doc(cfg(feature = "ring-io")))]
#[cfg(feature = "ring-io")]
impl RsaSubjectPublicKey {
/// The public modulus (n).
Expand Down
1 change: 1 addition & 0 deletions aws-lc-rs/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 789812a

Please sign in to comment.