linux/crypto
Stephan Mueller 72548b093e crypto: algif_aead - copy AAD from src to dst
Use the NULL cipher to copy the AAD and PT/CT from the TX SGL
to the RX SGL. This allows an in-place crypto operation on the
RX SGL for encryption, because the TX data is always smaller or
equal to the RX data (the RX data will hold the tag).

For decryption, a per-request TX SGL is created which will only hold
the tag value. As the RX SGL will have no space for the tag value and
an in-place operation will not write the tag buffer, the TX SGL with the
tag value is chained to the RX SGL. This now allows an in-place
crypto operation.

For example:

* without the patch:
kcapi -x 2 -e -c "gcm(aes)" -p 89154d0d4129d322e4487bafaa4f6b46 -k c0ece3e63198af382b5603331cc23fa8 -i 7e489b83622e7228314d878d -a afcd7202d621e06ca53b70c2bdff7fb2 -l 16 -u -s
00000000000000000000000000000000f4a3eacfbdadd3b1a17117b1d67ffc1f1e21efbbc6d83724a8c296e3bb8cda0c

* with the patch:
kcapi -x 2 -e -c "gcm(aes)" -p 89154d0d4129d322e4487bafaa4f6b46 -k c0ece3e63198af382b5603331cc23fa8 -i 7e489b83622e7228314d878d -a afcd7202d621e06ca53b70c2bdff7fb2 -l 16 -u -s
afcd7202d621e06ca53b70c2bdff7fb2f4a3eacfbdadd3b1a17117b1d67ffc1f1e21efbbc6d83724a8c296e3bb8cda0c

Tests covering this functionality have been added to libkcapi.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2017-08-09 20:17:52 +08:00
..
asymmetric_keys Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2017-07-05 15:17:26 +08:00
async_tx async_tx: Fix DMA_PREP_FENCE usage in do_async_gen_syndrome() 2017-05-16 10:01:57 +05:30
.gitignore
842.c
ablk_helper.c
ablkcipher.c
acompress.c
aead.c
aes_generic.c
aes_ti.c crypto: aes_ti - fix comment for MixColumns step 2017-06-19 14:11:53 +08:00
af_alg.c Networking 2017-07-12 18:38:06 +08:00
ahash.c
akcipher.c
algapi.c crypto: algapi - use separate dst and src operands for __crypto_xor() 2017-08-04 09:27:05 +08:00
algboss.c
algif_aead.c crypto: algif_aead - copy AAD from src to dst 2017-08-09 20:17:52 +08:00
algif_hash.c
algif_rng.c
algif_skcipher.c crypto: algif - return error code when no data was processed 2017-08-09 20:17:50 +08:00
ansi_cprng.c
anubis.c
api.c
arc4.c
authenc.c
authencesn.c crypto: authencesn - Fix digest_null crash 2017-07-18 17:01:11 +08:00
blkcipher.c
blowfish_common.c
blowfish_generic.c
camellia_generic.c
cast5_generic.c
cast6_generic.c
cast_common.c
cbc.c
ccm.c
chacha20_generic.c
chacha20poly1305.c
cipher.c
cmac.c
compress.c
crc32_generic.c
crc32c_generic.c
crct10dif_common.c
crct10dif_generic.c
cryptd.c
crypto_engine.c crypto: engine - replace pr_xxx by dev_xxx 2017-06-19 14:19:54 +08:00
crypto_null.c
crypto_user.c
crypto_wq.c
ctr.c crypto: algapi - make crypto_xor() take separate dst and src arguments 2017-08-04 09:27:15 +08:00
cts.c
deflate.c
des_generic.c
dh.c crypto: dh - comply with crypto_kpp_maxsize() 2017-06-10 12:04:27 +08:00
dh_helper.c crypto: kpp, (ec)dh - fix typos 2017-06-10 12:04:25 +08:00
drbg.c crypto: drbg - Fixes panic in wait_for_completion call 2017-06-22 16:47:21 +08:00
ecb.c
ecc.c crypto: ecdh - add privkey generation support 2017-06-10 12:04:35 +08:00
ecc.h crypto: ecdh - add privkey generation support 2017-06-10 12:04:35 +08:00
ecc_curve_defs.h
ecdh.c crypto: ecdh - fix concurrency on shared secret and pubkey 2017-08-03 13:47:22 +08:00
ecdh_helper.c crypto: kpp, (ec)dh - fix typos 2017-06-10 12:04:25 +08:00
echainiv.c
fcrypt.c
fips.c
gcm.c crypto: gcm - wait for crypto op not signal safe 2017-05-23 12:45:11 +08:00
gf128mul.c
ghash-generic.c
hash_info.c
hmac.c crypto: hmac - add hmac IPAD/OPAD constant 2017-05-23 12:52:05 +08:00
internal.h
jitterentropy-kcapi.c
jitterentropy.c
Kconfig crypto: algif_aead - copy AAD from src to dst 2017-08-09 20:17:52 +08:00
keywrap.c
khazad.c
kpp.c
lrw.c
lz4.c
lz4hc.c
lzo.c treewide: use kv[mz]alloc* rather than opencoded variants 2017-05-08 17:15:13 -07:00
Makefile crypto: ecdh - add privkey generation support 2017-06-10 12:04:35 +08:00
mcryptd.c
md4.c
md5.c
memneq.c
michael_mic.c
pcbc.c crypto: algapi - make crypto_xor() take separate dst and src arguments 2017-08-04 09:27:15 +08:00
pcrypt.c
poly1305_generic.c
proc.c
ripemd.h
rmd128.c
rmd160.c
rmd256.c
rmd320.c
rng.c crypto: rng - ensure that the RNG is ready before using 2017-07-28 17:56:00 +08:00
rsa-pkcs1pad.c crypto: rsa-pkcs1pad - use constant time memory comparison for MACs 2017-06-20 11:21:19 +08:00
rsa.c crypto: rsa - comply with crypto_akcipher_maxsize() 2017-06-10 12:04:30 +08:00
rsa_helper.c
rsaprivkey.asn1
rsapubkey.asn1
salsa20_generic.c
scatterwalk.c
scompress.c crypto: scompress - defer allocation of scratch buffer to first use 2017-08-03 13:52:44 +08:00
seed.c
seqiv.c
serpent_generic.c
sha1_generic.c
sha3_generic.c
sha256_generic.c
sha512_generic.c
shash.c
simd.c
skcipher.c crypto: skcipher - Add missing API setkey checks 2017-05-18 13:04:05 +08:00
tcrypt.c crypto: tcrypt - remove AES-XTS-192 speed tests 2017-08-03 13:47:20 +08:00
tcrypt.h
tea.c
testmgr.c crypto: testmgr - Reenable sha1/aes in FIPS mode 2017-06-28 22:18:58 +08:00
testmgr.h crypto: testmgr - add testvector for pkcs1pad(rsa) 2017-06-20 11:21:29 +08:00
tgr192.c
twofish_common.c
twofish_generic.c
vmac.c
wp512.c
xcbc.c
xor.c
xts.c