1. 03 Jul, 2020 5 commits
    • John Allen's avatar
      crypto: ccp - Fix use of merged scatterlists · 8a302808
      John Allen authored
      Running the crypto manager self tests with
      CONFIG_CRYPTO_MANAGER_EXTRA_TESTS may result in several types of errors
      when using the ccp-crypto driver:
      
      alg: skcipher: cbc-des3-ccp encryption failed on test vector 0; expected_error=0, actual_error=-5 ...
      
      alg: skcipher: ctr-aes-ccp decryption overran dst buffer on test vector 0 ...
      
      alg: ahash: sha224-ccp test failed (wrong result) on test vector ...
      
      These errors are the result of improper processing of scatterlists mapped
      for DMA.
      
      Given a scatterlist in which entries are merged as part of mapping the
      scatterlist for DMA, the DMA length of a merged entry will reflect the
      combined length of the entries that were merged. The subsequent
      scatterlist entry will contain DMA information for the scatterlist entry
      after the last merged entry, but the non-DMA information will be that of
      the first merged entry.
      
      The ccp driver does not take this scatterlist merging into account. To
      address this, add a second scatterlist pointer to track the current
      position in the DMA mapped representation of the scatterlist. Both the DMA
      representation and the original representation of the scatterlist must be
      tracked as while most of the driver can use just the DMA representation,
      scatterlist_map_and_copy() must use the original representation and
      expects the scatterlist pointer to be accurate to the original
      representation.
      
      In order to properly walk the original scatterlist, the scatterlist must
      be walked until the combined lengths of the entries seen is equal to the
      DMA length of the current entry being processed in the DMA mapped
      representation.
      
      Fixes: 63b94509 ("crypto: ccp - CCP device driver and interface support")
      Signed-off-by: default avatarJohn Allen <john.allen@amd.com>
      Cc: stable@vger.kernel.org
      Acked-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      8a302808
    • Sivaprakash Murugesan's avatar
      crypto: qce/sha - Do not modify scatterlist passed along with request · df12ef60
      Sivaprakash Murugesan authored
      Crypto test driver's test_ahash_speed calls crypto_ahash_update and
      crypto_ahash_final APIs repeatedly for all the available test vector
      buffer lengths.
      
      if we mark the end for scatterlist based on the current vector size then
      the subsequent vectors might fail if the later buffer lengths are higher.
      
      To avoid this, in qce do not mark the end of scatterlist in update API,
      the qce_ahash_async_req_handle API already takes care of this copying
      right amount of buffer from the request scatter list.
      Signed-off-by: default avatarSivaprakash Murugesan <sivaprak@codeaurora.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      df12ef60
    • Sivaprakash Murugesan's avatar
      crypto: qce - re-initialize context on import · a668ee56
      Sivaprakash Murugesan authored
      crypto testmgr deliberately corrupts the request context while passing
      vectors to the import. This is to make sure that drivers do not rely on
      request but they take all the necessary input from io vec passed to it.
      
      qce casts the request context from request parameter, since it is corrupted
      the sub squent hash request fails and qce hangs.
      
      To avoid this re-initialize request context on import. The qce import
      API alreasy takes care of taking the input vectors from passed io vec.
      Signed-off-by: default avatarSivaprakash Murugesan <sivaprak@codeaurora.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      a668ee56
    • Sivaprakash Murugesan's avatar
      crypto: qce - support zero length test vectors · 8ac1b9cc
      Sivaprakash Murugesan authored
      crypto test module passes zero length vectors as test input to sha-1 and
      sha-256. To provide correct output for these vectors, hash zero support
      has been added as in other crypto drivers.
      Signed-off-by: default avatarSivaprakash Murugesan <sivaprak@codeaurora.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      8ac1b9cc
    • Dinghao Liu's avatar
      crypto: sun8i-ce - Fix runtime PM imbalance in sun8i_ce_cipher_init · 5c3a8a66
      Dinghao Liu authored
      pm_runtime_get_sync() increments the runtime PM usage counter even
      the call returns an error code. Thus a corresponding decrement is
      needed on the error handling path to keep the counter balanced.
      
      Fix this by adding the missed function call.
      Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      5c3a8a66
  2. 26 Jun, 2020 12 commits
  3. 18 Jun, 2020 22 commits
  4. 15 Jun, 2020 1 commit