[Assignment-7] sign_firmware returns signature
All checks were successful
Latex Build / build-latex (Assignment 4 - Protokollsicherheit (Praxis)) (push) Successful in 1m3s
Latex Build / build-latex (Assignment 5 - Software Security - Teil 1) (push) Successful in 1m1s
Latex Build / build-latex (Assignment 6 - Software Security - Teil 2) (push) Successful in 1m0s

This commit is contained in:
Sascha Tommasone 2024-07-01 11:17:06 +02:00
parent aa1d4327f5
commit 7044b96803
Signed by: saschato
GPG key ID: 751068A86FCAA217

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;
} }