Skip to contentSkip to conversation

add longer timeout for verify signature command

PATCH Superseded [email protected] 2 participants 3 messages May 19, 2021 – May 20, 2021

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 add longer timeout for verify signature command

From: Amir Mizinski <[email protected]>

while testing TPM2_CC_VERIFY_SIGNATURE with usage of RSA 3070-bit keys i encountered a timeout error. it seems current values do not support this case as described in ptp 1.05 6.5.1.3:
https://trustedcomputinggroup.org/wp-content/uploads/PC_Client_Specific-Platform_TPM_Profile_for-PTP_2p0-v1p05p_r14_pub.pdf

The patch was tested on Raspberry-Pie 3, using Nuvoton NPCT75X TPM.

Changes since version 1:
-"tpm2: add longer timout for verify signature command"
- Fixed and extended commit description.
Addressed comments from:
- Jarkko Sakkinen: https://lore.kernel.org/patchwork/patch/1424664/

Amir Mizinski (1):
tpm2: add longer timeout for verify signature command

 drivers/char/tpm/tpm2-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 tpm2: add longer timeout for verify signature command

From: Amir Mizinski <[email protected]>

While running a TPM2_CC_VERIFY_SIGNATURE(0x177) operation with RSA 3070-bit keys the TPM driver fails with the following error:
"kernel: [ 2416.187522] tpm tpm0: Operation Timed out"

Since a) the TPM PC Client specification does not specify a number for verify signature operation timeout, and b) the duration of TPM2_CC_VERIFY_SIGNATURE with RSA 3070-bit keys exceeds the current timeout of TPM_LONG (2 seconds), it is preferable to pick the longest timeout possible.
Therefore, set the duration for TPM2_CC_VERIFY_SIGNATUE to TPM_LONG_LONG (5 minutes).

---
 drivers/char/tpm/tpm2-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm2-cmd.c +1 -1
index 7603295..e71154b 100644
@@ -87,7 +87,7 @@ static u8 tpm2_ordinal_duration_index(u32 ordinal)
 		return TPM_MEDIUM;
 
 	case TPM2_CC_VERIFY_SIGNATURE:        /* 177 */
-		return TPM_LONG;
+		return TPM_LONG_LONG;
 
 	case TPM2_CC_PCR_EXTEND:              /* 182 */
 		return TPM_MEDIUM;
Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [PATCH v2] tpm2: add longer timeout for verify signature command

Quoted 3 lines · On Wed, May 19, 2021 at 05:00:59PM +0300, [email protected] wrote:

From: Amir Mizinski <[email protected]>

While running a TPM2_CC_VERIFY_SIGNATURE(0x177) operation with RSA 3070-bit

The hexcode for the TPM command is absoulutely irrelevant detail.

AFAIK, 3070-bit does not exist. It's 3072-bit.

Quoted 1 line

keys the TPM driver fails with the following error:

Empty line here.

Quoted 3 lines

"kernel: [ 2416.187522] tpm tpm0: Operation Timed out"

Since a) the TPM PC Client specification does not specify a number for

Remove "a)".

Quoted 1 line

verify signature operation timeout, and b) the duration of

Remove "b)".

Quoted 3 lines

TPM2_CC_VERIFY_SIGNATURE with RSA 3070-bit keys exceeds the current timeout of TPM_LONG (2 seconds), it is preferable to pick the longest timeout possible.

Empty line here.

Quoted 3 lines

Therefore, set the duration for TPM2_CC_VERIFY_SIGNATUE to TPM_LONG_LONG (5 minutes).

Add here:

Quoted 24 lines
---
 drivers/char/tpm/tpm2-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm2-cmd.c +1 -1
index 7603295..e71154b 100644
@@ -87,7 +87,7 @@ static u8 tpm2_ordinal_duration_index(u32 ordinal)
 		return TPM_MEDIUM;
 
 	case TPM2_CC_VERIFY_SIGNATURE:        /* 177 */
-		return TPM_LONG;
+		return TPM_LONG_LONG;
 
 	case TPM2_CC_PCR_EXTEND:              /* 182 */
 		return TPM_MEDIUM;
Signature · 1 line
2.7.4

/Jarkko