"zhongxuan (A)" zhongxuan2@huawei.com writes:
Yes, I've tried to make a fork in https://git.lysator.liu.se/nettle/nettle/-/forks/new but failed, it just reports ' An error occurred while forking the project. Please try again. '.
Sorry, I don't really know how to troubleshoot. Maybe you can try if it works better on the mirror repo at https://gitlab.com/gnutls/nettle?
I've had a new look at your latest patch. I'm not at all familiar with sm2, and I'm hoping I don't have to fully understand all details, but I am a bit confused.
I think one important part of your patch is about adding support for Weierstrass curves with a different constant than a = -3.
And then I look at the spec at https://datatracker.ietf.org/doc/html/draft-shen-sm2-ecdsa to see how the curve really is defined. It looks like that document gives several examples of curves, including one named "Fp-256", but the one that it looks like you are defining, in eccdata.c, is the one defined in Appendix D "Recommended parameters".
So my first question: Is "sm2" an appropriate name for a single curve, or is there some more specific name for the curve in Appendix D that you use?
Second question, when I look at that curve, it is defined like this:
: A elliptic curve on a prime field of 256 bits is recommended: : : : y^2 = x^3 + ax + b : : : p=FFFFFFFE FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 00000000 FFFFFFFF FFFFFFFF : a=FFFFFFFE FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 00000000 FFFFFFFF FFFFFFFC : b=28E9FA9E 9D9F5E34 4D5A9E4B CF6509A7 F39789F5 15AB8F92 DDBCBD41 4D940E93 : n=FFFFFFFE FFFFFFFF FFFFFFFF FFFFFFFF 7203DF6B 21C6052B 53BBF409 39D54123 : Gx=32C4AE2C 1F198119 5F990446 6A39C994 8FE30BBF F2660BE1 715A4589 334C74C7 : Gy=BC3736A2 F4F6779C 59BDCEE3 6B692153 D0A9877C C62A4740 02DF32E5 2139F0A0
But for this parameters, we have a = p - 3 = -3 (mod p), like for all other Weierstrass curves currently supported by Nettle! Which is good news, since then the same point addition functions can be used, but it also means that maybe you have done some work that isn't really needed?
Regards, /Niels