Skip to content

Commit

Permalink
fix: solve various import issues, ensure CI also tests rustcrypto wit…
Browse files Browse the repository at this point in the history
…h no_std
  • Loading branch information
pulsastrix committed Aug 27, 2024
1 parent 91d0419 commit 417ac63
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustc, cargo
- run: cargo test --no-default-features --features openssl
- run: cargo test --no-default-features --features openssl,rustcrypto

fmt:
name: Rustfmt
Expand Down
4 changes: 3 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ fn main() {
cfg_aliases! {
rustcrypto_encrypt_base: {
any(
feature = "rustcrypto-aes-gcm"
feature = "rustcrypto-aes-gcm",
feature = "rustcrypto-aes-ccm",
feature = "rustcrypto-chacha20-poly1305"
)
},
rustcrypto_sign_base: {
Expand Down
1 change: 1 addition & 0 deletions src/token/cose/crypto_impl/rustcrypto/encrypt/aes_ccm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::error::CoseCipherError;
use crate::token::cose::{CoseSymmetricKey, CryptoBackend};

use super::RustCryptoContext;
use alloc::vec::Vec;

impl<RNG: RngCore + CryptoRng> RustCryptoContext<RNG> {
/// Perform an AES-CCM encryption operation on `plaintext` and the additional authenticated
Expand Down
1 change: 1 addition & 0 deletions src/token/cose/crypto_impl/rustcrypto/encrypt/aes_gcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::error::CoseCipherError;
use crate::token::cose::{CoseSymmetricKey, CryptoBackend};

use super::RustCryptoContext;
use alloc::vec::Vec;

impl<RNG: RngCore + CryptoRng> RustCryptoContext<RNG> {
/// Perform an AES-GCM encryption operation on `plaintext` and the additional authenticated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use crate::error::CoseCipherError;
use crate::token::cose::{CoseSymmetricKey, CryptoBackend};

use super::RustCryptoContext;
use alloc::vec::Vec;

impl<RNG: RngCore + CryptoRng> RustCryptoContext<RNG> {
/// Perform an AES key wrap operation on the key contained in `plaintext` which is wrapped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use rand::{CryptoRng, RngCore};
use crate::error::CoseCipherError;
use crate::token::cose::crypto_impl::rustcrypto::RustCryptoContext;
use crate::token::cose::{CoseSymmetricKey, KeyDistributionCryptoBackend};
use alloc::vec::Vec;

#[cfg(feature = "rustcrypto-aes-kw")]
mod aes_key_wrap;
Expand Down
6 changes: 5 additions & 1 deletion src/token/cose/crypto_impl/rustcrypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ impl From<digest::MacError> for CoseCipherError<CoseRustCryptoCipherError> {
}
}

#[cfg(feature = "rustcrypto-aes-gcm")]
#[cfg(any(
feature = "rustcrypto-aes-gcm",
feature = "rustcrypto-aes-ccm",
feature = "rustcrypto-chacha20-poly1305"
))]
impl From<aead::Error> for CoseCipherError<CoseRustCryptoCipherError> {
fn from(_value: aead::Error) -> Self {
CoseCipherError::VerificationFailure
Expand Down
1 change: 1 addition & 0 deletions src/token/cose/crypto_impl/rustcrypto/sign/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use crate::error::CoseCipherError;
use crate::token::cose::crypto_impl::rustcrypto::CoseRustCryptoCipherError;
use crate::token::cose::crypto_impl::rustcrypto::RustCryptoContext;
use crate::token::cose::{CoseEc2Key, CryptoBackend, EllipticCurve};
use alloc::vec::Vec;

impl<RNG: RngCore + CryptoRng> RustCryptoContext<RNG> {
/// Perform an ECDSA signature operation with the ECDSA variant given in `algorithm` for the
Expand Down
1 change: 1 addition & 0 deletions src/token/cose/crypto_impl/rustcrypto/sign/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use rand::{CryptoRng, RngCore};

use crate::token::cose::crypto_impl::rustcrypto::RustCryptoContext;
use crate::token::SignCryptoBackend;
use alloc::vec::Vec;

#[cfg(feature = "rustcrypto-ecdsa")]
mod ecdsa;
Expand Down

0 comments on commit 417ac63

Please sign in to comment.