-
Notifications
You must be signed in to change notification settings - Fork 199
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
xtest: add asymmetric cipher perf test #714
Conversation
|
That's a funny coincidence, we were working on a similar application benchmark, and we were about to submit it here. We will review the pull-request then. |
Much appreciated 👍 |
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.
is key derivation also plan to be part of asymmetric benchmark ?
TEE_ALG_SM2_DSA_SM3 will be added soon. ED25519 and keypair derivation maybe later. |
d5e4aad
to
1bb8323
Compare
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.
Split your commit into two commits (CA et TA).
Could you please use fixup commits? That would help a lot on tracking changes during the review. Thanks!
Hi @yuzexiyzx, please use fixup commits and answer/resolve comments so we can keep track of your modifications. Thanks! |
|
Sure! Instead of amending your previous commit and force-pushing every time, you create a fixup commit that “fixes” one of your previous commits like so : It will automatically generate a commit message based on the commit you want to fix. Please note that OPTEE CI does not like commits with empty message body. You can reword it to specify the changes you made. When the review is done, you can squash all commits automatically with |
@yuzexiyzx The latest commit you pushed is empty. You need to add the changes you make during the review to the fixup commit. |
ed4be4b
to
cb515d5
Compare
@yuzexiyzx Could you also answer and eventually resolve comments ? So we know if the comment has been addressed or not. Thanks |
@jforissier @clementfaure @etienne-lms @omasse-linaro All comments have been solved. |
Hi @yuzexiyzx, sorry about that. The error is unrelated to your change. It should go away as soon as OP-TEE/build#725 is merged. I will restart the job afterwards. |
@jforissier Thanks! |
@clementfaure @omasse-linaro @etienne-lms All comments have been solved.Anything else need to be modified? |
Hi @yuzexiyzx |
Hi @clementfaure |
Your comments are |
@clementfaure Really sorry about that.Could you tell me how to submit my review? I cannot find this option. |
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.
Commit "xtest: add asymmetric cipher perf test" looks good to me (with monir comment):
Acked-by: Etienne Carriere <[email protected]>
.
@jforissier, there seems to be an issue with the Rust setup build. Any idea?
2024-01-29T11:32:27.2529700Z info: downloading component 'rust-std' for 'aarch64-unknown-linux-gnu'
2024-01-29T11:32:27.2547290Z error: component download failed for rust-docs-x86_64-unknown-linux-gnu: could not rename downloaded file from '/github/home/.rustup/downloads/34651bc0aae' (snip)
host/xtest/asym_perf.c
Outdated
main_algo = ALGO_DH; | ||
mode = MODE_GENKEYPAIR; | ||
} | ||
else if (!strcasecmp(argv[i], "RSA_GENKEYPAIR")) { |
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.
nitpicking: for consistency:
} else if (!strcasecmp(argv[i], "RSA_GENKEYPAIR")) {
Ditto at line 746.
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.
solved
@yuzexiyzx No problem. |
Not yet, I am trying to reproduce it locally. |
@clementfaure Thanks.The right corner of pull request page is like this. |
@jforissier Could you please tell me how to solve it? Thank you very much! |
Hi @yuzexiyzx, |
@etienne-lms found it.Thank you very much! |
f1be7c1
to
e68c45f
Compare
@clementfaure I have submitted my comments. |
@clementfaure @omasse-linaro All comments have been solved. |
host/xtest/asym_perf.c
Outdated
} | ||
|
||
/* initial test buffer allocation (eventual registering to TEEC) */ | ||
static void alloc_buffers(size_t sz, int verbosity) |
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.
Better remove verbosity
no ?
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.
solved
host/xtest/asym_perf.c
Outdated
check_res(res, "TEEC_InvokeCommand()", &ret_origin); | ||
} | ||
|
||
static void prepare_enc_sign(uint32_t size, uint32_t mode, uint32_t is_random, |
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.
What's the use for uint32_t is_random
?
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.
You're right. It's unused here, only used in asym_perf_run_test()
to init input data. Can be removed.
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.
is_random has been removed
host/xtest/asym_perf.c
Outdated
case ALGO_ECDH: | ||
curve_id = get_curve_id(width_bits); | ||
if (curve_id == TEE_CRYPTO_ELEMENT_NONE) | ||
return -1; |
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.
No need to goto out;
?
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.
solved
host/xtest/asym_perf.c
Outdated
break; | ||
default: | ||
fprintf(stderr, "Unexpected mode value\n"); | ||
exit(1); |
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.
No need to goto out;
?
Edit: in this function, we exit in several different ways, it's inconsistent. We've got goto out;
, return 1
, exit(1)
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.
solved
if (param_types != exp_param_types) | ||
return TEE_ERROR_BAD_PARAMETERS; | ||
|
||
crypto_buf = TEE_Malloc(params[0].memref.size, 0); |
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.
Check if the malloc is successful
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.
solved
ta/crypto_perf/ta_crypto_perf.c
Outdated
params[1].memref.buffer, params[1].memref.size, | ||
params[2].memref.buffer, dummy_size); | ||
|
||
CHECK(res, "TEE processing failed", goto out;); |
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.
You can break
instead of goto out
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.
solved
ta/crypto_perf/ta_crypto_perf.c
Outdated
params[1].memref.buffer, params[1].memref.size, | ||
params[2].memref.buffer, &dummy_size); | ||
|
||
CHECK(res, "TEE processing failed", goto out;); |
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.
You can break
instead of goto out
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.
solved
ta/crypto_perf/ta_entry.c
Outdated
@@ -54,7 +55,6 @@ TEE_Result TA_InvokeCommandEntryPoint(void *pSessionContext, | |||
switch (nCommandID) { | |||
case TA_CRYPTO_PERF_CMD_CIPHER_PREPARE_KEY: | |||
return cmd_cipher_prepare_key(nParamTypes, pParams); | |||
|
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.
Remove this change as it is not related to the PR
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.
solved
uint32_t b; | ||
}; | ||
|
||
static TEE_Result unpack_attrs(const uint8_t *buf, size_t blen, |
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.
Note: this function is duplicated. I don't know if it's really an issue, however. @etienne-lms ?
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.
Do you refer to the unpack_attrs()
function in ta/crypt/cryp_taf.c.
I don't think it's worth factorizing both as they relate to specific TAs.
ta/crypto_perf/ta_crypto_perf.c
Outdated
else if (mode == MODE_DECRYPT) | ||
do_asym = TEE_AsymmetricDecrypt; | ||
else if (mode == MODE_SIGN) | ||
do_asym = TEE_AsymmetricSignDigest; |
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.
Add an else
to return an error as do_asym()
as it can be called as NULL
.
Do the if (mode == MODE_VERIFY) {...}
first and then the other modes.
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.
solved
Add perf test for DH, RSA, ECDH, ECDSA algorithm Signed-off-by: Zexi Yu <[email protected]> Acked-by: Etienne Carriere <[email protected]>
Add perf test for DH, RSA, ECDH, ECDSA algorithm Signed-off-by: Zexi Yu <[email protected]> Acked-by: Etienne Carriere <[email protected]>
@clementfaure All comments have been solved. |
Thanks @yuzexiyzx for all the work. |
Add perf test for DH, RSA, ECDH, ECDSA algorithm