qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 06/10] crypto: add a nettle cipher implementatio


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH 06/10] crypto: add a nettle cipher implementation
Date: Fri, 22 May 2015 10:05:10 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Thu, May 21, 2015 at 12:38:01PM -0700, Richard Henderson wrote:
> On 05/21/2015 03:56 AM, Daniel P. Berrange wrote:
> > +static uint8_t *qcrypto_cipher_munge_des_rfb_key(const uint8_t *key,
> > +                                                 size_t nkey)
> > +{
> > +    uint8_t *ret = g_new0(uint8_t, nkey);
> > +    size_t i;
> > +    for (i = 0; i < nkey; i++) {
> > +        uint8_t r = key[i];
> > +        r = (r & 0xf0)>>4 | (r & 0x0f)<<4;
> > +        r = (r & 0xcc)>>2 | (r & 0x33)<<2;
> > +        r = (r & 0xaa)>>1 | (r & 0x55)<<1;
> > +        ret[i] = r;
> > +    }
> > +    return ret;
> > +}
> > +
> 
> Surely you can share this between the gcrypt and nettle files and not 
> duplicate
> it...

Potentially, but it was small enough that I felt it not worth the bother
of introducing another file for sharing it. The copyright header on a
new file would be larger than the amount of code shared in a new file.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]