Fixed loading of parent handles in TPM TSS2 keys#153
Open
thomkopp wants to merge 1 commit intotpm2-software:masterfrom
Open
Fixed loading of parent handles in TPM TSS2 keys#153thomkopp wants to merge 1 commit intotpm2-software:masterfrom
thomkopp wants to merge 1 commit intotpm2-software:masterfrom
Conversation
Author
|
Quick question: Who would be able to review this? I created the MR in November of last year and am still hoping to get some feedback (have the change eventually merged). I'm not a maintainer of this project and therefore definitely don't understand all the details. But I'm trying to make it better by fixing a bug which we encountered in our environment. Thanks in advance. |
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>
ebd9a89 to
30d57cf
Compare
Contributor
|
Hello. Thank you for pointing out this problem. I made an alternative fix in #175, which is (almost) identical to what tpm2-tools did. I prefer to stay similar to that code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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