[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 11/18] crypto: rename des-rfb cipher to just des
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH 11/18] crypto: rename des-rfb cipher to just des |
Date: |
Wed, 7 Jul 2021 14:48:37 +0100 |
User-agent: |
Mutt/2.0.7 (2021-05-04) |
On Wed, Jul 07, 2021 at 02:47:15PM +0200, Markus Armbruster wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
>
> > Currently the crypto layer exposes support for a 'des-rfb'
> > algorithm which is just normal single-DES, with the bits
> > in each key byte reversed. This special key munging is
> > required by the RFB protocol password authentication
> > mechanism.
> >
> > Since the crypto layer is generic shared code, it makes
> > more sense to do the key byte munging in the VNC server
> > code, and expose normal single-DES support.
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
>
> [...]
>
> > diff --git a/qapi/crypto.json b/qapi/crypto.json
> > index 7116ae9a46..6b3fadabac 100644
> > --- a/qapi/crypto.json
> > +++ b/qapi/crypto.json
> > @@ -66,7 +66,7 @@
> > # @aes-128: AES with 128 bit / 16 byte keys
> > # @aes-192: AES with 192 bit / 24 byte keys
> > # @aes-256: AES with 256 bit / 32 byte keys
> > -# @des-rfb: RFB specific variant of single DES. Do not use except in VNC.
> > +# @des: DES with 56 bit / 8 byte keys. Do not use except in VNC.
> > # @3des: 3DES(EDE) with 192 bit / 24 byte keys (since 2.9)
> > # @cast5-128: Cast5 with 128 bit / 16 byte keys
> > # @serpent-128: Serpent with 128 bit / 16 byte keys
> > @@ -80,7 +80,7 @@
> > { 'enum': 'QCryptoCipherAlgorithm',
> > 'prefix': 'QCRYPTO_CIPHER_ALG',
> > 'data': ['aes-128', 'aes-192', 'aes-256',
> > - 'des-rfb', '3des',
> > + 'des', '3des',
> > 'cast5-128',
> > 'serpent-128', 'serpent-192', 'serpent-256',
> > 'twofish-128', 'twofish-192', 'twofish-256']}
>
> Is enum value "des-rfb" part of any external interface?
Strictly speaking, yes, but in reality it doesn't matter.
The only place in QEMU that actually uses DES-RFB is the
VNC server code. That is an indirect usage when the user
sets the "password" option flag in QemuOpts. The fact that
it uses DES-RFB is an internal impl detail.
The one place that does publically expose ability to set a
field using the QCryptoCipherAlgorithm enum type is the
LUKS support in the block layer:
{ 'struct': 'QCryptoBlockCreateOptionsLUKS',
'base': 'QCryptoBlockOptionsLUKS',
'data': { '*cipher-alg': 'QCryptoCipherAlgorithm',
'*cipher-mode': 'QCryptoCipherMode',
'*ivgen-alg': 'QCryptoIVGenAlgorithm',
'*ivgen-hash-alg': 'QCryptoHashAlgorithm',
'*hash-alg': 'QCryptoHashAlgorithm',
'*iter-time': 'int'}}
eg exposed on CLI as:
$ qemu-img create -f luks -o cipher-alg=NNN foo.luks 1G
or equivalant with QMP blockdev-create
While the QMP schema allows any valid QCryptoCipherAlgorithm
string to be set, the actual implementation does not.
The crypto/block-luks.c code has a map between cipher algs
and LUKS format algoritm names:
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 },
};
If it isn't in that table, it can't be used. IOW, the only
scenario we're affecting in this rename is one which would
already result in an error condition
Original behaviour:
$ qemu-img create -f luks --object secret,id=sec0,data=123 -o
cipher-alg=des-rfb,key-secret=sec0 demo.luks 1G
Formatting 'demo.luks', fmt=luks size=1073741824 key-secret=sec0
cipher-alg=des-rfb
qemu-img: demo.luks: Algorithm 'des-rfb' not supported
New behaviour:
$ qemu-img create -f luks --object secret,id=sec0,data=123 -o
cipher-alg=des-rfb,key-secret=sec0 demo.luks 1G
Formatting 'demo.luks', fmt=luks size=1073741824 key-secret=sec0
cipher-alg=des-fish
qemu-img: demo.luks: Invalid parameter 'des-rfb'
I considered this incompatibility to be acceptable, and thus
not worth going through a deprecation dance.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- [PATCH 04/18] crypto: use &error_fatal in crypto tests, (continued)
- [PATCH 04/18] crypto: use &error_fatal in crypto tests, Daniel P . Berrangé, 2021/07/06
- [PATCH 10/18] crypto: delete built-in XTS cipher mode support, Daniel P . Berrangé, 2021/07/06
- [PATCH 12/18] crypto: flip priority of backends to prefer gcrypt, Daniel P . Berrangé, 2021/07/06
- [PATCH 13/18] crypto: introduce build system for gnutls crypto backend, Daniel P . Berrangé, 2021/07/06
- [PATCH 11/18] crypto: rename des-rfb cipher to just des, Daniel P . Berrangé, 2021/07/06
- Re: [PATCH 11/18] crypto: rename des-rfb cipher to just des, Eric Blake, 2021/07/08
[PATCH 14/18] crypto: add gnutls cipher provider, Daniel P . Berrangé, 2021/07/06
[PATCH 15/18] crypto: add gnutls hash provider, Daniel P . Berrangé, 2021/07/06
[PATCH 16/18] crypto: add gnutls hmac provider, Daniel P . Berrangé, 2021/07/06