-
alc_error_t alcp_multibuffer_init(const alc_cipher_handle_p pCipherHandle, const Uint8 *pKey, Uint64 keyLen, const Uint8 **pIv, Uint64 ivLen, Uint64 numBuffers)#
Initialize multi-buffer cipher operation with key and per-buffer IVs.
This API prepares a multi-buffer cipher session for parallel encryption of multiple independent buffers. It must be called after alcp_cipher_request and before alcp_flush.
Multi-buffer mode processes up to 127 independent plaintext buffers in parallel using AVX-512 instructions. Each buffer uses its own IV for independent encryption streams.
Supported cipher modes: AES-CBC, AES-CFB.
Note
Error needs to be checked for each call, valid only if alcp_is_error (ret) is false
Note
Requires AVX-512 capable CPU. Otherwise falls back to single buffer implementation.
- Parameters:
pCipherHandle – [in] Session handle from alcp_cipher_request
pKey – [in] Encryption key (NULL to reuse key from request)
keyLen – [in] Key length in bits (0 if pKey is NULL)
pIv – [in] Array of pointers to IV buffers, one per buffer
ivLen – [in] Length of each IV in bytes (e.g., 16 for AES)
numBuffers – [in] Number of buffers to process (max 127)
- Returns:
ALC_ERROR_NONE on success.
-
alc_error_t alcp_flush(const alc_cipher_handle_p pCipherHandle, const Uint8 **pPlainText, const Uint64 *pLengths, Uint64 numBuffers)#
Enqueue multiple plaintext buffers for parallel encryption.
Stages a batch of plaintext buffers for parallel SIMD encryption. Each buffer can have a different length (variable-length multi-buffer). Call alcp_dequeue to retrieve the encrypted results.
This API must be called after alcp_multibuffer_init. The buffers are not encrypted immediately — actual processing happens during alcp_dequeue.
Supported cipher modes: AES-CBC, AES-CFB.
Note
Error needs to be checked for each call, valid only if alcp_is_error (ret) is false
Note
Requires AVX-512 capable CPU for SIMD multi-buffer execution. On platforms without AVX-512, falls back to single-buffer processing.
- Parameters:
pCipherHandle – [in] Session handle for cipher operation
pPlainText – [in] Array of pointers to plaintext buffers
pLengths – [in] Array of per-buffer lengths in bytes
numBuffers – [in] Number of buffers in the batch (max 127)
- Pre:
alcp_multibuffer_init must be called before this API.
- Returns:
ALC_ERROR_NONE on success.
-
alc_error_t alcp_dequeue(const alc_cipher_handle_p pCipherHandle, Uint8 **pCipherText, Uint64 numBuffers, const Uint64 *pLengths)#
Retrieve encrypted ciphertext from multi-buffer operation.
Performs the actual parallel encryption of buffers staged via alcp_flush and writes results to the provided output buffers. Uses the Iterative MinLen algorithm for maximum SIMD parallelism across variable-length buffers.
Each output buffer must be pre-allocated by the caller with at least the corresponding length from pLengths.
Supported cipher modes: AES-CBC, AES-CFB.
Note
Error needs to be checked for each call, valid only if alcp_is_error (ret) is false
Note
On platforms without AVX-512, falls back to single-buffer processing.
- Parameters:
pCipherHandle – [in] Session handle for cipher operation
pCipherText – [out] Array of pointers to pre-allocated output buffers
numBuffers – [in] Number of buffers to dequeue
pLengths – [in] Array of per-buffer lengths in bytes
- Pre:
alcp_flush must be called before this API.
- Returns:
ALC_ERROR_NONE on success.