SM2 #733
No reviewers
Labels
No labels
bug
duplicate
enhancement
feature
help wanted
improve API
invalid
needs documentation
not-planned
rtfm
stale
support
wishlist
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libtom/libtomcrypt!733
Loading…
Reference in a new issue
No description provided.
Delete branch "pr/sm2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Added SM2 (Chinese public key algorithm) support.
It depends on the not-yet-merged SM3 hash support.
SM2 uses the existing ECC curve code where possible (it is just another curve). However, its signing/encryption work differently enough, so this patch adds separate SM2-specific functions.
Checklist
@ -474,0 +481,4 @@const unsigned char *msg, unsigned long msglen,const unsigned char *sig, unsigned long siglen,int hash_idx, int *stat, const ecc_key *key);Would it maybe make sense to introduce a new generic API?
Add
LTC_ECCSIG_SM2toecc_signature_typeandhash_idxtoltc_ecc_sig_optsand then have the following:@ -0,0 +534,4 @@LTC_ARGCHK(key != NULL);if ((err = s_sm2_only_curve(key)) != CRYPT_OK) return err;if ((hash_idx = s_sm2_hash_idx(hash_idx)) < 0) return hash_idx;This error check won't work.
I'd say we can remove the
hash_idxin the API. This also applies toecc_decrypt_key_sm2().@ -474,0 +481,4 @@const unsigned char *msg, unsigned long msglen,const unsigned char *sig, unsigned long siglen,int hash_idx, int *stat, const ecc_key *key);you mean something similar to https://github.com/libtom/libtomcrypt/issues/724#issuecomment-4252844286 ?
I am not sure if it is a nice piece of code.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.