1. 17 11月, 2019 1 次提交
  2. 01 11月, 2019 2 次提交
    • E
      crypto: skcipher - rename the crypto_blkcipher module and kconfig option · b95bba5d
      Eric Biggers 提交于
      Now that the blkcipher algorithm type has been removed in favor of
      skcipher, rename the crypto_blkcipher kernel module to crypto_skcipher,
      and rename the config options accordingly:
      
      	CONFIG_CRYPTO_BLKCIPHER => CONFIG_CRYPTO_SKCIPHER
      	CONFIG_CRYPTO_BLKCIPHER2 => CONFIG_CRYPTO_SKCIPHER2
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      b95bba5d
    • D
      crypto: blake2b - add blake2b generic implementation · 91d68933
      David Sterba 提交于
      The patch brings support of several BLAKE2 variants (2b with various
      digest lengths).  The keyed digest is supported, using tfm->setkey call.
      The in-tree user will be btrfs (for checksumming), we're going to use
      the BLAKE2b-256 variant.
      
      The code is reference implementation taken from the official sources and
      modified in terms of kernel coding style (whitespace, comments, uintXX_t
      -> uXX types, removed unused prototypes and #ifdefs, removed testing
      code, changed secure_zero_memory -> memzero_explicit, used own helpers
      for unaligned reads/writes and rotations).
      
      Further changes removed sanity checks of key length or output size,
      these values are verified in the crypto API callbacks or hardcoded in
      shash_alg and not exposed to users.
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      91d68933
  3. 25 10月, 2019 1 次提交
    • E
      crypto: powerpc - convert SPE AES algorithms to skcipher API · 7f725f41
      Eric Biggers 提交于
      Convert the glue code for the PowerPC SPE implementations of AES-ECB,
      AES-CBC, AES-CTR, and AES-XTS from the deprecated "blkcipher" API to the
      "skcipher" API.  This is needed in order for the blkcipher API to be
      removed.
      
      Tested with:
      
      	export ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu-
      	make mpc85xx_defconfig
      	cat >> .config << EOF
      	# CONFIG_MODULES is not set
      	# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
      	CONFIG_DEBUG_KERNEL=y
      	CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y
      	CONFIG_CRYPTO_AES=y
      	CONFIG_CRYPTO_CBC=y
      	CONFIG_CRYPTO_CTR=y
      	CONFIG_CRYPTO_ECB=y
      	CONFIG_CRYPTO_XTS=y
      	CONFIG_CRYPTO_AES_PPC_SPE=y
      	EOF
      	make olddefconfig
      	make -j32
      	qemu-system-ppc -M mpc8544ds -cpu e500 -nographic \
      		-kernel arch/powerpc/boot/zImage \
      		-append cryptomgr.fuzz_iterations=1000
      
      Note that xts-ppc-spe still fails the comparison tests due to the lack
      of ciphertext stealing support.  This is not addressed by this patch.
      
      This patch also cleans up the code by making ->encrypt() and ->decrypt()
      call a common function for each of ECB, CBC, and XTS, and by using a
      clearer way to compute the length to process at each step.
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      7f725f41
  4. 23 10月, 2019 3 次提交
  5. 10 10月, 2019 1 次提交
  6. 04 9月, 2019 1 次提交
  7. 22 8月, 2019 3 次提交
  8. 15 8月, 2019 1 次提交
  9. 02 8月, 2019 1 次提交
  10. 27 7月, 2019 1 次提交
  11. 26 7月, 2019 7 次提交
  12. 20 6月, 2019 1 次提交
  13. 06 6月, 2019 1 次提交
    • N
      crypto: xxhash - Implement xxhash support · 67882e76
      Nikolay Borisov 提交于
      xxhash is currently implemented as a self-contained module in /lib.
      This patch enables that module to be used as part of the generic kernel
      crypto framework. It adds a simple wrapper to the 64bit version.
      
      I've also added test vectors (with help from Nick Terrell). The upstream
      xxhash code is tested by running hashing operation on random 222 byte
      data with seed values of 0 and a prime number. The upstream test
      suite can be found at https://github.com/Cyan4973/xxHash/blob/cf46e0c/xxhsum.c#L664
      
      Essentially hashing is run on data of length 0,1,14,222 with the
      aforementioned seed values 0 and prime 2654435761. The particular random
      222 byte string was provided to me by Nick Terrell by reading
      /dev/random and the checksums were calculated by the upstream xxsum
      utility with the following bash script:
      
      dd if=/dev/random of=TEST_VECTOR bs=1 count=222
      
      for a in 0 1; do
      	for l in 0 1 14 222; do
      		for s in 0 2654435761; do
      			echo algo $a length $l seed $s;
      			head -c $l TEST_VECTOR | ~/projects/kernel/xxHash/xxhsum -H$a -s$s
      		done
      	done
      done
      
      This produces output as follows:
      
      algo 0 length 0 seed 0
      02cc5d05  stdin
      algo 0 length 0 seed 2654435761
      02cc5d05  stdin
      algo 0 length 1 seed 0
      25201171  stdin
      algo 0 length 1 seed 2654435761
      25201171  stdin
      algo 0 length 14 seed 0
      c1d95975  stdin
      algo 0 length 14 seed 2654435761
      c1d95975  stdin
      algo 0 length 222 seed 0
      b38662a6  stdin
      algo 0 length 222 seed 2654435761
      b38662a6  stdin
      algo 1 length 0 seed 0
      ef46db3751d8e999  stdin
      algo 1 length 0 seed 2654435761
      ac75fda2929b17ef  stdin
      algo 1 length 1 seed 0
      27c3f04c2881203a  stdin
      algo 1 length 1 seed 2654435761
      4a15ed26415dfe4d  stdin
      algo 1 length 14 seed 0
      3d33dc700231dfad  stdin
      algo 1 length 14 seed 2654435761
      ea5f7ddef9a64f80  stdin
      algo 1 length 222 seed 0
      5f3d3c08ec2bef34  stdin
      algo 1 length 222 seed 2654435761
      6a9df59664c7ed62  stdin
      
      algo 1 is xx64 variant, algo 0 is the 32 bit variant which is currently
      not hooked up.
      Signed-off-by: NNikolay Borisov <nborisov@suse.com>
      Reviewed-by: NEric Biggers <ebiggers@kernel.org>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      67882e76
  14. 30 5月, 2019 5 次提交
  15. 25 4月, 2019 1 次提交
  16. 18 4月, 2019 3 次提交
    • V
      crypto: ecrdsa - add EC-RDSA (GOST 34.10) algorithm · 0d7a7864
      Vitaly Chikunov 提交于
      Add Elliptic Curve Russian Digital Signature Algorithm (GOST R
      34.10-2012, RFC 7091, ISO/IEC 14888-3) is one of the Russian (and since
      2018 the CIS countries) cryptographic standard algorithms (called GOST
      algorithms). Only signature verification is supported, with intent to be
      used in the IMA.
      
      Summary of the changes:
      
      * crypto/Kconfig:
        - EC-RDSA is added into Public-key cryptography section.
      
      * crypto/Makefile:
        - ecrdsa objects are added.
      
      * crypto/asymmetric_keys/x509_cert_parser.c:
        - Recognize EC-RDSA and Streebog OIDs.
      
      * include/linux/oid_registry.h:
        - EC-RDSA OIDs are added to the enum. Also, a two currently not
          implemented curve OIDs are added for possible extension later (to
          not change numbering and grouping).
      
      * crypto/ecc.c:
        - Kenneth MacKay copyright date is updated to 2014, because
          vli_mmod_slow, ecc_point_add, ecc_point_mult_shamir are based on his
          code from micro-ecc.
        - Functions needed for ecrdsa are EXPORT_SYMBOL'ed.
        - New functions:
          vli_is_negative - helper to determine sign of vli;
          vli_from_be64 - unpack big-endian array into vli (used for
            a signature);
          vli_from_le64 - unpack little-endian array into vli (used for
            a public key);
          vli_uadd, vli_usub - add/sub u64 value to/from vli (used for
            increment/decrement);
          mul_64_64 - optimized to use __int128 where appropriate, this speeds
            up point multiplication (and as a consequence signature
            verification) by the factor of 1.5-2;
          vli_umult - multiply vli by a small value (speeds up point
            multiplication by another factor of 1.5-2, depending on vli sizes);
          vli_mmod_special - module reduction for some form of Pseudo-Mersenne
            primes (used for the curves A);
          vli_mmod_special2 - module reduction for another form of
            Pseudo-Mersenne primes (used for the curves B);
          vli_mmod_barrett - module reduction using pre-computed value (used
            for the curve C);
          vli_mmod_slow - more general module reduction which is much slower
           (used when the modulus is subgroup order);
          vli_mod_mult_slow - modular multiplication;
          ecc_point_add - add two points;
          ecc_point_mult_shamir - add two points multiplied by scalars in one
            combined multiplication (this gives speed up by another factor 2 in
            compare to two separate multiplications).
          ecc_is_pubkey_valid_partial - additional samity check is added.
        - Updated vli_mmod_fast with non-strict heuristic to call optimal
            module reduction function depending on the prime value;
        - All computations for the previously defined (two NIST) curves should
          not unaffected.
      
      * crypto/ecc.h:
        - Newly exported functions are documented.
      
      * crypto/ecrdsa_defs.h
        - Five curves are defined.
      
      * crypto/ecrdsa.c:
        - Signature verification is implemented.
      
      * crypto/ecrdsa_params.asn1, crypto/ecrdsa_pub_key.asn1:
        - Templates for BER decoder for EC-RDSA parameters and public key.
      
      Cc: linux-integrity@vger.kernel.org
      Signed-off-by: NVitaly Chikunov <vt@altlinux.org>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      0d7a7864
    • V
      crypto: ecc - make ecc into separate module · 4a2289da
      Vitaly Chikunov 提交于
      ecc.c have algorithms that could be used togeter by ecdh and ecrdsa.
      Make it separate module. Add CRYPTO_ECC into Kconfig. EXPORT_SYMBOL and
      document to what seems appropriate. Move structs ecc_point and ecc_curve
      from ecc_curve_defs.h into ecc.h.
      
      No code changes.
      Signed-off-by: NVitaly Chikunov <vt@altlinux.org>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      4a2289da
    • V
      crypto: Kconfig - create Public-key cryptography section · 3d6228a5
      Vitaly Chikunov 提交于
      Group RSA, DH, and ECDH into Public-key cryptography config section.
      Signed-off-by: NVitaly Chikunov <vt@altlinux.org>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      3d6228a5
  17. 28 3月, 2019 1 次提交
  18. 22 3月, 2019 6 次提交