-
alc_error_t alcp_cipher_segment_request(const alc_cipher_mode_t cipherMode, const Uint64 keyLen, alc_cipher_handle_p pCipherHandle)#
Request for populating handle with algorithm specified by cipher mode and key Length.
This API can be called after alcp_cipher_context_size is called
Note
Error needs to be checked for each call, valid only if alcp_is_error (ret) is false, ctx to be considered valid.
- Parameters:
cipherMode – [in] cipher mode to be set
keyLen – [in] key length in bits
pCipherHandle – [out] Library populated session handle for future cipher operations.
- Returns:
ALC_ERROR_NONE on success.
-
alc_error_t alcp_cipher_segment_init(const alc_cipher_handle_p pCipherHandle, const Uint8 *pKey, Uint64 keyLen, const Uint8 *pIv, Uint64 ivLen)#
Cipher Segment init.
This API can be called after alcp_cipher_segment_request is called.
- Parameters:
pCipherHandle – [in] Session handle for cipher operation
pKey – [in] Key
keyLen – [in] key Length in bits
pIv – [in] IV/Nonce
ivLen – [in] IV length in bytes
- Returns:
ALC_ERROR_NONE on success.
-
alc_error_t alcp_cipher_segment_encrypt_xts(const alc_cipher_handle_p pCipherHandle, const Uint8 *pPlainText, Uint8 *pCipherText, Uint64 currPlainTextLen, Uint64 startBlockNum)#
Encrypt plain text and write it to cipher text with provided handle.
This XTS specific API should be called only after alcp_cipher_segment_request and alcp_cipher_segment_init. API is meant to be used with XTS mode.
Note
Error needs to be checked for each call, valid only if alcp_is_error (ret) is false
Note
XTS: Argument currPlainTextLen should be a multiple of 16 bytes unless it’s the last call. By the last call, if there is a partial block, both a partial and a complete block have to be included in the last call to this function.
- Parameters:
pCipherHandle – [in] Session handle for future encrypt decrypt operation
pPlainText – [in] Pointer to Plain Text
pCipherText – [out] Pointer to Cipher Text
currPlainTextLen – [in] Length of the given plaintext
startBlockNum – [in] Start block number of given plaintext
- Returns:
ALC_ERROR_NONE on success.
-
alc_error_t alcp_cipher_segment_decrypt_xts(const alc_cipher_handle_p pCipherHandle, const Uint8 *pCipherText, Uint8 *pPlainText, Uint64 currCipherTextLen, Uint64 startBlockNum)#
Decryption of cipher text and write it to plain text with provided handle.
This XTS specific API should be called only after alcp_cipher_segment_request and alcp_cipher_segment_init. API is meant to be used with XTS mode.
Note
Error needs to be checked for each call, valid only if alcp_is_error (ret) is false
Note
XTS: Argument currCipherTextLen should be a multiple of 16 bytes unless it’s the last call. By the last call, if there is a partial block, both a partial and a complete block have to be included in the last call to this function.
- Parameters:
pCipherHandle – [in] Session handle for future encrypt decrypt operation
pCipherText – [in] Pointer to Cipher Text
pPlainText – [out] Pointer to Plain Text
currCipherTextLen – [in] Length of the given Cipher Text
startBlockNum – [in] Start block number of given plaintext
- Returns:
ALC_ERROR_NONE on success.
-
void alcp_cipher_segment_finish(const alc_cipher_handle_p pCipherHandle)#
Release resources allocated by alcp_cipher_segment_request.
This API is called to free the session resources
Note
alcp_cipher_segment_finish to be called at the end of the transaction. Context will be unusable after this call.
- Parameters:
pCipherHandle – [in] Session handle for completed encrypt/decrypt operations whose resources has to be freed.
- Returns:
None