crypto/cipher: Add GCM to QCryptoCipherMode

Introduce the GCM cipher mode so authenticated encryption can be built
on top of the existing qcrypto_cipher API. GCM is an IV-based mode, so
register it in mode_need_iv. No backend advertises it yet, so it stays
unsupported until a backend and the AAD/tag helpers are added in the
following patches.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260811060115.1849266-8-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Jamin Lin 2026-08-11 06:01:26 +00:00 committed by Cédric Le Goater
parent d030f3cabe
commit b781906fcc
2 changed files with 4 additions and 1 deletions

View file

@ -66,6 +66,7 @@ static const bool mode_need_iv[QCRYPTO_CIPHER_MODE__MAX] = {
[QCRYPTO_CIPHER_MODE_CBC] = true,
[QCRYPTO_CIPHER_MODE_XTS] = true,
[QCRYPTO_CIPHER_MODE_CTR] = true,
[QCRYPTO_CIPHER_MODE_GCM] = true,
};

View file

@ -121,10 +121,12 @@
#
# @ctr: Counter (Since 2.8)
#
# @gcm: Galois/Counter Mode (Since 11.2)
#
# Since: 2.6
##
{ 'enum': 'QCryptoCipherMode',
'data': ['ecb', 'cbc', 'xts', 'ctr']}
'data': ['ecb', 'cbc', 'xts', 'ctr', 'gcm']}
##
# @QCryptoIVGenAlgo: