security/integrity/integrity.h
Source file repositories/reference/linux-study-clean/security/integrity/integrity.h
File Facts
- System
- Linux kernel
- Corpus path
security/integrity/integrity.h- Extension
.h- Size
- 7416 bytes
- Lines
- 282
- Domain
- Core OS
- Bucket
- Security And Isolation
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/integrity.hlinux/secure_boot.hcrypto/sha1.hcrypto/hash.hlinux/key.hlinux/audit.hlinux/lsm_hooks.h
Detected Declarations
struct evm_ima_xattr_datastruct evm_xattrstruct ima_digest_datastruct ima_max_digest_datastruct signature_v2_hdrstruct ima_file_idstruct modsigenum evm_ima_xattr_typefunction integrity_digsig_verifyfunction integrity_modsig_verifyfunction integrity_init_keyringfunction integrity_load_certfunction asymmetric_verifyfunction asymmetric_verify_v3function ima_modsig_verifyfunction ima_load_x509function evm_load_x509function integrity_audit_log_startfunction integrity_audit_msgfunction add_to_platform_keyringfunction add_to_machine_keyring
Annotated Snippet
struct evm_ima_xattr_data {
/* New members must be added within the __struct_group() macro below. */
__struct_group(evm_ima_xattr_data_hdr, hdr, __packed,
u8 type;
);
u8 data[];
} __packed;
static_assert(offsetof(struct evm_ima_xattr_data, data) == sizeof(struct evm_ima_xattr_data_hdr),
"struct member likely outside of __struct_group()");
/* Only used in the EVM HMAC code. */
struct evm_xattr {
struct evm_ima_xattr_data_hdr data;
u8 digest[SHA1_DIGEST_SIZE];
} __packed;
#define IMA_MAX_DIGEST_SIZE HASH_MAX_DIGESTSIZE
struct ima_digest_data {
/* New members must be added within the __struct_group() macro below. */
__struct_group(ima_digest_data_hdr, hdr, __packed,
u8 algo;
u8 length;
union {
struct {
u8 unused;
u8 type;
} sha1;
struct {
u8 type;
u8 algo;
} ng;
u8 data[2];
} xattr;
);
u8 digest[];
} __packed;
static_assert(offsetof(struct ima_digest_data, digest) == sizeof(struct ima_digest_data_hdr),
"struct member likely outside of __struct_group()");
/*
* 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 hdr;
u8 digest[HASH_MAX_DIGESTSIZE];
} __packed;
/*
* signature header format v2 - for using with asymmetric keys
*
* The signature_v2_hdr struct includes a signature format version
* to simplify defining new signature formats.
*
* signature format:
* version 2: regular file data hash based signature
* version 3: struct ima_file_id data based signature
*/
struct signature_v2_hdr {
uint8_t type; /* xattr type */
uint8_t version; /* signature format version */
uint8_t hash_algo; /* Digest algorithm [enum hash_algo] */
__be32 keyid; /* IMA key identifier - not X509/PGP specific */
__be16 sig_size; /* signature size */
uint8_t sig[]; /* signature payload */
} __packed;
/*
* IMA signature version 3 disambiguates the data that is signed, by
* indirectly signing the hash of the ima_file_id structure data,
* containing either the fsverity_descriptor struct digest or, in the
* future, the regular IMA file hash.
*
* (The hash of the ima_file_id structure is only of the portion used.)
*/
struct ima_file_id {
__u8 hash_type; /* xattr type [enum evm_ima_xattr_type] */
__u8 hash_algorithm; /* Digest algorithm [enum hash_algo] */
__u8 hash[HASH_MAX_DIGESTSIZE];
} __packed;
int integrity_kernel_read(struct file *file, loff_t offset,
void *addr, unsigned long count);
int __init integrity_fs_init(void);
void __init integrity_fs_fini(void);
#define INTEGRITY_KEYRING_EVM 0
#define INTEGRITY_KEYRING_IMA 1
#define INTEGRITY_KEYRING_PLATFORM 2
Annotation
- Immediate include surface: `linux/types.h`, `linux/integrity.h`, `linux/secure_boot.h`, `crypto/sha1.h`, `crypto/hash.h`, `linux/key.h`, `linux/audit.h`, `linux/lsm_hooks.h`.
- Detected declarations: `struct evm_ima_xattr_data`, `struct evm_xattr`, `struct ima_digest_data`, `struct ima_max_digest_data`, `struct signature_v2_hdr`, `struct ima_file_id`, `struct modsig`, `enum evm_ima_xattr_type`, `function integrity_digsig_verify`, `function integrity_modsig_verify`.
- Atlas domain: Core OS / Security And Isolation.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.