[Assignment-7] hardcoded authorized public keys

This commit is contained in:
Sascha Tommasone 2024-07-03 16:45:54 +02:00
parent cd43a6744a
commit 118d7385e8
Signed by: saschato
GPG key ID: 751068A86FCAA217

View file

@ -53,6 +53,17 @@
#define SI_SIZE 2*SK_SIZE #define SI_SIZE 2*SK_SIZE
#endif #endif
const sgx_ec256_public_t authorized[2] = {
{
0,
0
},
{
0,
0
}
};
int get_sealed_size() { int get_sealed_size() {
return sgx_calc_sealed_data_size(PK_SIZE, SK_SIZE); return sgx_calc_sealed_data_size(PK_SIZE, SK_SIZE);
} }
@ -238,6 +249,7 @@ sgx_status_t verify_firmware(const uint8_t *data, uint32_t data_size, const uint
if(public_key != NULL) { if(public_key != NULL) {
// invalid public key // invalid public key
if(public_key_size != PK_SIZE) { if(public_key_size != PK_SIZE) {
sgx_ecc256_close_context(ecc_handle);
return SGX_ERROR_INVALID_PARAMETER; return SGX_ERROR_INVALID_PARAMETER;
} }
@ -253,7 +265,7 @@ sgx_status_t verify_firmware(const uint8_t *data, uint32_t data_size, const uint
// verify signature // verify signature
uint8_t result; uint8_t result;
sgx_status_t verification_status = sgx_ecdsa_verify((const uint8_t *)data, data_size, (const sgx_ec256_public_t *)&public, (const sgx_ec256_signature_t *)&ecc_signature, &result, ecc_handle); sgx_status_t verification_status = sgx_ecdsa_verify(data, data_size, (const sgx_ec256_public_t *)&public, (const sgx_ec256_signature_t *)&ecc_signature, &result, ecc_handle);
// handle failed verification process // handle failed verification process
if(verification_status != SGX_SUCCESS) { if(verification_status != SGX_SUCCESS) {