Horia Geanta
cc1cebf867
crypto: ccm - Fix handling of zero plaintext when computing mac
commit 5638cabf3e upstream.
There are cases when cryptlen can be zero in crypto_ccm_auth():
-encryptiom: input scatterlist length is zero (no plaintext)
-decryption: input scatterlist contains only the mac
plus the condition of having different source and destination buffers
(or else scatterlist length = max(plaintext_len, ciphertext_len)).
These are not handled correctly, leading to crashes like:
root@p4080ds:~/crypto# insmod tcrypt.ko mode=45
------------[ cut here ]------------
kernel BUG at crypto/scatterwalk.c:37!
Oops: Exception in kernel mode, sig: 5 [#1]
SMP NR_CPUS=8 P4080 DS
Modules linked in: tcrypt(+) crc32c xts xcbc vmac pcbc ecb gcm ghash_generic gf128mul ccm ctr seqiv
CPU: 3 PID: 1082 Comm: cryptomgr_test Not tainted 3.11.0 #14
task: ee12c5b0 ti: eecd0000 task.ti: eecd0000
NIP: c0204d98 LR: f9225848 CTR: c0204d80
REGS: eecd1b70 TRAP: 0700 Not tainted (3.11.0)
MSR: 00029002 <CE,EE,ME> CR: 22044022 XER: 20000000
GPR00: f9225c94 eecd1c20 ee12c5b0 eecd1c28 ee879400 ee879400 00000000 ee607464
GPR08: 00000001 00000001 00000000 006b0000 c0204d80 00000000 00000002 c0698e20
GPR16: ee987000 ee895000 fffffff4 ee879500 00000100 eecd1d58 00000001 00000000
GPR24: ee879400 00000020 00000000 00000000 ee5b2800 ee607430 00000004 ee607460
NIP [c0204d98] scatterwalk_start+0x18/0x30
LR [f9225848] get_data_to_compute+0x28/0x2f0 [ccm]
Call Trace:
[eecd1c20] [f9225974] get_data_to_compute+0x154/0x2f0 [ccm] (unreliable)
[eecd1c70] [f9225c94] crypto_ccm_auth+0x184/0x1d0 [ccm]
[eecd1cb0] [f9225d40] crypto_ccm_encrypt+0x60/0x2d0 [ccm]
[eecd1cf0] [c020d77c] __test_aead+0x3ec/0xe20
[eecd1e20] [c020f35c] test_aead+0x6c/0xe0
[eecd1e40] [c020f420] alg_test_aead+0x50/0xd0
[eecd1e60] [c020e5e4] alg_test+0x114/0x2e0
[eecd1ee0] [c020bd1c] cryptomgr_test+0x4c/0x60
[eecd1ef0] [c0047058] kthread+0xa8/0xb0
[eecd1f40] [c000eb0c] ret_from_kernel_thread+0x5c/0x64
Instruction dump:
0f080000 81290024 552807fe 0f080000 5529003a 4bffffb4 90830000 39400000
39000001 8124000c 2f890000 7d28579e <0f090000> 81240008 91230004 4e800020
---[ end trace 6d652dfcd1be37bd ]---
Cc: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: Horia Geanta <horia.geanta@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
2013-12-20 11:34:20 -08:00
..
2013-12-06 14:27:40 -08:00
2012-03-20 21:48:16 +08:00
2012-09-07 04:17:06 +08:00
2013-03-14 11:26:35 -07:00
2013-03-14 11:26:35 -07:00
2012-08-01 17:47:27 +08:00
2011-07-26 16:49:47 -07:00
2013-03-14 11:26:35 -07:00
2013-07-16 10:35:42 -07:00
2013-07-09 11:42:30 +01:00
2013-12-13 12:20:42 -08:00
2013-12-13 12:20:42 -08:00
2012-08-01 17:47:25 +08:00
2012-08-01 17:47:27 +08:00
2013-09-20 12:56:23 -07:00
2012-06-14 10:07:23 +08:00
2013-12-20 11:34:19 -08:00
2011-03-13 20:22:27 -07:00
2013-03-14 11:26:35 -07:00
2011-09-22 21:25:25 +10:00
2012-08-01 17:47:27 +08:00
2012-08-01 17:47:27 +08:00
2012-12-06 17:16:26 +08:00
2012-12-06 17:16:26 +08:00
2012-12-06 17:16:26 +08:00
2008-02-07 08:42:26 -08:00
2013-12-20 11:34:20 -08:00
2009-02-19 14:44:02 +08:00
2010-02-16 20:31:37 +08:00
2010-02-16 20:31:04 +08:00
2012-03-23 16:58:38 -07:00
2012-10-24 21:21:18 +08:00
2012-08-01 17:47:24 +08:00
2013-03-14 11:26:35 -07:00
2011-10-31 19:31:11 -04:00
2010-05-26 10:36:51 +10:00
2008-06-02 15:46:51 +10:00
2012-08-01 17:47:27 +08:00
2012-08-01 17:47:24 +08:00
2010-02-16 20:33:49 +08:00
2010-12-02 14:47:16 +08:00
2012-08-01 17:47:27 +08:00
2008-08-29 15:50:02 +10:00
2013-04-12 09:52:09 -07:00
2011-07-08 17:21:21 +08:00
2012-08-01 17:47:27 +08:00
2010-03-30 22:02:32 +09:00
2013-07-09 11:42:30 +01:00
2012-12-06 17:16:26 +08:00
2012-08-01 17:47:27 +08:00
2012-08-01 17:47:27 +08:00
2011-11-09 11:50:31 +08:00
2012-08-01 17:47:27 +08:00
2012-12-06 17:16:26 +08:00
2011-10-31 19:31:11 -04:00
2011-08-06 18:32:45 -07:00
2008-12-25 11:02:24 +11:00
2008-02-07 08:42:26 -08:00
2013-03-14 11:26:35 -07:00
2012-03-29 19:52:47 +08:00
2011-10-31 19:31:11 -04:00
2008-07-10 20:35:12 +08:00
2011-01-04 23:34:03 +11:00
2011-01-04 23:34:03 +11:00
2011-01-04 23:34:03 +11:00
2011-01-04 23:34:03 +11:00
2013-03-14 11:26:35 -07:00
2012-08-01 17:47:27 +08:00
2012-03-20 21:48:16 +08:00
2012-08-01 17:47:27 +08:00
2010-03-30 22:02:32 +09:00
2012-08-01 17:47:25 +08:00
2011-08-10 19:00:28 +08:00
2012-08-01 17:47:26 +08:00
2012-08-01 17:47:26 +08:00
2013-03-14 11:26:35 -07:00
2012-11-09 17:32:28 +08:00
2012-08-01 17:47:29 +08:00
2012-08-01 17:47:24 +08:00
2012-12-06 17:16:28 +08:00
2012-12-06 17:16:29 +08:00
2012-08-01 17:47:26 +08:00
2011-11-09 11:53:32 +08:00
2012-08-01 17:47:27 +08:00
2012-10-15 22:33:20 +08:00
2012-08-01 17:47:27 +08:00
2011-10-31 19:31:11 -04:00
2012-10-11 13:42:32 +11:00
2011-11-09 11:56:06 +08:00
2011-06-29 05:48:41 -07:00