Skip to content
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

Fixes issue wrong max size in some sized buffer types. #549

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

Superhepper
Copy link
Collaborator

Some of the sized buffers had their buffer sizes
set as numbers. Even though this in some cases
were the correct numbers they were a little hard
to determine if they actually followed the size
specified in the standard. So this PR fixes #548
in the main branch by using the the calculations
specified in the standard for the buffer sizes.

Some of the sized buffers had their buffer sizes
set as numbers. Even though this in some cases
were the correct numbers they were a little hard
to determine if they actually followed the size
specified in the standard. So this PR fixes parallaxsecond#548
in the main branch by using the the calculations
specified in the standard for the buffer sizes.

Signed-off-by: Jesper Brynolf <[email protected]>
Copy link
Member

@ionut-arm ionut-arm 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 the effort, that was very quick!

Comment on lines +6 to +15
fn test_max_sized_ecc_parameter_conversions() {
let expected_secret = [0xffu8; EncryptedSecret::MAX_SIZE];
let native = EncryptedSecret::try_from(expected_secret.as_slice().to_vec()).expect(
"It should be possible to convert an array of MAX size into a EncryptedSecret object.",
);
let tss = TPM2B_ENCRYPTED_SECRET::from(native);
assert_eq!(EncryptedSecret::MAX_SIZE, tss.size as usize);
// This will be a compiler error if the max size does not match the TSS buffer size.
assert_eq!(expected_secret, tss.secret);
}
Copy link
Member

Choose a reason for hiding this comment

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

I guess in the future we can make a macro out of this sort of test.

Copy link
Collaborator

@wiktor-k wiktor-k left a comment

Choose a reason for hiding this comment

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

Looks pretty straightforward, thanks for the work! 👏

@Superhepper Superhepper merged commit 2faf073 into parallaxsecond:main Sep 30, 2024
12 checks passed
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.

Conversion from tss-esapi native buffer type into the corresponding tss-esapi-sys TSS type can panic
3 participants