Skip to main content

gmcrypto_core/
lib.rs

1//! Constant-time-designed pure-Rust SM2 / SM3 / SM4 primitives.
2//!
3//! See the workspace `README.md` for scope, threat model, and the honest
4//! framing of the in-CI `dudect`-based timing-leak regression harness.
5//!
6//! # Modules
7//!
8//! - [`sm2`] — SM2 elliptic-curve sign / verify / encrypt / decrypt
9//!   (GB/T 32918). Comb-table fixed-base scalar mult (v0.3 W6).
10//! - [`sm3`] — SM3 hash (GB/T 32905) with streaming `new/update/finalize`.
11//! - [`sm4`] — SM4 block cipher (GB/T 32907) + CBC mode (single-shot
12//!   and v0.3 W5 streaming).
13//! - [`hmac`] — HMAC-SM3 (RFC 2104), single-shot + v0.3 W5 streaming.
14//! - [`kdf`] — PBKDF2-HMAC-SM3 (RFC 8018 §5.2).
15//! - [`asn1`] — strict-canonical DER reader / writer / OID constants
16//!   (v0.3 W1); GM/T 0009 SM2 ciphertext SEQUENCE; RFC 3279 SM2
17//!   signature SEQUENCE.
18//! - [`pem`] — RFC 7468 PEM codec (v0.3 W2; hand-rolled, `no_std`).
19//! - [`spki`] — RFC 5280 `SubjectPublicKeyInfo` for SM2 (v0.3 W2).
20//! - [`sec1`] — RFC 5915 `ECPrivateKey` + SEC1 uncompressed point (v0.3 W2).
21//! - [`pkcs8`] — RFC 5958 `OneAsymmetricKey` + RFC 8018 PBES2 (v0.3 W2).
22//! - [`traits`] — in-crate `Hash` / `Mac` / `BlockCipher` traits
23//!   (v0.3 W5; RustCrypto-trait fit deferred to v0.4).
24//!
25//! # Crate features
26//!
27//! - `default` — `no_std`, `alloc`-only.
28//! - `std` — opt-in; reserved for future file-I/O wire-format helpers.
29
30#![no_std]
31#![deny(missing_docs)]
32#![doc(html_root_url = "https://docs.rs/gmcrypto-core/0.3.0")]
33
34extern crate alloc;
35
36#[cfg(feature = "std")]
37extern crate std;
38
39pub mod asn1;
40pub mod hmac;
41pub mod kdf;
42pub mod pem;
43pub mod pkcs8;
44pub mod sec1;
45pub mod sm2;
46pub mod sm3;
47pub mod sm4;
48pub mod spki;
49pub mod traits;