diff options
| -rw-r--r-- | security/integrity/ima/ima_crypto.c | 2 | ||||
| -rw-r--r-- | security/integrity/ima/ima_main.c | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c index 205bc69361ea..4e085a17124f 100644 --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c | |||
| @@ -73,6 +73,8 @@ int __init ima_init_crypto(void) | |||
| 73 | hash_algo_name[ima_hash_algo], rc); | 73 | hash_algo_name[ima_hash_algo], rc); |
| 74 | return rc; | 74 | return rc; |
| 75 | } | 75 | } |
| 76 | pr_info("Allocated hash algorithm: %s\n", | ||
| 77 | hash_algo_name[ima_hash_algo]); | ||
| 76 | return 0; | 78 | return 0; |
| 77 | } | 79 | } |
| 78 | 80 | ||
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 5d122daf5c8a..74d0bd7e76d7 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c | |||
| @@ -16,6 +16,9 @@ | |||
| 16 | * implements the IMA hooks: ima_bprm_check, ima_file_mmap, | 16 | * implements the IMA hooks: ima_bprm_check, ima_file_mmap, |
| 17 | * and ima_file_check. | 17 | * and ima_file_check. |
| 18 | */ | 18 | */ |
| 19 | |||
| 20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 21 | |||
| 19 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 20 | #include <linux/file.h> | 23 | #include <linux/file.h> |
| 21 | #include <linux/binfmts.h> | 24 | #include <linux/binfmts.h> |
| @@ -504,6 +507,16 @@ static int __init init_ima(void) | |||
| 504 | ima_init_template_list(); | 507 | ima_init_template_list(); |
| 505 | hash_setup(CONFIG_IMA_DEFAULT_HASH); | 508 | hash_setup(CONFIG_IMA_DEFAULT_HASH); |
| 506 | error = ima_init(); | 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 | if (!error) { | 520 | if (!error) { |
| 508 | ima_initialized = 1; | 521 | ima_initialized = 1; |
| 509 | ima_update_policy_flag(); | 522 | ima_update_policy_flag(); |
