linux/crypto
Ard Biesheuvel 18e615ad87 crypto: skcipher - fix crash in virtual walk
The new skcipher walk API may crash in the following way. (Interestingly,
the tcrypt boot time tests seem unaffected, while an explicit test using
the module triggers it)

  Unable to handle kernel NULL pointer dereference at virtual address 00000000
  ...
  [<ffff000008431d84>] __memcpy+0x84/0x180
  [<ffff0000083ec0d0>] skcipher_walk_done+0x328/0x340
  [<ffff0000080c5c04>] ctr_encrypt+0x84/0x100
  [<ffff000008406d60>] simd_skcipher_encrypt+0x88/0x98
  [<ffff0000083fa05c>] crypto_rfc3686_crypt+0x8c/0x98
  [<ffff0000009b0900>] test_skcipher_speed+0x518/0x820 [tcrypt]
  [<ffff0000009b31c0>] do_test+0x1408/0x3b70 [tcrypt]
  [<ffff0000009bd050>] tcrypt_mod_init+0x50/0x1000 [tcrypt]
  [<ffff0000080838f4>] do_one_initcall+0x44/0x138
  [<ffff0000081aee60>] do_init_module+0x68/0x1e0
  [<ffff0000081524d0>] load_module+0x1fd0/0x2458
  [<ffff000008152c38>] SyS_finit_module+0xe0/0xf0
  [<ffff0000080836f0>] el0_svc_naked+0x24/0x28

