diff options
author | Dimitri John Ledkov <dimitri.ledkov@canonical.com> | 2023-10-22 20:40:26 +0100 |
---|---|---|
committer | John Johansen <john.johansen@canonical.com> | 2023-11-19 00:47:56 -0800 |
commit | e44a4dc4b36cc087878596b937d52caca35e9b19 (patch) | |
tree | 2503fb92c4eff889a6987c747792c16141020ff9 /security/apparmor/crypto.c | |
parent | b85ea95d086471afb4ad062012a4d73cd328fa86 (diff) |
apparmor: switch SECURITY_APPARMOR_HASH from sha1 to sha256
sha1 is insecure and has colisions, thus it is not useful for even
lightweight policy hash checks. Switch to sha256, which on modern
hardware is fast enough.
Separately as per NIST Policy on Hash Functions, sha1 usage must be
withdrawn by 2030. This config option currently is one of many that
holds up sha1 usage.
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/crypto.c')
-rw-r--r-- | security/apparmor/crypto.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/security/apparmor/crypto.c b/security/apparmor/crypto.c index 6724e2ff6da8..aad486b2fca6 100644 --- a/security/apparmor/crypto.c +++ b/security/apparmor/crypto.c @@ -106,16 +106,16 @@ static int __init init_profile_hash(void) if (!apparmor_initialized) return 0; - tfm = crypto_alloc_shash("sha1", 0, 0); + tfm = crypto_alloc_shash("sha256", 0, 0); if (IS_ERR(tfm)) { int error = PTR_ERR(tfm); - AA_ERROR("failed to setup profile sha1 hashing: %d\n", error); + AA_ERROR("failed to setup profile sha256 hashing: %d\n", error); return error; } apparmor_tfm = tfm; apparmor_hash_size = crypto_shash_digestsize(apparmor_tfm); - aa_info_message("AppArmor sha1 policy hashing enabled"); + aa_info_message("AppArmor sha256 policy hashing enabled"); return 0; } |