mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
ima: define ima_max_digest_data struct without a flexible array variable
To support larger hash digests in the 'iint' cache, instead of defining the 'digest' field as the maximum digest size, the 'digest' field was defined as a flexible array variable. The "ima_digest_data" struct was wrapped inside a local structure with the maximum digest size. But before adding the record to the iint cache, memory for the exact digest size was dynamically allocated. The original reason for defining the 'digest' field as a flexible array variable is still valid for the 'iint' cache use case. Instead of wrapping the 'ima_digest_data' struct in a local structure define 'ima_max_digest_data' struct. Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/integrity.h>
|
||||
#include <crypto/sha1.h>
|
||||
#include <crypto/hash.h>
|
||||
#include <linux/key.h>
|
||||
#include <linux/audit.h>
|
||||
|
||||
@@ -110,6 +111,15 @@ struct ima_digest_data {
|
||||
u8 digest[];
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* Instead of wrapping the ima_digest_data struct inside a local structure
|
||||
* with the maximum hash size, define ima_max_digest_data struct.
|
||||
*/
|
||||
struct ima_max_digest_data {
|
||||
struct ima_digest_data hdr;
|
||||
u8 digest[HASH_MAX_DIGESTSIZE];
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* signature format v2 - for using with asymmetric keys
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user