fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / kernel / module-verify.h
1 /* module-verify.h: module verification definitions
2  *
3  * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4  * Written by David Howells (dhowells@redhat.com)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version
9  * 2 of the License, or (at your option) any later version.
10  */
11
12 #include <linux/types.h>
13 #include <linux/crypto.h>
14 #include <asm/module.h>
15
16 #ifdef CONFIG_MODULE_VERIFY
17 struct module_verify_data {
18         struct hash_desc        hash;           /* module signature digest */
19         const void              *buffer;        /* module buffer */
20         const Elf_Ehdr          *hdr;           /* ELF header */
21         const Elf_Shdr          *sections;      /* ELF section table */
22         const Elf_Sym           *symbols;       /* ELF symbol table */
23         const char              *secstrings;    /* ELF section string table */
24         const char              *strings;       /* ELF string table */
25         size_t                  *secsizes;      /* section size list */
26         size_t                  size;           /* module object size */
27         size_t                  nsects;         /* number of sections */
28         size_t                  nsyms;          /* number of symbols */
29         size_t                  nstrings;       /* size of strings section */
30         size_t                  signed_size;    /* count of bytes contributed to digest */
31         int                     *canonlist;     /* list of canonicalised sections */
32         int                     *canonmap;      /* section canonicalisation map */
33         int                     sig_index;      /* module signature section index */
34         uint8_t                 xcsum;          /* checksum of bytes contributed to digest */
35         uint8_t                 csum;           /* checksum of bytes representing a section */
36 };
37
38 /*
39  * module-verify.c
40  */
41 extern int module_verify(const Elf_Ehdr *hdr, size_t size);
42
43 /*
44  * module-verify-elf.c
45  */
46 #ifdef CONFIG_MODULE_VERIFY_ELF
47 extern int module_verify_elf(struct module_verify_data *mvdata);
48 #else
49 #define module_verify_elf(m) (0)
50 #endif
51
52 /*
53  * module-verify-sig.c
54  */
55 #ifdef CONFIG_MODULE_SIG
56 extern int module_verify_signature(struct module_verify_data *mvdata);
57 #else
58 #define module_verify_signature(m) (0)
59 #endif
60
61 #else
62 #define module_verify(h, s) (0)
63 #endif