[Assignment-7] small changes
All checks were successful
Latex Build / build-latex (Assignment 4 - Protokollsicherheit (Praxis)) (push) Successful in 1m5s
Latex Build / build-latex (Assignment 5 - Software Security - Teil 1) (push) Successful in 1m4s
Latex Build / build-latex (Assignment 6 - Software Security - Teil 2) (push) Successful in 59s
Latex Build / build-latex (Assignment 4 - Protokollsicherheit (Praxis)) (pull_request) Successful in 31s
Latex Build / build-latex (Assignment 5 - Software Security - Teil 1) (pull_request) Successful in 9s
Latex Build / build-latex (Assignment 6 - Software Security - Teil 2) (pull_request) Successful in 8s

This commit is contained in:
Paul Zinselmeyer 2024-07-06 18:06:12 +02:00
parent 86c1001ce0
commit 6f4c0a8aec
Signed by: pfzetto
GPG key ID: B471A1AF06C895FD
5 changed files with 21 additions and 15 deletions

View file

@ -74,7 +74,7 @@ else
Urts_Library_Name := sgx_urts Urts_Library_Name := sgx_urts
endif 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_Include_Paths := -IInclude -Iapp -I$(SGX_SDK)/include
App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)

View file

@ -23,18 +23,18 @@ typedef struct {
char *embedded_device_syntax(void) { char *embedded_device_syntax(void) {
return 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" " -ppub <path> file path of the PEM encoded public key of the proxy\n"
" -firm <path> path of to firmware binary\n"; " -firm <path> path of to firmware binary\n";
} }
static EVP_PKEY *read_public_key(uint8_t *public_key_file_path, EVP_PKEY **key) { static EVP_PKEY *read_public_key(char *public_key_file_path, EVP_PKEY **key) {
if(public_key_file == NULL) { if(public_key_file_path == NULL) {
fprintf(stderr, "public_key_file_path is a null pointer!\n"); fprintf(stderr, "public_key_file_path is a null pointer!\n");
return NULL; return NULL;
} }
FILE *fd = fopen(public_key_file, "rb"); FILE *fd = fopen(public_key_file_path, "rb");
if(fd == NULL) { if(fd == NULL) {
fprintf(stderr, "failed to open public key file!\n"); fprintf(stderr, "failed to open public key file!\n");
return NULL; return NULL;
@ -110,6 +110,8 @@ int handle_embedded_device(int argc, char **argv) {
hash_firmware(args.firmware_path, &ctx); hash_firmware(args.firmware_path, &ctx);
if (EVP_DigestVerifyFinal(ctx, signature, signature_size) != 1) { if (EVP_DigestVerifyFinal(ctx, signature, signature_size) != 1) {
fprintf(stderr, "failed to verify firmware signature\n"); fprintf(stderr, "failed to verify firmware signature\n");
}else {
printf("successfully verified firmware signature\n");
} }
clean: ; clean: ;

View file

@ -1,6 +1,7 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include "embedded_device.h"
#include "employee.h" #include "employee.h"
#include "proxy.h" #include "proxy.h"
#include "proxysetup.h" #include "proxysetup.h"

View file

@ -7,6 +7,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "embedded_device.h"
#include "employee.h" #include "employee.h"
#include "util.h" #include "util.h"
#include "proxy.h" #include "proxy.h"
@ -27,9 +28,11 @@ void syntax_exit(void) {
"\n" "\n"
"%s" "%s"
"\n" "\n"
"%s"
"\n"
"%s"; "%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); exit (EXIT_FAILURE);
} }