2019-06-12 16:19:53 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
2019-11-08 12:22:08 +00:00
|
|
|
# chacha is used by the /dev/random driver which is always builtin
|
|
|
|
obj-y += chacha.o
|
|
|
|
obj-$(CONFIG_CRYPTO_LIB_CHACHA_GENERIC) += libchacha.o
|
|
|
|
|
2019-11-08 12:22:07 +00:00
|
|
|
obj-$(CONFIG_CRYPTO_LIB_AES) += libaes.o
|
|
|
|
libaes-y := aes.o
|
2019-07-02 19:41:22 +00:00
|
|
|
|
2019-11-08 12:22:07 +00:00
|
|
|
obj-$(CONFIG_CRYPTO_LIB_ARC4) += libarc4.o
|
|
|
|
libarc4-y := arc4.o
|
2019-08-15 09:01:09 +00:00
|
|
|
|
2021-12-22 13:56:58 +00:00
|
|
|
# blake2s is used by the /dev/random driver which is always builtin
|
|
|
|
obj-y += libblake2s.o
|
|
|
|
libblake2s-y := blake2s.o
|
|
|
|
libblake2s-$(CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC) += blake2s-generic.o
|
2019-11-08 12:22:28 +00:00
|
|
|
|
2019-11-08 12:22:39 +00:00
|
|
|
obj-$(CONFIG_CRYPTO_LIB_CHACHA20POLY1305) += libchacha20poly1305.o
|
|
|
|
libchacha20poly1305-y += chacha20poly1305.o
|
|
|
|
|
2020-01-08 04:37:35 +00:00
|
|
|
obj-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += libcurve25519-generic.o
|
|
|
|
libcurve25519-generic-y := curve25519-fiat32.o
|
|
|
|
libcurve25519-generic-$(CONFIG_ARCH_SUPPORTS_INT128) := curve25519-hacl64.o
|
|
|
|
libcurve25519-generic-y += curve25519-generic.o
|
|
|
|
|
|
|
|
obj-$(CONFIG_CRYPTO_LIB_CURVE25519) += libcurve25519.o
|
2019-11-08 12:22:32 +00:00
|
|
|
libcurve25519-y += curve25519.o
|
|
|
|
|
2019-11-08 12:22:07 +00:00
|
|
|
obj-$(CONFIG_CRYPTO_LIB_DES) += libdes.o
|
|
|
|
libdes-y := des.o
|
2019-08-17 14:24:33 +00:00
|
|
|
|
2019-11-08 12:22:19 +00:00
|
|
|
obj-$(CONFIG_CRYPTO_LIB_POLY1305_GENERIC) += libpoly1305.o
|
crypto: poly1305 - add new 32 and 64-bit generic versions
These two C implementations from Zinc -- a 32x32 one and a 64x64 one,
depending on the platform -- come from Andrew Moon's public domain
poly1305-donna portable code, modified for usage in the kernel. The
precomputation in the 32-bit version and the use of 64x64 multiplies in
the 64-bit version make these perform better than the code it replaces.
Moon's code is also very widespread and has received many eyeballs of
scrutiny.
There's a bit of interference between the x86 implementation, which
relies on internal details of the old scalar implementation. In the next
commit, the x86 implementation will be replaced with a faster one that
doesn't rely on this, so none of this matters much. But for now, to keep
this passing the tests, we inline the bits of the old implementation
that the x86 implementation relied on. Also, since we now support a
slightly larger key space, via the union, some offsets had to be fixed
up.
Nonce calculation was folded in with the emit function, to take
advantage of 64x64 arithmetic. However, Adiantum appeared to rely on no
nonce handling in emit, so this path was conditionalized. We also
introduced a new struct, poly1305_core_key, to represent the precise
amount of space that particular implementation uses.
Testing with kbench9000, depending on the CPU, the update function for
the 32x32 version has been improved by 4%-7%, and for the 64x64 by
19%-30%. The 32x32 gains are small, but I think there's great value in
having a parallel implementation to the 64x64 one so that the two can be
compared side-by-side as nice stand-alone units.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2020-01-06 03:40:46 +00:00
|
|
|
libpoly1305-y := poly1305-donna32.o
|
|
|
|
libpoly1305-$(CONFIG_ARCH_SUPPORTS_INT128) := poly1305-donna64.o
|
|
|
|
libpoly1305-y += poly1305.o
|
2019-11-08 12:22:19 +00:00
|
|
|
|
2019-11-08 12:22:07 +00:00
|
|
|
obj-$(CONFIG_CRYPTO_LIB_SHA256) += libsha256.o
|
|
|
|
libsha256-y := sha256.o
|
2019-11-08 12:22:28 +00:00
|
|
|
|
crypto: sm4 - create SM4 library based on sm4 generic code
Take the existing small footprint and mostly time invariant C code
and turn it into a SM4 library that can be used for non-performance
critical, casual use of SM4, and as a fallback for, e.g., SIMD code
that needs a secondary path that can be taken in contexts where the
SIMD unit is off limits.
Secondly, some codes have been optimized, such as unrolling small
times loop, removing unnecessary memory shifts, exporting sbox, fk,
ck arrays, and basic encryption and decryption functions.
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2021-07-20 03:46:39 +00:00
|
|
|
obj-$(CONFIG_CRYPTO_LIB_SM4) += libsm4.o
|
|
|
|
libsm4-y := sm4.o
|
|
|
|
|
2019-11-08 12:22:28 +00:00
|
|
|
ifneq ($(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS),y)
|
|
|
|
libblake2s-y += blake2s-selftest.o
|
2019-11-08 12:22:39 +00:00
|
|
|
libchacha20poly1305-y += chacha20poly1305-selftest.o
|
2019-12-16 18:53:26 +00:00
|
|
|
libcurve25519-y += curve25519-selftest.o
|
2019-11-08 12:22:28 +00:00
|
|
|
endif
|