qcrypto/luks: implement encryption key management

Next few patches will expose that functionality to the user.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200608094030.670121-3-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Maxim Levitsky
2020-07-06 08:49:28 +02:00
committed by Max Reitz
parent 43cbd06df2
commit 557d2bdcca
2 changed files with 469 additions and 6 deletions
+412 -4
View File
File diff suppressed because it is too large Load Diff
+57 -2
View File
@@ -297,7 +297,6 @@
'uuid': 'str',
'slots': [ 'QCryptoBlockInfoLUKSSlot' ] }}
##
# @QCryptoBlockInfo:
#
@@ -310,8 +309,64 @@
'discriminator': 'format',
'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
##
# @QCryptoBlockLUKSKeyslotState:
#
# Defines state of keyslots that are affected by the update
#
# @active: The slots contain the given password and marked as active
# @inactive: The slots are erased (contain garbage) and marked as inactive
#
# Since: 5.1
##
{ 'enum': 'QCryptoBlockLUKSKeyslotState',
'data': [ 'active', 'inactive' ] }
##
# @QCryptoBlockAmendOptionsLUKS:
#
# This struct defines the update parameters that activate/de-activate set
# of keyslots
#
# @state: the desired state of the keyslots
#
# @new-secret: The ID of a QCryptoSecret object providing the password to be
# written into added active keyslots
#
# @old-secret: Optional (for deactivation only)
# If given will deactive all keyslots that
# match password located in QCryptoSecret with this ID
#
# @iter-time: Optional (for activation only)
# Number of milliseconds to spend in
# PBKDF passphrase processing for the newly activated keyslot.
# Currently defaults to 2000.
#
# @keyslot: Optional. ID of the keyslot to activate/deactivate.
# For keyslot activation, keyslot should not be active already
# (this is unsafe to update an active keyslot),
# but possible if 'force' parameter is given.
# If keyslot is not given, first free keyslot will be written.
#
# For keyslot deactivation, this parameter specifies the exact
# keyslot to deactivate
#
# @secret: Optional. The ID of a QCryptoSecret object providing the
# password to use to retrive current master key.
# Defaults to the same secret that was used to open the image
#
#
# Since 5.1
##
{ 'struct': 'QCryptoBlockAmendOptionsLUKS',
'data': { 'state': 'QCryptoBlockLUKSKeyslotState',
'*new-secret': 'str',
'*old-secret': 'str',
'*keyslot': 'int',
'*iter-time': 'int',
'*secret': 'str' } }
##
# @QCryptoBlockAmendOptions:
#
@@ -324,4 +379,4 @@
'base': 'QCryptoBlockOptionsBase',
'discriminator': 'format',
'data': {
} }
'luks': 'QCryptoBlockAmendOptionsLUKS' } }