-
Notifications
You must be signed in to change notification settings - Fork 161
ecdsa: add new example with runtime algo selection #134
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
base: master
Are you sure you want to change the base?
Conversation
Add new example demonstrating ECDSA algorithms: - TEE_ALG_ECDSA_SHA1 - TEE_ALG_ECDSA_SHA224 - TEE_ALG_ECDSA_SHA256 - TEE_ALG_ECDSA_SHA384 - TEE_ALG_ECDSA_SHA512 - Allows users to select algorithm at runtime via: `optee_example_ecdsa <algo>` - Defaults to TA_ALG_ECDSA_SHA256 if no algorithm is specified - The selected algorithm is used for ECDSA operations Signed-off-by: Amey Avinash Raghatate <[email protected]>
This pull request has been marked as a stale pull request because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment, otherwise this pull request will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time. |
@etienne-lms @jenswi-linaro |
{ | ||
switch (param) { | ||
case TA_ALG_ECDSA_SHA1: | ||
*algo_id = TEE_ALG_ECDSA_SHA1; |
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'd prefer the client to provide this value directly to avoid translating it again. The algorithm values are defined in a GP standard, so they are "well known" and shouldn't change.
if (param_types != exp_param_types) | ||
return TEE_ERROR_BAD_PARAMETERS; | ||
|
||
TEE_Result res; |
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.
Please initialize all locals https://optee.readthedocs.io/en/latest/general/coding_standards.html
TEE_PARAM_TYPE_NONE, | ||
TEE_PARAM_TYPE_NONE, | ||
TEE_PARAM_TYPE_NONE); | ||
if (param_types != exp_param_types) |
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.
Variables are declared first in a block, before the code.
sess->keypair = TEE_HANDLE_NULL; | ||
sess->public_key = TEE_HANDLE_NULL; | ||
|
||
(void)param_types; |
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.
Please use the __unused
attribute on param_types
above instead, same for params
.
Add new example demonstrating ECDSA algorithms:
optee_example_ecdsa <algo>