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

addition of uart and uartns550 to swtpm #301

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JacobBarthelmeh
Copy link
Contributor

No description provided.

@JacobBarthelmeh JacobBarthelmeh self-assigned this Oct 4, 2023
@dgarske
Copy link
Contributor

dgarske commented Oct 4, 2023

For there UART transport it seems odd to still use the swtpm feature. Is there a reason you didn't set it up as its own transport like SPI/I2C as I did in this PR #286 ?

@JacobBarthelmeh
Copy link
Contributor Author

Not sure I fully understand, is this pulling the uartns550 additions out of swtpm and placing it in its own location. Possibly something under hal/tpm_io_uartns550 or the like? Which re-looking at it may be a better fit for it. No reason for it to be in the swtpm code other than familiarity with that section of code when doing the work, happy to move it to a better spot.

@dgarske
Copy link
Contributor

dgarske commented Oct 4, 2023

Not sure I fully understand, is this pulling the uartns550 additions out of swtpm and placing it in its own location. Possibly something under hal/tpm_io_uartns550 or the like? Which re-looking at it may be a better fit for it. No reason for it to be in the swtpm code other than familiarity with that section of code when doing the work, happy to move it to a better spot.

I see... you are still using the SWPTM packet framing (locality, TX size, packet, RX size, etc..) but you are adding UART transport instead of socket.
For some reason I was environing this solution looking more like a physical TPM, not SWTPM.
Keep this as-is for now.

Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

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

Looks great and tested it out. Just one minor suggestion.

@@ -34,7 +34,13 @@
/* --- Local Variables -- */
/******************************************************************************/

static THREAD_LS_T TPM2_CTX* gActiveTPM;
#if defined(WOLFTPM_SWTPM_UARTNS550)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would prefer a different build option to make this a non-static non-thread local. Maybe WOLFTPM2_PUBLIC_CTX?

Refactor debug printf to new macro to support Xilinx FSBL.
Author: Jacob Barthelmeh
@gojimmypi
Copy link
Contributor

Hi @dgarske and @JacobBarthelmeh - just wondering what's the status of this PR?

I see there's a useful DEBUG_PRINTF proposed. I almost when down a similar path, but ended up changing my mind.

I have a similar change in the works, but using the ERROR_OUT(rc, exit) pattern found in the wolfCrypt test.

This is all in relation to my #351 adding Espressif TPM support, and in particular the ability to use the colorization of messages, such as the red ESP_LOGE() messages.

Any preference here?

@JacobBarthelmeh
Copy link
Contributor Author

@gojimmypi it's been blocked on me. I went back and rebased it but after the rebase it was not working like I expected. Have not resolved that yet.

Yeah the abstraction of printf's saved a large amount of data when trying to debug in a resource constrained device that had a light version of printf.

My preference is not having ERROR_OUT and goto's.....that a preference though.

@gojimmypi
Copy link
Contributor

@JacobBarthelmeh I hear ya on the goto's. I too, have mixed feeling about using them. It can be acceptable if used properly.

@dgarske has quite a few instances of the goto exit pattern, which of course lend themselves to easily adapting to ERROR_OUT.

In any case, I'll hold off on that for now.

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.

None yet

4 participants