Commit Graph

70 Commits

Author SHA1 Message Date
liwei3013 a456310fcd fix(crypto/siphash): fix Reinit/FreeCtx/Deinit sensitive data handling
- Reinit: restore key-derived init state instead of zeroing
- FreeCtx: cleanse context before free
- Deinit: cleanse entire context, preserve algorithm config
- Init: reset runtime state for safe repeated calls

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

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-05-20 20:24:49 +08:00
liwei3013 e958b0484d crypto: remove unused FIPS provider and harden MdMB/RSA checks
- remove fips_prov sources and HITLS_CRYPTO_CMVP_FIPS build/test wiring
- keep CMVP selftest guards scoped to ISO19790 and SM providers
- validate CRYPT_EAL_MdMB update/final state transitions
- check RSA param value/valueLen before reading MD and MGF IDs

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

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-05-20 20:24:49 +08:00
jchx 5cbfed93c7 Clean up code compilation warnings
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/1337

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
liwei3013 cfba92d5eb fix: resolve O3 build failures
Refine several safe copy paths to avoid GCC stringop-overflow false positives
and update the x86_64 build options to use -O3.

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:42 +08:00
longparty ecf56f0776 feat:minimization for protocol
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:38 +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
hanzhiyang 6913244ec5 fix:Code optimization and refactoring
Co-authored-by: hanzhiyang<hanzhiyang4@h-partners.com>

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

fix:Code optimization and refactoring

Created-by: hanzhiyang
Commit-by: hanzhiyang
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!961

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:35 +08:00
Dongjianwei001 4ed1ab3ef8 Algorithm performance optimization and code refactoring.
Co-authored-by: Dongjianwei001<dongjianwei1@huawei.com>

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

Algorithm performance optimization and code refactoring.

Created-by: Dongjianwei001
Commit-by: Dongjianwei001
Merged-by: liwei3013
Description: Synchronize HiTLS code

See merge request: openHiTLS/openhitls!807

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:32 +08:00
Dongjianwei001 4968762388 Fix compilation issue in miniaturization test.
Co-authored-by: Dongjianwei001<dongjianwei1@huawei.com>

# message auto-generated for no-merge-commit merge:
!783 merge feature/new-branch into main

Fix compilation issue in miniaturization test.

Created-by: Dongjianwei001
Commit-by: Dongjianwei001
Merged-by: liwei3013
Description: Fix compilation issue in miniaturization test.

See merge request: openHiTLS/openhitls!783

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:29 +08:00
m0_69551548 485cdbac1c fix: macro problems in test_suite_sdv_x509
Co-authored-by: Tom<yanxu52@huawei.com>

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

fix: macro problems in test_suite_sdv_x509

Created-by: m0_69551548
Commit-by: Tom
Merged-by: liwei3013
Description: fix: macro problems in test_suite_sdv_x509

See merge request: openHiTLS/openhitls!690

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
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
Ooohui 160f4a1203 Fix mini test
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/659

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:26 +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
xxxlu 4034d53fef feat:Resolve the reviewer's suggestions
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/638

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:43:37 +08:00
xxxlu 72b8827361 feat:Support RFC8998 cipher suites
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/638

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:43:37 +08:00
libiaoliang 8657b026ed demo test access control error correction
Co-authored-by: 离标量<xuzhengyi1@h-partners.com>

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

demo test access control error correction

Created-by: libiaoliang
Commit-by: 离标量
Merged-by: liwei3013
Description: demo test access control error correction

See merge request: openHiTLS/openhitls!538

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:30 +08:00
dumb a2275a5119 preparing for riscv-CI
Co-authored-by: dumb<liuermeng2@huawei.com>

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

preparing for riscv-CI

Created-by: dumb
Commit-by: dumb
Merged-by: liwei3013
Description: preparing for riscv-CI

See merge request: openHiTLS/openhitls!582

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:30 +08:00
dny 4e4fde00f0 Sm provider add kdftls12 and tls groups.
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/535

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:29 +08:00
dny 22b6538bf9 App adds SM function.
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/477

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:29 +08:00
Ooohui b78f4f97a4 Fix the macros in default provider
Co-authored-by: Ooohui<zhanghui160@huawei.com>

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

