Skip to content

Improve TPMUSymKeyBits and TPMUSymMode #384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 23, 2025
Merged

Improve TPMUSymKeyBits and TPMUSymMode #384

merged 4 commits into from
Jan 23, 2025

Conversation

AlexandreEXFO
Copy link
Contributor

No description provided.

@AlexandreEXFO AlexandreEXFO requested review from alexmwu, jkl73 and a team as code owners December 20, 2024 17:43
Copy link
Member

@chrisfenner chrisfenner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this change! I have a couple comments.

// AES returns the 'aes' member of the union.
//
// Deprecated: AES exists for historical compatibility
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure does indeed have members for each algorithm, see https://trustedcomputinggroup.org/wp-content/uploads/TPM-2.0-1.83-Part-2-Structures.pdf#page=150 (and see https://trustedcomputinggroup.org/wp-content/uploads/TPM-2.0-1.83-Part-2-Structures.pdf#page=32 for an explanation of the algorithm tokens). sym is there as a convenience within the reference implementation and IMHO probably shouldn't even be mentioned in the spec. Also, I'm expecting that a future version of the spec flattens these macros, because they're hard to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I really didn't understand the specification like that the first time I look at it (it was really not clear), but looking at it a second time, I actually understand.

@@ -1446,7 +1461,7 @@ type SymModeContents interface {
// create implements the unmarshallableWithHint interface.
func (u *TPMUSymMode) create(hint int64) (reflect.Value, error) {
switch TPMAlgID(hint) {
case TPMAlgAES:
case TPMAlgTDES, TPMAlgAES, TPMAlgSM4, TPMAlgCamellia:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TDES is deprecated (https://csrc.nist.gov/news/2023/nist-to-withdraw-sp-800-67-rev-2) so can we just not implement support for it?

Copy link
Contributor Author

@AlexandreEXFO AlexandreEXFO Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that TDES is deprecated by NIST, but I find that not allowing access to the information in a TPM structure would be a wrong choice. In the Golang standard library, access to verify a DSA signature is still possible even if DSA have been deprecated by the NIST. The Golang standard library don't offer method to generate new DSA signatures. In addition, TDES is still widely used in some areas such as payment, even if deprecated by NIST.

Copy link
Member

@chrisfenner chrisfenner Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fair point.

Can we mark the relevant fields as Deprecated to discourage new uses?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sure.

@chrisfenner chrisfenner merged commit 5934315 into google:main Jan 23, 2025
4 checks passed
@chrisfenner
Copy link
Member

Sorry for the delayed review @AlexandreEXFO! Thanks for this contribution!

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.

2 participants