1. 30 May, 2018 10 commits
    • Horia Geantă's avatar
      crypto: caam/qi - fix warning in init_cgr() · d9c35771
      Horia Geantă authored
      Coverity warns about an
      "Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)"
      when computing the congestion threshold value.
      
      Even though it is highly unlikely for an overflow to happen,
      use this as an opportunity to simplify the code.
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      d9c35771
    • Horia Geantă's avatar
      crypto: caam - fix rfc4543 descriptors · b2106476
      Horia Geantă authored
      In some cases the CCB DMA-based internal transfer started by the MOVE
      command (src=M3 register, dst=descriptor buffer) does not finish
      in time and DECO executes the unpatched descriptor.
      This leads eventually to a DECO Watchdog Timer timeout error.
      
      To make sure the transfer ends, change the MOVE command to be blocking.
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      b2106476
    • Horia Geantă's avatar
      crypto: caam - fix MC firmware detection · 06d44c91
      Horia Geantă authored
      Management Complex (MC) f/w detection is based on CTPR_MS[DPAA2] bit.
      
      This is incorrect since:
      -the bit is set for all CAAM blocks integrated in SoCs with a certain
      Layerscape Chassis
      -some SoCs with LS Chassis don't have an MC block (thus no MC f/w)
      
      To fix this, MC f/w detection will be based on the presence of
      "fsl,qoriq-mc" compatible string in the device tree.
      
      Fixes: 297b9ceb ("crypto: caam/jr - add support for DPAA2 parts")
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      06d44c91
    • Adam Langley's avatar
      crypto: clarify licensing of OpenSSL asm code · c2e415fe
      Adam Langley authored
      Several source files have been taken from OpenSSL. In some of them a
      comment that "permission to use under GPL terms is granted" was
      included below a contradictory license statement. In several cases,
      there was no indication that the license of the code was compatible
      with the GPLv2.
      
      This change clarifies the licensing for all of these files. I've
      confirmed with the author (Andy Polyakov) that a) he has licensed the
      files with the GPLv2 comment under that license and b) that he's also
      happy to license the other files under GPLv2 too. In one case, the
      file is already contained in his CRYPTOGAMS bundle, which has a GPLv2
      option, and so no special measures are needed.
      
      In all cases, the license status of code has been clarified by making
      the GPLv2 license prominent.
      
      The .S files have been regenerated from the updated .pl files.
      
      This is a comment-only change. No code is changed.
      Signed-off-by: default avatarAdam Langley <agl@chromium.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c2e415fe
    • Ondrej Mosnacek's avatar
      crypto: morus - Mark MORUS SIMD glue as x86-specific · 2808f173
      Ondrej Mosnacek authored
      Commit 56e8e57f ("crypto: morus - Add common SIMD glue code for
      MORUS") accidetally consiedered the glue code to be usable by different
      architectures, but it seems to be only usable on x86.
      
      This patch moves it under arch/x86/crypto and adds 'depends on X86' to
      the Kconfig options and also removes the prompt to hide these internal
      options from the user.
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarOndrej Mosnacek <omosnacek@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2808f173
    • Eric Biggers's avatar
      crypto: testmgr - eliminate redundant decryption test vectors · 92a4c9fe
      Eric Biggers authored
      Currently testmgr has separate encryption and decryption test vectors
      for symmetric ciphers.  That's massively redundant, since with few
      exceptions (mostly mistakes, apparently), all decryption tests are
      identical to the encryption tests, just with the input/result flipped.
      
      Therefore, eliminate the redundancy by removing the decryption test
      vectors and updating testmgr to test both encryption and decryption
      using what used to be the encryption test vectors.  Naming is adjusted
      accordingly: each cipher_testvec now has a 'ptext' (plaintext), 'ctext'
      (ciphertext), and 'len' instead of an 'input', 'result', 'ilen', and
      'rlen'.  Note that it was always the case that 'ilen == rlen'.
      
      AES keywrap ("kw(aes)") is special because its IV is generated by the
      encryption.  Previously this was handled by specifying 'iv_out' for
      encryption and 'iv' for decryption.  To make it work cleanly with only
      one set of test vectors, put the IV in 'iv', remove 'iv_out', and add a
      boolean that indicates that the IV is generated by the encryption.
      
      In total, this removes over 10000 lines from testmgr.h, with no
      reduction in test coverage since prior patches already copied the few
      unique decryption test vectors into the encryption test vectors.
      
      This covers all algorithms that used 'struct cipher_testvec', e.g. any
      block cipher in the ECB, CBC, CTR, XTS, LRW, CTS-CBC, PCBC, OFB, or
      keywrap modes, and Salsa20 and ChaCha20.  No change is made to AEAD
      tests, though we probably can eliminate a similar redundancy there too.
      
      The testmgr.h portion of this patch was automatically generated using
      the following awk script, with some slight manual fixups on top (updated
      'struct cipher_testvec' definition, updated a few comments, and fixed up
      the AES keywrap test vectors):
      
          BEGIN { OTHER = 0; ENCVEC = 1; DECVEC = 2; DECVEC_TAIL = 3; mode = OTHER }
      
          /^static const struct cipher_testvec.*_enc_/ { sub("_enc", ""); mode = ENCVEC }
          /^static const struct cipher_testvec.*_dec_/ { mode = DECVEC }
          mode == ENCVEC && !/\.ilen[[:space:]]*=/ {
          	sub(/\.input[[:space:]]*=$/,    ".ptext =")
          	sub(/\.input[[:space:]]*=/,     ".ptext\t=")
          	sub(/\.result[[:space:]]*=$/,   ".ctext =")
          	sub(/\.result[[:space:]]*=/,    ".ctext\t=")
          	sub(/\.rlen[[:space:]]*=/,      ".len\t=")
          	print
          }
          mode == DECVEC_TAIL && /[^[:space:]]/ { mode = OTHER }
          mode == OTHER                         { print }
          mode == ENCVEC && /^};/               { mode = OTHER }
          mode == DECVEC && /^};/               { mode = DECVEC_TAIL }
      
      Note that git's default diff algorithm gets confused by the testmgr.h
      portion of this patch, and reports too many lines added and removed.
      It's better viewed with 'git diff --minimal' (or 'git show --minimal'),
      which reports "2 files changed, 919 insertions(+), 11723 deletions(-)".
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      92a4c9fe
    • Eric Biggers's avatar
      crypto: testmgr - add extra kw(aes) encryption test vector · 4074a77d
      Eric Biggers authored
      One "kw(aes)" decryption test vector doesn't exactly match an encryption
      test vector with input and result swapped.  In preparation for removing
      the decryption test vectors, add this test vector to the encryption test
      vectors, so we don't lose any test coverage.
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      4074a77d
    • Eric Biggers's avatar
      crypto: testmgr - add extra ecb(tnepres) encryption test vectors · a0e20b9b
      Eric Biggers authored
      None of the four "ecb(tnepres)" decryption test vectors exactly match an
      encryption test vector with input and result swapped.  In preparation
      for removing the decryption test vectors, add these to the encryption
      test vectors, so we don't lose any test coverage.
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      a0e20b9b
    • Eric Biggers's avatar
      crypto: testmgr - make an cbc(des) encryption test vector chunked · 17880f11
      Eric Biggers authored
      One "cbc(des)" decryption test vector doesn't exactly match an
      encryption test vector with input and result swapped.  It's *almost* the
      same as one, but the decryption version is "chunked" while the
      encryption version is "unchunked".  In preparation for removing the
      decryption test vectors, make the encryption one both chunked and
      unchunked, so we don't lose any test coverage.
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      17880f11
    • Eric Biggers's avatar
      crypto: testmgr - add extra ecb(des) encryption test vectors · 097012e8
      Eric Biggers authored
      Two "ecb(des)" decryption test vectors don't exactly match any of the
      encryption test vectors with input and result swapped.  In preparation
      for removing the decryption test vectors, add these to the encryption
      test vectors, so we don't lose any test coverage.
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      097012e8
  2. 26 May, 2018 19 commits
  3. 18 May, 2018 11 commits