mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
evm: Enforce signatures version 3 with new EVM policy 'bit 3'
Enable the configuration of EVM so that it requires that asymmetric signatures it accepts are of version 3 (sigv3). To enable this, introduce bit 3 (value 0x0008) that the user may write to EVM's securityfs policy configuration file 'evm' for sigv3 enforcement. Mention bit 3 in the documentation. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
committed by
Mimi Zohar
parent
bab8e90bca
commit
82bbd44719
@@ -136,6 +136,14 @@ static bool evm_hmac_disabled(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool evm_sigv3_required(void)
|
||||
{
|
||||
if (evm_initialized & EVM_SIGV3_REQUIRED)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int evm_find_protected_xattrs(struct dentry *dentry)
|
||||
{
|
||||
struct inode *inode = d_backing_inode(dentry);
|
||||
@@ -258,6 +266,12 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry,
|
||||
}
|
||||
|
||||
hdr = (struct signature_v2_hdr *)xattr_data;
|
||||
|
||||
if (evm_sigv3_required() && hdr->version != 3) {
|
||||
evm_status = INTEGRITY_FAIL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
digest.hdr.algo = hdr->hash_algo;
|
||||
rc = evm_calc_hash(dentry, xattr_name, xattr_value,
|
||||
xattr_value_len, xattr_data->type, &digest,
|
||||
|
||||
Reference in New Issue
Block a user