Commit Graph

95 Commits

Author SHA1 Message Date
Ooohui 70bc6f4b88 feat: add hash algorithm security bits check in X508 certificate chain verification
Add hash algorithm security strength check to certificate chain verification.
Root certificates skip hash security check but still verify key security bits.

Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/1335

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-05-20 20:23:16 +08:00
liwei3013 f664eda26f refactor: make list traversal stateless and harden x509 verification
add node-based BSL list helpers and migrate shared-list readers off curr-mutating macros
precompute DN UTF-8 during parse and reuse cached values in X.509 compare/verify
clean up app UIO ownership handling and expand PKI/TLS regression coverage

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-04-21 20:20:46 +08:00
Dongjianwei001 51f41da579 Sync the code of openhitls-03
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-04-01 18:46:46 +08:00
xuzhengyi 0174d78bbb P8 decoding of SM2 compatibility enhance.
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:41 +08:00
balabala-123 9716f8a7b4 Fix sizeof enumeration error
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:40 +08:00
Ooohui 7b3c8ef0dc Fix obj bugs
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:40 +08:00
majianchao 79c59967dd Test cases for PKCS8/PKCS12
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:39 +08:00
jchx 68e037feeb fix that not return error when encountering an unknown attribute.
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:39 +08:00
c3dehui 7d1c15af83 fix:Upgraded BSL_ERR_OutputFunc to retrieve error info.
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:38 +08:00
ZHui_er 2bf2545a11 feat:add mldsa cms, refence RFC9882
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:38 +08:00
Ooohui 9f7bcce9d2 feat: Add the function of printing brief cert info; Fix some bugs
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:38 +08:00
c3dehui 429b45f1c9 feat:BSL_ERR moudle add ErrorStack print
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:37 +08:00
Lzhjian 461d2fcccd feat:Full support for the character set
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:37 +08:00
dsy cb9d4ed5d4 feat:Added support for x25519 cert
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:36 +08:00
hs6246 a388ca3ad3 Add DSA/DH key pair encode and decode.
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:36 +08:00
jchx 614766c24f Add signedData gen/parse/verify/sign in pki
Co-authored-by: jchx<chenqi180@huawei.com>

# message auto-generated for no-merge-commit merge:
!780 merge cms into main

Add signedData gen/parse/verify/sign in pki

Created-by: jchx
Commit-by: jchx
Merged-by: liwei3013
Description: Add signedData gen/parse/verify/sign in pki

See merge request: openHiTLS/openhitls!780

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:34 +08:00
ZHui_er 44b097b9f4 feat:add xmss cert, refence rfc9802
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/896

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:34 +08:00
Nice515 bfae49a41e recheck
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/896

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:33 +08:00
Lzhjian 4fcaf3938f Add test cases for the CRL revocation mechanism of SM2 with userId
Co-authored-by: Lzhjian<liuzhijian24@huawei.com>

# message auto-generated for no-merge-commit merge:
!917 merge charset into main

Add test cases for the CRL revocation mechanism of SM2 with userId

Created-by: Lzhjian
Commit-by: Lzhjian
Merged-by: liwei3013
Description: Add test cases for the CRL revocation mechanism of SM2 with userId

See merge request: openHiTLS/openhitls!917

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:33 +08:00
xlot 856f071c81 feat: support ml-kem/slh-dsa in X509
Co-authored-by: xlot<xietianyuan@huawei.com>

# message auto-generated for no-merge-commit merge:
!803 merge main into main

feat:  support ml-kem/slh-dsa in X509

Created-by: xlot
Commit-by: xlot
Merged-by: liwei3013
Description: support ml-kem/slh-dsa in X509

See merge request: openHiTLS/openhitls!803

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:31 +08:00
Lzhjian 3b27658fb3 Add test cases for the CRL revocation mechanism of SM2
Co-authored-by: Lzhjian<liuzhijian24@huawei.com>

# message auto-generated for no-merge-commit merge:
!862 merge crl into main

Add test cases for the CRL revocation mechanism of SM2

