mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
crypto: Introduce SM4 symmetric cipher algorithm
Introduce the SM4 cipher algorithms (OSCCA GB/T 32907-2016). SM4 (GBT.32907-2016) is a cryptographic standard issued by the Organization of State Commercial Administration of China (OSCCA) as an authorized cryptographic algorithms for the use within China. Detect the SM4 cipher algorithms and enable the feature silently if it is available. Signed-off-by: Hyman Huang <yong.huang@smartx.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
fdd51403a3
commit
52ed9f455e
7 changed files with 117 additions and 1 deletions
|
@ -95,12 +95,23 @@ qcrypto_block_luks_cipher_size_map_twofish[] = {
|
|||
{ 0, 0 },
|
||||
};
|
||||
|
||||
#ifdef CONFIG_CRYPTO_SM4
|
||||
static const QCryptoBlockLUKSCipherSizeMap
|
||||
qcrypto_block_luks_cipher_size_map_sm4[] = {
|
||||
{ 16, QCRYPTO_CIPHER_ALG_SM4},
|
||||
{ 0, 0 },
|
||||
};
|
||||
#endif
|
||||
|
||||
static const QCryptoBlockLUKSCipherNameMap
|
||||
qcrypto_block_luks_cipher_name_map[] = {
|
||||
{ "aes", qcrypto_block_luks_cipher_size_map_aes },
|
||||
{ "cast5", qcrypto_block_luks_cipher_size_map_cast5 },
|
||||
{ "serpent", qcrypto_block_luks_cipher_size_map_serpent },
|
||||
{ "twofish", qcrypto_block_luks_cipher_size_map_twofish },
|
||||
#ifdef CONFIG_CRYPTO_SM4
|
||||
{ "sm4", qcrypto_block_luks_cipher_size_map_sm4},
|
||||
#endif
|
||||
};
|
||||
|
||||
QEMU_BUILD_BUG_ON(sizeof(struct QCryptoBlockLUKSKeySlot) != 48);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue