tasign 0.2.0

TA ELF signing utilities with CMS/PKCS#7 support
//! Cryptographic primitives with pluggable backends (`tasign::crypto`).

extern crate alloc;

#[cfg(feature = "std")]
extern crate std;

#[cfg(all(feature = "backend-mbedtls", feature = "backend-rustcrypto"))]
compile_error!(
    "features `backend-mbedtls` and `backend-rustcrypto` are mutually exclusive; \
     use `--no-default-features` when enabling `backend-rustcrypto`"
);

#[cfg(not(any(feature = "backend-mbedtls", feature = "backend-rustcrypto")))]
compile_error!("enable exactly one of `backend-mbedtls` or `backend-rustcrypto`");

pub mod error;

#[cfg(all(feature = "std", any(feature = "backend-mbedtls", feature = "backend-rustcrypto")))]
pub(crate) mod gmssl_pkcs8_parse;

#[cfg(all(feature = "std", feature = "alloc", any(feature = "backend-mbedtls", feature = "backend-rustcrypto")))]
pub mod key_parse;

#[cfg(all(feature = "backend-mbedtls", not(feature = "backend-rustcrypto")))]
mod backend_mbedtls;

#[cfg(all(feature = "backend-rustcrypto", not(feature = "backend-mbedtls")))]
mod backend_rustcrypto;

#[cfg(all(feature = "backend-mbedtls", not(feature = "backend-rustcrypto")))]
pub use backend_mbedtls::{hash, key, pk, rng};

#[cfg(all(feature = "backend-rustcrypto", not(feature = "backend-mbedtls")))]
pub use backend_rustcrypto::{cert_sm2, hash, key, pk};

#[cfg(all(
    feature = "backend-rustcrypto",
    not(feature = "backend-mbedtls"),
    feature = "std"
))]
pub use backend_rustcrypto::rng;

#[cfg(all(feature = "interop-bytes", feature = "backend-rustcrypto", not(feature = "backend-mbedtls")))]
#[doc(hidden)]
/// Unstable byte-level SM2 API for `tasign-crypto-interop` only — not part of the stable `tasign` surface.
pub mod bytes {
    pub use super::backend_rustcrypto::{
        sm2_sign_digest, sm2_sign_message, sm2_verify_digest_sec1, sm2_verify_message_sec1,
    };
    pub use super::backend_rustcrypto::rng::{bridge_rng, CryptoRng, TeeRng};
}

pub use error::{CryptoError, Result};