27 Commits

Author SHA1 Message Date
dumb 6979f132dc fix: harden file permissions for sensitive data and add input validation
- Introduce HITLS_APP_UioOpenPrivate to create key files with 0600
  permissions, replacing open-then-chmod pattern to avoid TOCTOU race
- Migrate key/PKCS12/rand output paths to use private file creation
- Refactor PKCS12 generation to use GenBuff + private UIO write
- Add null check for confirmP.data in SPAKE2+ RespDerive
- Add max length validation for private pass token challenge requests
- Reject AEAD ciphers in enc command explicitly
- Add 30s handshake timeout on accepted TCP connections

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

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-06-30 10:14:03 +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
zyw007 44409c3773 fix: resolve build issues and optimize feature configuration
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:42 +08:00
dny 41c0b875a5 Remove algorithms print.
Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:39 +08:00
hs6246 7a8721571e fix:Remove some redundant function.
Co-authored-by: hs6246<zhengzeyang@huawei.com>

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

fix:Remove some redundant function.

Created-by: hs6246
Commit-by: hs6246
Merged-by: liwei3013
Description: fix:Remove some redundant function.

See merge request: openHiTLS/openhitls!932

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:34 +08:00
Ooohui fa29783cbe fix: Standardize function naming and error handling in the apps module
Co-authored-by: Ooohui<zhanghui160@huawei.com>

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

fix: Standardize function naming and error handling in the apps module

Created-by: Ooohui
Commit-by: Ooohui
Merged-by: liwei3013
Description: fix: Standardize function naming and error handling in the apps module

See merge request: openHiTLS/openhitls!921

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:34 +08:00
hs6246 b49c6f70a7 fix:Refactor some functions in app module.
Co-authored-by: hs6246<zhengzeyang@huawei.com>

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

fix:Refactor some functions in app module.

Created-by: hs6246
Commit-by: hs6246
Merged-by: liwei3013
Description: fix:Refactor some functions in app module.
![image.png](https://raw.gitcode.com/user-images/assets/4195561/a4952bd7-ee26-4e1a-bbbb-e8a1d18912b5/image.png 'image.png')
![image.png](https://raw.gitcode.com/user-images/assets/4195561/0a5502e4-8bc6-4f96-adce-0dc7a4813e2b/image.png 'image.png')
![image.png](https://raw.gitcode.com/user-images/assets/4195561/bbb02e64-cb25-49c4-8ebe-28d62443a39b/image.png 'image.png')
![image.png](https://raw.gitcode.com/user-images/assets/4195561/26ccf5ba-5ff5-4b18-b2ff-bc4cfec682fb/image.png 'image.png')
![image.png](https://raw.gitcode.com/user-images/assets/4195561/184c1132-c0ae-4607-a730-b7620efaa609/image.png 'image.png')

See merge request: openHiTLS/openhitls!914

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:34 +08:00
hs6246 d23649f345 fix:Remove some redundant commands.
Co-authored-by: hs6246<zhengzeyang@huawei.com>

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

fix:Remove some redundant commands.

Created-by: hs6246
Commit-by: hs6246
Merged-by: liwei3013
Description: fix:Remove some redundant commands.

See merge request: openHiTLS/openhitls!918

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:33 +08:00
hs6246 475b0ea38e fix:Refactor some functions in app module.
Co-authored-by: hs6246<zhengzeyang@huawei.com>

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

fix:Refactor some functions in app module.

Created-by: hs6246
Commit-by: hs6246
Merged-by: liwei3013
Description: fix:Refactor some functions in app module.

See merge request: openHiTLS/openhitls!887

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:33 +08:00
cnxf cb55114cdf feat(app): add prime command line with prime number generation and testing
- Implement prime number generation and primality testing
- Support decimal and hexadecimal input/output formats
- Add safe prime generation option
- Include 15 comprehensive test cases with cross-platform support
- Add command-line interface with options: -generate, -bits, -safe, -hex, -checks

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

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:33 +08:00
libiaoliang 3c2e80d8a6 Fix app digest errors
Co-authored-by: xuzhengyi<xuzhengyi1@h-partners.com>

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

Fix app digest errors

Created-by: libiaoliang
Commit-by: xuzhengyi
Merged-by: liwei3013
Description: Fix app digest errors

See merge request: openHiTLS/openhitls!891

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:50:33 +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
baoyi84930 b174cc4583 feat:Added TLS to the CLI
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/688

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
dny 1d6f4525e1 Modify the HITLS_APP_SM_PrintLog function name.
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/601

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:42:24 +08:00
dny 621324747a Modify sm provider errcode and entropy self-check parameters.
Cherry-picked from: https://gitcode.com/openHiTLS/openhitls/merge_requests/601

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 19:41:57 +08:00
dny 84ea051d6a Fix testcase failed.
Co-authored-by: dny<duanningyan@huawei.com>

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

Fix testcase failed.

Created-by: dny
Commit-by: dny
Merged-by: liwei3013
Description: Fix testcase failed.

See merge request: openHiTLS/openhitls!597

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:30 +08:00
dny beef878248 App tlcp support use p12 sign key.
Co-authored-by: dny<duanningyan@huawei.com>

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

App tlcp support use p12 sign key.

Created-by: dny
Commit-by: dny
Merged-by: liwei3013
Description: App tlcp support use p12 sign key.

See merge request: openHiTLS/openhitls!585

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:30 +08:00
dny c7f74a0b96 App tlcp add sm mode.
Co-authored-by: dny<duanningyan@huawei.com>

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

App tlcp add sm mode.

Created-by: dny
Commit-by: dny
Merged-by: liwei3013
Description: App tlcp add sm mode.

See merge request: openHiTLS/openhitls!579

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:30 +08:00
tianshenqi cb7ad6c550 feat: Add asymmetric-related function.
Co-authored-by: tianshenqi<tianshenqi@h-partners.com>

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

feat: Add asymmetric-related function.

Created-by: tianshenqi
Commit-by: tianshenqi
Merged-by: liwei3013
Description: feat: Add asymmetric-related function.

See merge request: openHiTLS/openhitls!495

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:30 +08:00
tianshenqi 574ca299c3 feat:TLS protocol features related to SM series
Co-authored-by: tianshenqi<tianshenqi@h-partners.com>

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

feat:TLS protocol features related to SM series

Created-by: tianshenqi
Commit-by: tianshenqi
Merged-by: liwei3013
Description: feat: Add command-line TLS protocol function.
Merge branch 'main' of gitcode.com:tianshenqi/openhitls into TLS
feat:TLS protocol features related to SM series

See merge request: openHiTLS/openhitls!507

Signed-off-by: Dongjianwei001 <dongjianwei1@huawei.com>
2026-03-30 17:49:30 +08:00
dny ada3d4d9b7 App public module log remove the prefix.
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
dny aef80cfd7d Modify sm code style.
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
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
tianshenqi cae46025ab fix: Modified according to review comments.
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
tianshenqi 2c5687dd4f feat:APP MAC and KDF 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
离标量 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