Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'v6.16-p5' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

Pull crypto fixes from Herbert Xu:
"This fixes a regression in ahash (broken fallback finup) and
reinstates a Kconfig option to control the extra self-tests"

* tag 'v6.16-p5' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: ahash - Fix infinite recursion in ahash_def_finup
crypto: testmgr - reinstate kconfig control over full self-tests

+41 -11
+21 -4
crypto/Kconfig
··· 176 176 177 177 config CRYPTO_SELFTESTS 178 178 bool "Enable cryptographic self-tests" 179 - depends on DEBUG_KERNEL 179 + depends on EXPERT 180 180 help 181 181 Enable the cryptographic self-tests. 182 182 183 183 The cryptographic self-tests run at boot time, or at algorithm 184 184 registration time if algorithms are dynamically loaded later. 185 185 186 - This is primarily intended for developer use. It should not be 187 - enabled in production kernels, unless you are trying to use these 188 - tests to fulfill a FIPS testing requirement. 186 + There are two main use cases for these tests: 187 + 188 + - Development and pre-release testing. In this case, also enable 189 + CRYPTO_SELFTESTS_FULL to get the full set of tests. All crypto code 190 + in the kernel is expected to pass the full set of tests. 191 + 192 + - Production kernels, to help prevent buggy drivers from being used 193 + and/or meet FIPS 140-3 pre-operational testing requirements. In 194 + this case, enable CRYPTO_SELFTESTS but not CRYPTO_SELFTESTS_FULL. 195 + 196 + config CRYPTO_SELFTESTS_FULL 197 + bool "Enable the full set of cryptographic self-tests" 198 + depends on CRYPTO_SELFTESTS 199 + help 200 + Enable the full set of cryptographic self-tests for each algorithm. 201 + 202 + The full set of tests should be enabled for development and 203 + pre-release testing, but not in production kernels. 204 + 205 + All crypto code in the kernel is expected to pass the full tests. 189 206 190 207 config CRYPTO_NULL 191 208 tristate "Null algorithms"
+3 -1
crypto/ahash.c
··· 600 600 601 601 static int ahash_def_finup_finish1(struct ahash_request *req, int err) 602 602 { 603 + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); 604 + 603 605 if (err) 604 606 goto out; 605 607 606 608 req->base.complete = ahash_def_finup_done2; 607 609 608 - err = crypto_ahash_final(req); 610 + err = crypto_ahash_alg(tfm)->final(req); 609 611 if (err == -EINPROGRESS || err == -EBUSY) 610 612 return err; 611 613
+12 -3
crypto/testmgr.c
··· 45 45 module_param(notests, bool, 0644); 46 46 MODULE_PARM_DESC(notests, "disable all crypto self-tests"); 47 47 48 + #ifdef CONFIG_CRYPTO_SELFTESTS_FULL 48 49 static bool noslowtests; 49 50 module_param(noslowtests, bool, 0644); 50 51 MODULE_PARM_DESC(noslowtests, "disable slow crypto self-tests"); ··· 53 52 static unsigned int fuzz_iterations = 100; 54 53 module_param(fuzz_iterations, uint, 0644); 55 54 MODULE_PARM_DESC(fuzz_iterations, "number of fuzz test iterations"); 55 + #else 56 + #define noslowtests 1 57 + #define fuzz_iterations 0 58 + #endif 56 59 57 60 #ifndef CONFIG_CRYPTO_SELFTESTS 58 61 ··· 324 319 325 320 /* 326 321 * The following are the lists of testvec_configs to test for each algorithm 327 - * type when the fast crypto self-tests are enabled. They aim to provide good 328 - * test coverage, while keeping the test time much shorter than the full tests 329 - * so that the fast tests can be used to fulfill FIPS 140 testing requirements. 322 + * type when the "fast" crypto self-tests are enabled. They aim to provide good 323 + * test coverage, while keeping the test time much shorter than the "full" tests 324 + * so that the "fast" tests can be enabled in a wider range of circumstances. 330 325 */ 331 326 332 327 /* Configs for skciphers and aeads */ ··· 1188 1183 1189 1184 static void crypto_disable_simd_for_test(void) 1190 1185 { 1186 + #ifdef CONFIG_CRYPTO_SELFTESTS_FULL 1191 1187 migrate_disable(); 1192 1188 __this_cpu_write(crypto_simd_disabled_for_test, true); 1189 + #endif 1193 1190 } 1194 1191 1195 1192 static void crypto_reenable_simd_for_test(void) 1196 1193 { 1194 + #ifdef CONFIG_CRYPTO_SELFTESTS_FULL 1197 1195 __this_cpu_write(crypto_simd_disabled_for_test, false); 1198 1196 migrate_enable(); 1197 + #endif 1199 1198 } 1200 1199 1201 1200 /*
+4 -2
include/crypto/internal/simd.h
··· 44 44 * 45 45 * This delegates to may_use_simd(), except that this also returns false if SIMD 46 46 * in crypto code has been temporarily disabled on this CPU by the crypto 47 - * self-tests, in order to test the no-SIMD fallback code. 47 + * self-tests, in order to test the no-SIMD fallback code. This override is 48 + * currently limited to configurations where the "full" self-tests are enabled, 49 + * because it might be a bit too invasive to be part of the "fast" self-tests. 48 50 */ 49 - #ifdef CONFIG_CRYPTO_SELFTESTS 51 + #ifdef CONFIG_CRYPTO_SELFTESTS_FULL 50 52 DECLARE_PER_CPU(bool, crypto_simd_disabled_for_test); 51 53 #define crypto_simd_usable() \ 52 54 (may_use_simd() && !this_cpu_read(crypto_simd_disabled_for_test))
+1 -1
lib/crypto/Makefile
··· 66 66 67 67 obj-$(CONFIG_MPILIB) += mpi/ 68 68 69 - obj-$(CONFIG_CRYPTO_SELFTESTS) += simd.o 69 + obj-$(CONFIG_CRYPTO_SELFTESTS_FULL) += simd.o 70 70 71 71 obj-$(CONFIG_CRYPTO_LIB_SM3) += libsm3.o 72 72 libsm3-y := sm3.o