From a76e8802e805939c37acd865df97aeec63ec83f1 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Sun, 21 Jul 2024 12:15:57 -0400 Subject: [PATCH] tests: Add test case when user chooses specific StateFormatLevel Test that a user is able to choose a specific StateFormatLevel that is not required by any of the chosen commands but enables a bugfix in the TPM 2 code for example. Signed-off-by: Stefan Berger --- tests/tpm2_setprofile.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/tpm2_setprofile.c b/tests/tpm2_setprofile.c index 3bf13259..dcc1c924 100644 --- a/tests/tpm2_setprofile.c +++ b/tests/tpm2_setprofile.c @@ -285,6 +285,34 @@ static const struct { "cmac,ctr,ofb,cbc,cfb,ecb\"," "\"Description\":\"test\"" "}}", + }, { + // choosen StateFormatLevel 4 not require by commands but enables bugfix + // -> stays at StateFormatLevel 4 + .profile = "{" + "\"Name\":\"custom\"," + "\"StateFormatLevel\":4," + "\"Commands\":\"0x11f-0x122,0x124-0x12e,0x130-0x140,0x142-0x159," + "0x15b-0x15e,0x160-0x165,0x167-0x174,0x176-0x178," + "0x17a-0x193,0x197\"," + "\"Description\":\"test\"" + "}", + .exp_fail = false, + .exp_profile = + "{\"ActiveProfile\":{" + "\"Name\":\"custom\"," + "\"StateFormatLevel\":4," + "\"Commands\":\"0x11f-0x122,0x124-0x12e,0x130-0x140,0x142-0x159," + "0x15b-0x15e,0x160-0x165,0x167-0x174,0x176-0x178," + "0x17a-0x193,0x197\"," + "\"Algorithms\":\"rsa,rsa-min-size=1024,tdes,tdes-min-size=128," + "sha1,hmac,aes,aes-min-size=128,mgf1,keyedhash," + "xor,sha256,sha384,sha512,null,rsassa,rsaes,rsapss," + "oaep,ecdsa,ecdh,ecdaa,sm2,ecschnorr,ecmqv," + "kdf1-sp800-56a,kdf2,kdf1-sp800-108,ecc,ecc-min-size=192," + "ecc-nist,ecc-bn,symcipher,camellia,camellia-min-size=128," + "cmac,ctr,ofb,cbc,cfb,ecb\"," + "\"Description\":\"test\"" + "}}", }, { // keep last }