2026-03-11 18:32:21 +08:00
|
|
|
|
# ── Workspace 配置 ──────────────────────────────────────────────────────────
|
|
|
|
|
|
[workspace]
|
|
|
|
|
|
resolver = "2"
|
|
|
|
|
|
members = [
|
|
|
|
|
|
".", # libsmx (现有单体 crate,保持向后兼容)
|
|
|
|
|
|
"sm2", # SM2 独立 crate(实现 signature::Signer/Verifier)
|
|
|
|
|
|
"sm3", # SM3 独立 crate(实现 digest::Digest)
|
|
|
|
|
|
"sm4", # SM4 独立 crate(实现 cipher::BlockCipher)
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
[workspace.dependencies]
|
|
|
|
|
|
digest = { version = "0.11.1", default-features = false }
|
|
|
|
|
|
cipher = { version = "0.5.1", default-features = false }
|
|
|
|
|
|
subtle = { version = "2.6", default-features = false }
|
|
|
|
|
|
zeroize = { version = "1.8", default-features = false, features = ["derive"] }
|
|
|
|
|
|
signature = { version = "2.2", default-features = false }
|
|
|
|
|
|
hex-literal = "0.4"
|
|
|
|
|
|
|
|
|
|
|
|
# ── libsmx Package 配置(保留现有不变)────────────────────────────────────
|
2026-03-07 13:03:10 +08:00
|
|
|
|
[package]
|
|
|
|
|
|
name = "libsmx"
|
2026-03-09 10:13:09 +08:00
|
|
|
|
version = "0.3.0"
|
2026-03-07 13:03:10 +08:00
|
|
|
|
edition = "2021"
|
2026-03-07 20:38:34 +08:00
|
|
|
|
rust-version = "1.83.0"
|
2026-03-09 18:51:40 +08:00
|
|
|
|
authors = ["kintai <kintai@foxmail.com>"]
|
2026-03-07 13:03:10 +08:00
|
|
|
|
license = "Apache-2.0"
|
2026-03-07 19:27:41 +08:00
|
|
|
|
description = "Pure-Rust, no_std, constant-time SM2/SM3/SM4/SM9 Chinese cryptography (GB/T 32918/32905/32907/38635)"
|
2026-03-07 20:38:34 +08:00
|
|
|
|
repository = "https://github.com/kintaiW/libsmx"
|
2026-03-07 13:03:10 +08:00
|
|
|
|
documentation = "https://docs.rs/libsmx"
|
2026-03-09 18:51:40 +08:00
|
|
|
|
homepage = "https://kintaiw.github.io/libsmx/"
|
2026-03-07 13:03:10 +08:00
|
|
|
|
categories = ["cryptography", "no-std"]
|
2026-03-09 18:51:40 +08:00
|
|
|
|
keywords = ["sm2", "sm3", "sm4", "sm9", "cryptography"]
|
2026-03-07 19:27:41 +08:00
|
|
|
|
readme = "README.md"
|
2026-03-07 13:03:10 +08:00
|
|
|
|
exclude = [
|
|
|
|
|
|
"benches/",
|
|
|
|
|
|
"tests/",
|
|
|
|
|
|
"docs/",
|
|
|
|
|
|
".github/",
|
2026-03-07 19:27:41 +08:00
|
|
|
|
"scripts/",
|
|
|
|
|
|
"reference/",
|
2026-03-07 13:03:10 +08:00
|
|
|
|
"*.sh",
|
2026-03-07 19:27:41 +08:00
|
|
|
|
"*.md",
|
|
|
|
|
|
"!README.md",
|
|
|
|
|
|
"!CHANGELOG.md",
|
|
|
|
|
|
"!SECURITY.md",
|
|
|
|
|
|
".claude*",
|
2026-03-07 13:03:10 +08:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
[lib]
|
|
|
|
|
|
name = "libsmx"
|
|
|
|
|
|
path = "src/lib.rs"
|
|
|
|
|
|
|
|
|
|
|
|
[dependencies]
|
|
|
|
|
|
crypto-bigint = { version = "0.6", default-features = false }
|
|
|
|
|
|
subtle = { version = "2.6", default-features = false }
|
|
|
|
|
|
zeroize = { version = "1.8", default-features = false, features = ["derive"] }
|
|
|
|
|
|
rand_core = { version = "0.6", default-features = false }
|
2026-03-09 18:51:40 +08:00
|
|
|
|
rustls = { git = "https://github.com/rustls/rustls.git", branch = "main", optional = true, default-features = false }
|
2026-03-09 10:13:09 +08:00
|
|
|
|
pki-types = { package = "rustls-pki-types", version = "1", optional = true, features = ["alloc"] }
|
|
|
|
|
|
getrandom = { version = "0.2", optional = true }
|
2026-03-07 13:03:10 +08:00
|
|
|
|
|
|
|
|
|
|
[features]
|
|
|
|
|
|
default = ["alloc"]
|
|
|
|
|
|
alloc = []
|
|
|
|
|
|
std = ["alloc", "rand_core/std"]
|
2026-03-09 10:13:09 +08:00
|
|
|
|
# rustls CryptoProvider 集成(RFC 8998 国密 TLS 套件)
|
|
|
|
|
|
rustls-provider = ["alloc", "dep:rustls", "dep:pki-types", "dep:getrandom"]
|
2026-03-07 13:03:10 +08:00
|
|
|
|
|
|
|
|
|
|
[dev-dependencies]
|
|
|
|
|
|
hex = "0.4"
|
|
|
|
|
|
criterion = { version = "0.5", features = ["html_reports"] }
|
|
|
|
|
|
rand = "0.8"
|
|
|
|
|
|
sm9_core = "0.5.0"
|
2026-03-11 18:32:21 +08:00
|
|
|
|
proptest = { version = "1", default-features = false, features = ["alloc"] }
|
2026-03-09 18:51:40 +08:00
|
|
|
|
# rustls-provider 集成测试依赖(通过 feature 条件编译保护)
|
|
|
|
|
|
rustls = { git = "https://github.com/rustls/rustls.git", branch = "main", default-features = false, features = ["log", "webpki"] }
|
|
|
|
|
|
pki-types = { package = "rustls-pki-types", version = "1", features = ["alloc"] }
|
2026-03-07 13:03:10 +08:00
|
|
|
|
|
|
|
|
|
|
[[bench]]
|
|
|
|
|
|
name = "sm2_bench"
|
|
|
|
|
|
harness = false
|
|
|
|
|
|
|
|
|
|
|
|
[[bench]]
|
|
|
|
|
|
name = "sm3_bench"
|
|
|
|
|
|
harness = false
|
|
|
|
|
|
|
|
|
|
|
|
[[bench]]
|
|
|
|
|
|
name = "sm4_bench"
|
|
|
|
|
|
harness = false
|
|
|
|
|
|
|
|
|
|
|
|
[[bench]]
|
|
|
|
|
|
name = "sm9_bench"
|
|
|
|
|
|
harness = false
|