[Assignment-7] adjusted some error messages

This commit is contained in:
Sascha Tommasone 2024-07-06 17:42:06 +02:00 committed by saschato
parent a4303acdf6
commit 90ea867646

View file

@ -21,9 +21,9 @@ typedef struct {
uint8_t *public_key_path;
} embedded_device_args;
static EVP_PKEY *read_public_key(uint8_t *public_key_file, EVP_PKEY **key) {
static EVP_PKEY *read_public_key(uint8_t *public_key_file_path, EVP_PKEY **key) {
if(public_key_file == NULL) {
fprintf(stderr, "public_key_file is a null pointer!\n");
fprintf(stderr, "public_key_file_path is a null pointer!\n");
return NULL;
}
@ -100,14 +100,13 @@ int main(int argc, char **argv) {
uint8_t signature[BUFSIZE] = {0};
size_t signature_size = read(0, signature, BUFSIZE);
if(signature_size < 70) {
printf("failed to read firmware signature\n");
fprintf(stderr, "failed to read firmware signature\n");
goto clean;
}
hash_firmware(args.firmware_path, &ctx);
if (EVP_DigestVerifyFinal(ctx, signature, signature_size) != 1) {
printf("failed to verify firmware signature\n");
goto clean;
fprintf(stderr, "failed to verify firmware signature\n");
}
clean: ;