]> git.karo-electronics.de Git - karo-tx-linux.git/commit
MODSIGN: Implement module signature checking
authorDavid Howells <dhowells@redhat.com>
Wed, 26 Sep 2012 09:11:03 +0000 (10:11 +0100)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 28 Sep 2012 05:22:46 +0000 (14:52 +0930)
commit524891a51f4d5e2f7a4298e286cb6a65ac34ba39
treeec160932178f61cfd3f552e825b6591dfc6c5b57
parent9481c9a34b5f31e5292fc589663d0ea6a401e81c
MODSIGN: Implement module signature checking

Check the signature on the module against the keys compiled into the kernel or
available in a hardware key store.

Currently, only RSA keys are supported - though that's easy enough to change,
and the signature is expected to contain raw components (so not a PGP or
PKCS#7 formatted blob).

The signature blob is expected to consist of the following pieces in order:

 (1) The binary identifier for the key.  This is expected to match the
     SubjectKeyIdentifier from an X.509 certificate.  Only X.509 type
     identifiers are currently supported.

 (2) The signature data, consisting of a series of MPIs in which each is in
     the format of a 2-byte BE word sizes followed by the content data.

 (3) A 12 byte information block of the form:

struct module_signature {
enum pkey_algo algo : 8;
enum pkey_hash_algo hash : 8;
enum pkey_id_type id_type : 8;
u8 __pad;
__be32 id_length;
__be32 sig_length;
};

     The three enums are defined in crypto/public_key.h.

     'algo' contains the public-key algorithm identifier (0->DSA, 1->RSA).

     'hash' contains the digest algorithm identifier (0->MD4, 1->MD5, 2->SHA1,
      etc.).

     'id_type' contains the public-key identifier type (0->PGP, 1->X.509).

     '__pad' should be 0.

     'id_length' should contain in the binary identifier length in BE form.

     'sig_length' should contain in the signature data length in BE form.

     The lengths are in BE order rather than CPU order to make dealing with
     cross-compilation easier.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (minor Kconfig fix)
init/Kconfig
kernel/module_signing.c