Assignment-7-sgximpl #13
5 changed files with 29 additions and 7 deletions
|
@ -83,7 +83,6 @@ int handle_employee(int argc, char** argv) {
|
|||
* Sign Firmware
|
||||
*/
|
||||
|
||||
|
||||
mdctx = EVP_MD_CTX_new();
|
||||
if (EVP_DigestSignInit(mdctx, NULL, EVP_sha256(), NULL, key) != 1) {
|
||||
fprintf(stderr, "Message digest initialization failed.\n");
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
#include "util.h"
|
||||
|
||||
|
||||
/*
|
||||
* main method of the binary calls the implementation of the specified subcommand
|
||||
*/
|
||||
int main(int argc, char** argv) {
|
||||
if(argc < 1)
|
||||
syntax_exit();
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
#include <sgx_tcrypto.h>
|
||||
|
||||
|
||||
|
||||
#include "enclave_u.h"
|
||||
#include "proxy.h"
|
||||
#include "util.h"
|
||||
|
@ -221,6 +219,10 @@ static int ECDSA_SIG_to_sgx_signature(ECDSA_SIG* ecdsa_sig, sgx_ec256_signature_
|
|||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is a modified version of the `sgx_ecdsa_verify_hash` function in the [Intel SGX crypto library](https://github.com/intel/linux-sgx/blob/main/sdk/tlibcrypto/sgxssl/sgx_ecc256_ecdsa.cpp).
|
||||
* The specified License applies.
|
||||
*/
|
||||
static int sgx_signature_to_ECDSA_SIG(sgx_ec256_signature_t* sgx_signature, ECDSA_SIG** ecdsa_signature) {
|
||||
BIGNUM *bn_r = NULL;
|
||||
BIGNUM *bn_s = NULL;
|
||||
|
@ -318,7 +320,7 @@ int handle_proxy(int argc, char** argv) {
|
|||
syntax_exit();
|
||||
|
||||
/*
|
||||
* Read Signature Input
|
||||
* Read And Parse Signature Input
|
||||
*/
|
||||
|
||||
ecdsa_signature_data = malloc(1024);
|
||||
|
|
|
@ -28,6 +28,10 @@ char* proxysetup_syntax(void) {
|
|||
" -token <path> (optional) file path of the sgx token\n";
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is a modified version of the `get_pub_key_from_coords` function in the [Intel SGX crypto library](https://github.com/intel/linux-sgx/blob/c1ceb4fe146e0feb1097dee81c7e89925443e43c/sdk/tlibcrypto/sgxssl/sgx_ecc256.cpp).
|
||||
* The specified License applies.
|
||||
*/
|
||||
static EVP_PKEY *sgx_public_to_EVP_PKEY(const sgx_ec256_public_t *p_public)
|
||||
{
|
||||
EVP_PKEY *evp_key = NULL;
|
||||
|
|
|
@ -39,13 +39,20 @@ void syntax_exit(void) {
|
|||
void set_bin_name(char* bin_name) {
|
||||
BIN_NAME = bin_name;
|
||||
}
|
||||
|
||||
/*
|
||||
* This definition is copied from the provided SGX Examples.
|
||||
* The specified License applies.
|
||||
*/
|
||||
typedef struct _sgx_errlist_t {
|
||||
sgx_status_t err;
|
||||
const char *msg;
|
||||
const char *sug; /* Suggestion */
|
||||
} sgx_errlist_t;
|
||||
|
||||
/*
|
||||
* This definition is copied from the provided SGX Examples.
|
||||
* The specified License applies.
|
||||
*/
|
||||
/* Error code returned by sgx_create_enclave */
|
||||
static sgx_errlist_t sgx_errlist[] = {
|
||||
{
|
||||
|
@ -124,7 +131,10 @@ static sgx_errlist_t sgx_errlist[] = {
|
|||
NULL
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* This Method is copied from the provided SGX Examples.
|
||||
* The specified License applies.
|
||||
*/
|
||||
/* Check error conditions for loading enclave */
|
||||
void sgx_print_error_message(sgx_status_t ret)
|
||||
{
|
||||
|
@ -139,11 +149,15 @@ void sgx_print_error_message(sgx_status_t ret)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (idx == ttl)
|
||||
printf("Error code is 0x%X. Please refer to the \"Intel SGX SDK Developer Reference\" for more details.\n", ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* This Method is copied from the provided SGX Examples.
|
||||
* The specified License applies.
|
||||
*/
|
||||
int initialize_enclave(char* token_path) {
|
||||
FILE* sgx_token_file = NULL;
|
||||
sgx_launch_token_t token = {0};
|
||||
|
|
Loading…
Reference in a new issue