Assignment-7-sgximpl #13

Merged
saschato merged 62 commits from Assignment-7-sgximpl into Assignment-7 2024-07-08 11:03:28 +02:00
Showing only changes of commit 7044b96803 - Show all commits

View file

@ -3,8 +3,11 @@
#include <sgx_error.h> #include <sgx_error.h>
#include <sgx_tcrypto.h> #include <sgx_tcrypto.h>
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) { 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) { 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) if((status = sgx_ecdsa_sign(data, data_size, &private, &ecc_signature, ecc_handle)) != SGX_SUCCESS)
return status; 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); sgx_ecc256_close_context(ecc_handle);
return SGX_SUCCESS; return SGX_SUCCESS;
} }