diff options
author | Kent Yoder <key@linux.vnet.ibm.com> | 2012-06-07 14:47:14 -0400 |
---|---|---|
committer | Kent Yoder <key@linux.vnet.ibm.com> | 2012-08-22 12:11:33 -0400 |
commit | 41ab999c80f1d368f32a2554ba8f44feff26f54d (patch) | |
tree | 8d53970a210364e19ecbdc05f6d8c8f88e6aadbf /include/linux/tpm.h | |
parent | e5dcd87fee12ed64a9ea911102025facc0c7d10c (diff) |
tpm: Move tpm_get_random api into the TPM device driver
Move the tpm_get_random api from the trusted keys code into the TPM
device driver itself so that other callers can make use of it. Also,
change the api slightly so that the number of bytes read is returned in
the call, since the TPM command can potentially return fewer bytes than
requested.
Acked-by: David Safford <safford@linux.vnet.ibm.com>
Reviewed-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/tpm.h')
-rw-r--r-- | include/linux/tpm.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/tpm.h b/include/linux/tpm.h index fdc718abf83b..fcb627ff8d3e 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h | |||
@@ -32,6 +32,7 @@ | |||
32 | extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf); | 32 | extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf); |
33 | extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash); | 33 | extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash); |
34 | extern int tpm_send(u32 chip_num, void *cmd, size_t buflen); | 34 | extern int tpm_send(u32 chip_num, void *cmd, size_t buflen); |
35 | extern int tpm_get_random(u32 chip_num, u8 *data, size_t max); | ||
35 | #else | 36 | #else |
36 | static inline int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) { | 37 | static inline int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) { |
37 | return -ENODEV; | 38 | return -ENODEV; |
@@ -42,5 +43,8 @@ static inline int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) { | |||
42 | static inline int tpm_send(u32 chip_num, void *cmd, size_t buflen) { | 43 | static inline int tpm_send(u32 chip_num, void *cmd, size_t buflen) { |
43 | return -ENODEV; | 44 | return -ENODEV; |
44 | } | 45 | } |
46 | static inline int tpm_get_random(u32 chip_num, u8 *data, size_t max) { | ||
47 | return -ENODEV; | ||
48 | } | ||
45 | #endif | 49 | #endif |
46 | #endif | 50 | #endif |