Skip to content

Commit 64c658f

Browse files
committed
ima: add regular file data hash signature version 3 support
Instead of directly verifying the signature of a file data hash, signature v3 verifies the signature of the ima_file_id structure containing the file data hash. To disambiguate the signature usage, the ima_file_id structure also includes the hash algorithm and the type of data (e.g. regular file hash or fs-verity root hash). Tested-by: Stefan Berger <stefanb@linux.ibm.com> Acked-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent dccfbaf commit 64c658f

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

security/integrity/digsig_asymmetric.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static int calc_file_id_hash(enum evm_ima_xattr_type type,
154154
size_t file_id_size;
155155
int rc;
156156

157-
if (type != IMA_VERITY_DIGSIG)
157+
if (type != IMA_VERITY_DIGSIG && type != EVM_IMA_XATTR_DIGSIG)
158158
return -EINVAL;
159159

160160
tfm = crypto_alloc_shash(hash_algo_name[algo], 0, 0);

security/integrity/ima/ima_appraise.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static int xattr_verify(enum ima_hooks func, struct ima_iint_cache *iint,
297297
}
298298

299299
sig = (typeof(sig))xattr_value;
300-
if (sig->version >= 3) {
300+
if (sig->version > 3) {
301301
*cause = "invalid-signature-version";
302302
*status = INTEGRITY_FAIL;
303303
break;

0 commit comments

Comments
 (0)