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 @@ -78,6 +78,8 @@ int __init ima_init_crypto(void)
78
78
hash_algo_name [ima_hash_algo ], rc );
79
79
return rc ;
80
80
}
81
+ pr_info ("Allocated hash algorithm: %s\n" ,
82
+ hash_algo_name [ima_hash_algo ]);
81
83
return 0 ;
82
84
}
83
85
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>
@@ -353,6 +356,16 @@ static int __init init_ima(void)
353
356
354
357
hash_setup (CONFIG_IMA_DEFAULT_HASH );
355
358
error = ima_init ();
359
+
360
+ if (error && strcmp (hash_algo_name [ima_hash_algo ],
361
+ CONFIG_IMA_DEFAULT_HASH ) != 0 ) {
362
+ pr_info ("Allocating %s failed, going to use default hash algorithm %s\n" ,
363
+ hash_algo_name [ima_hash_algo ], CONFIG_IMA_DEFAULT_HASH );
364
+ hash_setup_done = 0 ;
365
+ hash_setup (CONFIG_IMA_DEFAULT_HASH );
366
+ error = ima_init ();
367
+ }
368
+
356
369
if (!error ) {
357
370
ima_initialized = 1 ;
358
371
ima_update_policy_flag ();
You can’t perform that action at this time.
0 commit comments