qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Eric Blake <eblake@redhat.com>,
	qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [PATCH 11/18] crypto: rename des-rfb cipher to just des
Date: Fri, 9 Jul 2021 14:59:02 +0100	[thread overview]
Message-ID: <YOhWJr+az/DOMJjb@redhat.com> (raw)
In-Reply-To: <87fswo50mf.fsf@dusky.pond.sub.org>

On Thu, Jul 08, 2021 at 04:41:28PM +0200, Markus Armbruster wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
> 
> > 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.
> 
> Thanks for the explanation.  I agree the deprecation dance is not
> necessary here.
> 
> Please consider explaining this in your commit message.  Suggest to
> append a variation of the tail of your explanation:
> 
>   Replacing cipher 'des-rfb' by 'des' looks like an incompatible
>   interface change, but it doesn't matter.  While the QMP schema allows
>   ...
>   qemu-img: demo.luks: Invalid parameter 'des-rfb'
> 
> Also consider tweaking the title to
> 
>   crypto: Replace 'des-rfb' cipher by 'des'
> 
> because it's not actually just a rename.
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>

Thanks, I've updated the commit msg as suggested

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 :|



  reply	other threads:[~2021-07-09 14:01 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06  9:59 [PATCH 00/18] crypto: misc cleanup and introduce gnutls backend driver Daniel P. Berrangé
2021-07-06  9:59 ` [PATCH 01/18] crypto: remove conditional around 3DES crypto test cases Daniel P. Berrangé
2021-07-08 18:27   ` Eric Blake
2021-07-06  9:59 ` [PATCH 02/18] crypto: remove obsolete crypto test condition Daniel P. Berrangé
2021-07-08 18:28   ` Eric Blake
2021-07-06  9:59 ` [PATCH 03/18] crypto: skip essiv ivgen tests if AES+ECB isn't available Daniel P. Berrangé
2021-07-08 18:29   ` Eric Blake
2021-07-06  9:59 ` [PATCH 04/18] crypto: use &error_fatal in crypto tests Daniel P. Berrangé
2021-07-08 18:33   ` Eric Blake
2021-07-06  9:59 ` [PATCH 05/18] crypto: fix gcrypt min version 1.8 regression Daniel P. Berrangé
2021-07-08 18:34   ` Eric Blake
2021-07-06  9:59 ` [PATCH 06/18] crypto: drop gcrypt thread initialization code Daniel P. Berrangé
2021-07-08 18:36   ` Eric Blake
2021-07-06  9:59 ` [PATCH 07/18] crypto: drop custom XTS support in gcrypt driver Daniel P. Berrangé
2021-07-08 18:40   ` Eric Blake
2021-07-06  9:59 ` [PATCH 08/18] crypto: add crypto tests for single block DES-ECB and DES-CBC Daniel P. Berrangé
2021-07-08 18:50   ` Eric Blake
2021-07-09 13:53     ` Daniel P. Berrangé
2021-07-06  9:59 ` [PATCH 09/18] crypto: delete built-in DES implementation Daniel P. Berrangé
2021-07-08 18:54   ` Eric Blake
2021-07-06  9:59 ` [PATCH 10/18] crypto: delete built-in XTS cipher mode support Daniel P. Berrangé
2021-07-08 18:56   ` Eric Blake
2021-07-06  9:59 ` [PATCH 11/18] crypto: rename des-rfb cipher to just des Daniel P. Berrangé
2021-07-07 12:47   ` Markus Armbruster
2021-07-07 13:48     ` Daniel P. Berrangé
2021-07-08 14:41       ` Markus Armbruster
2021-07-09 13:59         ` Daniel P. Berrangé [this message]
2021-07-08 19:50   ` Eric Blake
2021-07-06  9:59 ` [PATCH 12/18] crypto: flip priority of backends to prefer gcrypt Daniel P. Berrangé
2021-07-08 18:59   ` Eric Blake
2021-07-06  9:59 ` [PATCH 13/18] crypto: introduce build system for gnutls crypto backend Daniel P. Berrangé
2021-07-08 19:03   ` Eric Blake
2021-07-06  9:59 ` [PATCH 14/18] crypto: add gnutls cipher provider Daniel P. Berrangé
2021-07-08 19:13   ` Eric Blake
2021-07-06  9:59 ` [PATCH 15/18] crypto: add gnutls hash provider Daniel P. Berrangé
2021-07-08 19:29   ` Eric Blake
2021-07-06  9:59 ` [PATCH 16/18] crypto: add gnutls hmac provider Daniel P. Berrangé
2021-07-08 19:35   ` Eric Blake
2021-07-09 14:03     ` Daniel P. Berrangé
2021-07-06  9:59 ` [PATCH 17/18] crypto: add gnutls pbkdf provider Daniel P. Berrangé
2021-07-08 19:43   ` Eric Blake
2021-07-06  9:59 ` [PATCH 18/18] crypto: prefer gnutls as the crypto backend if new enough Daniel P. Berrangé
2021-07-08 19:52   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YOhWJr+az/DOMJjb@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).