Re: [PATCH v2] crypto: add key wrapping block chaining mode

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

 



Am Montag, 27. April 2015, 16:29:35 schrieb Herbert Xu:

Hi Herbert,

>On Sun, Apr 26, 2015 at 12:08:20AM +0200, Stephan Mueller wrote:
>> This patch implements the AES key wrapping as specified in
>> NIST SP800-38F and RFC3394.
>
>This is my attempt at turning kw into a givcipher.  The encrypt
>part is complete but untested as I gave up after finding the
>reverse SG problem with your decrypt code.

Is it that easy? I was struggling to understand what to do in the alloc 
function.

Thank you very much for that hint.

>static int crypto_kw_givdecrypt(struct skcipher_givcrypt_request *req)
>{
>	int err = crypto_kw_decrypt(&req->creq);
>
>	if (err)
>		return err;
>
>	return memcmp(req->creq.info, "\xA6\xA6\xA6\xA6\xA6\xA6\xA6\xA6",
>		      SEMIBSIZE) ? -EBADMSG : 0;

This memcmp implies that the final block->A from the decrypt is memcpy'ed to 
req->creq.info. I wanted to avoid any additional memcpy calls to not hurt 
performance even more.


Ciao
Stephan
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux