diff --git a/Assignment 7 - SGX Hands-on/src/enclave/enclave.c b/Assignment 7 - SGX Hands-on/src/enclave/enclave.c index 43da513..23630a4 100644 --- a/Assignment 7 - SGX Hands-on/src/enclave/enclave.c +++ b/Assignment 7 - SGX Hands-on/src/enclave/enclave.c @@ -3,8 +3,11 @@ #include #include +const unsigned char *secretkey_file = "/var/signrelay/sk"; +const unsigned char *publickey_file = "/var/signrelay/pk"; + sgx_status_t public_key(uint8_t *gx, uint8_t *gy) { - // unseal key or from file system + // TODO } sgx_status_t sign_firmware(uint8_t *data, size_t data_size, uint8_t *signature, size_t signature_size) { @@ -23,6 +26,10 @@ sgx_status_t sign_firmware(uint8_t *data, size_t data_size, uint8_t *signature, if((status = sgx_ecdsa_sign(data, data_size, &private, &ecc_signature, ecc_handle)) != SGX_SUCCESS) return status; + memcpy(signature, ecc_signature.x, SGX_ECP256_KEY_SIZE); + memcpy(signature + SGX_ECP256_KEY_SIZE, ecc_signature.y, SGX_ECP256_KEY_SIZE); + //signature_size = 2 * SGX_ECP256_KEY_SIZE; + sgx_ecc256_close_context(ecc_handle); return SGX_SUCCESS; } \ No newline at end of file