From 67de6639ef474e1d0ad90bb521cb84cc3421f023 Mon Sep 17 00:00:00 2001 From: Will Toohey Date: Wed, 21 Jun 2023 17:51:19 +1000 Subject: [PATCH] Make roundplug PCBID/EAMID verification fail a hard error This was previously a soft error, and also said "reverting to default" without actually doing so. We should be forcing correct format. --- src/main/ddrhook1/config-eamuse.c | 25 ++++--------------------- src/main/iidxhook-util/config-eamuse.c | 25 ++++--------------------- src/main/jbhook1/config-eamuse.c | 24 ++++-------------------- src/main/popnhook1/config-eamuse.c | 25 ++++--------------------- 4 files changed, 16 insertions(+), 83 deletions(-) diff --git a/src/main/ddrhook1/config-eamuse.c b/src/main/ddrhook1/config-eamuse.c index 260791d..f50fb36 100644 --- a/src/main/ddrhook1/config-eamuse.c +++ b/src/main/ddrhook1/config-eamuse.c @@ -56,7 +56,6 @@ void ddrhook1_config_eamuse_get( { char server_url[1024]; char *tmp; - char *tmp2; memset(config_eamuse, 0, sizeof(struct ddrhook1_config_eamuse)); @@ -102,16 +101,8 @@ void ddrhook1_config_eamuse_get( } if (!security_id_verify(&config_eamuse->pcbid)) { - tmp = security_id_to_str( - &DDRHOOK1_CONFIG_EAMUSE_DEFAULT_PCBID_VALUE, false); - tmp2 = security_id_to_str(&config_eamuse->pcbid, false); - log_warning( - "PCBID verification of '%s' failed, fallback to default " - "PCBID '%s'", - tmp2, - tmp); - free(tmp); - free(tmp2); + log_fatal("PCBID verification failed"); + return; } if (!cconfig_util_get_data( @@ -130,15 +121,7 @@ void ddrhook1_config_eamuse_get( } if (!security_id_verify(&config_eamuse->eamid)) { - tmp = security_id_to_str( - &DDRHOOK1_CONFIG_EAMUSE_DEFAULT_EAMID_VALUE, false); - tmp2 = security_id_to_str(&config_eamuse->eamid, false); - log_warning( - "EAMID verification of '%s' failed, fallback to default " - "EAMID '%s'", - tmp2, - tmp); - free(tmp); - free(tmp2); + log_fatal("EAMID verification failed"); + return; } } diff --git a/src/main/iidxhook-util/config-eamuse.c b/src/main/iidxhook-util/config-eamuse.c index f59b03e..adc3c35 100644 --- a/src/main/iidxhook-util/config-eamuse.c +++ b/src/main/iidxhook-util/config-eamuse.c @@ -68,7 +68,6 @@ void iidxhook_util_config_eamuse_get( { char server_url[1024]; char *tmp; - char *tmp2; memset(config_eamuse, 0, sizeof(struct iidxhook_util_config_eamuse)); @@ -127,16 +126,8 @@ void iidxhook_util_config_eamuse_get( } if (!security_id_verify(&config_eamuse->pcbid)) { - tmp = security_id_to_str( - &IIDXHOOK_CONFIG_EAMUSE_DEFAULT_PCBID_VALUE, false); - tmp2 = security_id_to_str(&config_eamuse->pcbid, false); - log_warning( - "PCBID verification of '%s' failed, fallback to default " - "PCBID '%s'", - tmp2, - tmp); - free(tmp); - free(tmp2); + log_fatal("PCBID verification failed"); + return; } if (!cconfig_util_get_data( @@ -155,15 +146,7 @@ void iidxhook_util_config_eamuse_get( } if (!security_id_verify(&config_eamuse->eamid)) { - tmp = security_id_to_str( - &IIDXHOOK_CONFIG_EAMUSE_DEFAULT_EAMID_VALUE, false); - tmp2 = security_id_to_str(&config_eamuse->eamid, false); - log_warning( - "EAMID verification of '%s' failed, fallback to default " - "EAMID '%s'", - tmp2, - tmp); - free(tmp); - free(tmp2); + log_fatal("EAMID verification failed"); + return; } } diff --git a/src/main/jbhook1/config-eamuse.c b/src/main/jbhook1/config-eamuse.c index dba512e..7ed941c 100644 --- a/src/main/jbhook1/config-eamuse.c +++ b/src/main/jbhook1/config-eamuse.c @@ -102,16 +102,8 @@ void jbhook1_config_eamuse_get( } if (!security_id_verify(&config_eamuse->pcbid)) { - tmp = security_id_to_str( - &JBHOOK1_CONFIG_EAMUSE_DEFAULT_PCBID_VALUE, false); - tmp2 = security_id_to_str(&config_eamuse->pcbid, false); - log_warning( - "PCBID verification of '%s' failed, fallback to default " - "PCBID '%s'", - tmp2, - tmp); - free(tmp); - free(tmp2); + log_fatal("PCBID verification failed"); + return; } if (!cconfig_util_get_data( @@ -130,15 +122,7 @@ void jbhook1_config_eamuse_get( } if (!security_id_verify(&config_eamuse->eamid)) { - tmp = security_id_to_str( - &JBHOOK1_CONFIG_EAMUSE_DEFAULT_EAMID_VALUE, false); - tmp2 = security_id_to_str(&config_eamuse->eamid, false); - log_warning( - "EAMID verification of '%s' failed, fallback to default " - "EAMID '%s'", - tmp2, - tmp); - free(tmp); - free(tmp2); + log_fatal("EAMID verification failed"); + return; } } diff --git a/src/main/popnhook1/config-eamuse.c b/src/main/popnhook1/config-eamuse.c index 98e406b..909911e 100644 --- a/src/main/popnhook1/config-eamuse.c +++ b/src/main/popnhook1/config-eamuse.c @@ -57,7 +57,6 @@ void popnhook1_config_eamuse_get( { char server_url[1024]; char *tmp; - char *tmp2; memset(config_eamuse, 0, sizeof(struct popnhook1_config_eamuse)); @@ -103,16 +102,8 @@ void popnhook1_config_eamuse_get( } if (!security_id_verify(&config_eamuse->pcbid)) { - tmp = security_id_to_str( - &POPNHOOK1_CONFIG_EAMUSE_DEFAULT_PCBID_VALUE, false); - tmp2 = security_id_to_str(&config_eamuse->pcbid, false); - log_warning( - "PCBID verification of '%s' failed, fallback to default " - "PCBID '%s'", - tmp2, - tmp); - free(tmp); - free(tmp2); + log_fatal("PCBID verification failed"); + return; } if (!cconfig_util_get_data( @@ -131,15 +122,7 @@ void popnhook1_config_eamuse_get( } if (!security_id_verify(&config_eamuse->eamid)) { - tmp = security_id_to_str( - &POPNHOOK1_CONFIG_EAMUSE_DEFAULT_EAMID_VALUE, false); - tmp2 = security_id_to_str(&config_eamuse->eamid, false); - log_warning( - "EAMID verification of '%s' failed, fallback to default " - "EAMID '%s'", - tmp2, - tmp); - free(tmp); - free(tmp2); + log_fatal("EAMID verification failed"); + return; } }