Open yyd106 opened 5 years ago
As its name, the sample cryptography functions are only samples and must not be used in production environment. https://github.com/intel/linux-sgx/blob/bcd3c27a6ea204a0dea1fd7cb00ef4880226d87d/sdk/sample_libcrypto/sample_libcrypto.cpp#L112 The random seed is hard coded and same ECC pointer is generated every time. X-coordinate of ECC pubkey and X-coordinate of ECDSA signature are both X-coordinate of a ECC pointer. Then they are the same due to ECC pointers are the same.
Thank you @llly for the reply. But from enclave side, it still can verify the signature right? Since the signature is not correct (the X-coordinate is not been calculated in correct way), how could it pass the verification from enclave side?
The signature is correct, but it uses a fake random number generator which always generates the same number, so the first 32-bit are always the same.
The sample crypto library is only for a demo and not using random number is to easily debug and reproduce the message. So it should not be used in any product code.
I'm trying to calculate the signature by using sample_ecdsa_sign.
But result turns out:
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?