This is due to the fact that skcipher_done_slow() may be entered with
walk->buffer unset. Since skcipher_walk_done() already deals with the
case where walk->buffer == walk->page, it appears to be the intention
that walk->buffer point to walk->page after skcipher_next_slow(), so
ensure that is the case.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2016-12-14 18:33:14 +08:00
..
asymmetric_keys crypto: asymmetric_keys - set error code on failure 2016-12-14 18:33:13 +08:00
async_tx async_pq_val: fix DMA memory leak 2016-10-05 06:18:09 +05:30
.gitignore
842.c crypto: acomp - add support for 842 via scomp 2016-10-25 11:08:33 +08:00
ablk_helper.c crypto: ablk_helper - Fix cryptd reordering 2016-06-23 18:29:53 +08:00
ablkcipher.c crypto: skcipher - Remove top-level givcipher interface 2016-07-18 17:35:46 +08:00
acompress.c crypto: acomp - add driver-side scomp interface 2016-10-25 11:08:31 +08:00
aead.c crypto: aead - Remove blkcipher null for IV generators 2016-07-18 17:35:43 +08:00
aes_generic.c
af_alg.c crypto: af_alg - Forbid bind(2) when nokey child sockets are present 2016-01-18 18:16:33 +08:00
ahash.c crypto: ahash - Add padding in crypto_ahash_extsize 2016-07-01 23:45:03 +08:00
akcipher.c crypto: akcipher - add akcipher declarations needed by templates. 2015-12-09 20:03:57 +08:00
algapi.c crypto: api - Add crypto_inst_setname 2016-07-01 23:45:11 +08:00
algboss.c crypto: testmgr - Do not test internal algorithms 2016-11-28 21:23:20 +08:00
algif_aead.c crypto: algif_aead - fix AIO handling of zero buffer 2016-12-01 21:06:44 +08:00
algif_hash.c crypto: algif_hash - Fix result clobbering in recvmsg 2016-11-22 15:02:24 +08:00
algif_rng.c
algif_skcipher.c crypto: algif_skcipher - set error code when kcalloc fails 2016-12-01 21:06:43 +08:00
ansi_cprng.c
anubis.c
api.c crypto: api - Do not clear type bits in crypto_larval_lookup 2016-11-28 21:23:18 +08:00
arc4.c
authenc.c crypto: skcipher - Get rid of crypto_spawn_skcipher2() 2016-11-01 08:37:17 +08:00
authencesn.c crypto: skcipher - Get rid of crypto_spawn_skcipher2() 2016-11-01 08:37:17 +08:00
blkcipher.c crypto: skcipher - Fix blkcipher walk OOM crash 2016-09-13 18:44:57 +08:00
blowfish_common.c
blowfish_generic.c
camellia_generic.c
cast5_generic.c
cast6_generic.c
cast_common.c
cbc.c crypto: cbc - Export CBC implementation 2016-11-28 21:23:21 +08:00
ccm.c crypto: skcipher - Get rid of crypto_spawn_skcipher2() 2016-11-01 08:37:17 +08:00
chacha20_generic.c random: replace non-blocking pool with a Chacha20-based CRNG 2016-07-03 00:57:23 -04:00
chacha20poly1305.c crypto: skcipher - Get rid of crypto_spawn_skcipher2() 2016-11-01 08:37:17 +08:00
cipher.c crypto: api - Remove no-op exit_ops code 2016-10-21 11:03:42 +08:00
cmac.c crypto: cmac - fix alignment of 'consts' 2016-10-21 11:03:42 +08:00
compress.c crypto: api - Remove no-op exit_ops code 2016-10-21 11:03:42 +08:00
crc32_generic.c crypto: crc32 - Rename generic implementation 2016-01-30 22:11:22 +08:00
crc32c_generic.c crypto: crc32c - Fix crc32c soft dependency 2016-01-19 15:52:10 +08:00
crct10dif_common.c
crct10dif_generic.c crypto: squash lines for simple wrapper functions 2016-09-13 20:27:26 +08:00
cryptd.c crypto: cryptd - Add support for skcipher 2016-11-28 21:23:18 +08:00
crypto_engine.c crypto: engine - Handle the kthread worker using the new API 2016-10-25 11:08:25 +08:00
crypto_null.c crypto: null - Remove default null blkcipher 2016-07-18 17:35:44 +08:00
crypto_user.c crypto: acomp - add asynchronous compression api 2016-10-25 11:08:30 +08:00
crypto_wq.c
ctr.c crypto: skcipher - Get rid of crypto_spawn_skcipher2() 2016-11-01 08:37:17 +08:00
cts.c crypto: skcipher - Get rid of crypto_spawn_skcipher2() 2016-11-01 08:37:17 +08:00
deflate.c crypto: acomp - add support for deflate via scomp 2016-10-25 11:08:36 +08:00
des_generic.c
dh.c crypto: dh - Consistenly return negative error codes 2016-11-13 17:45:04 +08:00
dh_helper.c crypto: dh - Add DH software implementation 2016-06-23 18:29:56 +08:00
drbg.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2016-11-30 19:53:12 +08:00
ecb.c
ecc.c crypto: ecdh - make ecdh_shared_secret unique 2016-06-24 21:24:59 +08:00
ecc.h crypto: ecdh - make ecdh_shared_secret unique 2016-06-24 21:24:59 +08:00
ecc_curve_defs.h crypto: ecdh - Add ECDH software support 2016-06-23 18:29:57 +08:00
ecdh.c crypto: ecdh - make ecdh_shared_secret unique 2016-06-24 21:24:59 +08:00
ecdh_helper.c crypto: ecdh - Add ECDH software support 2016-06-23 18:29:57 +08:00
echainiv.c crypto: echainiv - Replace chaining with multiplication 2016-09-13 18:44:57 +08:00
fcrypt.c
fips.c
gcm.c crypto: skcipher - Get rid of crypto_spawn_skcipher2() 2016-11-01 08:37:17 +08:00
gf128mul.c crypto: gf128mul - Zero memory when freeing multiplication table 2016-11-17 23:34:59 +08:00
ghash-generic.c crypto: ghash-generic - move common definitions to a new header file 2016-10-02 22:26:40 +08:00
hash_info.c keys, trusted: select hash algorithm for TPM2 chips 2015-12-20 15:27:12 +02:00
hmac.c
internal.h crypto: api - Remove no-op exit_ops code 2016-10-21 11:03:42 +08:00
jitterentropy-kcapi.c crypto: jitterentropy - drop duplicate header module.h 2016-11-17 23:34:52 +08:00
jitterentropy.c
Kconfig crypto: aesni - Convert to skcipher 2016-11-28 21:23:20 +08:00
keywrap.c crypto: keywrap - memzero the correct memory 2016-02-01 22:27:05 +08:00
khazad.c
kpp.c crypto: kpp - Key-agreement Protocol Primitives API (KPP) 2016-06-23 18:29:56 +08:00
lrw.c crypto: lrw - Convert to skcipher 2016-11-28 21:23:17 +08:00
lz4.c crypto: acomp - add support for lz4 via scomp 2016-10-25 11:08:32 +08:00
lz4hc.c crypto: acomp - add support for lz4hc via scomp 2016-10-25 11:08:32 +08:00
lzo.c crypto: acomp - add support for lzo via scomp 2016-10-25 11:08:31 +08:00
Makefile Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2016-11-30 19:53:12 +08:00
mcryptd.c crypto: squash lines for simple wrapper functions 2016-09-13 20:27:26 +08:00
md4.c
md5.c crypto: hash - add zero length message hash for shax and md5 2015-12-22 20:43:35 +08:00
memneq.c
michael_mic.c
pcbc.c crypto: pcbc - Convert to skcipher 2016-11-28 21:23:18 +08:00
pcrypt.c
poly1305_generic.c crypto: poly1305 - Use unaligned access where required 2016-11-13 17:45:03 +08:00
proc.c
ripemd.h
rmd128.c
rmd160.c
rmd256.c
rmd320.c
rng.c
rsa-pkcs1pad.c crypto: rsa-pkcs1pad - Handle leading zero for decryption 2016-09-22 17:42:08 +08:00
rsa.c crypto: rsa - Generate fixed-length output 2016-07-01 23:45:18 +08:00
rsa_helper.c crypto: rsa - allow keys >= 2048 bits in FIPS mode 2016-08-24 21:07:10 +08:00
rsaprivkey.asn1 crypto: rsa - Store rest of the private key components 2016-07-05 23:05:26 +08:00
rsapubkey.asn1
salsa20_generic.c
scatterwalk.c crypto: scatterwalk - Remove unnecessary aliasing check in map_and_copy 2016-11-22 15:02:25 +08:00
scompress.c crypto: acomp - add driver-side scomp interface 2016-10-25 11:08:31 +08:00
seed.c
seqiv.c crypto: skcipher - Remove top-level givcipher interface 2016-07-18 17:35:46 +08:00
serpent_generic.c
sha1_generic.c crypto: hash - add zero length message hash for shax and md5 2015-12-22 20:43:35 +08:00
sha3_generic.c crypto: sha3 - Add missing ULL suffixes for 64-bit constants 2016-08-08 23:43:46 +08:00
sha256_generic.c crypto: hash - add zero length message hash for shax and md5 2015-12-22 20:43:35 +08:00
sha512_generic.c
shash.c Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2016-03-17 11:22:54 -07:00
simd.c crypto: simd - Add simd skcipher helper 2016-11-28 21:23:18 +08:00
skcipher.c crypto: skcipher - fix crash in virtual walk 2016-12-14 18:33:14 +08:00
tcrypt.c crypto: sha3 - Add HMAC-SHA3 test modes and test vectors 2016-07-01 23:45:24 +08:00
tcrypt.h
tea.c
testmgr.c crypto: testmgr - fix overlap in chunked tests again 2016-12-08 20:14:59 +08:00
testmgr.h crypto: testmgr - add/enhance test cases for CRC-T10DIF 2016-12-07 20:01:15 +08:00
tgr192.c
twofish_common.c
twofish_generic.c
vmac.c
wp512.c
xcbc.c
xor.c crypto: xor - Fix warning when XOR_SELECT_TEMPLATE is unset 2016-08-31 23:00:48 +08:00
xts.c crypto: xts - Convert to skcipher 2016-11-28 21:23:18 +08:00