Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions sm2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ proptest = "1"
rand_core = { version = "0.9", features = ["os_rng"] }

[features]
default = ["arithmetic", "dsa", "pke", "pem", "std"]
default = ["arithmetic", "dsa", "pke", "pem"]
alloc = ["elliptic-curve/alloc"]
std = ["alloc", "elliptic-curve/std"]

getrandom = ["rand_core/os_rng"]
arithmetic = ["dep:primefield", "dep:primeorder", "elliptic-curve/arithmetic"]
bits = ["arithmetic", "elliptic-curve/bits"]
dsa = ["arithmetic", "dep:rfc6979", "dep:signature", "dep:sm3"]
Expand Down
7 changes: 3 additions & 4 deletions sm2/src/dsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ use signature::{Error, Result, SignatureEncoding};
#[cfg(feature = "alloc")]
use alloc::vec::Vec;

#[cfg(feature = "pkcs8")]
#[cfg(all(feature = "alloc", feature = "pkcs8"))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you changing this? Everything but SignatureBitStringEncoding is available in no-alloc environments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you resolve this comment without answering or changing anything?

use crate::pkcs8::{
AlgorithmIdentifierRef, ObjectIdentifier, der::AnyRef, spki::AssociatedAlgorithmIdentifier,
AlgorithmIdentifierRef, ObjectIdentifier, der, der::AnyRef,
spki::AssociatedAlgorithmIdentifier, spki::SignatureBitStringEncoding,
};
#[cfg(all(feature = "alloc", feature = "pkcs8"))]
use crate::pkcs8::{der, spki::SignatureBitStringEncoding};

/// SM2DSA signature serialized as bytes.
pub type SignatureBytes = [u8; Signature::BYTE_SIZE];
Expand Down
4 changes: 2 additions & 2 deletions sm2/src/dsa/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use signature::{
};
use sm3::Sm3;

#[cfg(feature = "pkcs8")]
#[cfg(all(feature = "pkcs8", feature = "alloc"))]
use crate::pkcs8::{
der::AnyRef,
spki::{AlgorithmIdentifier, AssociatedAlgorithmIdentifier, SignatureAlgorithmIdentifier},
Expand Down Expand Up @@ -247,7 +247,7 @@ fn sign_prehash_rfc6979(secret_scalar: &Scalar, prehash: &[u8], data: &[u8]) ->
Signature::from_scalars(r, s)
}

#[cfg(feature = "pkcs8")]
#[cfg(all(feature = "pkcs8", feature = "alloc"))]
impl SignatureAlgorithmIdentifier for SigningKey {
type Params = AnyRef<'static>;

Expand Down
6 changes: 3 additions & 3 deletions sm2/src/dsa/verifying.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ use sm3::{Sm3, digest::Digest};
use alloc::{boxed::Box, string::String};

#[cfg(all(feature = "alloc", feature = "pkcs8"))]
use crate::pkcs8::{self, EncodePublicKey, spki};
#[cfg(feature = "pkcs8")]
use crate::pkcs8::{
self, EncodePublicKey,
der::AnyRef,
spki,
spki::{AlgorithmIdentifier, AssociatedAlgorithmIdentifier, SignatureAlgorithmIdentifier},
};

Expand Down Expand Up @@ -223,7 +223,7 @@ impl EncodePublicKey for VerifyingKey {
}
}

#[cfg(feature = "pkcs8")]
#[cfg(all(feature = "pkcs8", feature = "alloc"))]
impl SignatureAlgorithmIdentifier for VerifyingKey {
type Params = AnyRef<'static>;

Expand Down
Loading