]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
crypto: keywrap - add key wrapping block chaining mode
authorStephan Mueller <smueller@chronox.de>
Mon, 21 Sep 2015 18:58:23 +0000 (20:58 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 15 Oct 2015 13:05:04 +0000 (21:05 +0800)
commite28facde3c39005071cc5323d56539bb44efa446
treef103a8d64c47cf5ffb985f9f387cfd06d4505db6
parent8a826a34a52eef9ea1cb93f49ada358fa7b0bb32
crypto: keywrap - add key wrapping block chaining mode

This patch implements the AES key wrapping as specified in
NIST SP800-38F and RFC3394.

The implementation covers key wrapping without padding.

IV handling: The caller does not provide an IV for encryption,
but must obtain the IV after encryption which would serve as the first
semblock in the ciphertext structure defined by SP800-38F. Conversely,
for decryption, the caller must provide the first semiblock of the data
as the IV and the following blocks as ciphertext.

The key wrapping is an authenticated decryption operation. The caller
will receive EBADMSG during decryption if the authentication failed.

Albeit the standards define the key wrapping for AES only, the template
can be used with any other block cipher that has a block size of 16
bytes. During initialization of the template, that condition is checked.
Any cipher not having a block size of 16 bytes will cause the
initialization to fail.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/keywrap.c [new file with mode: 0644]