1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

tpm: Do not use fprintf for logging.

* tpm2d/intel-tss.h (TSS_Create): Replace fprintf logging by
log_error.
This commit is contained in:
Werner Koch 2024-05-28 11:52:04 +02:00
parent 610a452bb5
commit 2e4b1f7850
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -300,7 +300,7 @@ TSS_Create(TSS_CONTEXT **tssContext)
} }
else else
{ {
fprintf(stderr, "Unknown TPM_INTERFACE_TYPE %s\n", intType); log_error ("tss: Unknown TPM_INTERFACE_TYPE %s\n", intType);
} }
} }
@ -352,15 +352,15 @@ TSS_Hash_Generate(TPMT_HA *digest, ...)
rc = TSS_Hash_GetMd(&algo, digest->hashAlg); rc = TSS_Hash_GetMd(&algo, digest->hashAlg);
if (rc) if (rc)
{ {
fprintf(stderr, "TSS_HASH_GENERATE: Unknown hash %d\n", log_error ("TSS_Hash_Generate: Unknown hash %d\n", digest->hashAlg);
digest->hashAlg);
goto out; goto out;
} }
rc = gcry_md_open (&md, algo, 0); rc = gcry_md_open (&md, algo, 0);
if (rc != 0) if (rc != 0)
{ {
fprintf(stderr, "TSS_Hash_Generate: EVP_MD_CTX_create failed\n"); log_error ("TSS_Hash_Generate: EVP_MD_CTX_create failed: %s\n",
gpg_strerror (rc));
rc = TPM_RC_FAILURE; rc = TPM_RC_FAILURE;
goto out; goto out;
} }
@ -374,7 +374,7 @@ TSS_Hash_Generate(TPMT_HA *digest, ...)
break; break;
if (length < 0) if (length < 0)
{ {
fprintf(stderr, "TSS_Hash_Generate: Length is negative\n"); log_error ("TSS_Hash_Generate: Length is negative\n");
goto out_free; goto out_free;
} }
if (length != 0) if (length != 0)
@ -408,9 +408,8 @@ tpm2_error(TPM_RC rc, const char *reason)
{ {
const char *msg; const char *msg;
fprintf(stderr, "%s failed with %d\n", reason, rc);
msg = Tss2_RC_Decode(rc); msg = Tss2_RC_Decode(rc);
fprintf(stderr, "%s\n", msg); log_error ("%s failed with error %d (%s)\n", reason, rc, msg);
} }
static inline int static inline int