aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.h
diff options
context:
space:
mode:
authorKent Yoder <key@linux.vnet.ibm.com>2012-06-07 14:47:14 -0400
committerKent Yoder <key@linux.vnet.ibm.com>2012-08-22 12:11:33 -0400
commit41ab999c80f1d368f32a2554ba8f44feff26f54d (patch)
tree8d53970a210364e19ecbdc05f6d8c8f88e6aadbf /drivers/char/tpm/tpm.h
parente5dcd87fee12ed64a9ea911102025facc0c7d10c (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 'drivers/char/tpm/tpm.h')
-rw-r--r--drivers/char/tpm/tpm.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 917f727e6740..645136eea890 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -28,6 +28,12 @@
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/tpm.h> 29#include <linux/tpm.h>
30 30
31enum tpm_const {
32 TPM_MINOR = 224, /* officially assigned */
33 TPM_BUFSIZE = 4096,
34 TPM_NUM_DEVICES = 256,
35};
36
31enum tpm_timeout { 37enum tpm_timeout {
32 TPM_TIMEOUT = 5, /* msecs */ 38 TPM_TIMEOUT = 5, /* msecs */
33}; 39};
@@ -269,6 +275,21 @@ struct tpm_pcrextend_in {
269 u8 hash[TPM_DIGEST_SIZE]; 275 u8 hash[TPM_DIGEST_SIZE];
270}__attribute__((packed)); 276}__attribute__((packed));
271 277
278/* 128 bytes is an arbitrary cap. This could be as large as TPM_BUFSIZE - 18
279 * bytes, but 128 is still a relatively large number of random bytes and
280 * anything much bigger causes users of struct tpm_cmd_t to start getting
281 * compiler warnings about stack frame size. */
282#define TPM_MAX_RNG_DATA 128
283
284struct tpm_getrandom_out {
285 __be32 rng_data_len;
286 u8 rng_data[TPM_MAX_RNG_DATA];
287}__attribute__((packed));
288
289struct tpm_getrandom_in {
290 __be32 num_bytes;
291}__attribute__((packed));
292
272typedef union { 293typedef union {
273 struct tpm_getcap_params_out getcap_out; 294 struct tpm_getcap_params_out getcap_out;
274 struct tpm_readpubek_params_out readpubek_out; 295 struct tpm_readpubek_params_out readpubek_out;
@@ -277,6 +298,8 @@ typedef union {
277 struct tpm_pcrread_in pcrread_in; 298 struct tpm_pcrread_in pcrread_in;
278 struct tpm_pcrread_out pcrread_out; 299 struct tpm_pcrread_out pcrread_out;
279 struct tpm_pcrextend_in pcrextend_in; 300 struct tpm_pcrextend_in pcrextend_in;
301 struct tpm_getrandom_in getrandom_in;
302 struct tpm_getrandom_out getrandom_out;
280} tpm_cmd_params; 303} tpm_cmd_params;
281 304
282struct tpm_cmd_t { 305struct tpm_cmd_t {