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

The issue on ECDSA #1037

Open
TheYangCode opened this issue Jun 19, 2024 · 1 comment
Open

The issue on ECDSA #1037

TheYangCode opened this issue Jun 19, 2024 · 1 comment

Comments

@TheYangCode
Copy link

I think the parameters used by SGX should be:

GX = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;
GY = 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;
AA = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;
BB = 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;
PP = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;
NN = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;

Through the sgx_ecc256_create_key_pairfunction, the key I obtained is:

sk:
abc284b60e61f2ced65603c41641922ada1caffb891b1bc4e93cfe0ba597537e
pk.gx:
5560b6f697cfafb011e80d2ad18cb1a2c4a9d556029c4b1035f2adfcec95ab3a
pk.gy:
76e1c5d3ff46376ae9dcdc95faffaef8aec488d230ef8d92c4d2738c3e4fd87c

After converting to little-endian:

sk:
7e5397a50bfe3ce9c41b1b89fbaf1cda2a924116c40356d6cef2610eb684c2ab
pk.gx:
3aab95ecfcadf235104b9c0256d5a9c4a2b18cd12a0de811b0afcf97f6b66055
pk.gy:
7cd84f3e8c73d2c4928def30d288c4aef8aefffa95dcdce96a3746ffd3c5e176

However, When I calculate the public key using functions other than those in SGX.I am unable to calculate with the value
7e5397a50bfe3ce9c41b1b89fbaf1cda2a924116c40356d6cef2610eb684c2ab

pk.gx:
3aab95ecfcadf235104b9c0256d5a9c4a2b18cd12a0de811b0afcf97f6b66055
pk.gy:
7cd84f3e8c73d2c4928def30d288c4aef8aefffa95dcdce96a3746ffd3c5e176

In this way, I am unable to further verify the signature. I am a beginner, please help me.Is it a problem with endianness conversion?

@ShundaZhang
Copy link

ShundaZhang commented Jun 21, 2024

Yes, you should not convert you data to little endian when calculating.
The equation public key = private key * G only holds for the big-endian data you listed. If you must store them in little-endian format, please convert them back when performing calculations. Otherwise, the equation will not hold.

That is to say: 0xabc284b60e61f2ced65603c41641922ada1caffb891b1bc4e93cfe0ba597537e * (0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296, 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5) == (0x5560b6f697cfafb011e80d2ad18cb1a2c4a9d556029c4b1035f2adfcec95ab3a, 0x76e1c5d3ff46376ae9dcdc95faffaef8aec488d230ef8d92c4d2738c3e4fd87c)

but
0x7e5397a50bfe3ce9c41b1b89fbaf1cda2a924116c40356d6cef2610eb684c2ab * (0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296, 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5) != (0x3aab95ecfcadf235104b9c0256d5a9c4a2b18cd12a0de811b0afcf97f6b66055, 0x7cd84f3e8c73d2c4928def30d288c4aef8aefffa95dcdce96a3746ffd3c5e176)

Here * means Multiplication on elliptic curves.

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

No branches or pull requests

2 participants