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

libtcgtpm: update _plat__NVEnable and _plat__NVDisable signatures #576

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

stefano-garzarella
Copy link
Member

_plat__NVEnable() and _plat__NVDisable() APIs were updated in the new TCG TPM reference implementation to include an additional paramSize parameter (size_t) in their signatures.

This patch synchronizes the header file and Rust FFI calls with the new function prototypes.

Previously, the outdated header and calls passed fewer arguments than required by the new TCG TPM library. However, this mismatch did not cause issues because the new parameter (paramSize) is not used by the new implementation.

Additionally, the first parameter of _plat__NVDisable() has changed from int delete to void* platParameter in the new signature. However, the actual value passed (1) remains the same.

In the future we should find a better way to keep the headers synchronized and avoid this problem.

Fixes: 9894bf4 ("libtcgtpm: swtich from MS TPM to TCG TPM")

`_plat__NVEnable()` and `_plat__NVDisable()` APIs were updated in the
new TCG TPM reference implementation to include an additional
`paramSize` parameter (size_t) in their signatures.

This patch synchronizes the header file and Rust FFI calls with the new
function prototypes.

Previously, the outdated header and calls passed fewer arguments than
required by the new TCG TPM library. However, this mismatch did not
cause issues because the new parameter (paramSize) is not used by the
new implementation.

Additionally, the first parameter of `_plat__NVDisable()` has changed
from `int delete` to `void* platParameter` in the new signature. However,
the actual value passed (1) remains the same.

In the future we should find a better way to keep the headers synchronized
and avoid this problem.

Fixes: 9894bf4 ("libtcgtpm: swtich from MS TPM to TCG TPM")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
@stefano-garzarella
Copy link
Member Author

CC @cclaudio

@joergroedel joergroedel requested a review from cclaudio December 17, 2024 13:52
@joergroedel joergroedel added the wait-for-review PR needs for approval by reviewers label Dec 17, 2024
Copy link
Member

@cclaudio cclaudio left a comment

Choose a reason for hiding this comment

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

LGTM.
It seems that upstream has re-structured the platform header files. Later we may want to follow what they are doing by generatiing bindings for those headers.

https://github.com/TrustedComputingGroup/TPM/blob/main/TPMCmd/Simulator/src/simulatorPrivate.h , which includes the new platform headers.

@stefano-garzarella
Copy link
Member Author

stefano-garzarella commented Dec 18, 2024

LGTM.

Thanks for the review!

It seems that upstream has re-structured the platform header files. Later we may want to follow what they are doing by generatiing bindings for those headers.

https://github.com/TrustedComputingGroup/TPM/blob/main/TPMCmd/Simulator/src/simulatorPrivate.h , which includes the new platform headers.

Yeah, I agree on that. I'll look into that, removing our intermediate header, and using bindgen directly on the headers provided by them! (in another PR)

@joergroedel joergroedel added in-review PR is under active review and not yet approved and removed wait-for-review PR needs for approval by reviewers labels Dec 18, 2024
@joergroedel joergroedel merged commit 110a811 into coconut-svsm:main Dec 20, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-review PR is under active review and not yet approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants