58 changes: 29 additions & 29 deletions tools/tpm2_getmanufec.c
Expand Up @@ -127,7 +127,7 @@ int setKeyAlgorithm(UINT16 algorithm, TPM2B_PUBLIC *inPublic)
inPublic->t.publicArea.unique.sym.t.size = 0;
break;
default:
LOG_ERR("\nThe algorithm type input(%4.4x) is not supported!\n", algorithm);
LOG_ERR("\nThe algorithm type input(%4.4x) is not supported!", algorithm);
return -1;
}

Expand Down Expand Up @@ -189,7 +189,7 @@ int createEKHandle(TSS2_SYS_CONTEXT *sapi_context)

if (tpm2_util_hex_to_byte_structure(endorsePasswd, &sessionData.hmac.t.size,
sessionData.hmac.t.buffer) != 0) {
LOG_ERR("Failed to convert Hex format password for endorsePasswd.\n");
LOG_ERR("Failed to convert Hex format password for endorsePasswd.");
return -1;
}
}
Expand All @@ -205,7 +205,7 @@ int createEKHandle(TSS2_SYS_CONTEXT *sapi_context)
inSensitive.t.sensitive.userAuth.t.size = sizeof(inSensitive.t.sensitive.userAuth) - 2;
if (tpm2_util_hex_to_byte_structure(ekPasswd, &inSensitive.t.sensitive.userAuth.t.size,
inSensitive.t.sensitive.userAuth.t.buffer) != 0) {
LOG_ERR("Failed to convert Hex format password for ekPasswd.\n");
LOG_ERR("Failed to convert Hex format password for ekPasswd.");
return -1;
}
}
Expand All @@ -225,10 +225,10 @@ int createEKHandle(TSS2_SYS_CONTEXT *sapi_context)
&creationData, &creationHash, &creationTicket,
&name, &sessionsDataOut);
if (rval != TPM_RC_SUCCESS ) {
LOG_ERR("\nTPM2_CreatePrimary Error. TPM Error:0x%x\n", rval);
LOG_ERR("\nTPM2_CreatePrimary Error. TPM Error:0x%x", rval);
return -2;
}
LOG_INFO("\nEK create succ.. Handle: 0x%8.8x\n", handle2048ek);
LOG_INFO("\nEK create succ.. Handle: 0x%8.8x", handle2048ek);

if (!nonPersistentRead) {
/*
Expand All @@ -244,7 +244,7 @@ int createEKHandle(TSS2_SYS_CONTEXT *sapi_context)
sessionData.hmac.t.size = sizeof(sessionData.hmac) - 2;
if (tpm2_util_hex_to_byte_structure(ownerPasswd, &sessionData.hmac.t.size,
sessionData.hmac.t.buffer) != 0) {
LOG_ERR("Failed to convert Hex format password for ownerPasswd.\n");
LOG_ERR("Failed to convert Hex format password for ownerPasswd.");
return -1;
}
}
Expand All @@ -253,24 +253,24 @@ int createEKHandle(TSS2_SYS_CONTEXT *sapi_context)
rval = Tss2_Sys_EvictControl(sapi_context, TPM_RH_OWNER, handle2048ek,
&sessionsData, persistentHandle, &sessionsDataOut);
if (rval != TPM_RC_SUCCESS ) {
LOG_ERR("\nEvictControl:Make EK persistent Error. TPM Error:0x%x\n", rval);
LOG_ERR("\nEvictControl:Make EK persistent Error. TPM Error:0x%x", rval);
return -3;
}
LOG_INFO("EvictControl EK persistent succ.\n");
LOG_INFO("EvictControl EK persistent succ.");
}

rval = Tss2_Sys_FlushContext(sapi_context,
handle2048ek);
if (rval != TPM_RC_SUCCESS ) {
LOG_ERR("\nFlush transient EK failed. TPM Error:0x%x\n", rval);
LOG_ERR("\nFlush transient EK failed. TPM Error:0x%x", rval);
return -4;
}

LOG_INFO("Flush transient EK succ.\n");
LOG_INFO("Flush transient EK succ.");

/* TODO this serialization is not correct */
if (!files_save_bytes_to_file(outputFile, (UINT8 *)&outPublic, sizeof(outPublic))) {
LOG_ERR("\nFailed to save EK pub key into file(%s)\n", outputFile);
LOG_ERR("\nFailed to save EK pub key into file(%s)", outputFile);
return -5;
}

Expand All @@ -284,7 +284,7 @@ unsigned char *HashEKPublicKey(void)

unsigned char EKpubKey[259];

LOG_INFO("Calculating the SHA256 hash of the Endorsement Public Key\n");
LOG_INFO("Calculating the SHA256 hash of the Endorsement Public Key");

fp = fopen(outputFile, "rb");
if (!fp) {
Expand All @@ -294,7 +294,7 @@ unsigned char *HashEKPublicKey(void)

int rc = fseek(fp, 0x66, 0);
if (rc < 0) {
LOG_ERR("Could not perform fseek: %s\n", strerror(errno));
LOG_ERR("Could not perform fseek: %s", strerror(errno));
goto out;
}

Expand Down Expand Up @@ -354,7 +354,7 @@ char *Base64Encode(const unsigned char* buffer)
BIO *bio, *b64;
BUF_MEM *bufferPtr;

LOG_INFO("Calculating the Base64Encode of the hash of the Endorsement Public Key:\n");
LOG_INFO("Calculating the Base64Encode of the hash of the Endorsement Public Key:");

if (buffer == NULL) {
LOG_ERR("HashEKPublicKey returned null");
Expand Down Expand Up @@ -468,7 +468,7 @@ int RetrieveEndorsementCredentials(char *b64h)

rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
LOG_ERR("curl_easy_perform() failed: %s\n", curl_easy_strerror(rc));
LOG_ERR("curl_easy_perform() failed: %s", curl_easy_strerror(rc));
goto out_easy_cleanup;
}

Expand All @@ -488,7 +488,7 @@ int RetrieveEndorsementCredentials(char *b64h)
int TPMinitialProvisioning(void)
{
if (EKserverAddr == NULL) {
LOG_ERR("TPM Manufacturer Endorsement Credential Server Address cannot be NULL\n");
LOG_ERR("TPM Manufacturer Endorsement Credential Server Address cannot be NULL");
return -99;
}

Expand All @@ -498,7 +498,7 @@ int TPMinitialProvisioning(void)
return -1;
}

LOG_INFO("%s\n", b64);
LOG_INFO("%s", b64);

int rc = RetrieveEndorsementCredentials(b64);
free(b64);
Expand Down Expand Up @@ -547,30 +547,30 @@ int execute_tool (int argc, char *argv[], char *envp[], common_opts_t *opts,
switch ( opt ) {
case 'H':
if (!tpm2_util_string_to_uint32(optarg, &persistentHandle)) {
LOG_ERR("\nPlease input the handle used to make EK persistent(hex) in correct format.\n");
LOG_ERR("\nPlease input the handle used to make EK persistent(hex) in correct format.");
return 1;
}
break;

case 'e':
if (optarg == NULL || (strlen(optarg) >= sizeof(TPMU_HA)) ) {
LOG_ERR("\nPlease input the endorsement password(optional,no more than %d characters).\n", (int)sizeof(TPMU_HA) - 1);
LOG_ERR("\nPlease input the endorsement password(optional,no more than %d characters).", (int)sizeof(TPMU_HA) - 1);
return 1;
}
endorsePasswd = optarg;
break;

case 'o':
if (optarg == NULL || (strlen(optarg) >= sizeof(TPMU_HA)) ) {
LOG_ERR("\nPlease input the owner password(optional,no more than %d characters).\n", (int)sizeof(TPMU_HA) - 1);
LOG_ERR("\nPlease input the owner password(optional,no more than %d characters).", (int)sizeof(TPMU_HA) - 1);
return 1;
}
ownerPasswd = optarg;
break;

case 'P':
if (optarg == NULL || (strlen(optarg) >= sizeof(TPMU_HA)) ) {
LOG_ERR("\nPlease input the EK password(optional,no more than %d characters).\n", (int)sizeof(TPMU_HA) - 1);
LOG_ERR("\nPlease input the EK password(optional,no more than %d characters).", (int)sizeof(TPMU_HA) - 1);
return 1;
}
ekPasswd = optarg;
Expand All @@ -579,14 +579,14 @@ int execute_tool (int argc, char *argv[], char *envp[], common_opts_t *opts,
case 'g':
algorithmType = tpm2_alg_util_from_optarg(optarg);
if (algorithmType == TPM_ALG_ERROR) {
LOG_ERR("\nPlease input the algorithm type in correct format.\n");
LOG_ERR("\nPlease input the algorithm type in correct format.");
return 1;
}
break;

case 'f':
if (optarg == NULL ) {
LOG_ERR("\nPlease input the file used to save the pub ek.\n");
LOG_ERR("\nPlease input the file used to save the pub ek.");
return 1;
}
outputFile = optarg;
Expand All @@ -601,23 +601,23 @@ int execute_tool (int argc, char *argv[], char *envp[], common_opts_t *opts,
break;
case 'N':
nonPersistentRead = 1;
LOG_INFO("Tss2_Sys_CreatePrimary called with Endorsement Handle without making it persistent\n");
LOG_INFO("Tss2_Sys_CreatePrimary called with Endorsement Handle without making it persistent");
break;
case 'O':
OfflineProv = 1;
LOG_INFO("Setting up for offline provisioning - reading the retrieved EK specified by the file \n");
LOG_INFO("Setting up for offline provisioning - reading the retrieved EK specified by the file ");
break;
case 'U':
SSL_NO_VERIFY = 1;
LOG_WARN("TLS communication with the said TPM manufacturer server setup with SSL_NO_VERIFY!\n");
LOG_WARN("TLS communication with the said TPM manufacturer server setup with SSL_NO_VERIFY!");
break;
case 'S':
if (EKserverAddr) {
LOG_ERR("Multiple specifications of -S\n");
LOG_ERR("Multiple specifications of -S");
return 1;
}
EKserverAddr = optarg;
LOG_INFO("TPM Manufacturer EK provisioning address -- %s\n", EKserverAddr);
LOG_INFO("TPM Manufacturer EK provisioning address -- %s", EKserverAddr);
break;
case 'i':
return_val = tpm2_util_string_to_uint32(optarg, &auth_session_handle);
Expand All @@ -629,7 +629,7 @@ int execute_tool (int argc, char *argv[], char *envp[], common_opts_t *opts,
is_session_based_auth = true;
break;
default:
LOG_ERR("Unknown option\n");
LOG_ERR("Unknown option");
return 1;
}
}
Expand Down
8 changes: 4 additions & 4 deletions tools/tpm2_getpubak.c
Expand Up @@ -357,7 +357,7 @@ static bool create_ak(getpubak_context *ctx) {
rval = Tss2_Sys_EvictControl(ctx->sapi_context, TPM_RH_OWNER, loaded_sha1_key_handle,
&sessions_data, ctx->persistent_handle.ak, &sessions_data_out);
if (rval != TPM_RC_SUCCESS) {
LOG_ERR("\n......TPM2_EvictControl Error. TPM Error:0x%x......\n",
LOG_ERR("\n......TPM2_EvictControl Error. TPM Error:0x%x......",
rval);
return false;
}
Expand Down Expand Up @@ -480,13 +480,13 @@ static bool init(int argc, char *argv[], getpubak_context *ctx) {
ctx->aknameFile = optarg;
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
8 changes: 4 additions & 4 deletions tools/tpm2_getpubek.c
Expand Up @@ -274,7 +274,7 @@ static bool init(int argc, char *argv[], char *envp[], getpubek_context *ctx) {
case 'H':
result = tpm2_util_string_to_uint32(optarg, &ctx->persistent_handle);
if (!result) {
LOG_ERR("Could not convert EK persistent from hex format.\n");
LOG_ERR("Could not convert EK persistent from hex format.");
return false;
}
break;
Expand Down Expand Up @@ -324,13 +324,13 @@ static bool init(int argc, char *argv[], char *envp[], getpubek_context *ctx) {
ctx->is_session_based_auth = true;
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
}

}
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_getrandom.c
Expand Up @@ -100,13 +100,13 @@ static bool init(int argc, char *argv[], tpm_random_ctx *ctx) {
ctx->output_file = optarg;
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
10 changes: 5 additions & 5 deletions tools/tpm2_hash.c
Expand Up @@ -60,7 +60,7 @@ static bool get_hierarchy_value(const char *hiearchy_code,

size_t len = strlen(hiearchy_code);
if (len != 1) {
LOG_ERR("Hierarchy Values are single characters, got: %s\n",
LOG_ERR("Hierarchy Values are single characters, got: %s",
hiearchy_code);
return false;
}
Expand All @@ -79,7 +79,7 @@ static bool get_hierarchy_value(const char *hiearchy_code,
*hierarchy_value = TPM_RH_NULL;
break;
default:
LOG_ERR("Unknown hierarchy value: %s\n", hiearchy_code);
LOG_ERR("Unknown hierarchy value: %s", hiearchy_code);
return false;
}
return true;
Expand Down Expand Up @@ -193,13 +193,13 @@ static bool init(int argc, char *argv[], tpm_hash_ctx *ctx) {
}
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_hmac.c
Expand Up @@ -198,13 +198,13 @@ static bool init(int argc, char *argv[], tpm_hmac_ctx *ctx) {
}
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_load.c
Expand Up @@ -220,13 +220,13 @@ execute_tool (int argc,
}
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return 1;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return 1;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return 1;
}
};
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_loadexternal.c
Expand Up @@ -168,13 +168,13 @@ static bool init(int argc, char *argv[], tpm_loadexternal_ctx *ctx) {
ctx->save_to_context_file = true;
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_makecredential.c
Expand Up @@ -200,13 +200,13 @@ static bool init(int argc, char *argv[], tpm_makecred_ctx *ctx) {
flags.o = 1;
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_nvdefine.c
Expand Up @@ -207,13 +207,13 @@ static bool init(int argc, char* argv[], tpm_nvdefine_ctx *ctx) {
}
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_nvread.c
Expand Up @@ -242,13 +242,13 @@ static bool init(int argc, char *argv[], tpm_nvread_ctx *ctx) {
}
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_nvreadlock.c
Expand Up @@ -149,13 +149,13 @@ static bool init(int argc, char *argv[], tpm_nvreadlock_ctx *ctx) {
}
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
8 changes: 4 additions & 4 deletions tools/tpm2_nvrelease.c
Expand Up @@ -68,7 +68,7 @@ static bool nv_space_release(tpm_nvrelease_ctx *ctx) {
return false;
}

LOG_INFO("Success to release NV area at index 0x%x (%d).\n", ctx->nv_index,
LOG_INFO("Success to release NV area at index 0x%x (%d).", ctx->nv_index,
ctx->nv_index);

return true;
Expand Down Expand Up @@ -131,13 +131,13 @@ static bool init(int argc, char* argv[], tpm_nvrelease_ctx *ctx) {
}
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
10 changes: 5 additions & 5 deletions tools/tpm2_nvwrite.c
Expand Up @@ -80,7 +80,7 @@ static int nv_write(tpm_nvwrite_ctx *ctx) {
ctx->data_size > MAX_NV_BUFFER_SIZE ?
MAX_NV_BUFFER_SIZE : ctx->data_size;

LOG_INFO("The data(size=%d) to be written:\n", nv_write_data.t.size);
LOG_INFO("The data(size=%d) to be written:", nv_write_data.t.size);

UINT16 i;
for (i = 0; i < nv_write_data.t.size; i++) {
Expand Down Expand Up @@ -169,21 +169,21 @@ static bool init(int argc, char *argv[], tpm_nvwrite_ctx *ctx) {
}
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}

ctx->data_size = MAX_NV_INDEX_SIZE;
result = files_load_bytes_from_file(ctx->input_file, ctx->nv_buffer, &ctx->data_size);
if (!result) {
LOG_ERR("Failed to read data from %s\n", ctx->input_file);
LOG_ERR("Failed to read data from %s", ctx->input_file);
return -false;
}

Expand Down
10 changes: 5 additions & 5 deletions tools/tpm2_pcrlist.c
Expand Up @@ -210,7 +210,7 @@ static bool check_pcr_selection(listpcr_context *context) {

if (j >= cap_data->data.assignedPCR.count) {
const char *alg_name = tpm2_alg_util_algtostr(pcr_sel->pcrSelections[i].hash);
LOG_WARN("Ignore unsupported bank/algorithm: %s(0x%04x)\n", alg_name, pcr_sel->pcrSelections[i].hash);
LOG_WARN("Ignore unsupported bank/algorithm: %s(0x%04x)", alg_name, pcr_sel->pcrSelections[i].hash);
pcr_sel->pcrSelections[i].hash = 0; //mark it as to be removed
}
}
Expand Down Expand Up @@ -241,7 +241,7 @@ static bool show_pcr_values(listpcr_context *context) {
continue;
}
if (vi >= context->pcrs.count || di >= context->pcrs.pcr_values[vi].count) {
LOG_ERR("Something wrong, trying to print but nothing more\n");
LOG_ERR("Something wrong, trying to print but nothing more");
return false;
}

Expand Down Expand Up @@ -313,7 +313,7 @@ static bool get_banks(listpcr_context *context) {
&more_data, capability_data, 0);
if (rval != TPM_RC_SUCCESS) {
LOG_ERR(
"GetCapability: Get PCR allocation status Error. TPM Error:0x%x......\n",
"GetCapability: Get PCR allocation status Error. TPM Error:0x%x......",
rval);
return false;
}
Expand Down Expand Up @@ -403,10 +403,10 @@ int execute_tool(int argc, char *argv[], char *envp[], common_opts_t *opts,
s_flag = 1;
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
goto error;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
goto error;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_quote.c
Expand Up @@ -407,13 +407,13 @@ int execute_tool (int argc, char *argv[], char *envp[], common_opts_t *opts,
is_auth_session = true;
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return 1;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return 1;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return 1;
}
};
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_rsadecrypt.c
Expand Up @@ -173,13 +173,13 @@ static bool init(int argc, char *argv[], tpm_rsadecrypt_ctx *ctx) {
}
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_rsaencrypt.c
Expand Up @@ -148,13 +148,13 @@ static bool init(int argc, char *argv[], tpm_rsaencrypt_ctx *ctx) {
flags.c = 1;
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
};
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_send_command.c
Expand Up @@ -136,13 +136,13 @@ static bool init(tpm2_send_command_ctx *ctx, int argc, char *argv[]) {
ctx->output = open_file(optarg, "wb");
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tools/tpm2_sign.c
Expand Up @@ -274,13 +274,13 @@ static bool init(int argc, char *argv[], tpm_sign_ctx *ctx) {
}
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand Down
12 changes: 6 additions & 6 deletions tools/tpm2_unseal.c
Expand Up @@ -182,13 +182,13 @@ static bool init(int argc, char *argv[], tpm_unseal_ctx *ctx) {
flags.F = 1;
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
return false;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
return false;
default:
LOG_ERR("?? getopt returned character code 0%o ??\n", opt);
LOG_ERR("?? getopt returned character code 0%o ??", opt);
return false;
}
}
Expand All @@ -214,7 +214,7 @@ static bool init(int argc, char *argv[], tpm_unseal_ctx *ctx) {
raw_pcrs_file, &pcr_digest, true,
tpm2_policy_pcr_build);
if (rval != TPM_RC_SUCCESS) {
LOG_ERR("Building PCR policy failed: 0x%x\n", rval);
LOG_ERR("Building PCR policy failed: 0x%x", rval);
return false;
}

Expand Down Expand Up @@ -244,15 +244,15 @@ int execute_tool(int argc, char *argv[], char *envp[], common_opts_t *opts,
}

if (!unseal_and_save(&ctx)) {
LOG_ERR("Unseal failed!\n");
LOG_ERR("Unseal failed!");
return 1;
}

if (ctx.policy_session) {
TPM_RC rval = Tss2_Sys_FlushContext(ctx.sapi_context,
ctx.policy_session->sessionHandle);
if (rval != TPM_RC_SUCCESS) {
LOG_ERR("Failed Flush Context: 0x%x\n", rval);
LOG_ERR("Failed Flush Context: 0x%x", rval);
return 1;
}

Expand Down
8 changes: 4 additions & 4 deletions tools/tpm2_verifysignature.c
Expand Up @@ -95,7 +95,7 @@ static bool verify_signature(tpm2_verifysig_ctx *ctx) {
rval = Tss2_Sys_VerifySignature(ctx->sapi_context, ctx->keyHandle, NULL,
&ctx->msgHash, &ctx->signature, &validation, &sessionsDataOut);
if (rval != TPM_RC_SUCCESS) {
LOG_ERR("Tss2_Sys_VerifySignature failed, error code: 0x%x\n", rval);
LOG_ERR("Tss2_Sys_VerifySignature failed, error code: 0x%x", rval);
return false;
}

Expand Down Expand Up @@ -199,7 +199,7 @@ static bool init(tpm2_verifysig_ctx *ctx) {
int rc = tpm_hash_compute_data(ctx->sapi_context, msg->buffer, msg->size,
ctx->halg, &ctx->msgHash);
if (rc) {
LOG_ERR("Compute message hash failed!\n");
LOG_ERR("Compute message hash failed!");
goto err;
}
}
Expand Down Expand Up @@ -285,10 +285,10 @@ static bool handle_options_and_init(int argc, char *argv[], tpm2_verifysig_ctx *
ctx->flags.key_context = 1;
break;
case ':':
LOG_ERR("Argument %c needs a value!\n", optopt);
LOG_ERR("Argument %c needs a value!", optopt);
break;
case '?':
LOG_ERR("Unknown Argument: %c\n", optopt);
LOG_ERR("Unknown Argument: %c", optopt);
break;
/* no default */
}
Expand Down