[Assignment-7] add first enclave part
All checks were successful
Latex Build / build-latex (Assignment 4 - Protokollsicherheit (Praxis)) (push) Successful in 1m4s
Latex Build / build-latex (Assignment 5 - Software Security - Teil 1) (push) Successful in 1m2s
Latex Build / build-latex (Assignment 6 - Software Security - Teil 2) (push) Successful in 59s
All checks were successful
Latex Build / build-latex (Assignment 4 - Protokollsicherheit (Praxis)) (push) Successful in 1m4s
Latex Build / build-latex (Assignment 5 - Software Security - Teil 1) (push) Successful in 1m2s
Latex Build / build-latex (Assignment 6 - Software Security - Teil 2) (push) Successful in 59s
This commit is contained in:
parent
a5458bb8d2
commit
aa1d4327f5
4 changed files with 138 additions and 0 deletions
28
Assignment 7 - SGX Hands-on/src/enclave/enclave.c
Normal file
28
Assignment 7 - SGX Hands-on/src/enclave/enclave.c
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "Enclave.h"
|
||||
#include "Enclave_t.h"
|
||||
#include <sgx_error.h>
|
||||
#include <sgx_tcrypto.h>
|
||||
|
||||
sgx_status_t public_key(uint8_t *gx, uint8_t *gy) {
|
||||
// unseal key or from file system
|
||||
}
|
||||
|
||||
sgx_status_t sign_firmware(uint8_t *data, size_t data_size, uint8_t *signature, size_t signature_size) {
|
||||
sgx_ecc_state_handle_t ecc_handle;
|
||||
sgx_ec256_private_t private;
|
||||
sgx_ec256_public_t public;
|
||||
|
||||
sgx_status_t status;
|
||||
if((status = sgx_ecc256_open_context(&ecc_handle)) != SGX_SUCCESS)
|
||||
return status;
|
||||
|
||||
if((status = sgx_ecc256_create_key_pair(&private, &public, ecc_handle)) != SGX_SUCCESS)
|
||||
return status;
|
||||
|
||||
sgx_ec256_signature_t ecc_signature;
|
||||
if((status = sgx_ecdsa_sign(data, data_size, &private, &ecc_signature, ecc_handle)) != SGX_SUCCESS)
|
||||
return status;
|
||||
|
||||
sgx_ecc256_close_context(ecc_handle);
|
||||
return SGX_SUCCESS;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue