1. 26 May, 2018 3 commits
  2. 18 May, 2018 11 commits
  3. 11 May, 2018 12 commits
  4. 05 May, 2018 9 commits
  5. 28 Apr, 2018 5 commits
    • Christian Lamparter's avatar
      crypto: crypto4xx - put temporary dst sg into request ctx · 658c9d2b
      Christian Lamparter authored
      This patch fixes a crash that happens when testing rfc4543(gcm(aes))
      
      Unable to handle kernel paging request for data at address 0xf59b3420
      Faulting instruction address: 0xc0012994
      Oops: Kernel access of bad area, sig: 11 [#1]
      BE PowerPC 44x Platform
      Modules linked in: tcrypt(+) crypto4xx [...]
      CPU: 0 PID: 0 Comm: swapper Tainted: G           O      4.17.0-rc1+ #23
      NIP:  c0012994 LR: d3077934 CTR: 06026d49
      REGS: cfff7e30 TRAP: 0300   Tainted: G           O       (4.17.0-rc1+)
      MSR:  00029000 <CE,EE,ME>  CR: 44744822  XER: 00000000
      DEAR: f59b3420 ESR: 00000000
      NIP [c0012994] __dma_sync+0x58/0x10c
      LR [d3077934] crypto4xx_bh_tasklet_cb+0x188/0x3c8 [crypto4xx]
      
      __dma_sync was fed the temporary _dst that crypto4xx_build_pd()
      had in it's function stack. This clearly never worked.
      This patch therefore overhauls the code from the original driver
      and puts the temporary dst sg list into aead's request context.
      
      Fixes: a0aae821 ("crypto: crypto4xx - prepare for AEAD support")
      Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      658c9d2b
    • Christian Lamparter's avatar
      crypto: crypto4xx - extend aead fallback checks · 584201f1
      Christian Lamparter authored
      1020 bytes is the limit for associated data. Any more
      and it will no longer fit into hash_crypto_offset anymore.
      
      The hardware will not process aead requests with plaintext
      that have less than AES_BLOCK_SIZE bytes. When decrypting
      aead requests the authsize has to be taken in account as
      well, as it is part of the cryptlen. Otherwise the hardware
      will think it has been misconfigured and will return:
      
      aead return err status = 0x98
      
      For rtc4543(gcm(aes)), the hardware has a dedicated GMAC
      mode as part of the hash function set.
      Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      584201f1
    • Christian Lamparter's avatar
      crypto: crypto4xx - properly set IV after de- and encrypt · fc340115
      Christian Lamparter authored
      This patch fixes cts(cbc(aes)) test when cbc-aes-ppc4xx is used.
      alg: skcipher: Test 1 failed (invalid result) on encryption for cts(cbc-aes-ppc4xx)
      00000000: 4b 10 75 fc 2f 14 1b 6a 27 35 37 33 d1 b7 70 05
      00000010: 97
      alg: skcipher: Failed to load transform for cts(cbc(aes)): -2
      
      The CTS cipher mode expect the IV (req->iv) of skcipher_request
      to contain the last ciphertext block after the {en,de}crypt
      operation is complete.
      
      Fix this issue for the AMCC Crypto4xx hardware engine.
      The tcrypt test case for cts(cbc(aes)) is now correctly passed.
      
      name         : cts(cbc(aes))
      driver       : cts(cbc-aes-ppc4xx)
      module       : cts
      priority     : 300
      refcnt       : 1
      selftest     : passed
      internal     : no
      type         : skcipher
      async        : yes
      blocksize    : 16
      min keysize  : 16
      max keysize  : 32
      ivsize       : 16
      chunksize    : 16
      walksize     : 16
      Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      fc340115
    • Christian Lamparter's avatar
      crypto: crypto4xx - add aes-ctr support · 98e87e3d
      Christian Lamparter authored
      This patch adds support for the aes-ctr skcipher.
      
      name         : ctr(aes)
      driver       : ctr-aes-ppc4xx
      module       : crypto4xx
      priority     : 300
      refcnt       : 1
      selftest     : passed
      internal     : no
      type         : skcipher
      async        : yes
      blocksize    : 16
      min keysize  : 16
      max keysize  : 32
      ivsize       : 16
      chunksize    : 16
      walksize     : 16
      
      The hardware uses only the last 32-bits as the counter while the
      kernel tests (aes_ctr_enc_tv_template[4] for example) expect that
      the whole IV is a counter. To make this work, the driver will
      fallback if the counter is going to overlow.
      
      The aead's crypto4xx_setup_fallback() function is renamed to
      crypto4xx_aead_setup_fallback.
      Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      98e87e3d
    • Christian Lamparter's avatar
      crypto: crypto4xx - avoid VLA use · c4e90650
      Christian Lamparter authored
      This patch fixes some of the -Wvla warnings.
      
      crypto4xx_alg.c:83:19: warning: Variable length array is used.
      crypto4xx_alg.c:273:56: warning: Variable length array is used.
      crypto4xx_alg.c:380:32: warning: Variable length array is used.
      Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c4e90650