diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-15 19:01:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-15 19:01:47 -0400 |
commit | dafa5f6577a9eecd2941add553d1672c30b02364 (patch) | |
tree | ff9d3d2dffafd6eba1b6ac21ba50623812041b70 /lib | |
parent | 9a76aba02a37718242d7cdc294f0a3901928aa57 (diff) | |
parent | 22240df7ac6d76a271197571a7be45addef2ba15 (diff) |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto updates from Herbert Xu:
"API:
- Fix dcache flushing crash in skcipher.
- Add hash finup self-tests.
- Reschedule during speed tests.
Algorithms:
- Remove insecure vmac and replace it with vmac64.
- Add public key verification for DH/ECDH.
Drivers:
- Decrease priority of sha-mb on x86.
- Improve NEON latency/throughput on ARM64.
- Add md5/sha384/sha512/des/3des to inside-secure.
- Support eip197d in inside-secure.
- Only register algorithms supported by the host in virtio.
- Add cts and remove incompatible cts1 from ccree.
- Add hisilicon SEC security accelerator driver.
- Replace msm hwrng driver with qcom pseudo rng driver.
Misc:
- Centralize CRC polynomials"
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (121 commits)
crypto: arm64/ghash-ce - implement 4-way aggregation
crypto: arm64/ghash-ce - replace NEON yield check with block limit
crypto: hisilicon - sec_send_request() can be static
lib/mpi: remove redundant variable esign
crypto: arm64/aes-ce-gcm - don't reload key schedule if avoidable
crypto: arm64/aes-ce-gcm - implement 2-way aggregation
crypto: arm64/aes-ce-gcm - operate on two input blocks at a time
crypto: dh - make crypto_dh_encode_key() make robust
crypto: dh - fix calculating encoded key size
crypto: ccp - Check for NULL PSP pointer at module unload
crypto: arm/chacha20 - always use vrev for 16-bit rotates
crypto: ccree - allow bigger than sector XTS op
crypto: ccree - zero all of request ctx before use
crypto: ccree - remove cipher ivgen left overs
crypto: ccree - drop useless type flag during reg
crypto: ablkcipher - fix crash flushing dcache in error path
crypto: blkcipher - fix crash flushing dcache in error path
crypto: skcipher - fix crash flushing dcache in error path
crypto: skcipher - remove unnecessary setting of walk->nbytes
crypto: scatterwalk - remove scatterwalk_samebuf()
...
Diffstat (limited to 'lib')
-rw-r--r-- | lib/crc32.c | 11 | ||||
-rw-r--r-- | lib/crc32defs.h | 14 | ||||
-rw-r--r-- | lib/decompress_bunzip2.c | 3 | ||||
-rw-r--r-- | lib/gen_crc32table.c | 5 | ||||
-rw-r--r-- | lib/mpi/mpi-pow.c | 3 | ||||
-rw-r--r-- | lib/xz/xz_crc32.c | 3 |
6 files changed, 14 insertions, 25 deletions
diff --git a/lib/crc32.c b/lib/crc32.c index 2ef20fe84b69..a6c9afafc8c8 100644 --- a/lib/crc32.c +++ b/lib/crc32.c | |||
@@ -27,6 +27,7 @@ | |||
27 | /* see: Documentation/crc32.txt for a description of algorithms */ | 27 | /* see: Documentation/crc32.txt for a description of algorithms */ |
28 | 28 | ||
29 | #include <linux/crc32.h> | 29 | #include <linux/crc32.h> |
30 | #include <linux/crc32poly.h> | ||
30 | #include <linux/module.h> | 31 | #include <linux/module.h> |
31 | #include <linux/types.h> | 32 | #include <linux/types.h> |
32 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
@@ -184,7 +185,7 @@ static inline u32 __pure crc32_le_generic(u32 crc, unsigned char const *p, | |||
184 | #if CRC_LE_BITS == 1 | 185 | #if CRC_LE_BITS == 1 |
185 | u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) | 186 | u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) |
186 | { | 187 | { |
187 | return crc32_le_generic(crc, p, len, NULL, CRCPOLY_LE); | 188 | return crc32_le_generic(crc, p, len, NULL, CRC32_POLY_LE); |
188 | } | 189 | } |
189 | u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) | 190 | u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) |
190 | { | 191 | { |
@@ -194,7 +195,7 @@ u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) | |||
194 | u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) | 195 | u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) |
195 | { | 196 | { |
196 | return crc32_le_generic(crc, p, len, | 197 | return crc32_le_generic(crc, p, len, |
197 | (const u32 (*)[256])crc32table_le, CRCPOLY_LE); | 198 | (const u32 (*)[256])crc32table_le, CRC32_POLY_LE); |
198 | } | 199 | } |
199 | u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) | 200 | u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) |
200 | { | 201 | { |
@@ -268,7 +269,7 @@ static u32 __attribute_const__ crc32_generic_shift(u32 crc, size_t len, | |||
268 | 269 | ||
269 | u32 __attribute_const__ crc32_le_shift(u32 crc, size_t len) | 270 | u32 __attribute_const__ crc32_le_shift(u32 crc, size_t len) |
270 | { | 271 | { |
271 | return crc32_generic_shift(crc, len, CRCPOLY_LE); | 272 | return crc32_generic_shift(crc, len, CRC32_POLY_LE); |
272 | } | 273 | } |
273 | 274 | ||
274 | u32 __attribute_const__ __crc32c_le_shift(u32 crc, size_t len) | 275 | u32 __attribute_const__ __crc32c_le_shift(u32 crc, size_t len) |
@@ -330,13 +331,13 @@ static inline u32 __pure crc32_be_generic(u32 crc, unsigned char const *p, | |||
330 | #if CRC_LE_BITS == 1 | 331 | #if CRC_LE_BITS == 1 |
331 | u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) | 332 | u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) |
332 | { | 333 | { |
333 | return crc32_be_generic(crc, p, len, NULL, CRCPOLY_BE); | 334 | return crc32_be_generic(crc, p, len, NULL, CRC32_POLY_BE); |
334 | } | 335 | } |
335 | #else | 336 | #else |
336 | u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) | 337 | u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) |
337 | { | 338 | { |
338 | return crc32_be_generic(crc, p, len, | 339 | return crc32_be_generic(crc, p, len, |
339 | (const u32 (*)[256])crc32table_be, CRCPOLY_BE); | 340 | (const u32 (*)[256])crc32table_be, CRC32_POLY_BE); |
340 | } | 341 | } |
341 | #endif | 342 | #endif |
342 | EXPORT_SYMBOL(crc32_be); | 343 | EXPORT_SYMBOL(crc32_be); |
diff --git a/lib/crc32defs.h b/lib/crc32defs.h index cb275a28a750..0c8fb5923e7e 100644 --- a/lib/crc32defs.h +++ b/lib/crc32defs.h | |||
@@ -1,18 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | /* | ||
3 | * There are multiple 16-bit CRC polynomials in common use, but this is | ||
4 | * *the* standard CRC-32 polynomial, first popularized by Ethernet. | ||
5 | * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0 | ||
6 | */ | ||
7 | #define CRCPOLY_LE 0xedb88320 | ||
8 | #define CRCPOLY_BE 0x04c11db7 | ||
9 | |||
10 | /* | ||
11 | * This is the CRC32c polynomial, as outlined by Castagnoli. | ||
12 | * x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+x^19+x^18+x^14+x^13+x^11+x^10+x^9+ | ||
13 | * x^8+x^6+x^0 | ||
14 | */ | ||
15 | #define CRC32C_POLY_LE 0x82F63B78 | ||
16 | 2 | ||
17 | /* Try to choose an implementation variant via Kconfig */ | 3 | /* Try to choose an implementation variant via Kconfig */ |
18 | #ifdef CONFIG_CRC32_SLICEBY8 | 4 | #ifdef CONFIG_CRC32_SLICEBY8 |
diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c index 0234361b24b8..7c4932eed748 100644 --- a/lib/decompress_bunzip2.c +++ b/lib/decompress_bunzip2.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #endif /* STATIC */ | 51 | #endif /* STATIC */ |
52 | 52 | ||
53 | #include <linux/decompress/mm.h> | 53 | #include <linux/decompress/mm.h> |
54 | #include <linux/crc32poly.h> | ||
54 | 55 | ||
55 | #ifndef INT_MAX | 56 | #ifndef INT_MAX |
56 | #define INT_MAX 0x7fffffff | 57 | #define INT_MAX 0x7fffffff |
@@ -654,7 +655,7 @@ static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, long len, | |||
654 | for (i = 0; i < 256; i++) { | 655 | for (i = 0; i < 256; i++) { |
655 | c = i << 24; | 656 | c = i << 24; |
656 | for (j = 8; j; j--) | 657 | for (j = 8; j; j--) |
657 | c = c&0x80000000 ? (c << 1)^0x04c11db7 : (c << 1); | 658 | c = c&0x80000000 ? (c << 1)^(CRC32_POLY_BE) : (c << 1); |
658 | bd->crc32Table[i] = c; | 659 | bd->crc32Table[i] = c; |
659 | } | 660 | } |
660 | 661 | ||
diff --git a/lib/gen_crc32table.c b/lib/gen_crc32table.c index 8f26660ea10a..f755b997b967 100644 --- a/lib/gen_crc32table.c +++ b/lib/gen_crc32table.c | |||
@@ -1,5 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include "../include/linux/crc32poly.h" | ||
3 | #include "../include/generated/autoconf.h" | 4 | #include "../include/generated/autoconf.h" |
4 | #include "crc32defs.h" | 5 | #include "crc32defs.h" |
5 | #include <inttypes.h> | 6 | #include <inttypes.h> |
@@ -57,7 +58,7 @@ static void crc32init_le_generic(const uint32_t polynomial, | |||
57 | 58 | ||
58 | static void crc32init_le(void) | 59 | static void crc32init_le(void) |
59 | { | 60 | { |
60 | crc32init_le_generic(CRCPOLY_LE, crc32table_le); | 61 | crc32init_le_generic(CRC32_POLY_LE, crc32table_le); |
61 | } | 62 | } |
62 | 63 | ||
63 | static void crc32cinit_le(void) | 64 | static void crc32cinit_le(void) |
@@ -76,7 +77,7 @@ static void crc32init_be(void) | |||
76 | crc32table_be[0][0] = 0; | 77 | crc32table_be[0][0] = 0; |
77 | 78 | ||
78 | for (i = 1; i < BE_TABLE_SIZE; i <<= 1) { | 79 | for (i = 1; i < BE_TABLE_SIZE; i <<= 1) { |
79 | crc = (crc << 1) ^ ((crc & 0x80000000) ? CRCPOLY_BE : 0); | 80 | crc = (crc << 1) ^ ((crc & 0x80000000) ? CRC32_POLY_BE : 0); |
80 | for (j = 0; j < i; j++) | 81 | for (j = 0; j < i; j++) |
81 | crc32table_be[0][i + j] = crc ^ crc32table_be[0][j]; | 82 | crc32table_be[0][i + j] = crc ^ crc32table_be[0][j]; |
82 | } | 83 | } |
diff --git a/lib/mpi/mpi-pow.c b/lib/mpi/mpi-pow.c index 468fb7cd1221..a5c921e6d667 100644 --- a/lib/mpi/mpi-pow.c +++ b/lib/mpi/mpi-pow.c | |||
@@ -41,7 +41,7 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) | |||
41 | mpi_ptr_t tspace = NULL; | 41 | mpi_ptr_t tspace = NULL; |
42 | mpi_ptr_t rp, ep, mp, bp; | 42 | mpi_ptr_t rp, ep, mp, bp; |
43 | mpi_size_t esize, msize, bsize, rsize; | 43 | mpi_size_t esize, msize, bsize, rsize; |
44 | int esign, msign, bsign, rsign; | 44 | int msign, bsign, rsign; |
45 | mpi_size_t size; | 45 | mpi_size_t size; |
46 | int mod_shift_cnt; | 46 | int mod_shift_cnt; |
47 | int negative_result; | 47 | int negative_result; |
@@ -53,7 +53,6 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) | |||
53 | esize = exp->nlimbs; | 53 | esize = exp->nlimbs; |
54 | msize = mod->nlimbs; | 54 | msize = mod->nlimbs; |
55 | size = 2 * msize; | 55 | size = 2 * msize; |
56 | esign = exp->sign; | ||
57 | msign = mod->sign; | 56 | msign = mod->sign; |
58 | 57 | ||
59 | rp = res->d; | 58 | rp = res->d; |
diff --git a/lib/xz/xz_crc32.c b/lib/xz/xz_crc32.c index 34532d14fd4c..25a5d87e2e4c 100644 --- a/lib/xz/xz_crc32.c +++ b/lib/xz/xz_crc32.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * but they are bigger and use more memory for the lookup table. | 15 | * but they are bigger and use more memory for the lookup table. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/crc32poly.h> | ||
18 | #include "xz_private.h" | 19 | #include "xz_private.h" |
19 | 20 | ||
20 | /* | 21 | /* |
@@ -29,7 +30,7 @@ STATIC_RW_DATA uint32_t xz_crc32_table[256]; | |||
29 | 30 | ||
30 | XZ_EXTERN void xz_crc32_init(void) | 31 | XZ_EXTERN void xz_crc32_init(void) |
31 | { | 32 | { |
32 | const uint32_t poly = 0xEDB88320; | 33 | const uint32_t poly = CRC32_POLY_LE; |
33 | 34 | ||
34 | uint32_t i; | 35 | uint32_t i; |
35 | uint32_t j; | 36 | uint32_t j; |