Open brenzi opened 4 years ago
Verifying failure may be related to endian switch. The output keys from SGX SDK are little endian.
And SGX also provides a function for checking whether a pub key is on the curve or not, named sgx_ecc256_check_point()
. You can try this function as well.
I tried little and big endian. both fail. verifying with intel sdk tools works, so there is no point in trying the check-point fn. It seems more like an incompatibility with openssl
In my enclave, I create a keypair and sign a message:
giving me
Now I'm trying to verify the signature with ring. But the pubkey seems not to be on the curve (I also tried reversing the bytes in case it was little-endian). Also boringSLL thinks it's not on the curve.
From these lines https://github.com/intel/linux-sgx/blob/4589daddd58bec7367a6a9de3fe301e6de17671a/sdk/tlibcrypto/sgxssl/sgx_ecc256.cpp#L57
I would conclude that ecc_handle is using the prime256v1 curve, equivalent to the NIST P-256 / secp256r1 that ring refers to with
ECDSA_P256_SHA256_FIXED
So I'd concatenate X and Y and prefix it with
0x04
to pass it to ring:So why is the pubkey not on the curve?