-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Crypto virtio patches #17979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ThePassionate
wants to merge
9
commits into
apache:master
Choose a base branch
from
ThePassionate:crypto-virtio-patches
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Crypto virtio patches #17979
+2,114
−34
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add support for storing driver-specific private data in the crypto driver structure. This allows crypto drivers to maintain session state and other driver-specific information. Signed-off-by: makejian <makejian@xiaomi.com>
Implement VirtIO crypto driver that provides hardware crypto acceleration in virtualized environments. The driver implements the VirtIO crypto device specification and supports symmetric cipher operations including AES-CBC, AES-CTR, AES-XTS, and AES-ECB. Key features: - Automatic algorithm conversion between VirtIO and NuttX formats - Support for hash operations (MD5, SHA-1, SHA-256, SHA-512) - Support for AES-CMAC message authentication - Integration with NuttX cryptodev subsystem Signed-off-by: makejian <makejian@xiaomi.com>
Add encryption operation tracking and output length (olen) field to support VirtIO crypto mode. This allows the cryptodev subsystem to properly track operation types and buffer sizes for VirtIO crypto operations. Signed-off-by: makejian <makejian@xiaomi.com>
Fix initialization vector (IV) length for AES-CTR and AES-XTS modes to be constant 16 bytes to maintain compatibility with QEMU backend. Changes: - CTR mode: IV length changed to 16, fix reinit to copy IV correctly - XTS mode: IV length changed to 16, use IV as tweak directly Signed-off-by: makejian <makejian@xiaomi.com>
Export initialization vector length (ivlen) in the crypto interface to support different cipher algorithms with varying IV length requirements. This improves flexibility for crypto drivers. Signed-off-by: makejian <makejian@xiaomi.com>
Implement crypto driver priority ordering to select the most appropriate crypto driver automatically. After adding the cross-core crypto driver, there are now three encryption modes: 1. Hardware driver in local core 2. Crypto driver in remote core 3. Software encryption in local core The system prioritizes drivers as follows: - Local hardware driver (preferred for best performance) - Remote driver (typically hardware, used in virtualized environments) - Local software driver (fallback for testing and compatibility) Signed-off-by: makejian <makejian@xiaomi.com>
Add algorithm conversion support between VirtIO crypto algorithms and NuttX crypto algorithms. This enables proper mapping of cipher and hash algorithms when using VirtIO crypto backend. Signed-off-by: makejian <makejian@xiaomi.com>
Fix cryptosoft encdec functions to not modify the input buffer pointer during encryption/decryption operations. This ensures buffer integrity and prevents potential memory corruption issues. Signed-off-by: makejian <makejian@xiaomi.com>
Add comprehensive documentation for the VirtIO crypto driver including configuration options, supported operations and algorithms, driver priority ordering, QEMU usage examples, and implementation notes. Signed-off-by: makejian <makejian@xiaomi.com>
375f2a7 to
7f0338c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: Crypto
Area: Documentation
Improvements or additions to documentation
Area: Drivers
Drivers issues
Size: XL
The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
VirtIO Crypto: Add VirtIO crypto driver support
Summary
This PR adds VirtIO crypto driver support to NuttX, enabling hardware crypto acceleration in virtualized environments. It includes comprehensive enhancements to the cryptodev subsystem to support various cipher algorithms and improves compatibility with QEMU and other VirtIO backends.
Changes
Files Modified/Added
drivers/virtio/virtio-crypto.c (new)
drivers/virtio/virtio-crypto.h (new)
include/crypto/virtio_crypto.h (new)
include/nuttx/virtio/virtio-crypto.h (new)
crypto/cryptodev.c
crypto/crypto.c
crypto/cryptosoft.c
drivers/virtio/CMakeLists.txt, Make.defs, Kconfig
Documentation/components/crypto.rst
Technical Details
VirtIO Crypto Driver:
Cryptodev Enhancements:
Bug Fixes:
Impact
Testing
Test Environment:
Test Procedure:
Test Results:
Related Issues