Skip to content

Commit 9575491

Browse files
authored
feat(mwrap): mbedtls 3.6.8.1 — the hash groups are sub-modules (#937)
1 parent 428b63d commit 9575491

4 files changed

Lines changed: 37 additions & 3 deletions

File tree

‎.agents/docs/2026-12-01-add-mbedtls-m-plan.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,10 @@
3636

3737
- `*_self_test` 函数由头文件声明并导出,但 `compat.mbedtls` 未以 `MBEDTLS_SELF_TEST_C` 构建,链接它们会失败;`tests/linked.cpp` 说明了这一点,文档要求在 `#if defined(MBEDTLS_SELF_TEST_C)` 下调用。
3838
- 版本尾号:首个 mwrap 身份直接用上游版本 `3.6.8`,后续包装修订才加 `.1`。
39+
40+
## 3.6.8.1(2026-12-01,wrapper 修订)
41+
42+
- 起因:首个消费者(xgit)按 README 写 `import mcpplibs.mwrap.mbedtls.sha256;`,得到 "module not found":各算法组在 mwrap-3.6.8 里是根模块的**分区**(`mcpplibs.mwrap.mbedtls:sha256`),只能经根模块导入,与 README 和 mwrap 规范(根模块 + 子模块 `mcpplibs.mwrap.<lib>.<group>`,docs/zh/mwrap.md)都不一致。
43+
- 修复:mcpplibs/mbedtls-m#1——`tools/generate.py` 生成 `export module mcpplibs.mwrap.mbedtls.<group>;`,根模块 `export import` 六个子模块(根的导入方不变);`tests/submodule_test.cpp` 只导入 `.sha256`。CI 6/6 通过,squash 合入,tag/release `mwrap-3.6.8.1`。
44+
- 来源:release 资产 `mbedtls-m-3.6.8.1.tar.gz`(GitHub `archive/refs/tags/mwrap-3.6.8.1.tar.gz` 原样上传;下载两次 sha256 一致,资产回读一致):`bcd9eb19871be089bf1add6672941425eab92a0310ec236a63115ca0b3a15e94`。
45+
- 索引:三平台加 `["3.6.8.1"]`(GLOBAL 字符串 url,CN 镜像仍为维护者步骤);`tests/mwrap/mbedtls-hashes` 升到 3.6.8.1,新增 `tests/submodule.cpp` 只导入 `.sha256`,钉住子模块契约。`mcpp xpkg parse` 通过。

‎pkgs/mwrap/mbedtls.lua‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
-- Immutable upstream-aligned mwrap source release (mbedtls-m mwrap-3.6.8).
1+
-- Immutable upstream-aligned mwrap source release (mbedtls-m mwrap-3.6.8;
2+
-- mwrap-3.6.8.1 is a wrapper revision: each hash group its own sub-module, as
3+
-- the mwrap spec names them, the root re-exporting the six).
24
-- GLOBAL only: the CN mirror under mcpp-res is a maintainer's step; the
35
-- plain string form is what the lint allows until then (docs/cn-mirror.md).
46
--
@@ -25,18 +27,30 @@ package = {
2527
url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8/mbedtls-m-3.6.8.tar.gz",
2628
sha256 = "91a2ecb55857499426bc764a3b7c1a1f2f94d3f8051e962cb4ff1db99f2c1584",
2729
},
30+
["3.6.8.1"] = {
31+
url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8.1/mbedtls-m-3.6.8.1.tar.gz",
32+
sha256 = "bcd9eb19871be089bf1add6672941425eab92a0310ec236a63115ca0b3a15e94",
33+
},
2834
},
2935
macosx = {
3036
["3.6.8"] = {
3137
url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8/mbedtls-m-3.6.8.tar.gz",
3238
sha256 = "91a2ecb55857499426bc764a3b7c1a1f2f94d3f8051e962cb4ff1db99f2c1584",
3339
},
40+
["3.6.8.1"] = {
41+
url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8.1/mbedtls-m-3.6.8.1.tar.gz",
42+
sha256 = "bcd9eb19871be089bf1add6672941425eab92a0310ec236a63115ca0b3a15e94",
43+
},
3444
},
3545
windows = {
3646
["3.6.8"] = {
3747
url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8/mbedtls-m-3.6.8.tar.gz",
3848
sha256 = "91a2ecb55857499426bc764a3b7c1a1f2f94d3f8051e962cb4ff1db99f2c1584",
3949
},
50+
["3.6.8.1"] = {
51+
url = "https://github.com/mcpplibs/mbedtls-m/releases/download/mwrap-3.6.8.1/mbedtls-m-3.6.8.1.tar.gz",
52+
sha256 = "bcd9eb19871be089bf1add6672941425eab92a0310ec236a63115ca0b3a15e94",
53+
},
4054
},
4155
},
4256
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "mbedtls-hashes"
3-
version = "3.6.8"
3+
version = "3.6.8.1"
44
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"
55

66
[dependencies]
7-
mcpplibs.mwrap.mbedtls = "3.6.8"
7+
mcpplibs.mwrap.mbedtls = "3.6.8.1"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// 3.6.8.1: each hash group is a sub-module of its own, as the README and the
2+
// mwrap spec name them; until then they were partitions of the root, and this
3+
// import did not compile. SHA-256 alone, by FIPS 180-2's vector for "abc".
4+
import std;
5+
import mcpplibs.mwrap.mbedtls.sha256;
6+
7+
int main() {
8+
unsigned char out[32] = {};
9+
if (mbedtls_sha256(reinterpret_cast<const unsigned char*>("abc"), 3, out, 0) != 0) return 1;
10+
std::string hex;
11+
for (auto b : out) hex += std::format("{:02x}", b);
12+
return hex == "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" ? 0 : 2;
13+
}

0 commit comments

Comments
 (0)