Created-by: Lzhjian
Commit-by: Lzhjian
Merged-by: liwei3013
Description: Add test cases for the CRL revocation mechanism of SM2

See merge request: openHiTLS/openhitls!862

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:31 +08:00
huangwenb0 fcbd8e7324 fix the testcase of certificate consistency
Co-authored-by: huangwenb0<huangwenbo18@h-partners.com>

# message auto-generated for no-merge-commit merge:
!835 merge main into main

fix the testcase of certificate consistency

Created-by: huangwenb0
Commit-by: huangwenb0
Merged-by: liwei3013
Description: fix the testcase of certificate consistency

See merge request: openHiTLS/openhitls!835

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:31 +08:00
liwei3013 39ea49bec0 Support partial certificate chain verification
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/692

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:29 +08:00
huangwenb0 2ad5908916 Certificate generation and parsing consistency test supplement
Co-authored-by: huangwenb0<huangwenbo18@h-partners.com>

# message auto-generated for no-merge-commit merge:
!766 merge main into main

Certificate generation and parsing consistency test supplement

Created-by: huangwenb0
Commit-by: huangwenb0
Merged-by: liwei3013
Description: Certificate generation and parsing consistency test supplement

See merge request: openHiTLS/openhitls!766

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:29 +08:00
Dongjianwei001 989512dbc0 Add certificate CRL file parsing and verification test cases
Co-authored-by: Dongjianwei<dongjianwei1@huawei.com>

# message auto-generated for no-merge-commit merge:
!750 merge main into main

Add certificate CRL file parsing and verification test cases

Created-by: Dongjianwei001
Commit-by: Dongjianwei
Merged-by: liwei3013
Description: Add certificate CRL file parsing and verification test cases

See merge request: openHiTLS/openhitls!750

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:29 +08:00
libiaoliang 25c71dc146 Supplementary Use Cases for CSR Consistency
Co-authored-by: xuzhengyi<xuzhengyi1@h-partners.com>

# message auto-generated for no-merge-commit merge:
!758 merge FIX_BUG into main

Supplementary Use Cases for CSR Consistency

Created-by: libiaoliang
Commit-by: xuzhengyi
Merged-by: liwei3013
Description: Supplementary Use Cases for CSR Consistency

See merge request: openHiTLS/openhitls!758

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:28 +08:00
dsy678 c85f8fc1da Supplement to Certificate Chain Verification Test Consistency Cases
Co-authored-by: dsy<dongshunyu1@huawei.com>

# message auto-generated for no-merge-commit merge:
!744 merge verify into main

Supplement to Certificate Chain Verification Test Consistency Cases

Created-by: dsy678
Commit-by: dsy
Merged-by: liwei3013
Description: Supplement to Certificate Chain Verification Test Consistency Cases

See merge request: openHiTLS/openhitls!744

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:28 +08:00
tlhc 3ba30169c2 feat: Add cross-platform support for Darwin/macOS
**Core Platform Support:**
- Add Darwin/macOS platform detection and conditional compilation
- Implement platform-specific library extensions (.dylib for macOS, .so for Linux)
- Enhanced dynamic library loading with cross-platform error handling
- Platform-optimized time functions (clock_gettime_nsec_np for macOS)
- Add App module support for Darwin/macOS

**Threading & Synchronization:**
- BSL: Migrate from simple integer flags to proper pthread_once_t implementation
- Add BSL_SAL_OnceControl type with platform-specific implementations
- Implement thread-safe one-time initialization across platforms
- Fix memory initialization patterns for thread-once controls

**Build System Improvements:**
- Remove GNU ld-specific flags for test-framework use c function pointer replace or `stub_utils.h` to hook target function
- Boundcheck components will linked as static library for tests, reduce tests dynamic library deps
- Update CMake configurations for Darwin support

**Test Framework Enhancements:**
- Replace jmp_buf with sigjmp_buf for better signal handling
- Update time handling to avoid platform-specific gmtime issues
- Improve entropy test stability across platforms
- Add proper RAND initialization/deinitialization

