Root/
1 | /* |
2 | * Copyright (C) 2012 Kent Yoder IBM Corporation |
3 | * |
4 | * HWRNG interfaces to pull RNG data from a TPM |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ |
19 | |
20 | #include <linux/module.h> |
21 | #include <linux/hw_random.h> |
22 | #include <linux/tpm.h> |
23 | |
24 | #define MODULE_NAME "tpm-rng" |
25 | |
26 | static int tpm_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) |
27 | { |
28 | return tpm_get_random(TPM_ANY_NUM, data, max); |
29 | } |
30 | |
31 | static struct hwrng tpm_rng = { |
32 | .name = MODULE_NAME, |
33 | .read = tpm_rng_read, |
34 | }; |
35 | |
36 | static int __init rng_init(void) |
37 | { |
38 | return hwrng_register(&tpm_rng); |
39 | } |
40 | module_init(rng_init); |
41 | |
42 | static void __exit rng_exit(void) |
43 | { |
44 | hwrng_unregister(&tpm_rng); |
45 | } |
46 | module_exit(rng_exit); |
47 | |
48 | MODULE_LICENSE("GPL v2"); |
49 | MODULE_AUTHOR("Kent Yoder <key@linux.vnet.ibm.com>"); |
50 | MODULE_DESCRIPTION("RNG driver for TPM devices"); |
51 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9