| OLD | NEW |
| 1 /* Software-Based Trusted Platform Module (TPM) Emulator for Linux | 1 /* Software-based Trusted Platform Module (TPM) Emulator |
| 2 * Copyright (C) 2004 Mario Strasser <mast@gmx.net>, | 2 * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net> |
| 3 * | 3 * |
| 4 * This module is free software; you can redistribute it and/or modify | 4 * This module is free software; you can redistribute it and/or modify |
| 5 * it under the terms of the GNU General Public License as published | 5 * it under the terms of the GNU General Public License as published |
| 6 * by the Free Software Foundation; either version 2 of the License, | 6 * by the Free Software Foundation; either version 2 of the License, |
| 7 * or (at your option) any later version. | 7 * or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This module is distributed in the hope that it will be useful, | 9 * This module is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * $Id$ | 14 * $Id: tpm_emulator.h 426 2010-02-22 17:11:58Z mast $ |
| 15 */ | 15 */ |
| 16 | 16 |
| 17 #ifndef _TPM_EMULATOR_H_ | 17 #ifndef _TPM_EMULATOR_H_ |
| 18 #define _TPM_EMULATOR_H_ | 18 #define _TPM_EMULATOR_H_ |
| 19 | 19 |
| 20 #include "config.h" | 20 #include "config.h" |
| 21 #include "tpm_emulator_extern.h" | 21 #include "tpm_emulator_extern.h" |
| 22 | 22 |
| 23 #define TPM_CMD_BUF_SIZE 4096 | |
| 24 | |
| 25 #define TPM_MANUFACTURER 0x4554485A /* 'ETHZ' */ | 23 #define TPM_MANUFACTURER 0x4554485A /* 'ETHZ' */ |
| 26 | 24 |
| 27 /** | 25 /** |
| 26 * configuration flags |
| 27 */ |
| 28 #define TPM_CONF_STRONG_PERSISTENCE 0x01 |
| 29 #define TPM_CONF_GENERATE_EK 0x02 |
| 30 #define TPM_CONF_GENERATE_SEED_DAA 0x04 |
| 31 #define TPM_CONF_USE_INTERNAL_PRNG 0x08 |
| 32 #define TPM_CONF_ALLOW_PRNG_STATE_SETTING 0x10 |
| 33 #define TPM_CONF_KEEP_PUBEK_READABLE 0x20 |
| 34 |
| 35 /** |
| 28 * tpm_emulator_init - initialises and starts the TPM emulator | 36 * tpm_emulator_init - initialises and starts the TPM emulator |
| 29 * @startup: [in] startup mode | 37 * @startup: [in] startup mode |
| 38 * @conf: [in] tpm configuration flags |
| 30 */ | 39 */ |
| 31 void tpm_emulator_init(uint32_t startup); | 40 void tpm_emulator_init(uint32_t startup, uint32_t conf); |
| 32 | 41 |
| 33 /** | 42 /** |
| 34 * tpm_emulator_shutdown - shuts the TPM emulator down | 43 * tpm_emulator_shutdown - shuts the TPM emulator down |
| 35 */ | 44 */ |
| 36 void tpm_emulator_shutdown(void); | 45 void tpm_emulator_shutdown(void); |
| 37 | 46 |
| 38 /** | 47 /** |
| 39 * tpm_handle_command - handles (i.e., executes) TPM commands | 48 * tpm_handle_command - handles (i.e., executes) TPM commands |
| 40 * @in: [in] incoming TPM command | 49 * @in: [in] incoming TPM command |
| 41 * @in_size: [in] total number of input bytes | 50 * @in_size: [in] total number of input bytes |
| 42 * @out: [inout] outgoing TPM result | 51 * @out: [inout] outgoing TPM result |
| 43 * @out_size: [inout] total number of output bytes | 52 * @out_size: [inout] total number of output bytes |
| 44 * @Returns: 0 on success, -1 otherwise | 53 * @Returns: 0 on success, -1 otherwise |
| 45 * | 54 * |
| 46 * Description: Handles (i.e., executes) TPM commands. The parameters | 55 * Description: Handles (i.e., executes) TPM commands. The parameters |
| 47 * out and out_size determine the output buffer and its capacity, | 56 * out and out_size determine the output buffer and its capacity, |
| 48 * respectively. If out is NULL, the required memory is allocated | 57 * respectively. If out is NULL, the required memory is allocated |
| 49 * internally and has to be released by means of tpm_free() after | 58 * internally and has to be released by means of tpm_free() after |
| 50 * its usage. In case of an error, all internally allocated memory | 59 * its usage. In case of an error, all internally allocated memory |
| 51 * is released and the the state of out and out_size is unspecified. | 60 * is released and the the state of out and out_size is unspecified. |
| 52 */ | 61 */ |
| 53 int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint3
2_t *out_size); | 62 int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint3
2_t *out_size); |
| 54 | 63 |
| 55 #endif /* _TPM_EMULATOR_H_ */ | 64 #endif /* _TPM_EMULATOR_H_ */ |
| 56 | 65 |
| OLD | NEW |