Make TPM datagrams const, since they cannot be modified in the RO firmware.

Change-Id: I7f135584536c7437824ae65f74a8f7ef27c28665

BUG=
TEST=

Review URL: http://codereview.chromium.org/3271006
This commit is contained in:
Luigi Semenzato
2010-08-31 15:49:56 -07:00
parent 3da063e3f7
commit 89a02c194f
6 changed files with 27 additions and 27 deletions

View File

@@ -29,7 +29,7 @@ void TlclOpenDevice(void);
/* Send data to the TPM and receive a response. Returns 0 if success,
* nonzero if error. */
uint32_t TlclStubSendReceive(uint8_t* request, int request_length,
uint32_t TlclStubSendReceive(const uint8_t* request, int request_length,
uint8_t* response, int max_length);
/*****************************************************************************/

View File

@@ -1,102 +1,102 @@
/* This file is automatically generated */
struct s_tpm_extend_cmd{
const struct s_tpm_extend_cmd{
uint8_t buffer[34];
uint16_t pcrNum;
uint16_t inDigest;
} tpm_extend_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x22, 0x0, 0x0, 0x0, 0x14, },
10, 14, };
struct s_tpm_getpermissions_cmd{
const struct s_tpm_getpermissions_cmd{
uint8_t buffer[22];
uint16_t index;
} tpm_getpermissions_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x11, 0x0, 0x0, 0x0, 0x4, },
18, };
struct s_tpm_getstclearflags_cmd{
const struct s_tpm_getstclearflags_cmd{
uint8_t buffer[22];
} tpm_getstclearflags_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, 0x9, },
};
struct s_tpm_getflags_cmd{
const struct s_tpm_getflags_cmd{
uint8_t buffer[22];
} tpm_getflags_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, 0x8, },
};
struct s_tpm_physicalsetdeactivated_cmd{
const struct s_tpm_physicalsetdeactivated_cmd{
uint8_t buffer[11];
uint16_t deactivated;
} tpm_physicalsetdeactivated_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xb, 0x0, 0x0, 0x0, 0x72, },
10, };
struct s_tpm_physicalenable_cmd{
const struct s_tpm_physicalenable_cmd{
uint8_t buffer[10];
} tpm_physicalenable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x6f, },
};
struct s_tpm_physicaldisable_cmd{
const struct s_tpm_physicaldisable_cmd{
uint8_t buffer[10];
} tpm_physicaldisable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x70, },
};
struct s_tpm_forceclear_cmd{
const struct s_tpm_forceclear_cmd{
uint8_t buffer[10];
} tpm_forceclear_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x5d, },
};
struct s_tpm_readpubek_cmd{
const struct s_tpm_readpubek_cmd{
uint8_t buffer[30];
} tpm_readpubek_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x1e, 0x0, 0x0, 0x0, 0x7c, },
};
struct s_tpm_continueselftest_cmd{
const struct s_tpm_continueselftest_cmd{
uint8_t buffer[10];
} tpm_continueselftest_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x53, },
};
struct s_tpm_selftestfull_cmd{
const struct s_tpm_selftestfull_cmd{
uint8_t buffer[10];
} tpm_selftestfull_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x50, },
};
struct s_tpm_resume_cmd{
const struct s_tpm_resume_cmd{
uint8_t buffer[12];
} tpm_resume_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x2, },
};
struct s_tpm_startup_cmd{
const struct s_tpm_startup_cmd{
uint8_t buffer[12];
} tpm_startup_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x1, },
};
struct s_tpm_finalizepp_cmd{
const struct s_tpm_finalizepp_cmd{
uint8_t buffer[12];
} tpm_finalizepp_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x2, 0xa0, },
};
struct s_tpm_pplock_cmd{
const struct s_tpm_pplock_cmd{
uint8_t buffer[12];
} tpm_pplock_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x4, },
};
struct s_tpm_ppenable_cmd{
const struct s_tpm_ppenable_cmd{
uint8_t buffer[12];
} tpm_ppenable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x20, },
};
struct s_tpm_ppassert_cmd{
const struct s_tpm_ppassert_cmd{
uint8_t buffer[12];
} tpm_ppassert_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x8, },
};
struct s_tpm_nv_read_cmd{
const struct s_tpm_nv_read_cmd{
uint8_t buffer[22];
uint16_t index;
uint16_t length;
} tpm_nv_read_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0xcf, },
10, 18, };
struct s_tpm_nv_write_cmd{
const struct s_tpm_nv_write_cmd{
uint8_t buffer[256];
uint16_t index;
uint16_t length;
@@ -104,7 +104,7 @@ struct s_tpm_nv_write_cmd{
} tpm_nv_write_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcd, },
10, 18, 22, };
struct s_tpm_nv_definespace_cmd{
const struct s_tpm_nv_definespace_cmd{
uint8_t buffer[101];
uint16_t index;
uint16_t perm;

View File

@@ -47,7 +47,7 @@ static INLINE int TpmReturnCode(const uint8_t* buffer) {
/* Sends a TPM command and gets a response. Returns 0 if success or the TPM
* error code if error. */
static uint32_t TlclSendReceive(uint8_t* request, uint8_t* response,
static uint32_t TlclSendReceive(const uint8_t* request, uint8_t* response,
int max_length) {
uint32_t result;
@@ -85,7 +85,7 @@ static uint32_t TlclSendReceive(uint8_t* request, uint8_t* response,
/* Sends a command and returns the error code. */
static uint32_t Send(uint8_t* command) {
static uint32_t Send(const uint8_t* command) {
uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE];
return TlclSendReceive(command, response, sizeof(response));
}

View File

@@ -84,7 +84,7 @@ static void TpmExecute(const uint8_t *in, const uint32_t in_len,
/* Gets the tag field of a TPM command.
*/
POSSIBLY_UNUSED static INLINE int TpmTag(uint8_t* buffer) {
POSSIBLY_UNUSED static INLINE int TpmTag(const uint8_t* buffer) {
uint16_t tag;
FromTpmUint16(buffer, &tag);
return (int) tag;
@@ -129,7 +129,7 @@ void TlclOpenDevice(void) {
}
uint32_t TlclStubSendReceive(uint8_t* request, int request_length,
uint32_t TlclStubSendReceive(const uint8_t* request, int request_length,
uint8_t* response, int max_length) {
/*
* In a real firmware implementation, this function should contain

View File

@@ -1 +1 @@
char* VbootVersion = "VBOOv=6eadb043";
char* VbootVersion = "VBOOv=fc764233";

View File

@@ -431,7 +431,7 @@ void OutputCommands(Command* cmd) {
if (cmd == NULL) {
return;
} else {
printf("struct s_%s{\n uint8_t buffer[%d];\n",
printf("const struct s_%s{\n uint8_t buffer[%d];\n",
cmd->name, cmd->size == 0 ? cmd->max_size : cmd->size);
OutputFields(cmd->fields);
printf("} %s = {{", cmd->name);