1. 09 Nov, 2018 1 commit
  2. 04 Sep, 2018 2 commits
  3. 22 Feb, 2018 1 commit
    • Eric Biggers's avatar
      crypto: arm/speck - add NEON-accelerated implementation of Speck-XTS · ede96221
      Eric Biggers authored
      Add an ARM NEON-accelerated implementation of Speck-XTS.  It operates on
      128-byte chunks at a time, i.e. 8 blocks for Speck128 or 16 blocks for
      Speck64.  Each 128-byte chunk goes through XTS preprocessing, then is
      encrypted/decrypted (doing one cipher round for all the blocks, then the
      next round, etc.), then goes through XTS postprocessing.
      The performance depends on the processor but can be about 3 times faster
      than the generic code.  For example, on an ARMv7 processor we observe
      the following performance with Speck128/256-XTS:
          xts-speck128-neon:     Encryption 107.9 MB/s, Decryption 108.1 MB/s
          xts(speck128-generic): Encryption  32.1 MB/s, Decryption  36.6 MB/s
      In comparison to AES-256-XTS without the Cryptography Extensions:
          xts-aes-neonbs:        Encryption  41.2 MB/s, Decryption  36.7 MB/s
          xts(aes-asm):          Encryption  31.7 MB/s, Decryption  30.8 MB/s
          xts(aes-generic):      Encryption  21.2 MB/s, Decryption  20.9 MB/s
      Speck64/128-XTS is even faster:
          xts-speck64-neon:      Encryption 138.6 MB/s, Decryption 139.1 MB/s
      Note that as with the generic code, only the Speck128 and Speck64
      variants are supported.  Also, for now only the XTS mode of operation is
      supported, to target the disk and file encryption use cases.  The NEON
      code also only handles the portion of the data that is evenly divisible
      into 128-byte chunks, with any remainder handled by a C fallback.  Of
      course, other modes of operation could be added later if needed, and/or
      the NEON code could be updated to handle other buffer sizes.
      The XTS specification is only defined for AES which has a 128-bit block
      size, so for the GF(2^64) math needed for Speck64-XTS we use the
      reducing polynomial 'x^64 + x^4 + x^3 + x + 1' given by the original XEX
      paper.  Of course, when possible users should use Speck128-XTS, but even
      that may be too slow on some processors; Speck64-XTS can be faster.
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  4. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      How this work was done:
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
      All documentation files were explicitly excluded.
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
         For non */uapi/* files that summary was:
         SPDX license identifier                            # files
         GPL-2.0                                              11139
         and resulted in the first patch in this series.
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
         SPDX license identifier                            # files
         GPL-2.0 WITH Linux-syscall-note                        930
         and resulted in the second patch in this series.
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
         SPDX license identifier                            # files
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
         and that resulted in the third patch in this series.
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
  5. 04 Aug, 2017 1 commit
  6. 09 Mar, 2017 1 commit
    • Ard Biesheuvel's avatar
      crypto: arm/aes-neonbs - resolve fallback cipher at runtime · b56f5cbc
      Ard Biesheuvel authored
      Currently, the bit sliced NEON AES code for ARM has a link time
      dependency on the scalar ARM asm implementation, which it uses as a
      fallback to perform CBC encryption and the encryption of the initial
      XTS tweak.
      The bit sliced NEON code is both fast and time invariant, which makes
      it a reasonable default on hardware that supports it. However, the
      ARM asm code it pulls in is not time invariant, and due to the way it
      is linked in, cannot be overridden by the new generic time invariant
      driver. In fact, it will not be used at all, given that the ARM asm
      code registers itself as a cipher with a priority that exceeds the
      priority of the fixed time cipher.
      So remove the link time dependency, and allocate the fallback cipher
      via the crypto API. Note that this requires this driver's module_init
      call to be replaced with late_initcall, so that the (possibly generic)
      fallback cipher is guaranteed to be available when the builtin test
      is performed at registration time.
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  7. 13 Jan, 2017 1 commit
    • Ard Biesheuvel's avatar
      crypto: arm/aes - replace bit-sliced OpenSSL NEON code · cc477bf6
      Ard Biesheuvel authored
      This replaces the unwieldy generated implementation of bit-sliced AES
      in CBC/CTR/XTS modes that originated in the OpenSSL project with a
      new version that is heavily based on the OpenSSL implementation, but
      has a number of advantages over the old version:
      - it does not rely on the scalar AES cipher that also originated in the
        OpenSSL project and contains redundant lookup tables and key schedule
        generation routines (which we already have in crypto/aes_generic.)
      - it uses the same expanded key schedule for encryption and decryption,
        reducing the size of the per-key data structure by 1696 bytes
      - it adds an implementation of AES in ECB mode, which can be wrapped by
        other generic chaining mode implementations
      - it moves the handling of corner cases that are non critical to performance
        to the glue layer written in C
      - it was written directly in assembler rather than generated from a Perl
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  8. 12 Jan, 2017 2 commits
  9. 28 Dec, 2016 1 commit
  10. 27 Dec, 2016 1 commit
  11. 07 Dec, 2016 2 commits
  12. 30 Nov, 2016 1 commit
  13. 29 Nov, 2016 1 commit
  14. 11 May, 2015 1 commit
    • Ard Biesheuvel's avatar
      crypto: arm/sha512 - accelerated SHA-512 using ARM generic ASM and NEON · c80ae7ca
      Ard Biesheuvel authored
      This replaces the SHA-512 NEON module with the faster and more
      versatile implementation from the OpenSSL project. It consists
      of both a NEON and a generic ASM version of the core SHA-512
      transform, where the NEON version reverts to the ASM version
      when invoked in non-process context.
      This patch is based on the OpenSSL upstream version b1a5d1c65208
      of sha512-armv4.pl, which can be found here:
      Performance relative to the generic implementation (measured
      using tcrypt.ko mode=306 sec=1 running on a Cortex-A57 under
        input size	block size	asm	neon	old neon
        16		16		1.39	2.54	2.21
        64		16		1.32	2.33	2.09
        64		64		1.38	2.53	2.19
        256		16		1.31	2.28	2.06
        256		64		1.38	2.54	2.25
        256		256		1.40	2.77	2.39
        1024		16		1.29	2.22	2.01
        1024		256		1.40	2.82	2.45
        1024		1024		1.41	2.93	2.53
        2048		16		1.33	2.21	2.00
        2048		256		1.40	2.84	2.46
        2048		1024		1.41	2.96	2.55
        2048		2048		1.41	2.98	2.56
        4096		16		1.34	2.20	1.99
        4096		256		1.40	2.84	2.46
        4096		1024		1.41	2.97	2.56
        4096		4096		1.41	3.01	2.58
        8192		16		1.34	2.19	1.99
        8192		256		1.40	2.85	2.47
        8192		1024		1.41	2.98	2.56
        8192		4096		1.41	2.71	2.59
        8192		8192		1.51	3.51	2.69
      Acked-by: default avatarJussi Kivilinna <jussi.kivilinna@iki.fi>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  15. 13 Apr, 2015 1 commit
    • Arnd Bergmann's avatar
      crypto: arm/sha256 - avoid sha256 code on ARMv7-M · b48321de
      Arnd Bergmann authored
      The sha256 assembly implementation can deal with all architecture levels
      from ARMv4 to ARMv7-A, but not with ARMv7-M. Enabling it in an
      ARMv7-M kernel results in this build failure:
      arm-linux-gnueabi-ld: error: arch/arm/crypto/sha256_glue.o: Conflicting architecture profiles M/A
      arm-linux-gnueabi-ld: failed to merge target specific data of file arch/arm/crypto/sha256_glue.o
      This adds a Kconfig dependency to prevent the code from being disabled
      for ARMv7-M.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  16. 10 Apr, 2015 2 commits
  17. 03 Apr, 2015 1 commit
    • Sami Tolvanen's avatar
      crypto: arm/sha256 - Add optimized SHA-256/224 · f2f770d7
      Sami Tolvanen authored
      Add Andy Polyakov's optimized assembly and NEON implementations for
      The sha256-armv4.pl script for generating the assembly code is from
      OpenSSL commit 51f8d095562f36cdaa6893597b5c609e943b0565.
      Compared to sha256-generic these implementations have the following
      tcrypt speed improvements on Motorola Nexus 6 (Snapdragon 805):
        bs    b/u      sha256-neon  sha256-asm
        16    16       x1.32        x1.19
        64    16       x1.27        x1.15
        64    64       x1.36        x1.20
        256   16       x1.22        x1.11
        256   64       x1.36        x1.19
        256   256      x1.59        x1.23
        1024  16       x1.21        x1.10
        1024  256      x1.65        x1.23
        1024  1024     x1.76        x1.25
        2048  16       x1.21        x1.10
        2048  256      x1.66        x1.23
        2048  1024     x1.78        x1.25
        2048  2048     x1.79        x1.25
        4096  16       x1.20        x1.09
        4096  256      x1.66        x1.23
        4096  1024     x1.79        x1.26
        4096  4096     x1.82        x1.26
        8192  16       x1.20        x1.09
        8192  256      x1.67        x1.23
        8192  1024     x1.80        x1.26
        8192  4096     x1.85        x1.28
        8192  8192     x1.85        x1.27
      Where bs refers to block size and b/u to bytes per update.
      Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Cc: Andy Polyakov <appro@openssl.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  18. 12 Mar, 2015 5 commits