Skip to content

Commit 985abb5

Browse files
committed
Updated docs. Add test case for TPM2_GetAlgId.
1 parent 9c2ada8 commit 985abb5

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

examples/u-boot/README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,32 @@ No USB controllers found
121121
Net: eth0: virtio-net#32
122122
123123
Hit any key to stop autoboot: 0
124-
=> tpm help
125-
tpm - Issue a TPMv1.x command
124+
=> tpm2 help
125+
tpm2 - Issue a TPMv2.x command
126126
127127
Usage:
128-
tpm cmd args...
128+
tpm2 <command> [<arguments>]
129+
130+
device [num device]
131+
Show all devices or set the specified device
132+
info
133+
Show information about the TPM.
134+
```
135+
136+
7. Example commands:
137+
138+
```
139+
=> tpm2 info
140+
tpm_tis@0 v2.0: VendorID 0x1014, DeviceID 0x0001, RevisionID 0x01 [open]
141+
=> tpm2 startup TPM2_SU_CLEAR
142+
=> tpm2 get_capability 0x6 0x20e 0x200 1
143+
Capabilities read from TPM:
144+
Property 0x6a2e45a9: 0x6c3646a9
145+
=> tpm2 pcr_read 10 0x100000
146+
PCR #10 sha256 32 byte content (20 known updates):
147+
20 25 73 0a 00 56 61 6c 75 65 3a 0a 00 23 23 20
148+
4f 75 74 20 6f 66 20 6d 65 6d 6f 72 79 0a 00 23
129149
```
130150

131-
7. Exiting the QEMU:
151+
8. Exiting the QEMU:
132152
Press Ctrl-A followed by X

tests/unit_tests.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,12 @@ static void test_TPM2_KDFa(void)
357357
rc >= 0 ? "Passed" : "Failed");
358358
}
359359

360+
static void test_GetAlgId(void)
361+
{
362+
TPM_ALG_ID alg = TPM2_GetAlgId("SHA256");
363+
AssertIntEQ(alg, TPM_ALG_SHA256);
364+
}
365+
360366
static void test_wolfTPM2_CSR(void)
361367
{
362368
#if defined(WOLFTPM2_CERT_GEN) && !defined(WOLFTPM2_NO_HEAP) && \
@@ -663,6 +669,7 @@ int unit_tests(int argc, char *argv[])
663669
test_wolfTPM2_GetRandom();
664670
test_TPM2_PCRSel();
665671
test_TPM2_KDFa();
672+
test_GetAlgId();
666673
test_wolfTPM2_ReadPublicKey();
667674
test_wolfTPM2_CSR();
668675
#if !defined(WOLFTPM2_NO_WOLFCRYPT) && defined(WOLFTPM2_PEM_DECODE) && \

0 commit comments

Comments
 (0)