Skip to content

v0.45.3 (2026-11-11)

Latest

Choose a tag to compare

@emmansun emmansun released this 11 Nov 09:56
688a8a5

本次发布修复了 SM2 短明文加密的偶发解密失败问题,新增 ML-KEM 的 X.509 密钥支持,并改进 LoongArch 平台实现。

问题修复

  • SM2 加密:修复 KDF 输出全零后重试时公钥点被覆盖的问题。此前重试可能生成无法正常解密的密文,短明文更容易触发;1 字节明文的触发概率约为 1/256。新增确定性回归测试。#668
  • SM2 内部解密:避免修改输入密文的 C1 点,确保同一内部密文对象可以重复解密。新增成功及认证失败场景下的输入保留测试。此修复消除内部对象复用副作用,不影响公开 API 的调用方式。
  • CCM:在 Seal 和 Open 中增加输出缓冲区与 AAD 的重叠检查,防止认证前覆盖 AAD;新增重叠检查及 AAD 长度编码边界测试。

新增功能

  • smx509:支持 ML-KEM-512、ML-KEM-768 和 ML-KEM-1024 公钥的 PKIX 编解码,以及携带这些公钥的证书创建和解析。
  • 支持 ML-KEM 私钥的 PKCS#8 编解码:解析种子、展开密钥及二者组合形式,组合形式会检查一致性;序列化使用种子形式。
  • ML-KEM 证书若包含 KeyUsage 扩展,仅允许设置 keyEncipherment。

平台与维护

  • LoongArch:启用 SM4 优化块加密配合通用 Go GHASH 的 GCM 路径,并扩展差分测试覆盖。
  • 使用 ALSLV 精简 LoongArch 上 SM2 域平方及 SM9/bn256 域运算的汇编实现。
  • 补充 smx509 手工维护指南,更新 CI 与安全扫描相关 GitHub Actions 依赖。

升级提示
建议使用 SM2 加密,尤其涉及短明文的用户升级。CCM 输出缓冲区与 AAD 重叠的调用现在会触发 panic;此类调用本身不符合 cipher.AEAD 的使用约定。


This release fixes intermittent SM2 decryption failures when encrypting short messages, adds ML-KEM X.509 key support, and improves LoongArch implementations.

Bug Fixes

  • SM2 encryption: Preserve the original public point when retrying encryption after an all-zero KDF result. Previously, a retry could produce ciphertext that failed decryption. Short messages were more likely to trigger this issue, with an approximate probability of 1 in 256 for a one-byte message. Added a deterministic regression test. #668
  • SM2 internal decryption: Preserve the input ciphertext’s C1 point so that the same internal ciphertext object can be decrypted repeatedly. Added input-preservation tests for successful decryption and authentication failure. This removes an internal object-reuse side effect without changing public API usage.
  • CCM: Reject overlapping output and AAD buffers in Seal and Open, preventing AAD from being overwritten before authentication. Added overlap and AAD length-encoding boundary tests.

New Features

  • smx509: Add PKIX public key encoding and decoding for ML-KEM-512, ML-KEM-768, and ML-KEM-1024, along with certificate creation and parsing for these public keys.
  • Add PKCS#8 private key support for ML-KEM. Parsing accepts seed-only, expanded-key-only, and combined forms, with consistency validation for the combined form. Marshaling uses the seed form.
  • When present, the KeyUsage extension in an ML-KEM certificate may contain only keyEncipherment.

Platform and Maintenance

  • LoongArch: Enable the SM4 GCM path combining optimized block encryption with generic Go GHASH, and extend differential test coverage.
  • Simplify LoongArch assembly for SM2 field squaring and SM9/bn256 field arithmetic using ALSLV.
  • Add manual maintenance guidance for smx509 and update CI and security-scanning GitHub Actions dependencies.

Upgrade Notes
Users of SM2 encryption, particularly for short messages, are encouraged to upgrade. CCM calls with overlapping output and AAD buffers now panic; such calls already violate the cipher.AEAD usage contract.