[Assignment-7] hardcoded authorized public keys
This commit is contained in:
parent
cd43a6744a
commit
118d7385e8
1 changed files with 13 additions and 1 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue