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)
7878 hash_algo_name [ima_hash_algo ], rc );
7979 return rc ;
8080 }
81+ pr_info ("Allocated hash algorithm: %s\n" ,
82+ hash_algo_name [ima_hash_algo ]);
8183 return 0 ;
8284}
8385
Original file line number Diff line number Diff line change 1616 * implements the IMA hooks: ima_bprm_check, ima_file_mmap,
1717 * and ima_file_check.
1818 */
19+
20+ #define pr_fmt (fmt ) KBUILD_MODNAME ": " fmt
21+
1922#include <linux/module.h>
2023#include <linux/file.h>
2124#include <linux/binfmts.h>
@@ -353,6 +356,16 @@ static int __init init_ima(void)
353356
354357 hash_setup (CONFIG_IMA_DEFAULT_HASH );
355358 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+
356369 if (!error ) {
357370 ima_initialized = 1 ;
358371 ima_update_policy_flag ();
You can’t perform that action at this time.
0 commit comments