Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * Module signature handling.
0004  *
0005  * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
0006  * Written by David Howells (dhowells@redhat.com)
0007  */
0008 
0009 #ifndef _LINUX_MODULE_SIGNATURE_H
0010 #define _LINUX_MODULE_SIGNATURE_H
0011 
0012 #include <linux/types.h>
0013 
0014 /* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */
0015 #define MODULE_SIG_STRING "~Module signature appended~\n"
0016 
0017 enum pkey_id_type {
0018     PKEY_ID_PGP,        /* OpenPGP generated key ID */
0019     PKEY_ID_X509,       /* X.509 arbitrary subjectKeyIdentifier */
0020     PKEY_ID_PKCS7,      /* Signature in PKCS#7 message */
0021 };
0022 
0023 /*
0024  * Module signature information block.
0025  *
0026  * The constituents of the signature section are, in order:
0027  *
0028  *  - Signer's name
0029  *  - Key identifier
0030  *  - Signature data
0031  *  - Information block
0032  */
0033 struct module_signature {
0034     u8  algo;       /* Public-key crypto algorithm [0] */
0035     u8  hash;       /* Digest algorithm [0] */
0036     u8  id_type;    /* Key identifier type [PKEY_ID_PKCS7] */
0037     u8  signer_len; /* Length of signer's name [0] */
0038     u8  key_id_len; /* Length of key identifier [0] */
0039     u8  __pad[3];
0040     __be32  sig_len;    /* Length of signature data */
0041 };
0042 
0043 int mod_check_sig(const struct module_signature *ms, size_t file_len,
0044           const char *name);
0045 
0046 #endif /* _LINUX_MODULE_SIGNATURE_H */