From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvitJ-00007c-0R for qemu-devel@nongnu.org; Fri, 22 May 2015 05:05:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvitI-0006Xj-1f for qemu-devel@nongnu.org; Fri, 22 May 2015 05:05:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvitH-0006XX-Ru for qemu-devel@nongnu.org; Fri, 22 May 2015 05:05:16 -0400 Date: Fri, 22 May 2015 10:05:10 +0100 From: "Daniel P. Berrange" Message-ID: <20150522090510.GB14428@redhat.com> References: <1432205817-16414-1-git-send-email-berrange@redhat.com> <1432205817-16414-7-git-send-email-berrange@redhat.com> <555E3419.5060902@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <555E3419.5060902@twiddle.net> Subject: Re: [Qemu-devel] [PATCH 06/10] crypto: add a nettle cipher implementation Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Kevin Wolf , Paolo Bonzini , qemu-devel@nongnu.org, Gerd Hoffmann 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 :|