Open MartinLoeper opened 1 year ago
TPM2_ALG_SHA and TPM2_ALG_SHA1 both have the value 0x4. So that can't be the reason. Unfortunately the bad value is not displayed. Would it be possible for you to replace the return_error at the end of ifapi_json_TPM2_ALG_ID_serialize with:
LOG_ERROR("Undefined constant %hu", in);
return TSS2_FAPI_RC_BAD_VALUE ;
So we could check what's the alg value which is currently not defined in TSS.
@MartinLoeper It also would be interesting what TPM you are using.
@MartinLoeper It also would be interesting what TPM you are using.
It's produced by STM. I cannot determine which particular product it is. It is built into a ThinkPad X1. Here is the output of tpm2_getcap properties-fixed
:
TPM2_PT_FAMILY_INDICATOR:
raw: 0x322E3000
value: "2.0"
TPM2_PT_LEVEL:
raw: 0
TPM2_PT_REVISION:
raw: 0x8A
value: 1.38
TPM2_PT_DAY_OF_YEAR:
raw: 0x8
TPM2_PT_YEAR:
raw: 0x7E2
TPM2_PT_MANUFACTURER:
raw: 0x53544D20
value: "STM "
TPM2_PT_VENDOR_STRING_1:
raw: 0x10102
value: ""
TPM2_PT_VENDOR_STRING_2:
raw: 0x20102
value: ""
TPM2_PT_VENDOR_STRING_3:
raw: 0x0
value: ""
TPM2_PT_VENDOR_STRING_4:
raw: 0x0
value: ""
TPM2_PT_VENDOR_TPM_TYPE:
raw: 0x1
TPM2_PT_FIRMWARE_VERSION_1:
raw: 0x10102
TPM2_PT_FIRMWARE_VERSION_2:
raw: 0x0
TPM2_PT_INPUT_BUFFER:
raw: 0x400
TPM2_PT_HR_TRANSIENT_MIN:
raw: 0x5
TPM2_PT_HR_PERSISTENT_MIN:
raw: 0x8
TPM2_PT_HR_LOADED_MIN:
raw: 0x4
TPM2_PT_ACTIVE_SESSIONS_MAX:
raw: 0x40
TPM2_PT_PCR_COUNT:
raw: 0x18
TPM2_PT_PCR_SELECT_MIN:
raw: 0x3
TPM2_PT_CONTEXT_GAP_MAX:
raw: 0xFFFF
TPM2_PT_NV_COUNTERS_MAX:
raw: 0x0
TPM2_PT_NV_INDEX_MAX:
raw: 0x800
TPM2_PT_MEMORY:
raw: 0x2
TPM2_PT_CLOCK_UPDATE:
raw: 0x2710
TPM2_PT_CONTEXT_HASH:
raw: 0xC
TPM2_PT_CONTEXT_SYM:
raw: 0x6
TPM2_PT_CONTEXT_SYM_SIZE:
raw: 0x100
TPM2_PT_ORDERLY_COUNT:
raw: 0xFF
TPM2_PT_MAX_COMMAND_SIZE:
raw: 0x710
TPM2_PT_MAX_RESPONSE_SIZE:
raw: 0x710
TPM2_PT_MAX_DIGEST:
raw: 0x30
TPM2_PT_MAX_OBJECT_CONTEXT:
raw: 0x4A4
TPM2_PT_MAX_SESSION_CONTEXT:
raw: 0x146
TPM2_PT_PS_FAMILY_INDICATOR:
raw: 0x1
TPM2_PT_PS_LEVEL:
raw: 0x0
TPM2_PT_PS_REVISION:
raw: 0x103
TPM2_PT_PS_DAY_OF_YEAR:
raw: 0x0
TPM2_PT_PS_YEAR:
raw: 0x0
TPM2_PT_SPLIT_MAX:
raw: 0x80
TPM2_PT_TOTAL_COMMANDS:
raw: 0x6F
TPM2_PT_LIBRARY_COMMANDS:
raw: 0x68
TPM2_PT_VENDOR_COMMANDS:
raw: 0x7
TPM2_PT_NV_BUFFER_MAX:
raw: 0x400
TPM2_PT_MODES:
raw: 0x1
value: TPMA_MODES_FIPS_140_2
TPM2_ALG_SHA and TPM2_ALG_SHA1 both have the value 0x4. So that can't be the reason. Unfortunately the bad value is not displayed. Would it be possible for you to replace the return_error at the end of ifapi_json_TPM2_ALG_ID_serialize with:
LOG_ERROR("Undefined constant %hu", in);
return TSS2_FAPI_RC_BAD_VALUE ;
So we could check what's the alg value which is currently not defined in TSS.
Will have to look into it as I typically do not compile packages manually on that Arch machine. Anyway, thanks for your hint how to debug it further!
@MartinLoeper Could you please also attach the output of tpm2_getcap algorithms
. If that command works with your TPM we should see the alg id which causes the problem.
Yes that worked!
rsa:
value: 0x1
asymmetric: 1
symmetric: 0
hash: 0
object: 1
reserved: 0x0
signing: 0
encrypting: 0
method: 0
sha1:
value: 0x4
asymmetric: 0
symmetric: 0
hash: 1
object: 0
reserved: 0x0
signing: 0
encrypting: 0
method: 0
hmac:
value: 0x5
asymmetric: 0
symmetric: 0
hash: 1
object: 0
reserved: 0x0
signing: 1
encrypting: 0
method: 0
aes:
value: 0x6
asymmetric: 0
symmetric: 1
hash: 0
object: 0
reserved: 0x0
signing: 0
encrypting: 0
method: 0
mgf1:
value: 0x7
asymmetric: 0
symmetric: 0
hash: 1
object: 0
reserved: 0x0
signing: 0
encrypting: 0
method: 1
keyedhash:
value: 0x8
asymmetric: 0
symmetric: 0
hash: 1
object: 1
reserved: 0x0
signing: 1
encrypting: 1
method: 0
xor:
value: 0xA
asymmetric: 0
symmetric: 1
hash: 1
object: 0
reserved: 0x0
signing: 0
encrypting: 0
method: 0
sha256:
value: 0xB
asymmetric: 0
symmetric: 0
hash: 1
object: 0
reserved: 0x0
signing: 0
encrypting: 0
method: 0
sha384:
value: 0xC
asymmetric: 0
symmetric: 0
hash: 1
object: 0
reserved: 0x0
signing: 0
encrypting: 0
method: 0
rsassa:
value: 0x14
asymmetric: 1
symmetric: 0
hash: 0
object: 0
reserved: 0x0
signing: 1
encrypting: 0
method: 0
rsaes:
value: 0x15
asymmetric: 1
symmetric: 0
hash: 0
object: 0
reserved: 0x0
signing: 0
encrypting: 1
method: 0
rsapss:
value: 0x16
asymmetric: 1
symmetric: 0
hash: 0
object: 0
reserved: 0x0
signing: 1
encrypting: 0
method: 0
oaep:
value: 0x17
asymmetric: 1
symmetric: 0
hash: 0
object: 0
reserved: 0x0
signing: 0
encrypting: 1
method: 0
ecdsa:
value: 0x18
asymmetric: 1
symmetric: 0
hash: 0
object: 0
reserved: 0x0
signing: 1
encrypting: 0
method: 1
ecdh:
value: 0x19
asymmetric: 1
symmetric: 0
hash: 0
object: 0
reserved: 0x0
signing: 0
encrypting: 0
method: 1
ecdaa:
value: 0x1A
asymmetric: 1
symmetric: 0
hash: 0
object: 0
reserved: 0x0
signing: 1
encrypting: 0
method: 0
ecschnorr:
value: 0x1C
asymmetric: 1
symmetric: 0
hash: 0
object: 0
reserved: 0x0
signing: 1
encrypting: 0
method: 0
kdf1_sp800_56a:
value: 0x20
asymmetric: 0
symmetric: 0
hash: 1
object: 0
reserved: 0x0
signing: 0
encrypting: 0
method: 1
kdf1_sp800_108:
value: 0x22
asymmetric: 0
symmetric: 0
hash: 1
object: 0
reserved: 0x0
signing: 0
encrypting: 0
method: 1
ecc:
value: 0x23
asymmetric: 1
symmetric: 0
hash: 0
object: 1
reserved: 0x0
signing: 0
encrypting: 0
method: 0
symcipher:
value: 0x25
asymmetric: 0
symmetric: 0
hash: 0
object: 1
reserved: 0x0
signing: 0
encrypting: 0
method: 0
sha3_256:
value: 0x27
asymmetric: 0
symmetric: 0
hash: 1
object: 0
reserved: 0x0
signing: 0
encrypting: 0
method: 0
sha3_384:
value: 0x28
asymmetric: 0
symmetric: 0
hash: 1
object: 0
reserved: 0x0
signing: 0
encrypting: 0
method: 0
ctr:
value: 0x40
asymmetric: 0
symmetric: 1
hash: 0
object: 0
reserved: 0x0
signing: 0
encrypting: 1
method: 0
ofb:
value: 0x41
asymmetric: 0
symmetric: 1
hash: 0
object: 0
reserved: 0x0
signing: 0
encrypting: 1
method: 0
cbc:
value: 0x42
asymmetric: 0
symmetric: 1
hash: 0
object: 0
reserved: 0x0
signing: 0
encrypting: 1
method: 0
cfb:
value: 0x43
asymmetric: 0
symmetric: 1
hash: 0
object: 0
reserved: 0x0
signing: 0
encrypting: 1
method: 0
ecb:
value: 0x44
asymmetric: 0
symmetric: 1
hash: 0
object: 0
reserved: 0x0
signing: 0
encrypting: 1
method: 0
@MartinLoeper Thank you for sending the alg list. Currently tss does not support:
sha3_256, sha3_384, and sha3_512
If you do not use these algs everything should work except of tss2_getinfo which tries to list all algs. As an emergency solution you could add:
LOG_WARNING("Undefined alg %hu", in);
return TSS2_RC_SUCCESS;
at the end of ifapi_json_TPM2_ALG_ID_serialize
I will create a PR to fix this problem.
Thanks for looking into this! This is not an issue for me right now. I was just starting to play around with this whole tpm2/tss ecosystem and was surprised that I could not obtain the info. Thanks for confirming the issue and suggesting a fix!
I cannot get the
tss2_getinfo
command to run. The relevant TRACE log is attached below.I wonder whether the following line has something to do with it since the tpm output contains the byte "0x04" which might correspond to TPM2_ALG_SHA: https://github.com/tpm2-software/tpm2-tss/blob/master/src/tss2-fapi/tpm_json_serialize.c#L356