-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
There was a problem hiding this 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
demo/client/wh_demo_client_crypto.c
Outdated
* wolfHSM functions wh_Client_AesCmacGenerate and wh_Client_AesCmacVerify | ||
* when doing oneshot cmac generation or oneshot verifition, manual steps | ||
* can be done as above */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* 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() */ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this 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
demo/client/wh_demo_client_crypto.c
Outdated
@@ -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 */ |
There was a problem hiding this comment.
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
/* initialize rng to make the cruve25519 keys */ | |
/* initialize rng to make the curve25519 keys */ |
demo/client/wh_demo_client_crypto.c
Outdated
* wolfHSM functions wh_Client_AesCmacGenerate and wh_Client_AesCmacVerify | ||
* when doing oneshot cmac generation or oneshot verifition, manual steps | ||
* can be done as above */ |
There was a problem hiding this comment.
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.
gotcha, added the oneshot example |
imported keys