Fix the macros in default provider

Created-by: Ooohui
Commit-by: Ooohui
Merged-by: liwei3013
Description: Fix the macros in default provider

See merge request: openHiTLS/openhitls!532

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:28 +08:00
jchx 6b24a383ac chore: Optimize the demo construction framework and fix the default running issues of the demo
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/531

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:28 +08:00
dny 3a26cbb8d6 SM provider cuts the algorithm and only keeps sm algorithm.
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/481

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:26 +08:00
dny 52c8bf54e3 Add sm provider
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/444

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:26 +08:00
balabala-123 b87571cbb9 test: Add tlcp demo
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/456

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:25 +08:00
jchx 266de90f4f Rsa parameter sp800-validation is disabled by default
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/422

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
pi_ixeL 29e25c3d45 feat: support Certificate Authorities extension
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/397

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:23 +08:00
yanshichao 03a49b0535 support xmss/xmssmt
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/354

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:22 +08:00
pi_ixeL 741278531c feat: add user data to session
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/372

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:20 +08:00
bala ed498e245e fix:DTLS adds a timeout detection external interface.
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/328

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:19 +08:00
longparty 1ff66831d6 feat: add mtu related functions
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/338

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:19 +08:00
zhengzeyang b6fb1a09a8 Add fips186_4 dsa param generation.
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/346

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:19 +08:00
离标量 7e469eff2b RSA key generation supports setting random prime number seeds
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/250

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:47:14 +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
baoyi84930 42acbf3b10 chore: add -Wl,-no-undefined
This change adds the -Wl,-no-undefined option to the
linker flags to ensure that all symbols are defined
at link time. This helps catch missing symbols early,
prevents runtime errors due to unresolved symbols,
and improves build reliability by failing the build
if any undefined references remain.

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

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2025-07-26 18:07:43 +08:00
Dongjianwei001 992fd53cae Delete the invalid code of uio_addr
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/370

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2025-07-09 14:13:59 +08:00
baoyi84930 c8d479f20b fix: x8664 without sha3 asm
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/363

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2025-07-08 14:19:13 +08:00
Dongjianwei001 531cde850e Modify the test feature of tlcp.
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/358

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2025-07-08 14:18:19 +08:00
baoyi84930 7e5f7d26a0 fix: no_kem mini case, add base connect mini test
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/356

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2025-07-08 14:18:19 +08:00
baoyi84930 c108260f44 test:tlcp mini test
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/337

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2025-06-28 18:59:46 +08:00
JerryDevis 87603f8050 modify compiler file of sdv testcase
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/318

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2025-06-28 18:59:46 +08:00
dumb 0d8a22464a add "HITLS_ATOMIC_THREAD_LOCK" macro to cover the thread-lock implemented atomic
Co-authored-by: Liu-Ermeng<liuermeng2@huawei.com>

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

add "HITLS_ATOMIC_THREAD_LOCK" macro to cover the thread-lock implemented atomic

Created-by: dumb
Commit-by: Liu-Ermeng
Merged-by: fly2x
Description: add pure-c and minitest workflows
add "HITLS_ATOMIC_THREAD_LOCK" macro to cover the thread-lock implemented atomic

See merge request: openHiTLS/openhitls!311

Signed-off-by: lanming <lanming@huawei.com>
2025-05-29 20:03:05 +08:00
liwei3013 cea047ff0a refactor algorithm module provider interfaces to be compatible with no-provider's interfaces
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/260
2025-05-08 21:14:06 +08:00
JerryDevis bc033090f6 add testcase for decoder provider
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/254
2025-05-06 21:21:30 +08:00
JerryDevis 78f63e8c4f support decoder provider
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/242
2025-04-30 15:06:59 +08:00
jchx 13abf5871f Co-authored-by: jchx<chenqi180@huawei.com>
# message auto-generated for no-merge-commit merge:
merge main into main

fix the Secure_C compile path

Created-by: jchx
Commit-by: jchx
Merged-by: liwei3013
Description: fix the Secure_C compile path

See merge request: openHiTLS/openhitls!249
2025-04-29 19:51:20 +08:00