File tree Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -454,7 +454,7 @@ int crypto_register_alg(struct crypto_alg *alg)
454
454
down_write (& crypto_alg_sem );
455
455
larval = __crypto_register_alg (alg , & algs_to_put );
456
456
if (!IS_ERR_OR_NULL (larval )) {
457
- test_started = static_key_enabled ( & crypto_boot_test_finished );
457
+ test_started = crypto_boot_test_finished ( );
458
458
larval -> test_started = test_started ;
459
459
}
460
460
up_write (& crypto_alg_sem );
@@ -1253,6 +1253,9 @@ EXPORT_SYMBOL_GPL(crypto_stats_skcipher_decrypt);
1253
1253
1254
1254
static void __init crypto_start_tests (void )
1255
1255
{
1256
+ if (IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS ))
1257
+ return ;
1258
+
1256
1259
for (;;) {
1257
1260
struct crypto_larval * larval = NULL ;
1258
1261
struct crypto_alg * q ;
@@ -1286,7 +1289,7 @@ static void __init crypto_start_tests(void)
1286
1289
crypto_wait_for_test (larval );
1287
1290
}
1288
1291
1289
- static_branch_enable ( & crypto_boot_test_finished );
1292
+ set_crypto_boot_test_finished ( );
1290
1293
}
1291
1294
1292
1295
static int __init crypto_algapi_init (void )
Original file line number Diff line number Diff line change @@ -31,8 +31,10 @@ EXPORT_SYMBOL_GPL(crypto_alg_sem);
31
31
BLOCKING_NOTIFIER_HEAD (crypto_chain );
32
32
EXPORT_SYMBOL_GPL (crypto_chain );
33
33
34
- DEFINE_STATIC_KEY_FALSE (crypto_boot_test_finished );
35
- EXPORT_SYMBOL_GPL (crypto_boot_test_finished );
34
+ #ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
35
+ DEFINE_STATIC_KEY_FALSE (__crypto_boot_test_finished );
36
+ EXPORT_SYMBOL_GPL (__crypto_boot_test_finished );
37
+ #endif
36
38
37
39
static struct crypto_alg * crypto_larval_wait (struct crypto_alg * alg );
38
40
@@ -202,7 +204,7 @@ static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg)
202
204
struct crypto_larval * larval = (void * )alg ;
203
205
long timeout ;
204
206
205
- if (!static_branch_likely ( & crypto_boot_test_finished ))
207
+ if (!crypto_boot_test_finished ( ))
206
208
crypto_start_test (larval );
207
209
208
210
timeout = wait_for_completion_killable_timeout (
Original file line number Diff line number Diff line change @@ -47,7 +47,25 @@ extern struct list_head crypto_alg_list;
47
47
extern struct rw_semaphore crypto_alg_sem ;
48
48
extern struct blocking_notifier_head crypto_chain ;
49
49
50
- DECLARE_STATIC_KEY_FALSE (crypto_boot_test_finished );
50
+ #ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
51
+ static inline bool crypto_boot_test_finished (void )
52
+ {
53
+ return true;
54
+ }
55
+ static inline void set_crypto_boot_test_finished (void )
56
+ {
57
+ }
58
+ #else
59
+ DECLARE_STATIC_KEY_FALSE (__crypto_boot_test_finished );
60
+ static inline bool crypto_boot_test_finished (void )
61
+ {
62
+ return static_branch_likely (& __crypto_boot_test_finished );
63
+ }
64
+ static inline void set_crypto_boot_test_finished (void )
65
+ {
66
+ static_branch_enable (& __crypto_boot_test_finished );
67
+ }
68
+ #endif /* !CONFIG_CRYPTO_MANAGER_DISABLE_TESTS */
51
69
52
70
#ifdef CONFIG_PROC_FS
53
71
void __init crypto_init_proc (void );
You can’t perform that action at this time.
0 commit comments