**Entropy & Cryptographic Updates:**
- Temporarily disable CPU jitter entropy on macOS (pending validation)
- Add cross-platform entropy source management
- Update DRBG configuration for improved compatibility
- Enhance hardware entropy detection and handling

**Network & I/O:**
- Extend POSIX network functions to support both Linux and Darwin
- Add file accessibility checks before dynamic loading
- Improve error handling for symbol resolution across platforms
- Update socket and I/O operations for cross-platform compatibility

Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/677

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:28 +08:00
dsy 144f284c8b feat:x509_verify and add eku_suite test data
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/632

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:27 +08:00
hanzhiyang af1dbe591d fix:Fix the issue of printing crl reason fields in crl
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/663

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:26 +08:00
tlhc b67050ce74 feat: build system improvements and cross-platform support (macOS)
Major Features:
- Multi-compiler/linker configuration system with toolchain support
- Auto-manage Secure C (libboundscheck) dependency
- Dynamic provider library names for CMVP modes (ISO19790, SM)
- macOS/Darwin platform support with unified POSIX abstractions
- Cross-platform build improvements and optimizations

Build System:
- Add toolchain management for cross-compilation
- Support nested 'common' format in compile config
- with _EXTRA/_REMOVE/_OVERRIDE in common flags, we can add remove by
  per compiler
- Unify toolchain naming convention (arch-vendor-os-abi-compiler)

Platform Support:
- Unify Linux and Darwin sources under POSIX
- Add Darwin support for SAL and build flags
- Add Darwin support for REC wrapper functions (WIP)
- Cross-platform ops count macros for benchmarking
- Platform-specific library extension detection (.dylib vs .so)

Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/652

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:26 +08:00
xlot 12e4238318 fix: add keyusage check, add key consistence check, fix bugs
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/650

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:25 +08:00
Ooohui 546420a052 Optimize the code to reduce ROM space
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/575

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:25 +08:00
Tom 8b24094621 feat: Support mldsa certificate
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/618

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:43:11 +08:00
baoyi84930 b7e643e345 tests: add tests HITLS_CFG_LoadDefaultCAPath & SAL_CERT_X509ParseBundleFile
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/581

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:43:05 +08:00
tianshenqi 5bb41e2e99 Test asymmetric command-line functionality
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/604

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:42:31 +08:00
pi_ixeL 41985ae8da fix: fix test code issue
Co-authored-by: pi_ixeL<xuzhewei2@huawei.com>

# message auto-generated for no-merge-commit merge:
merge new123 into main

fix: fix test code issue

Created-by: pi_ixeL
Commit-by: pi_ixeL
Merged-by: liwei3013
Description: fix: fix test code issue

See merge request: openHiTLS/openhitls!568

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:29 +08:00
jchx 6b63629b6f pkcs12 support provider
Co-authored-by: jchx<chenqi180@huawei.com>

# message auto-generated for no-merge-commit merge:
merge pro into main

pkcs12 support provider

Created-by: jchx
Commit-by: jchx
Merged-by: liwei3013
Description: pkcs12 support provider

See merge request: openHiTLS/openhitls!505

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:28 +08:00
pi_ixeL e22e4e0f63 feat: Support parsing certificate chains from files and support paring ca file from dir
Co-authored-by: pi_ixeL<xuzhewei2@huawei.com>

merge version into main

feat: Support parsing certificate chains from files and support paring ca file from dir

Created-by: pi_ixeL
Commit-by: pi_ixeL
Merged-by: liwei3013
Description: feat: Support parsing certificate chains from files and support paring ca file from dir

See merge request: openHiTLS/openhitls!463

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:28 +08:00
hanzhiyang cd5e19b140 bsl_pki_crypto capability supplement
Co-authored-by: hanzhiyang<hanzhiyang4@h-partners.com>

# message auto-generated for no-merge-commit merge:
merge bsl_pki_crypto into main

bsl_pki_crypto capability supplement

Created-by: hanzhiyang
Commit-by: hanzhiyang
Merged-by: liwei3013
Description: bsl_pki_crypto capability supplement

See merge request: openHiTLS/openhitls!448

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:26 +08:00
Ooohui 0e8f132bc3 Fix the bug in reading pem file for apps
Co-authored-by: Ooohui<zhanghui160@huawei.com>

