From bc34fccb8cae411f1862c6e15c96dd1d3056f7e9 Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Tue, 1 Dec 2026 07:39:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(mwrap):=20mbedtls=203.6.8.1=20=E2=80=94=20?= =?UTF-8?q?the=20hash=20groups=20are=20sub-modules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .agents/docs/2026-12-01-add-mbedtls-m-plan.md | 7 +++++++ pkgs/mwrap/mbedtls.lua | 16 +++++++++++++++- tests/mwrap/mbedtls-hashes/mcpp.toml | 4 ++-- tests/mwrap/mbedtls-hashes/tests/submodule.cpp | 13 +++++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 tests/mwrap/mbedtls-hashes/tests/submodule.cpp diff --git a/.agents/docs/2026-12-01-add-mbedtls-m-plan.md b/.agents/docs/2026-12-01-add-mbedtls-m-plan.md index dfb40556..fbc8a3b8 100644 --- a/.agents/docs/2026-12-01-add-mbedtls-m-plan.md +++ b/.agents/docs/2026-12-01-add-mbedtls-m-plan.md @@ -36,3 +36,10 @@ - `*_self_test` 函数由头文件声明并导出,但 `compat.mbedtls` 未以 `MBEDTLS_SELF_TEST_C` 构建,链接它们会失败;`tests/linked.cpp` 说明了这一点,文档要求在 `#if defined(MBEDTLS_SELF_TEST_C)` 下调用。 - 版本尾号:首个 mwrap 身份直接用上游版本 `3.6.8`,后续包装修订才加 `.1`。 + +## 3.6.8.1(2026-12-01,wrapper 修订) + +- 起因:首个消费者(xgit)按 README 写 `import mcpplibs.mwrap.mbedtls.sha256;`,得到 "module not found":各算法组在 mwrap-3.6.8 里是根模块的**分区**(`mcpplibs.mwrap.mbedtls:sha256`),只能经根模块导入,与 README 和 mwrap 规范(根模块 + 子模块 `mcpplibs.mwrap..`,docs/zh/mwrap.md)都不一致。 +- 修复:mcpplibs/mbedtls-m#1——`tools/generate.py` 生成 `export module mcpplibs.mwrap.mbedtls.;`,根模块 `export import` 六个子模块(根的导入方不变);`tests/submodule_test.cpp` 只导入 `.sha256`。CI 6/6 通过,squash 合入,tag/release `mwrap-3.6.8.1`。 +- 来源:release 资产 `mbedtls-m-3.6.8.1.tar.gz`(GitHub `archive/refs/tags/mwrap-3.6.8.1.tar.gz` 原样上传;下载两次 sha256 一致,资产回读一致):`bcd9eb19871be089bf1add6672941425eab92a0310ec236a63115ca0b3a15e94`。 +- 索引:三平台加 `["3.6.8.1"]`(GLOBAL 字符串 url,CN 镜像仍为维护者步骤);`tests/mwrap/mbedtls-hashes` 升到 3.6.8.1,新增 `tests/submodule.cpp` 只导入 `.sha256`,钉住子模块契约。`mcpp xpkg parse` 通过。 diff --git a/pkgs/mwrap/mbedtls.lua b/pkgs/mwrap/mbedtls.lua index 24b973b5..88544495 100644 --- a/pkgs/mwrap/mbedtls.lua +++ b/pkgs/mwrap/mbedtls.lua @@ -1,4 +1,6 @@ --- Immutable upstream-aligned mwrap source release (mbedtls-m mwrap-3.6.8). +-- Immutable upstream-aligned mwrap source release (mbedtls-m mwrap-3.6.8; +-- mwrap-3.6.8.1 is a wrapper revision: each hash group its own sub-module, as +-- the mwrap spec names them, the root re-exporting the six). -- GLOBAL only: the CN mirror under mcpp-res is a maintainer's step; the -- plain string form is what the lint allows until then (docs/cn-mirror.md). -- @@ -25,18 +27,30 @@ package = { url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8/mbedtls-m-3.6.8.tar.gz", sha256 = "91a2ecb55857499426bc764a3b7c1a1f2f94d3f8051e962cb4ff1db99f2c1584", }, + ["3.6.8.1"] = { + url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8.1/mbedtls-m-3.6.8.1.tar.gz", + sha256 = "bcd9eb19871be089bf1add6672941425eab92a0310ec236a63115ca0b3a15e94", + }, }, macosx = { ["3.6.8"] = { url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8/mbedtls-m-3.6.8.tar.gz", sha256 = "91a2ecb55857499426bc764a3b7c1a1f2f94d3f8051e962cb4ff1db99f2c1584", }, + ["3.6.8.1"] = { + url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8.1/mbedtls-m-3.6.8.1.tar.gz", + sha256 = "bcd9eb19871be089bf1add6672941425eab92a0310ec236a63115ca0b3a15e94", + }, }, windows = { ["3.6.8"] = { url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8/mbedtls-m-3.6.8.tar.gz", sha256 = "91a2ecb55857499426bc764a3b7c1a1f2f94d3f8051e962cb4ff1db99f2c1584", }, + ["3.6.8.1"] = { + url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8.1/mbedtls-m-3.6.8.1.tar.gz", + sha256 = "bcd9eb19871be089bf1add6672941425eab92a0310ec236a63115ca0b3a15e94", + }, }, }, } diff --git a/tests/mwrap/mbedtls-hashes/mcpp.toml b/tests/mwrap/mbedtls-hashes/mcpp.toml index 207494af..6062c858 100644 --- a/tests/mwrap/mbedtls-hashes/mcpp.toml +++ b/tests/mwrap/mbedtls-hashes/mcpp.toml @@ -1,7 +1,7 @@ [package] name = "mbedtls-hashes" -version = "3.6.8" +version = "3.6.8.1" description = "Consume the immutable Mbed TLS wrapper: the published digests of abc for every hash, streaming equal to one call, and HMAC-SHA-256 from RFC 4231" [dependencies] -mcpplibs.mwrap.mbedtls = "3.6.8" +mcpplibs.mwrap.mbedtls = "3.6.8.1" diff --git a/tests/mwrap/mbedtls-hashes/tests/submodule.cpp b/tests/mwrap/mbedtls-hashes/tests/submodule.cpp new file mode 100644 index 00000000..1083ed9f --- /dev/null +++ b/tests/mwrap/mbedtls-hashes/tests/submodule.cpp @@ -0,0 +1,13 @@ +// 3.6.8.1: each hash group is a sub-module of its own, as the README and the +// mwrap spec name them; until then they were partitions of the root, and this +// import did not compile. SHA-256 alone, by FIPS 180-2's vector for "abc". +import std; +import mcpplibs.mwrap.mbedtls.sha256; + +int main() { + unsigned char out[32] = {}; + if (mbedtls_sha256(reinterpret_cast("abc"), 3, out, 0) != 0) return 1; + std::string hex; + for (auto b : out) hex += std::format("{:02x}", b); + return hex == "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" ? 0 : 2; +}