replace tabs of parameter explanation comments of functions with spaces

This commit is contained in:
Thomas
2017-09-11 14:47:56 +02:00
parent 2b4fad42d4
commit ded6b58ba1

106
eltt2.c
View File

@@ -49,15 +49,15 @@
int main(int argc, char **argv)
{
// ---------- Local declarations ----------
int ret_val = EXIT_SUCCESS; // Return value.
uint8_t *tpm_response_buf = NULL; // Buffer for TPM response.
ssize_t tpm_response_buf_size = 0; // Size of tpm_response_buf.
int i = 0; // Command line parsing counter.
int option = 0; // Command line option.
uint8_t *input_bytes = NULL; // Custom command bytes for transmit in case of command line options -b and -E.
size_t input_bytes_size = 0; // Size of input_bytes.
int no_transmission = 0; // Flag to skip the transmission call, e.g. in case of command line option -h.
int tpm_error = 0; // Flag to indicate whether a TPM response has returned a TPM error code or not.
int ret_val = EXIT_SUCCESS; // Return value.
uint8_t *tpm_response_buf = NULL; // Buffer for TPM response.
ssize_t tpm_response_buf_size = 0; // Size of tpm_response_buf.
int i = 0; // Command line parsing counter.
int option = 0; // Command line option.
uint8_t *input_bytes = NULL; // Custom command bytes for transmit in case of command line options -b and -E.
size_t input_bytes_size = 0; // Size of input_bytes.
int no_transmission = 0; // Flag to skip the transmission call, e.g. in case of command line option -h.
int tpm_error = 0; // Flag to indicate whether a TPM response has returned a TPM error code or not.
// ---------- Program flow ----------
printf("\n");
@@ -603,9 +603,9 @@ static int response_print(uint8_t *response_buf, size_t resp_size, int option)
static int print_response_buf(uint8_t *response_buf, size_t resp_size, uint32_t offset, int format)
{
int ret_val = EXIT_SUCCESS; // Return value.
uint32_t i = 0; // Loop variable.
uint64_t data_size = 0; // Size of response data.
int ret_val = EXIT_SUCCESS; // Return value.
uint32_t i = 0; // Loop variable.
uint64_t data_size = 0; // Size of response data.
do
{
@@ -834,11 +834,11 @@ static int print_capability_flags(uint8_t *response_buf, uint8_t cap_selector)
tmp = ((propertyValue & i) == 0? 0:1); // Check bit 0 value.
printf("Shared RAM: %i %s", (tmp), ((tmp)? "SET\n" : "CLEAR\n"));
i = i + i; // bit 1
i = i << 1; // bit 1
tmp = ((propertyValue & i) == 0? 0:1); // Check bit 1 value.
printf("Shared NV: %i %s", (tmp), ((tmp)? "SET\n" : "CLEAR\n"));
i = i * 2; // bit 2
i = i << 1; // bit 2
tmp = ((propertyValue & i) == 0? 0:1); // Check bit 2 value.
printf("Object Copied To Ram: %i %s", (tmp), ((tmp)? "SET\n" : "CLEAR\n"));
//bit 31:3 = reserved
@@ -917,11 +917,11 @@ static int print_capability_flags(uint8_t *response_buf, uint8_t cap_selector)
static int print_clock_info(uint8_t *response_buf)
{
int ret_val = EXIT_SUCCESS; // Return value.
uint64_t propertyValue = 0; // Value of the read property.
uint64_t tmp_value = 0; // Helper variable for calculating actual values.
uint64_t sec = 0; // Value for seconds.
uint64_t tmp = 0; // buf_to_uint64 return value.
int ret_val = EXIT_SUCCESS; // Return value.
uint64_t propertyValue = 0; // Value of the read property.
uint64_t tmp_value = 0; // Helper variable for calculating actual values.
uint64_t sec = 0; // Value for seconds.
uint64_t tmp = 0; // buf_to_uint64 return value.
do
{
@@ -996,9 +996,9 @@ static int print_clock_info(uint8_t *response_buf)
static int buf_to_uint64(uint8_t *input_buffer, uint32_t offset, uint32_t length, uint64_t *output_value, uint32_t input_buffer_size)
{
int ret_val = EXIT_SUCCESS; // Return value.
uint32_t i = 0; // Loop variable.
uint64_t tmp = 0; // Temporary variable for value calculation.
int ret_val = EXIT_SUCCESS; // Return value.
uint32_t i = 0; // Loop variable.
uint64_t tmp = 0; // Temporary variable for value calculation.
do
{
@@ -1050,11 +1050,11 @@ static int buf_to_uint64(uint8_t *input_buffer, uint32_t offset, uint32_t length
static int hexstr_to_bytearray(char *byte_string, uint8_t *byte_values, size_t byte_values_size)
{
int ret_val = EXIT_SUCCESS; // Return value.
char hex_byte[3] = {0}; // Temporary buffer for input bytes.
char* invalidChars = NULL; // Pointer to target buffer where method stores invalid characters.
uint32_t i = 0; // Loop variable.
uint32_t unStrLen = 0; // Temporary store for byte string length.
int ret_val = EXIT_SUCCESS; // Return value.
char hex_byte[3] = {0}; // Temporary buffer for input bytes.
char* invalidChars = NULL; // Pointer to target buffer where method stores invalid characters.
uint32_t i = 0; // Loop variable.
uint32_t unStrLen = 0; // Temporary store for byte string length.
do
{
@@ -1126,8 +1126,8 @@ static int hexstr_to_bytearray(char *byte_string, uint8_t *byte_values, size_t b
static int int_to_bytearray(uint64_t input, uint32_t input_size, uint8_t *output_byte)
{
int ret_val = EXIT_SUCCESS; // Return value.
uint32_t i; // For-while-loop counter.
int ret_val = EXIT_SUCCESS; // Return value.
uint32_t i; // For-while-loop counter.
do
{
@@ -1156,9 +1156,9 @@ static int int_to_bytearray(uint64_t input, uint32_t input_size, uint8_t *output
static int get_random(char *data_length_string, uint8_t *response_buf)
{
int ret_val = EXIT_SUCCESS; // Return value.
uint8_t bytes_requested = 0; // Amount of random bytes requested by the user.
size_t byte_string_size = 0; // Size of user input.
int ret_val = EXIT_SUCCESS; // Return value.
uint8_t bytes_requested = 0; // Amount of random bytes requested by the user.
size_t byte_string_size = 0; // Size of user input.
do
{
@@ -1280,19 +1280,19 @@ static int create_hash(char *data_string, char option, uint8_t *hash_cmd_buf, ui
static int create_hash_sequence(char *data_string, char option, uint8_t *tpm_response_buf, ssize_t *tpm_response_buf_size)
{
int ret_val = EXIT_SUCCESS; // Return value.
uint16_t data_string_bytes_size = 0; // Size of user input data string in bytes.
uint8_t *data_string_bytes = NULL; // Buffer for user input data string as bytes.
uint32_t update_request_size = 0; // Size of user input string.
uint16_t transfer_bytes = 0; // Amount of bytes to be transmitted to the TPM.
uint16_t remaining_bytes = 0; // Amount of bytes not yet transmitted to the TPM.
uint32_t offset = 0; // Helper offset for generating command request.
uint64_t tpm_rc = TPM_RC_SUCCESS; // TPM return code.
uint8_t *update_request = NULL; // Buffer for update sequence command.
uint8_t sequence_handle[4]; // Buffer for sequence handle.
ssize_t original_response_buf_size = 0; // Backup of the original response buffer size.
int ret_val = EXIT_SUCCESS; // Return value.
uint16_t data_string_bytes_size = 0; // Size of user input data string in bytes.
uint8_t *data_string_bytes = NULL; // Buffer for user input data string as bytes.
uint32_t update_request_size = 0; // Size of user input string.
uint16_t transfer_bytes = 0; // Amount of bytes to be transmitted to the TPM.
uint16_t remaining_bytes = 0; // Amount of bytes not yet transmitted to the TPM.
uint32_t offset = 0; // Helper offset for generating command request.
uint64_t tpm_rc = TPM_RC_SUCCESS; // TPM return code.
uint8_t *update_request = NULL; // Buffer for update sequence command.
uint8_t sequence_handle[4]; // Buffer for sequence handle.
ssize_t original_response_buf_size = 0; // Backup of the original response buffer size.
ssize_t minimum_response_buf_size =
TPM_CMD_HEADER_SIZE + sizeof(sequence_handle); // Minimum success response buffer size (TPM command header + sequence handle)
TPM_CMD_HEADER_SIZE + sizeof(sequence_handle); // Minimum success response buffer size (TPM command header + sequence handle)
do
{
@@ -1451,9 +1451,9 @@ static int create_hash_sequence(char *data_string, char option, uint8_t *tpm_res
static int pcr_extend(char *pcr_index_str, char *pcr_digest_str, uint8_t *pcr_cmd_buf, size_t pcr_cmd_buf_size, char option)
{
int ret_val = EXIT_SUCCESS; // Return value.
uint8_t pcr_index = 0; // PCR index user input byte.
uint32_t pcr_digest_size = 0; // Sizeof PCR digest user input.
int ret_val = EXIT_SUCCESS; // Return value.
uint8_t pcr_index = 0; // PCR index user input byte.
uint32_t pcr_digest_size = 0; // Sizeof PCR digest user input.
do
{
@@ -1546,10 +1546,10 @@ static int pcr_extend(char *pcr_index_str, char *pcr_digest_str, uint8_t *pcr_cm
static int pcr_read(char *pcr_index_str, uint8_t *pcr_cmd_buf, char option)
{
int ret_val = EXIT_SUCCESS; // Return value.
int pcr_byte_index = 0; // The location for pcr_select on pcr_cmd_buf.
uint8_t pcr_select = 0; // PCR index as mapped bit value.
uint8_t pcr_index = 0; // PCR user input byte.
int ret_val = EXIT_SUCCESS; // Return value.
int pcr_byte_index = 0; // The location for pcr_select on pcr_cmd_buf.
uint8_t pcr_select = 0; // PCR index as mapped bit value.
uint8_t pcr_index = 0; // PCR user input byte.
do
{
@@ -1613,8 +1613,8 @@ static int pcr_read(char *pcr_index_str, uint8_t *pcr_cmd_buf, char option)
static int pcr_reset(char *pcr_index_str, uint8_t *pcr_cmd_buf)
{
int ret_val = EXIT_SUCCESS; // Return value.
uint8_t pcr_index = 0; // PCR user input byte.
int ret_val = EXIT_SUCCESS; // Return value.
uint8_t pcr_index = 0; // PCR user input byte.
do
{