mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 14:02:05 -06:00
crypto: add additional query accessors for cipher instances
Adds new methods to allow querying the length of the cipher key, block size and initialization vectors. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
5dc42c186d
commit
dd2bf9eb95
3 changed files with 95 additions and 0 deletions
|
@ -107,6 +107,43 @@ struct QCryptoCipher {
|
|||
*/
|
||||
bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg);
|
||||
|
||||
/**
|
||||
* qcrypto_cipher_get_block_len:
|
||||
* @alg: the cipher algorithm
|
||||
*
|
||||
* Get the required data block size in bytes. When
|
||||
* encrypting data, it must be a multiple of the
|
||||
* block size.
|
||||
*
|
||||
* Returns: the block size in bytes
|
||||
*/
|
||||
size_t qcrypto_cipher_get_block_len(QCryptoCipherAlgorithm alg);
|
||||
|
||||
|
||||
/**
|
||||
* qcrypto_cipher_get_key_len:
|
||||
* @alg: the cipher algorithm
|
||||
*
|
||||
* Get the required key size in bytes.
|
||||
*
|
||||
* Returns: the key size in bytes
|
||||
*/
|
||||
size_t qcrypto_cipher_get_key_len(QCryptoCipherAlgorithm alg);
|
||||
|
||||
|
||||
/**
|
||||
* qcrypto_cipher_get_iv_len:
|
||||
* @alg: the cipher algorithm
|
||||
* @mode: the cipher mode
|
||||
*
|
||||
* Get the required initialization vector size
|
||||
* in bytes, if one is required.
|
||||
*
|
||||
* Returns: the IV size in bytes, or 0 if no IV is permitted
|
||||
*/
|
||||
size_t qcrypto_cipher_get_iv_len(QCryptoCipherAlgorithm alg,
|
||||
QCryptoCipherMode mode);
|
||||
|
||||
|
||||
/**
|
||||
* qcrypto_cipher_new:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue