[Assignment-7] sign_firmware returns signature
This commit is contained in:
parent
76d8d4a2f4
commit
07254a8036
1 changed files with 8 additions and 1 deletions
|
@ -3,8 +3,11 @@
|
|||
#include <sgx_error.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) {
|
||||
// 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;
|
||||
}
|
Loading…
Reference in a new issue