[Assignment-7] small changes
This commit is contained in:
parent
1b83c83a4f
commit
c3c1de2811
5 changed files with 21 additions and 15 deletions
|
@ -74,7 +74,7 @@ else
|
|||
Urts_Library_Name := sgx_urts
|
||||
endif
|
||||
|
||||
App_C_Files := app/main.c app/proxy.c app/proxysetup.c app/employee.c app/util.c
|
||||
App_C_Files := app/main.c app/proxy.c app/proxysetup.c app/employee.c app/util.c app/embedded_device.c
|
||||
App_Include_Paths := -IInclude -Iapp -I$(SGX_SDK)/include
|
||||
|
||||
App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
|
||||
|
|
|
@ -23,18 +23,18 @@ typedef struct {
|
|||
|
||||
char *embedded_device_syntax(void) {
|
||||
return
|
||||
"embedded device (sim) mock up implementation of a embedded device\n"
|
||||
"embedded mock up implementation of a embedded device\n"
|
||||
" -ppub <path> file path of the PEM encoded public key of the proxy\n"
|
||||
" -firm <path> path of to firmware binary\n";
|
||||
}
|
||||
|
||||
static EVP_PKEY *read_public_key(uint8_t *public_key_file_path, EVP_PKEY **key) {
|
||||
if(public_key_file == NULL) {
|
||||
static EVP_PKEY *read_public_key(char *public_key_file_path, EVP_PKEY **key) {
|
||||
if(public_key_file_path == NULL) {
|
||||
fprintf(stderr, "public_key_file_path is a null pointer!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FILE *fd = fopen(public_key_file, "rb");
|
||||
FILE *fd = fopen(public_key_file_path, "rb");
|
||||
if(fd == NULL) {
|
||||
fprintf(stderr, "failed to open public key file!\n");
|
||||
return NULL;
|
||||
|
@ -110,6 +110,8 @@ int handle_embedded_device(int argc, char **argv) {
|
|||
hash_firmware(args.firmware_path, &ctx);
|
||||
if (EVP_DigestVerifyFinal(ctx, signature, signature_size) != 1) {
|
||||
fprintf(stderr, "failed to verify firmware signature\n");
|
||||
}else {
|
||||
printf("successfully verified firmware signature\n");
|
||||
}
|
||||
|
||||
clean: ;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "embedded_device.h"
|
||||
#include "employee.h"
|
||||
#include "proxy.h"
|
||||
#include "proxysetup.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "embedded_device.h"
|
||||
#include "employee.h"
|
||||
#include "util.h"
|
||||
#include "proxy.h"
|
||||
|
@ -27,9 +28,11 @@ void syntax_exit(void) {
|
|||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s";
|
||||
|
||||
printf(syntax, BIN_NAME, employee_syntax(), proxy_syntax(), proxysetup_syntax());
|
||||
printf(syntax, BIN_NAME, proxysetup_syntax(), employee_syntax(), proxy_syntax(), embedded_device_syntax());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue