1. 17 Mar, 2015 1 commit
    • Andre Wolokita's avatar
      hwrng: omap - Change RNG_CONFIG_REG to RNG_CONTROL_REG when checking and disabling TRNG · 1a5addfe
      Andre Wolokita authored
      In omap4_rng_init(), a check of bit 10 of the RNG_CONFIG_REG is done to determine
      whether the RNG is running. This is suspicious firstly due to the use of
      RNG_CONTROL_ENABLE_TRNG_MASK and secondly because the same mask is written to
      RNG_CONTROL_REG after configuration of the FROs. Similar suspicious logic is
      repeated in omap4_rng_cleanup() when RNG_CONTROL_REG masked with
      RNG_CONTROL_ENABLE_TRNG_MASK is read, the same mask bit is cleared, and then
      written to RNG_CONFIG_REG. Unless the TRNG is enabled with one bit in RNG_CONTROL
      and disabled with another in RNG_CONFIG and these bits are mirrored in some way,
      I believe that the TRNG is not really shutting off.
      
      Apart from the strange logic, I have reason to suspect that the OMAP4 related
      code in this driver is driving an Inside Secure IP hardware RNG and strongly
      suspect that bit 10 of RNG_CONFIG_REG is one of the bits configuring the
      sampling rate of the FROs. This option is by default set to 0 and is not being
      set anywhere in omap-rng.c. Reading this bit during omap4_rng_init() will
      always return 0. It will remain 0 because ~(value of TRNG_MASK in control) will
      always be 0, because the TRNG is never shut off. This is of course presuming
      that the OMAP4 features the Inside Secure IP.
      
      I'm interested in knowing what the guys at TI think about this, as only they
      can confirm or deny the detailed structure of these registers.
      Signed-off-by: default avatarAndre Wolokita <Andre.Wolokita@analog.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      1a5addfe
  2. 16 Mar, 2015 10 commits
  3. 13 Mar, 2015 2 commits
  4. 12 Mar, 2015 7 commits
  5. 11 Mar, 2015 6 commits
    • Dmitry Torokhov's avatar
      crypto: amcc - remove incorrect __init/__exit markups · 1eb8a1b3
      Dmitry Torokhov authored
      Even if bus is not hot-pluggable, the devices can be bound and unbound
      from the driver via sysfs, so we should not be using __init/__exit
      annotations on probe() and remove() methods. The only exception is
      drivers registered with platform_driver_probe() which specifically
      disables sysfs bind/unbind attributes.
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      1eb8a1b3
    • Dmitry Torokhov's avatar
      crypto: qat - remove incorrect __exit markup · 83ce01d2
      Dmitry Torokhov authored
      PCI bus is hot-pluggable, and even if it wasn't one can still unbind the
      device from driver via sysfs, so we should not make driver's remove
      method as __exit.
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      83ce01d2
    • Dmitry Torokhov's avatar
      hwrng: pseries - remove incorrect __init/__exit markups · 257bedd4
      Dmitry Torokhov authored
      Even if bus is not hot-pluggable, the devices can be unbound from the
      driver via sysfs, so we should not be using __exit annotations on
      remove() methods. The only exception is drivers registered with
      platform_driver_probe() which specifically disables sysfs bind/unbind
      attributes.
      
      Similarly probe() methods should not be marked __init unless
      platform_driver_probe() is used.
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      257bedd4
    • Dmitry Torokhov's avatar
      hwrng: octeon - remove incorrect __exit markups · 87094a04
      Dmitry Torokhov authored
      Even if bus is not hot-pluggable, the devices can be unbound from the
      driver via sysfs, so we should not be using __exit annotations on
      remove() methods. The only exception is drivers registered with
      platform_driver_probe() which specifically disables sysfs bind/unbind
      attributes
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      87094a04
    • Dmitry Torokhov's avatar
      hwrng: omap - remove incorrect __exit markups · 1ee9b5e4
      Dmitry Torokhov authored
      Even if bus is not hot-pluggable, the devices can be unbound from the
      driver via sysfs, so we should not be using __exit annotations on
      remove() methods. The only exception is drivers registered with
      platform_driver_probe() which specifically disables sysfs bind/unbind
      attributes.
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      1ee9b5e4
    • Horia Geant?'s avatar
      crypto: tcrypt - fix uninit sg entries in test_acipher_speed · 007ee8de
      Horia Geant? authored
      Commit 5be4d4c9 ("crypto: replace scatterwalk_sg_next with sg_next")
      did not consider the fact that scatterwalk_sg_next() was looking at
      sg entry length, while sg_next() looks at the "chained" sg bit.
      
      This should have no effect in theory. However in practice, there are
      cases where the sg table is initialized to a number of entries and
      some of them are not properly configured. While scatterwalk_sg_next()
      would have returned NULL (since sg length = 0 and sg page_link = 0),
      sg_next() happily returns the next unconfigured sg entry.
      
      insmod tcrypt.ko mode=500 sec=1
      
      testing speed of async cbc(aes) (cbc-aes-talitos) encryption
      test 0 (128 bit key, 16 byte blocks):
      Unable to handle kernel paging request for data at address 0x00000000
      Faulting instruction address: 0xc00d79e4
      Oops: Kernel access of bad area, sig: 11 [#1]
      SMP NR_CPUS=8 P1022 DS
      Modules linked in: tcrypt(+) talitos
      CPU: 0 PID: 2670 Comm: insmod Not tainted 4.0.0-rc1-QorIQ-SDK-V1.6+g904f1ca82209 #1
      task: e8de3200 ti: e70bc000 task.ti: e70bc000
      NIP: c00d79e4 LR: f92d223c CTR: c00d79c8
      REGS: e70bda00 TRAP: 0300   Not tainted  (4.0.0-rc1-QorIQ-SDK-V1.6+g904f1ca82209)
      MSR: 00029000 <CE,EE,ME>  CR: 84428f22  XER: 00000000
      DEAR: 00000000 ESR: 00000000
      GPR00: f92d223c e70bdab0 e8de3200 00000000 e70bdbb8 00000001 00000000 00000000
      GPR08: 00000000 00000000 c08b0380 27282010 c00d79c8 1003a634 00000000 e70bdf1c
      GPR16: e70bdef0 00000020 00000000 c08c0000 00000010 00000000 e70bdbb8 00000010
      GPR24: e976d3a8 00000010 00000000 e70bdbd8 e8961010 00000001 c086e560 00000000
      NIP [c00d79e4] page_address+0x1c/0x110
      LR [f92d223c] talitos_map_sg+0x130/0x184 [talitos]
      Call Trace:
      [e70bdab0] [00000010] 0x10 (unreliable)
      [e70bdad0] [f92d223c] talitos_map_sg+0x130/0x184 [talitos]
      [e70bdb00] [f92d30d8] common_nonsnoop.constprop.13+0xc0/0x304 [talitos]
      [e70bdb30] [f933fd90] test_acipher_speed+0x434/0x7dc [tcrypt]
      [e70bdcc0] [f934318c] do_test+0x2478/0x306c [tcrypt]
      [e70bdd80] [f11fe058] tcrypt_mod_init+0x58/0x100 [tcrypt]
      [e70bdda0] [c0002354] do_one_initcall+0x90/0x1f4
      [e70bde10] [c061fe00] do_init_module+0x60/0x1ac
      [e70bde30] [c00a79f0] load_module+0x185c/0x1f88
      [e70bdee0] [c00a82b0] SyS_finit_module+0x7c/0x98
      [e70bdf40] [c000e8b0] ret_from_syscall+0x0/0x3c
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      007ee8de
  6. 10 Mar, 2015 7 commits
  7. 09 Mar, 2015 7 commits
    • Kim Phillips's avatar
      crypto: powerpc - move files to fix build error · 3265c4ba
      Kim Phillips authored
      The current cryptodev-2.6 tree commits:
      
      d9850fc5 ("crypto: powerpc/sha1 - kernel config")
      50ba29aa ("crypto: powerpc/sha1 - glue")
      
      failed to properly place files under arch/powerpc/crypto, which
      leads to build errors:
      
      make[1]: *** No rule to make target 'arch/powerpc/crypto/sha1-spe-asm.o', needed by 'arch/powerpc/crypto/sha1-ppc-spe.o'.  Stop.
      make[1]: *** No rule to make target 'arch/powerpc/crypto/sha1_spe_glue.o', needed by 'arch/powerpc/crypto/sha1-ppc-spe.o'.  Stop.
      Makefile:947: recipe for target 'arch/powerpc/crypto' failed
      
      Move the two sha1 spe files under crypto/, and whilst there, rename
      other powerpc crypto files with underscores to use dashes for
      consistency.
      
      Cc: Markus Stockhausen <stockhausen@collogia.de>
      Signed-off-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      3265c4ba
    • Feng Kan's avatar
      hwrng: xgene - add ACPI support for APM X-Gene RNG unit · a508412b
      Feng Kan authored
      This adds ACPI support for APM X-Gene RNG unit.
      Signed-off-by: default avatarFeng Kan <fkan@apm.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      a508412b
    • Stephan Mueller's avatar
      MAINTAINERS: add crypto-API.tmpl · 2ca87a17
      Stephan Mueller authored
      The file Documentation/DocBook/crypto-API.tmpl documents the kernel
      crypto API and is maintained.
      Signed-off-by: default avatarStephan Mueller <smueller@chronox.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2ca87a17
    • Stephan Mueller's avatar
      crypto: doc - AEAD / RNG AF_ALG interface · dbe5fe7e
      Stephan Mueller authored
      The patch moves the information provided in
      Documentation/crypto/crypto-API-userspace.txt into a separate chapter in
      the kernel crypto API DocBook. Some corrections are applied (such as
      removing a reference to Netlink when the AF_ALG socket is referred to).
      
      In addition, the AEAD and RNG interface description is now added.
      
      Also, a brief description of the zero-copy interface with an example
      code snippet is provided.
      Signed-off-by: default avatarStephan Mueller <smueller@chronox.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      dbe5fe7e
    • Stephan Mueller's avatar
      crypto: rng - RNGs must return 0 in success case · cde001e4
      Stephan Mueller authored
      Change the RNGs to always return 0 in success case.
      
      This patch ensures that seqiv.c works with RNGs other than krng. seqiv
      expects that any return code other than 0 is an error. Without the
      patch, rfc4106(gcm(aes)) will not work when using a DRBG or an ANSI
      X9.31 RNG.
      Signed-off-by: default avatarStephan Mueller <smueller@chronox.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      cde001e4
    • Yanjiang Jin's avatar
      hwrng: caam - fix rng_unmap_ctx's DMA_UNMAP size problem · 4842234f
      Yanjiang Jin authored
      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: default avatarYanjiang Jin <yanjiang.jin@windriver.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      4842234f
    • Yanjiang Jin's avatar
      crypto: caam - fix uninitialized edesc->sec4_sg_bytes field · 060e234e
      Yanjiang Jin authored
      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: default avatarYanjiang Jin <yanjiang.jin@windriver.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      060e234e