# message auto-generated for no-merge-commit merge:
merge apps into main

Fix the bug in reading pem file for apps

Created-by: Ooohui
Commit-by: Ooohui
Merged-by: liwei3013
Description: Fix the bug in reading pem file for apps

See merge request: openHiTLS/openhitls!468

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:26 +08:00
tianshenqi 93e0ea3a52 test:Add tests for mac and kdf app function
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/436

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:25 +08:00
Ooohui 096c529ddf Supports offloading hash algorithms in composition algorithms
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/392

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:24 +08:00
离标量 1cf5a5970a New command line added
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/415

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:24 +08:00
Dongjianwei001 0bc8d0302d Add the compilation configuration of the cmvp module
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/310

Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/396

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:21 +08:00
jchx 4d4d2f87ce Add and sink key consistency checks for asymmetric algorithms
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/377

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:20 +08:00
Ooohui 70449ed37c feat: Support curve nistp192 and setting/getting generic extension
Co-authored-by: Ooohui<zhanghui160@huawei.com>

# message auto-generated for no-merge-commit merge:
!960 merge openhitls-0.2 into openhitls-0.2

feat: Support curve nistp192 and setting/getting generic extension

Created-by: Ooohui
Commit-by: Ooohui
Merged-by: liwei3013
Description: <!--  Thanks for sending a pull request!  Here are some tips for you:

1) If this is your first time, please read our contributor guidelines: https://gitcode.com/openHiTLS/openhitls/wiki/FAQ-社区需求贡献流程.md

-->

**What does this PR do / why do we need it**:

**Self-checklist**:(**请自检,在[ ]内打上x**)

+ - [ ] **测试**:PR中的代码是否已有UT/ST测试用例进行充分的覆盖,新增测试用例是否随本PR一并上库或已经上库
+ - [ ] **接口**:是否涉及对外接口变更,相应变更已得到接口评审组织的通过,API对应的注释信息已经刷新正确
+ - [ ] **文档**:是否涉及官网文档修改,如果涉及请及时提交资料到Doc仓

<!-- **Special notes for your reviewers**: -->
<!-- + - [ ] 是否导致无法前向兼容 -->
<!-- + - [ ] 是否涉及依赖的三方库变更 -->

See merge request: openHiTLS/openhitls!960

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-01-15 15:48:45 +08:00
libiaoliang 4643e1bf8c Bug fix for the HITLS_X509_CertVerifyByPubKey interface and addition of test specifications
Co-authored-by: xuzhengyi<xuzhengyi1@h-partners.com>

# message auto-generated for no-merge-commit merge:
!923 merge FIX_BUG_0.2 into openhitls-0.2

Bug fix for the HITLS_X509_CertVerifyByPubKey interface and addition of test specifications

Created-by: libiaoliang
Commit-by: xuzhengyi
Merged-by: liwei3013
Description: Bug fix for the HITLS_X509_CertVerifyByPubKey interface and addition of test specifications

See merge request: openHiTLS/openhitls!923

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-01-15 15:48:45 +08:00
dsy678 34a3af1434 fix missing CA akid can also be verified.
Co-authored-by: dsy<dongshunyu1@huawei.com>

# message auto-generated for no-merge-commit merge:
!848 merge akiFix0.2 into openhitls-0.2

fix missing CA akid can also be verified.

Created-by: dsy678
Commit-by: dsy
Merged-by: liwei3013
Description: fix missing CA akid can also be verified.

See merge request: openHiTLS/openhitls!848

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2025-12-09 10:29:31 +08:00
gsp114514 278dfff1c6 fix:CRL revocation support configuration
Co-authored-by: gsp114514<gaosiping1@huawei.com>

!821 merge tcrlAdd into openhitls-0.2

fix:CRL revocation support configuration

Created-by: gsp114514
Commit-by: gsp114514
Merged-by: liwei3013
Description: fix:CRL revocation support configuration

See merge request: openHiTLS/openhitls!821

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2025-12-09 10:29:28 +08:00