From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: debora@linux.vnet.ibm.com, srajiv@linux.vnet.ibm.com,
tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Cc: jirislaby@gmail.com, preining@logic.at,
Stefan Berger <stefanb@linux.vnet.ibm.com>
Subject: [PATCH V2 07/12] tpm: Fix display of data in pubek sysfs entry
Date: Wed, 30 Mar 2011 12:13:29 -0400 [thread overview]
Message-ID: <20110330161417.744862809@linux.vnet.ibm.com> (raw)
In-Reply-To: 20110330161322.015113054@linux.vnet.ibm.com
[-- Attachment #1: tpm_driver_fix_pubek.patch --]
[-- Type: text/plain, Size: 2602 bytes --]
This patch fixes the TPM's pubek sysfs entry that is accessible as long
as the TPM doesn't have an owner. It was necessary to shift the access to the
data by -10 -- the first byte immediately follows the 10 byte header. The
line
data = tpm_cmd.params.readpubek_out_buffer;
sets it at the offset '10' in the packet, so we can read the data array
starting at offset '0'.
Before:
Algorithm: 00 0C 00 00
Encscheme: 08 00
Sigscheme: 00 00
Parameters: 00 00 00 00 01 00 AC E2 5E 3C A0 78
Modulus length: -563306801
Modulus:
28 21 08 0F 82 CD F2 B1 E7 49 F7 74 70 BE 59 8C
43 78 B1 24 EA 52 E2 FE 52 5C 3A 12 3B DC 61 71
[...]
After:
Algorithm: 00 00 00 01
Encscheme: 00 03
Sigscheme: 00 01
Parameters: 00 00 08 00 00 00 00 02 00 00 00 00
Modulus length: 256
Modulus:
AC E2 5E 3C A0 78 DE 6C 9E CF 28 21 08 0F 82 CD
F2 B1 E7 49 F7 74 70 BE 59 8C 43 78 B1 24 EA 52
[...]
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
drivers/char/tpm/tpm.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
Index: linux-2.6/drivers/char/tpm/tpm.c
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm.c
+++ linux-2.6/drivers/char/tpm/tpm.c
@@ -878,18 +878,24 @@ ssize_t tpm_show_pubek(struct device *de
data = tpm_cmd.params.readpubek_out_buffer;
str +=
sprintf(str,
- "Algorithm: %02X %02X %02X %02X\nEncscheme: %02X %02X\n"
- "Sigscheme: %02X %02X\nParameters: %02X %02X %02X %02X"
- " %02X %02X %02X %02X %02X %02X %02X %02X\n"
- "Modulus length: %d\nModulus: \n",
- data[10], data[11], data[12], data[13], data[14],
- data[15], data[16], data[17], data[22], data[23],
- data[24], data[25], data[26], data[27], data[28],
- data[29], data[30], data[31], data[32], data[33],
- be32_to_cpu(*((__be32 *) (data + 34))));
+ "Algorithm: %02X %02X %02X %02X\n"
+ "Encscheme: %02X %02X\n"
+ "Sigscheme: %02X %02X\n"
+ "Parameters: %02X %02X %02X %02X "
+ "%02X %02X %02X %02X "
+ "%02X %02X %02X %02X\n"
+ "Modulus length: %d\n"
+ "Modulus:\n",
+ data[0], data[1], data[2], data[3],
+ data[4], data[5],
+ data[6], data[7],
+ data[12], data[13], data[14], data[15],
+ data[16], data[17], data[18], data[19],
+ data[20], data[21], data[22], data[23],
+ be32_to_cpu(*((__be32 *) (data + 24))));
for (i = 0; i < 256; i++) {
- str += sprintf(str, "%02X ", data[i + 38]);
+ str += sprintf(str, "%02X ", data[i + 28]);
if ((i + 1) % 16 == 0)
str += sprintf(str, "\n");
}
next prev parent reply other threads:[~2011-03-30 16:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-30 16:13 [PATCH V2 00/12] tpm + tpm_tis : Various fixes Stefan Berger
2011-03-30 16:13 ` [PATCH V2 01/12] tpm: Use durations returned from TPM Stefan Berger
2011-03-30 16:13 ` [PATCH V2 02/12] tpm: Adjust the durations if they are too small Stefan Berger
2011-03-30 16:13 ` [PATCH V2 03/12] tpm_tis: Introduce durations sysfs entry Stefan Berger
2011-03-30 16:13 ` [PATCH V2 04/12] tpm: Use interface timeouts returned from the TPM Stefan Berger
2011-03-30 16:13 ` [PATCH V2 05/12] tpm: Adjust interface timeouts if they are too small Stefan Berger
2011-03-30 16:13 ` [PATCH V2 06/12] tpm_tis: Add timeouts sysfs entry Stefan Berger
2011-03-30 16:13 ` Stefan Berger [this message]
2011-03-30 16:13 ` [PATCH V2 08/12] tpm_tis: Re-enable interrupts upon (S3) resume Stefan Berger
2011-03-30 16:13 ` [PATCH V2 09/12] tpm_tis: Delay ACPI S3 suspend while the TPM is busy Stefan Berger
2011-03-30 16:13 ` [PATCH V2 10/12] tpm_tis: Fix the probing for interrupts Stefan Berger
2011-03-30 16:13 ` [PATCH V2 11/12] tpm_tis: Probing function for Intel iTPM bug Stefan Berger
2011-03-30 16:13 ` [PATCH V2 12/12] tpm: Fix a typo Stefan Berger
2011-05-27 20:55 ` [PATCH V2 00/12] tpm + tpm_tis : Various fixes Stefan Berger
2011-05-31 13:23 ` Rajiv Andrade
2011-06-13 15:34 ` Stefan Berger
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=20110330161417.744862809@linux.vnet.ibm.com \
--to=stefanb@linux.vnet.ibm.com \
--cc=debora@linux.vnet.ibm.com \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=preining@logic.at \
--cc=srajiv@linux.vnet.ibm.com \
--cc=tpmdd-devel@lists.sourceforge.net \
/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