From: Stefan Berger <stefanb@linux.ibm.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
"Stefan Berger" <stefanb@linux.vnet.ibm.com>
Cc: QEMU <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 2/2] tpm_emulator: Translate TPM error codes to strings
Date: Thu, 25 Jul 2019 10:35:45 -0400 [thread overview]
Message-ID: <83cba945-2634-d500-0cdb-999cd6e2a402@linux.ibm.com> (raw)
In-Reply-To: <CAJ+F1CKdMR_ab=cz9RKsTUZQ5ioQp0=fSiqTOZcuVDiyZMZgWw@mail.gmail.com>
On 7/25/19 7:08 AM, Marc-André Lureau wrote:
> Hi
>
> On Thu, Jul 25, 2019 at 2:58 PM Stefan Berger
> <stefanb@linux.vnet.ibm.com> wrote:
>> Implement a function to translate TPM error codes to strings so that
>> at least the most common error codes can be translated to human
>> readable strings.
>>
>> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
>> ---
>> hw/tpm/tpm_emulator.c | 50 ++++++++++++++++++++++++++++++++++---------
>> 1 file changed, 40 insertions(+), 10 deletions(-)
>>
>> diff --git a/hw/tpm/tpm_emulator.c b/hw/tpm/tpm_emulator.c
>> index 1288cbcb8d..186dde0838 100644
>> --- a/hw/tpm/tpm_emulator.c
>> +++ b/hw/tpm/tpm_emulator.c
>> @@ -82,6 +82,30 @@ typedef struct TPMEmulator {
>> TPMBlobBuffers state_blobs;
>> } TPMEmulator;
>>
>> +struct tpm_error {
>> + uint32_t tpm_result;
>> + const char *string;
>> +};
>> +
>> +static const struct tpm_error tpm_errors[] = {
>> + { 9 , "operation failed" },
>> + { 32, "encryption error" },
>> + { 33, "decryption error" },
>> + /* TPM 2 codes */
>> + { 0x101, "operation failed" },
>> +};
> Wouldn't those codes be better defined in tpm_ioctl.h?
tpm_int.h has some already. will add some more there.
Stefan
prev parent reply other threads:[~2019-07-25 14:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-25 10:58 [Qemu-devel] [PATCH 0/2] tpm: Improve on error handling Stefan Berger
2019-07-25 10:58 ` [Qemu-devel] [PATCH 1/2] tpm: Exit in reset when backend indicates failure Stefan Berger
2019-07-25 11:34 ` Marc-André Lureau
2019-07-25 10:58 ` [Qemu-devel] [PATCH 2/2] tpm_emulator: Translate TPM error codes to strings Stefan Berger
2019-07-25 11:08 ` Marc-André Lureau
2019-07-25 14:35 ` Stefan Berger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83cba945-2634-d500-0cdb-999cd6e2a402@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=marcandre.lureau@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).