intel / intel/confidential-computing.sgx.sdk

Signature is incorrect from sample_ecdsa_sign

Open
#21 4 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
2
Forks
3
PR merge metrics
No merged PRs in 30d

Description

I'm trying to calculate the signature by using sample_ecdsa_sign.

```
static const sample_ec256_private_t g_sp_priv_key = {
{
0x90, 0xe7, 0x6c, 0xbb, 0x2d, 0x52, 0xa1, 0xce,
0x3b, 0x66, 0xde, 0x11, 0x43, 0x9c, 0x87, 0xec,
0x1f, 0x86, 0x6a, 0x3b, 0x65, 0xb6, 0xae, 0xea,
0xad, 0x57, 0x34, 0x53, 0xd1, 0x03, 0x8c, 0x01
}
};
sample_ec256_private_t test_text = {1};
sample_ec256_signature_t test_signature = {{0},{0}};
sample_ret = sample_ecdsa_sign((uint8_t *)&test_text, sizeof(sample_ec256_private_t),
(sample_ec256_private_t *)&g_sp_priv_key,
(sample_ec256_signature_t *)&test_signature,
ecc_state);
memcpy(test_sign_buf,(unsigned char *)&test_signature,sizeof(sample_ec256_signature_t));
Log("\t After Signature: (%s)", ByteArrayToString(test_sign_buf, sizeof(sample_ec256_signature_t)));
```
But result turns out:
```
1546918147 INFO : Before Signature : (00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
1546918147 INFO : Plant text: (0100000000000000000000000000000000000000000000000000000000000000)
1546918147 INFO : Private Key: (90e76cbb2d52a1ce3b66de11439c87ec1f866a3b65b6aeeaad573453d1038c01)
1546918147 INFO : After Signature: (6a83dc84d44c8abb5e42afee8de9f45771fd7366d7faadfaf21714dd5ab99e97dd3cfc8cd2149ab4b3a787930541cbb0e8462d3f24045543d711c617ae3c9332)
```

The first 32 byte of signature is totally same as the X-coordinate of SP publicKey g_b```6a83dc84d44c8abb5e42afee8de9f45771fd7366d7faadfaf21714dd5ab99e97```

I'm also done the ECDSA using same private key in both Python and JS, but obviously, totally different with the sample_ecdsa_sign did.
Can anyone help on this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.