Skip to content

Conversation

@ThePassionate
Copy link
Contributor

@ThePassionate ThePassionate commented Jan 28, 2026

NuttX-Apps Crypto Testing Framework Enhancement

Overview

Comprehensive modernization and expansion of NuttX-Apps cryptography testing framework, introducing CMocka unit testing framework, implementing key management API, and enhancing test coverage for multiple cryptographic algorithms.

Key Improvements

1️⃣ Unit Testing Framework Upgrade

  • Migration from CLI-based testing to CMocka unit testing framework
  • Improved test isolation, mocking capabilities, and assertion handling
  • Coverage for AES, 3DES, CRC32, HMAC, Hash, DHM, ECDSA, RSA algorithms

2️⃣ Key Management System (New)

  • Key Generation: AES (128/192/256-bit), RSA (variable key lengths), ECDSA (SECP256R1 curve)
  • Lifecycle Management: Key creation, deletion, storage, loading, and removal
  • Persistent Storage: MTD (Memory Technology Device) backend integration
  • Key Identifier (keyid) Support: Encryption/decryption operations using key identifiers

3️⃣ Cryptographic Algorithm Enhancements

  • Stream Mode Support: AES streaming encryption/decryption workflows
  • IV Length Parameters: Explicit IV length (ivlen) and output length (olen) parameter validation
  • QEMU Backend Compatibility: AES-CTR and AES-XTS support for virtual cryptographic devices

4️⃣ Dependency Optimization

  • Corrected Kconfig dependency configuration
  • Removed cryptosoftware driver dependency (supports rpmsg and virtio drivers)

5️⃣ Bug Fixes

  • AES-CMAC message update flow correction

Test Coverage

✅ AES-CBC, AES-CMAC, AES-CTR, AES-XTS
✅ 3DES-CBC, CRC32, HMAC, Hash (MD5/SHA-256)
✅ DHM (Diffie-Hellman), ECDSA, RSA
✅ Key generation and management operations
✅ Streaming encryption workflows

Apache Community Standards

  • ✅ All commits include detailed descriptions
  • ✅ Complete Signed-off-by footers
  • ✅ No internal metadata
  • ✅ Consistent code style
  • ✅ Full CMake/Make/Kconfig integration

Review Priority

  1. keymanagement.c - New key management core module (critical)
  2. CMakeLists.txt/Kconfig - Dependency configuration and CMocka integration
  3. Algorithm test files - Test case validation

Convert crypto test cases from CLI-based tests to cmocka unit testing framework.
This improves test isolation, mocking capabilities, and assertion handling.
Refactored test cases for AES, 3DES, CRC32, HMAC, Hash, DHM, ECDSA, and RSA algorithms.

Signed-off-by: makejian <makejian@xiaomi.com>
Fix AES-CMAC test to properly update message content before completing
the cryptographic operation, ensuring correct test execution flow.

Signed-off-by: makejian <makejian@xiaomi.com>
Correct Kconfig dependency settings for crypto unit tests to ensure proper
build configuration and test execution.

Signed-off-by: makejian <makejian@xiaomi.com>
Fix AES-CTR and AES-XTS implementations for QEMU backend compatibility.
Support output length parameter and enable testing with QEMU virtual
cryptographic devices.

Signed-off-by: makejian <makejian@xiaomi.com>
Add explicit IV length (ivlen) and output length (olen) parameters to test cases.
This enables proper validation of IV handling across cryptographic algorithms.

Signed-off-by: makejian <makejian@xiaomi.com>
Extend AES testing to support stream mode operations with comprehensive
test cases for streaming encryption/decryption workflows.

Signed-off-by: makejian <makejian@xiaomi.com>
…ware

Remove unnecessary dependency on cryptosoftware implementation since
crypto driver tests now support rpmsg and virtio driver backends.

Signed-off-by: makejian <makejian@xiaomi.com>
Add comprehensive key management test suite covering:
- AES key generation (128, 192, 256-bit)
- RSA keypair generation with variable key sizes
- ECDSA keypair generation on SECP256R1 curve
Tests key lifecycle operations and MTD-based persistent storage.

Signed-off-by: makejian <makejian@xiaomi.com>
@ThePassionate ThePassionate force-pushed the apps-features branch 2 times, most recently from a9b9de3 to 541ac63 Compare January 28, 2026 08:03
Add comprehensive test cases for key identifier (keyid) based cipher operations.
Tests encrypted data verification using cryptographic keys referenced by unique identifiers,
enabling testing of key management integration with cipher algorithms.
Support for AES encryption/decryption, HMAC, and other algorithms with keyid-based access.

Signed-off-by: makejian <makejian@xiaomi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants