File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,8 @@ int __init ima_init_crypto(void)
73
73
hash_algo_name [ima_hash_algo ], rc );
74
74
return rc ;
75
75
}
76
+ pr_info ("Allocated hash algorithm: %s\n" ,
77
+ hash_algo_name [ima_hash_algo ]);
76
78
return 0 ;
77
79
}
78
80
Original file line number Diff line number Diff line change 16
16
* implements the IMA hooks: ima_bprm_check, ima_file_mmap,
17
17
* and ima_file_check.
18
18
*/
19
+
20
+ #define pr_fmt (fmt ) KBUILD_MODNAME ": " fmt
21
+
19
22
#include <linux/module.h>
20
23
#include <linux/file.h>
21
24
#include <linux/binfmts.h>
@@ -504,6 +507,16 @@ static int __init init_ima(void)
504
507
ima_init_template_list ();
505
508
hash_setup (CONFIG_IMA_DEFAULT_HASH );
506
509
error = ima_init ();
510
+
511
+ if (error && strcmp (hash_algo_name [ima_hash_algo ],
512
+ CONFIG_IMA_DEFAULT_HASH ) != 0 ) {
513
+ pr_info ("Allocating %s failed, going to use default hash algorithm %s\n" ,
514
+ hash_algo_name [ima_hash_algo ], CONFIG_IMA_DEFAULT_HASH );
515
+ hash_setup_done = 0 ;
516
+ hash_setup (CONFIG_IMA_DEFAULT_HASH );
517
+ error = ima_init ();
518
+ }
519
+
507
520
if (!error ) {
508
521
ima_initialized = 1 ;
509
522
ima_update_policy_flag ();
You can’t perform that action at this time.
0 commit comments