Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/decoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::crypto::aws_lc::{
RsaPss512Verifier,
},
};
#[cfg(feature = "rust_crypto")]
#[cfg(all(not(feature = "aws_lc_rs"), feature = "rust_crypto"))]
use crate::crypto::rust_crypto::{
ecdsa::{Es256Verifier, Es384Verifier},
eddsa::EdDSAVerifier,
Expand Down
2 changes: 1 addition & 1 deletion src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::crypto::aws_lc::{
Rsa256Signer, Rsa384Signer, Rsa512Signer, RsaPss256Signer, RsaPss384Signer, RsaPss512Signer,
},
};
#[cfg(feature = "rust_crypto")]
#[cfg(all(not(feature = "aws_lc_rs"), feature = "rust_crypto"))]
use crate::crypto::rust_crypto::{
ecdsa::{Es256Signer, Es384Signer},
eddsa::EdDSASigner,
Expand Down
14 changes: 7 additions & 7 deletions src/jwk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ use crate::{
use aws_lc_rs::{digest, signature as aws_sig};
#[cfg(feature = "aws_lc_rs")]
use aws_sig::KeyPair;
#[cfg(feature = "rust_crypto")]
#[cfg(all(not(feature = "aws_lc_rs"), feature = "rust_crypto"))]
use p256::{ecdsa::SigningKey as P256SigningKey, pkcs8::DecodePrivateKey};
#[cfg(feature = "rust_crypto")]
#[cfg(all(not(feature = "aws_lc_rs"), feature = "rust_crypto"))]
use p384::ecdsa::SigningKey as P384SigningKey;
#[cfg(feature = "rust_crypto")]
#[cfg(all(not(feature = "aws_lc_rs"), feature = "rust_crypto"))]
use rsa::{RsaPrivateKey, pkcs1::DecodeRsaPrivateKey, traits::PublicKeyParts};
#[cfg(feature = "rust_crypto")]
#[cfg(all(not(feature = "aws_lc_rs"), feature = "rust_crypto"))]
use sha2::{Digest, Sha256, Sha384, Sha512};

/// The intended usage of the public `KeyType`. This enum is serialized `untagged`
Expand Down Expand Up @@ -448,7 +448,7 @@ fn extract_rsa_public_key_components(key_content: &[u8]) -> errors::Result<(Vec<
Ok((components.n, components.e))
}

#[cfg(feature = "rust_crypto")]
#[cfg(all(not(feature = "aws_lc_rs"), feature = "rust_crypto"))]
fn extract_rsa_public_key_components(key_content: &[u8]) -> errors::Result<(Vec<u8>, Vec<u8>)> {
let private_key = RsaPrivateKey::from_pkcs1_der(key_content)
.map_err(|e| ErrorKind::InvalidRsaKey(e.to_string()))?;
Expand Down Expand Up @@ -483,7 +483,7 @@ fn extract_ec_public_key_coordinates(
Ok((curve, x.to_vec(), y.to_vec()))
}

#[cfg(feature = "rust_crypto")]
#[cfg(all(not(feature = "aws_lc_rs"), feature = "rust_crypto"))]
fn extract_ec_public_key_coordinates(
key_content: &[u8],
alg: Algorithm,
Expand Down Expand Up @@ -527,7 +527,7 @@ fn compute_digest(data: &[u8], hash_function: ThumbprintHash) -> Vec<u8> {
digest::digest(algorithm, data).as_ref().to_vec()
}

#[cfg(feature = "rust_crypto")]
#[cfg(all(not(feature = "aws_lc_rs"), feature = "rust_crypto"))]
fn compute_digest(data: &[u8], hash_function: ThumbprintHash) -> Vec<u8> {
match hash_function {
ThumbprintHash::SHA256 => Sha256::digest(data).to_vec(),
Expand Down
5 changes: 0 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

#![deny(missing_docs)]

#[cfg(all(feature = "rust_crypto", feature = "aws_lc_rs"))]
compile_error!(
"feature \"rust_crypto\" and feature \"aws_lc_rs\" cannot be enabled at the same time"
);

#[cfg(not(any(feature = "rust_crypto", feature = "aws_lc_rs")))]
compile_error!("at least one of the features \"rust_crypto\" or \"aws_lc_rs\" must be enabled");

Expand Down