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: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH 06/10] crypto: add a nettle cipher implementation
Date: Thu, 21 May 2015 12:38:01 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

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


r~



reply via email to

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