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

drivers:crypto:add support for SM2_DSA_SM3 #5912

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

yuzexiyzx
Copy link
Contributor

@yuzexiyzx yuzexiyzx commented Mar 25, 2023

Adds TEE_TYPE_SM2_DSA_SM3_PUBLIC_KEY to
drvcrypt_asym_alloc_ecc_public_key() and adds
TEE_TYPE_SM2_DSA_SM3_KEYPAIR to drvcrypt_asym_alloc_ecc_keypair(). Adds support for TEE_MAIN_ALGO_SM2_DSA_SM3 in ecc_sign and ecc_verify.

@jenswi-linaro
Copy link
Contributor

Please update the commit message to describe accurately what's done. For instance, I can't find drvcrypto_asym_alloc_ecc_public_key anywhere.

@yuzexiyzx
Copy link
Contributor Author

I have updated the commit message.

@@ -570,6 +580,7 @@ TEE_Result drvcrypt_asym_alloc_ecc_public_key(struct ecc_public_key *key,

switch (type) {
case TEE_TYPE_SM2_PKE_PUBLIC_KEY:
case TEE_TYPE_SM2_DSA_PUBLIC_KEY:
key->curve = TEE_ECC_CURVE_SM2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why isn't ecc->alloc_publickey() taking care of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ecc->alloc_publickey() can not get key_type(such as TEE_TYPE_SM2_DSA_PUBLIC_KEY) to decide which curve it is.

Copy link
Contributor

Choose a reason for hiding this comment

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

crypto_asym_alloc_ecc_keypair() in core/lib/libtomcrypt/ecc.c and lib/libmbedtls/core/ecc.c does that.

It might be worth adding a comment here about why some special treatment is needed.

@jenswi-linaro
Copy link
Contributor

In the commit message, please () after function names to show that they're functions. Also add a space before the next character following a : or ..

@yuzexiyzx yuzexiyzx force-pushed the master branch 2 times, most recently from a50ce17 to 63339e2 Compare March 29, 2023 02:21
@jenswi-linaro
Copy link
Contributor

Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

Adds TEE_TYPE_SM2_DSA_SM3_PUBLIC_KEY to
drvcrypt_asym_alloc_ecc_public_key() and adds
TEE_TYPE_SM2_DSA_SM3_KEYPAIR to drvcrypt_asym_alloc_ecc_keypair(). Adds
support for TEE_MAIN_ALGO_SM2_DSA_SM3 in ecc_sign and ecc_verify.

Signed-off-by: Zexi Yu <yuzexi@hisilicon.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
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.

3 participants