Skip to content

Conversation

@thomkopp
Copy link

We need to make sure to be able to load TPM2 TSS2 keys which have been created with earlier versions of the tpm2-openssl provider or with earlier versions of the tpm2-tss-engine.

The parent handle of TPM2_TSS keys created with provider version < 1.2 or engine version < 1.2.0-rc0 have been written using ASN1_INTEGER_set ASN1_INTEGER_set takes a (signed) long (which on 32-bit systems is 32-bit and on 64-bit systems is 64bit) As parent handles are in the range of 0x81000000 - 0x81FFFFFF the MSB on a 32-bit system is always set, and therefore is treated as negative. This won't be the case on 64 bit systems or in case the handle had been written using BN_set_word().

The parent handle of TPM2_TSS keys create with provider verision 1.2 - 1.3 have been written using ASN1_INTEGER_set_uint64. These values can safely be read using BN_get_word, as the values written always were of type TPM2_HANDLE (uint32_t).

Resolves: #152
See also: #74,
tpm2-software/tpm2-tss-engine#222, tpm2-software/tpm2-tools#3113

We need to make sure to be able to load TPM2 TSS2 keys which
have been created with earlier versions of the tpm2-openssl
provider or with earlier versions of the tpm2-tss-engine.

The parent handle of TPM2_TSS keys created with provider version < 1.2 or engine version < 1.2.0-rc0 have been written using ASN1_INTEGER_set
ASN1_INTEGER_set takes a (signed) long (which on 32-bit systems is 32-bit and on 64-bit systems is 64bit)
As parent handles are in the range of 0x81000000 - 0x81FFFFFF the MSB on a 32-bit system is always set, and therefore is treated as negative.
This won't be the case on 64 bit systems or in case the handle had been written using BN_set_word().

The parent handle of TPM2_TSS keys create with provider verision 1.2 - 1.3 have been written using ASN1_INTEGER_set_uint64.
These values can safely be read using BN_get_word, as the values written always were of type TPM2_HANDLE (uint32_t).

Resolves: tpm2-software#152
See also: tpm2-software#74,
tpm2-software/tpm2-tss-engine#222, tpm2-software/tpm2-tools#3113

Signed-off-by: Thomas Kopp <thomas.kopp@securiton.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loading of TPM2-TSS keys created with version earlier than 1.2.0 always fails

1 participant