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

add demos for cryptographic functions with and without #13

Merged
merged 3 commits into from
Jul 23, 2024

Conversation

jpbland1
Copy link
Contributor

imported keys

@jpbland1 jpbland1 self-assigned this Jul 22, 2024
@jpbland1 jpbland1 requested a review from bigbrett July 22, 2024 15:07
Copy link
Contributor

@bigbrett bigbrett left a comment

Choose a reason for hiding this comment

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

Awesome, thanks so much for this @jpbland1. Just a few changes/cleanups and things to make it clearer for the reader

posix/tcp/wh_client_tcp/user_settings.h Outdated Show resolved Hide resolved
posix/tcp/wh_server_tcp/user_settings.h Outdated Show resolved Hide resolved
demo/client/wh_demo_client_crypto.c Outdated Show resolved Hide resolved
demo/client/wh_demo_client_crypto.c Outdated Show resolved Hide resolved
demo/client/wh_demo_client_crypto.c Outdated Show resolved Hide resolved
demo/client/wh_demo_client_crypto.c Show resolved Hide resolved
demo/client/wh_demo_client_crypto.c Outdated Show resolved Hide resolved
demo/client/wh_demo_client_crypto.c Show resolved Hide resolved
demo/client/wh_demo_client_crypto.c Show resolved Hide resolved
Comment on lines 1332 to 1335
* wolfHSM functions wh_Client_AesCmacGenerate and wh_Client_AesCmacVerify
* when doing oneshot cmac generation or oneshot verifition, manual steps
* can be done as above */
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/* verify the tag, note that for pre-cached keys we need to use the special
* wolfHSM functions wh_Client_AesCmacGenerate and wh_Client_AesCmacVerify
* when doing oneshot cmac generation or oneshot verifition, manual steps
* can be done as above */
/* Verify the tag. Note that in order to use a cached key for
* CMAC verification, it is necessary to use the special wolfHSM
* client API function: wh_Client_AesCmacVerify() */

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, pedantic to us, but good for the user: we should do a separate one-shot example using the Client API, vs just mentioning it in the comment for the verify

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to show the cached key doing operations both manually and with a helper function but I also wanted to make the comment with both functions included so they understand that oneshot generate also has it's own special function

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand, I'm saying go one step further and add a oneshot generate example too, as opposed to just leaving the note about using the client API for oneshots in the comment. Harder to miss. That way we are explicitly demonstrating the correct way to do a oneshot CMAC in the demo code. Just create a whDemoClient_CryptoCmacOneshotImport() with the same input data.

@jpbland1 jpbland1 requested a review from bigbrett July 22, 2024 21:09
Copy link
Contributor

@bigbrett bigbrett left a comment

Choose a reason for hiding this comment

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

missed a typo and think we should create a one shot CMAC demo function, since it is a special case and we should highlight it

@@ -193,7 +193,7 @@ int wh_DemoClient_CryptoCurve25519(whClientContext* clientContext)
curve25519_key curve25519PublicKey[1];
WC_RNG rng[1];

/* initialize rng to make the cruve25516 keys */
/* initialize rng to make the cruve25519 keys */
Copy link
Contributor

Choose a reason for hiding this comment

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

@jpbland1 Somehow I didn't notice the double typo the first time XD

Suggested change
/* initialize rng to make the cruve25519 keys */
/* initialize rng to make the curve25519 keys */

Comment on lines 1332 to 1335
* wolfHSM functions wh_Client_AesCmacGenerate and wh_Client_AesCmacVerify
* when doing oneshot cmac generation or oneshot verifition, manual steps
* can be done as above */
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand, I'm saying go one step further and add a oneshot generate example too, as opposed to just leaving the note about using the client API for oneshots in the comment. Harder to miss. That way we are explicitly demonstrating the correct way to do a oneshot CMAC in the demo code. Just create a whDemoClient_CryptoCmacOneshotImport() with the same input data.

@jpbland1 jpbland1 requested a review from bigbrett July 22, 2024 22:17
@jpbland1
Copy link
Contributor Author

gotcha, added the oneshot example

@bigbrett bigbrett merged commit d65e823 into wolfSSL:main Jul 23, 2024
1 check 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.

2 participants