1. 20 7月, 2015 4 次提交
  2. 14 7月, 2015 1 次提交
  3. 19 6月, 2015 2 次提交
  4. 18 6月, 2015 2 次提交
    • H
      crypto: drivers - Fix Kconfig selects · 596103cf
      Herbert Xu 提交于
      This patch fixes a number of problems in crypto driver Kconfig
      entries:
      
      1. Select BLKCIPHER instead of BLKCIPHER2.  The latter is internal
      and should not be used outside of the crypto API itself.
      2. Do not select ALGAPI unless you use a legacy type like
      CRYPTO_ALG_TYPE_CIPHER.
      3. Select the algorithm type that you are implementing, e.g., AEAD.
      4. Do not select generic C code such as CBC/ECB unless you use them
      as a fallback.
      5. Remove default n since that is the default default.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      596103cf
    • S
      crypto: caam - fix non-64-bit write/read access · f657f82c
      Steffen Trumtrar 提交于
      The patch
      
      	crypto: caam - Add definition of rd/wr_reg64 for little endian platform
      
      added support for little endian platforms to the CAAM driver. Namely a
      write and read function for 64 bit registers.
      The only user of this functions is the Job Ring driver (drivers/crypto/caam/jr.c).
      It uses the functions to set the DMA addresses for the input/output rings.
      However, at least in the default configuration, the least significant 32 bits are
      always in the base+0x0004 address; independent of the endianness of the bytes itself.
      That means the addresses do not change with the system endianness.
      
      DMA addresses are only 32 bits wide on non-64-bit systems, writing the upper 32 bits
      of this value to the register for the least significant bits results in the DMA address
      being set to 0.
      
      Fix this by always writing the registers in the same way.
      Suggested-by: NRussell King <linux@arm.linux.org.uk>
      Signed-off-by: NSteffen Trumtrar <s.trumtrar@pengutronix.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      f657f82c
  5. 17 6月, 2015 2 次提交
    • H
      crypto: caam - Convert GCM to new AEAD interface · f2147b88
      Herbert Xu 提交于
      This patch converts the caam GCM implementations to the new AEAD
      interface.  This is compile-tested only.
      
      Note that all IV generation for GCM algorithms have been removed.
      The reason is that the current generation uses purely random IVs
      which is not appropriate for counter-based algorithms where we
      first and foremost require uniqueness.
      
      Of course there is no reason why you couldn't implement seqiv or
      seqniv within caam since all they do is xor the sequence number
      with a salt, but since I can't test this on actual hardware I'll
      leave it alone for now.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      f2147b88
    • H
      crypto: caam - Handle errors in dma_map_sg_chained · 6c94711c
      Herbert Xu 提交于
      Currently dma_map_sg_chained does not handle errors from the
      underlying dma_map_sg calls.  This patch adds rollback in case
      of an error by simply calling dma_unmap_sg_chained for the ones
      that we've already mapped.
      
      All current callers ignore the return value so this should have
      no impact on them.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      6c94711c
  6. 16 6月, 2015 4 次提交
    • V
      crypto: caam - Provide correct value to iounmap() in controller driver · f4ec6aa5
      Victoria Milhoan 提交于
      Fix a "Trying to vfree() nonexistent vm area" error when unloading the CAAM
      controller module by providing the correct pointer value to iounmap().
      Signed-off-by: NVictoria Milhoan <vicki.milhoan@freescale.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      f4ec6aa5
    • V
      crypto: caam - Fix incorrect size when DMA unmapping buffer · 8af7b0f8
      Victoria Milhoan 提交于
      The CAAM driver uses two data buffers to store data for a hashing operation,
      with one buffer defined as active. This change forces switching of the
      active buffer when executing a hashing operation to avoid a later DMA unmap
      using the length of the opposite buffer.
      Signed-off-by: NVictoria Milhoan <vicki.milhoan@freescale.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      8af7b0f8
    • S
      crypto: caam - fix RNG buffer cache alignment · 412c98c1
      Steve Cornelius 提交于
      The hwrng output buffers (2) are cast inside of a a struct (caam_rng_ctx)
      allocated in one DMA-tagged region. While the kernel's heap allocator
      should place the overall struct on a cacheline aligned boundary, the 2
      buffers contained within may not necessarily align. Consenquently, the ends
      of unaligned buffers may not fully flush, and if so, stale data will be left
      behind, resulting in small repeating patterns.
      
      This fix aligns the buffers inside the struct.
      
      Note that not all of the data inside caam_rng_ctx necessarily needs to be
      DMA-tagged, only the buffers themselves require this. However, a fix would
      incur the expense of error-handling bloat in the case of allocation failure.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NSteve Cornelius <steve.cornelius@freescale.com>
      Signed-off-by: NVictoria Milhoan <vicki.milhoan@freescale.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      412c98c1
    • S
      crypto: caam - improve initalization for context state saves · 6fd4b156
      Steve Cornelius 提交于
      Multiple function in asynchronous hashing use a saved-state block,
      a.k.a. struct caam_hash_state, which holds a stash of information
      between requests (init/update/final). Certain values in this state
      block are loaded for processing using an inline-if, and when this
      is done, the potential for uninitialized data can pose conflicts.
      Therefore, this patch improves initialization of state data to
      prevent false assignments using uninitialized data in the state block.
      
      This patch addresses the following traceback, originating in
      ahash_final_ctx(), although a problem like this could certainly
      exhibit other symptoms:
      
      kernel BUG at arch/arm/mm/dma-mapping.c:465!
      Unable to handle kernel NULL pointer dereference at virtual address 00000000
      pgd = 80004000
      [00000000] *pgd=00000000
      Internal error: Oops: 805 [#1] PREEMPT SMP
      Modules linked in:
      CPU: 0    Not tainted  (3.0.15-01752-gdd441b9-dirty #40)
      PC is at __bug+0x1c/0x28
      LR is at __bug+0x18/0x28
      pc : [<80043240>]    lr : [<8004323c>]    psr: 60000013
      sp : e423fd98  ip : 60000013  fp : 0000001c
      r10: e4191b84  r9 : 00000020  r8 : 00000009
      r7 : 88005038  r6 : 00000001  r5 : 2d676572  r4 : e4191a60
      r3 : 00000000  r2 : 00000001  r1 : 60000093  r0 : 00000033
      Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
      Control: 10c53c7d  Table: 1000404a  DAC: 00000015
      Process cryptomgr_test (pid: 1306, stack limit = 0xe423e2f0)
      Stack: (0xe423fd98 to 0xe4240000)
      fd80:                                                       11807fd1 80048544
      fda0: 88005000 e4191a00 e5178040 8039dda0 00000000 00000014 2d676572 e4191008
      fdc0: 88005018 e4191a60 00100100 e4191a00 00000000 8039ce0c e423fea8 00000007
      fde0: e4191a00 e4227000 e5178000 8039ce18 e419183c 80203808 80a94a44 00000006
      fe00: 00000000 80207180 00000000 00000006 e423ff08 00000000 00000007 e5178000
      fe20: e41918a4 80a949b4 8c4844e2 00000000 00000049 74227000 8c4844e2 00000e90
      fe40: 0000000e 74227e90 ffff8c58 80ac29e0 e423fed4 8006a350 8c81625c e423ff5c
      fe60: 00008576 e4002500 00000003 00030010 e4002500 00000003 e5180000 e4002500
      fe80: e5178000 800e6d24 007fffff 00000000 00000010 e4001280 e4002500 60000013
      fea0: 000000d0 804df078 00000000 00000000 00000000 00000000 00000000 00000000
      fec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      fee0: 00000000 00000000 e4227000 e4226000 e4753000 e4752000 e40a5000 e40a4000
      ff00: e41e7000 e41e6000 00000000 00000000 00000000 e423ff14 e423ff14 00000000
      ff20: 00000400 804f9080 e5178000 e4db0b40 00000000 e4db0b80 0000047c 00000400
      ff40: 00000000 8020758c 00000400 ffffffff 0000008a 00000000 e4db0b40 80206e00
      ff60: e4049dbc 00000000 00000000 00000003 e423ffa4 80062978 e41a8bfc 00000000
      ff80: 00000000 e4049db4 00000013 e4049db0 00000013 00000000 00000000 00000000
      ffa0: e4db0b40 e4db0b40 80204cbc 00000013 00000000 00000000 00000000 80204cfc
      ffc0: e4049da0 80089544 80040a40 00000000 e4db0b40 00000000 00000000 00000000
      ffe0: e423ffe0 e423ffe0 e4049da0 800894c4 80040a40 80040a40 00000000 00000000
      [<80043240>] (__bug+0x1c/0x28) from [<80048544>] (___dma_single_dev_to_cpu+0x84)
      [<80048544>] (___dma_single_dev_to_cpu+0x84/0x94) from [<8039dda0>] (ahash_fina)
      [<8039dda0>] (ahash_final_ctx+0x180/0x428) from [<8039ce18>] (ahash_final+0xc/0)
      [<8039ce18>] (ahash_final+0xc/0x10) from [<80203808>] (crypto_ahash_op+0x28/0xc)
      [<80203808>] (crypto_ahash_op+0x28/0xc0) from [<80207180>] (test_hash+0x214/0x5)
      [<80207180>] (test_hash+0x214/0x5b8) from [<8020758c>] (alg_test_hash+0x68/0x8c)
      [<8020758c>] (alg_test_hash+0x68/0x8c) from [<80206e00>] (alg_test+0x7c/0x1b8)
      [<80206e00>] (alg_test+0x7c/0x1b8) from [<80204cfc>] (cryptomgr_test+0x40/0x48)
      [<80204cfc>] (cryptomgr_test+0x40/0x48) from [<80089544>] (kthread+0x80/0x88)
      [<80089544>] (kthread+0x80/0x88) from [<80040a40>] (kernel_thread_exit+0x0/0x8)
      Code: e59f0010 e1a01003 eb126a8d e3a03000 (e5833000)
      ---[ end trace d52a403a1d1eaa86 ]---
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NSteve Cornelius <steve.cornelius@freescale.com>
      Signed-off-by: NVictoria Milhoan <vicki.milhoan@freescale.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      6fd4b156
  7. 09 6月, 2015 1 次提交
    • H
      crypto: caam - Clamp AEAD SG list by input length · 70c3c8a9
      Herbert Xu 提交于
      Currently caam assumes that the SG list contains exactly the number
      of bytes required.  This assumption is incorrect.
      
      Up until now this has been harmless.  However with the new AEAD
      interface this now breaks as the AD SG list contains more bytes
      than just the AD.
      
      This patch fixes this by always clamping the AD SG list by the
      specified AD length.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      70c3c8a9
  8. 22 5月, 2015 1 次提交
  9. 13 5月, 2015 2 次提交
  10. 23 4月, 2015 1 次提交
  11. 09 3月, 2015 2 次提交
    • Y
      hwrng: caam - fix rng_unmap_ctx's DMA_UNMAP size problem · 4842234f
      Yanjiang Jin 提交于
      Fix rng_unmap_ctx's DMA_UNMAP size problem for caam_rng, else system would
      report the below calltrace during cleanup caam_rng.
      Since rng_create_sh_desc() creates a fixed descriptor of exactly 4
      command-lengths now, also update DESC_RNG_LEN to (4 * CAAM_CMD_SZ).
      
      caam_jr ffe301000.jr: DMA-API: device driver frees DMA memory with different size [device address=0x000000007f080010] [map size=16 bytes] [unmap size=40 bytes]
      ------------[ cut here ]------------
      WARNING: at lib/dma-debug.c:887
      Modules linked in:
      task: c0000000f7cdaa80 ti: c0000000e5340000 task.ti: c0000000e5340000
      NIP: c0000000004f5bc8 LR: c0000000004f5bc4 CTR: c0000000005f69b0
      REGS: c0000000e53433c0 TRAP: 0700   Not tainted
      MSR: 0000000080029000 <CE,EE,ME>  CR: 24088482  XER: 00000000
      SOFTE: 0
      
      GPR00: c0000000004f5bc4 c0000000e5343640 c0000000012af360 000000000000009f
      GPR04: 0000000000000000 00000000000000a0 c000000000d02070 c000000015980660
      GPR08: c000000000cff360 0000000000000000 0000000000000000 c0000000012da018
      GPR12: 00000000000001e3 c000000001fff780 00000000100f0000 0000000000000001
      GPR16: 0000000000000002 0000000000000000 0000000000000000 0000000000000000
      GPR20: 0000000000000000 0000000000000000 ffffffffffffffff 0000000000000001
      GPR24: 0000000000000001 0000000000000001 0000000000000000 0000000000000001
      GPR28: c000000001556b90 c000000001565b80 c0000000e5343750 c0000000f9427480
      NIP [c0000000004f5bc8] .check_unmap+0x538/0x9c0
      LR [c0000000004f5bc4] .check_unmap+0x534/0x9c0
      Call Trace:
      [c0000000e5343640] [c0000000004f5bc4] .check_unmap+0x534/0x9c0 (unreliable)
      [c0000000e53436e0] [c0000000004f60d4] .debug_dma_unmap_page+0x84/0xb0
      [c0000000e5343810] [c00000000082f9d4] .caam_cleanup+0x1d4/0x240
      [c0000000e53438a0] [c00000000056cc88] .hwrng_unregister+0xd8/0x1c0
      Instruction dump:
      7c641b78 41de0410 e8a90050 2fa50000 419e0484 e8de0028 e8ff0030 3c62ff90
      e91e0030 38638388 48546ed9 60000000 <0fe00000> 3c62ff8f 38637fc8 48546ec5
      ---[ end trace e43fd1734d6600df ]---
      Signed-off-by: NYanjiang Jin <yanjiang.jin@windriver.com>
      Acked-by: NKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      4842234f
    • Y
      crypto: caam - fix uninitialized edesc->sec4_sg_bytes field · 060e234e
      Yanjiang Jin 提交于
      sec4_sg_bytes not being properly initialized causes ahash_done
      to try to free unallocated DMA memory:
      
      caam_jr ffe301000.jr: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0xdeadbeefdeadbeef] [size=3735928559 bytes]
      ------------[ cut here ]------------
      WARNING: at lib/dma-debug.c:1093
      Modules linked in:
      CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.0.0-rc1+ #6
      task: e9598c00 ti: effca000 task.ti: e95a2000
      NIP: c04ef24c LR: c04ef24c CTR: c0549730
      REGS: effcbd40 TRAP: 0700   Not tainted  (4.0.0-rc1+)
      MSR: 00029002 <CE,EE,ME>  CR: 22008084  XER: 20000000
      
      GPR00: c04ef24c effcbdf0 e9598c00 00000096 c08f7424 c00ab2b0 00000000 00000001
      GPR08: c0fe7510 effca000 00000000 000001c3 22008082 00000000 c1048e77 c1050000
      GPR16: c0c36700 493c0040 0000002c e690e4a0 c1054fb4 c18bac40 00029002 c18b0788
      GPR24: 00000014 e690e480 effcbe48 00000000 c0fde128 e6ffac10 deadbeef deadbeef
      NIP [c04ef24c] check_unmap+0x93c/0xb40
      LR [c04ef24c] check_unmap+0x93c/0xb40
      Call Trace:
      [effcbdf0] [c04ef24c] check_unmap+0x93c/0xb40 (unreliable)
      [effcbe40] [c04ef4f4] debug_dma_unmap_page+0xa4/0xc0
      [effcbec0] [c070cda8] ahash_done+0x128/0x1a0
      [effcbef0] [c0700070] caam_jr_dequeue+0x1d0/0x290
      [effcbf40] [c0045f40] tasklet_action+0x110/0x1f0
      [effcbf80] [c0044bc8] __do_softirq+0x188/0x700
      [effcbfe0] [c00455d8] irq_exit+0x108/0x120
      [effcbff0] [c000f520] call_do_irq+0x24/0x3c
      [e95a3e20] [c00059b8] do_IRQ+0xc8/0x170
      [e95a3e50] [c0011bc8] ret_from_except+0x0/0x18
      Signed-off-by: NYanjiang Jin <yanjiang.jin@windriver.com>
      Acked-by: NKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      060e234e
  12. 26 1月, 2015 6 次提交
  13. 17 11月, 2014 1 次提交
  14. 12 11月, 2014 1 次提交
  15. 06 11月, 2014 8 次提交
  16. 24 10月, 2014 2 次提交