qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: "Longpeng (Mike)" <longpeng2@huawei.com>
Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>,
	"eblake@redhat.com" <eblake@redhat.com>,
	"armbru@redhat.com" <armbru@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Wubin (H)" <wu.wubin@huawei.com>,
	"Zhoujian (jay, Euler)" <jianjay.zhou@huawei.com>
Subject: Re: [Qemu-devel] [PATCH for-2.9 1/2] crypto: add 3des-ede support when using libgcrypt/nettle
Date: Wed, 7 Dec 2016 09:43:14 +0000	[thread overview]
Message-ID: <20161207094314.GE21167@redhat.com> (raw)
In-Reply-To: <5847D42A.6090400@huawei.com>

On Wed, Dec 07, 2016 at 05:19:38PM +0800, Longpeng (Mike) wrote:
> 
> 
> On 2016/12/7 16:52, Gonglei (Arei) wrote:
> 
> >> -----Original Message-----
> >> From: longpeng
> >> Sent: Wednesday, December 07, 2016 4:34 PM
> >> To: berrange@redhat.com; eblake@redhat.com; armbru@redhat.com;
> >> Gonglei (Arei)
> >> Cc: qemu-devel@nongnu.org; Wubin (H); Zhoujian (jay, Euler); longpeng
> >> Subject: [PATCH for-2.9 1/2] crypto: add 3des-ede support when using
> >> libgcrypt/nettle
> >>
> >> Libgcrypt and nettle support 3des-ede, so this patch add 3des-ede
> >> support when using libgcrypt or nettle.
> >>
> >> Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
> >> ---
> ......
> >> --- a/qapi/crypto.json
> >> +++ b/qapi/crypto.json
> >> @@ -63,6 +63,7 @@
> >>  # @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.
> >> +# @3des-ede: 3DES-EDE with 192 bit / 24 byte keys
> > 
> > Missing since 2.9 here.
> > 
> 
> Okay, I will add it in V2.
> 
> >>  # @cast5-128: Cast5 with 128 bit / 16 byte keys
> >>  # @serpent-128: Serpent with 128 bit / 16 byte keys
> >>  # @serpent-192: Serpent with 192 bit / 24 byte keys
> ......
> >> +    {
> >> +        /* Borrowed from linux-kernel crypto/testmgr.h */
> >> +        .path = "/crypto/cipher/3des-ede-ecb",
> >> +        .alg = QCRYPTO_CIPHER_ALG_3DES_EDE,
> >> +        .mode = QCRYPTO_CIPHER_MODE_ECB,
> >> +        .key =
> >> +            "0123456789abcdef5555555555555555"
> >> +            "fedcba9876543210",
> >> +        .plaintext =
> >> +            "736f6d6564617461",
> >> +        .ciphertext =
> >> +            "18d748e563620572",
> >> +    },
> >> +#endif
> > 
> > Pls adds the CTR mode test case as well.
> > 
> 
> Okay!
> 
> But I confuse with the 3DES's iv length now. I saw that cbc(3des-ede)'s iv-len
> can be 8 or 16 bytes, and ctr(3des-ede)'s iv-len is 24 bytes(according to
> linux-kernel crypto/testmgr.h).
> 
> However, I think qcrypto_cipher_get_iv_len() cannot distinguish a cipher alg
> with more than one iv-len.
> 
> Daniel, do you have any idea ?

Both nettle and libgcrypt require that the iv len match the block size of
the cipher, so iv-len for 3des must always be 24


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

  parent reply	other threads:[~2016-12-07  9:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07  8:33 [Qemu-devel] [PATCH for-2.9 0/2] crypto: add 3des-ede support Longpeng(Mike)
2016-12-07  8:33 ` [Qemu-devel] [PATCH for-2.9 1/2] crypto: add 3des-ede support when using libgcrypt/nettle Longpeng(Mike)
2016-12-07  8:52   ` Gonglei (Arei)
2016-12-07  9:19     ` Longpeng (Mike)
2016-12-07  9:21       ` Longpeng (Mike)
2016-12-07  9:43       ` Daniel P. Berrange [this message]
2016-12-07  9:37   ` Daniel P. Berrange
2016-12-07  9:46     ` Longpeng (Mike)
2016-12-07  8:33 ` [Qemu-devel] [PATCH for-2.9 2/2] cryptodev: add 3des-ede support Longpeng(Mike)

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=20161207094314.GE21167@redhat.com \
    --to=berrange@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=longpeng2@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wu.wubin@huawei.com \
    /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).