From 42f406f6b69a8e716ae7154d3d8223c50c921b64 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Wed, 24 Jan 2024 15:11:22 +0100 Subject: [PATCH] implemented tkch_version in why2_input_flags --- include/flags.h | 1 + src/core/app/main.c | 2 +- src/core/lib/flags.c | 2 +- src/core/lib/test/main.c | 3 ++- src/logger/app/main.c | 3 ++- src/logger/lib/logger.c | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/flags.h b/include/flags.h index 047aede..1fe2445 100644 --- a/include/flags.h +++ b/include/flags.h @@ -71,6 +71,7 @@ typedef struct why2_bool no_check; //BOOLEAN FOR SKIPPING WHY2_VERSION CHECK why2_bool no_output; //BOOLEAN FOR NOT PRINTING OUTPUT WHEN ENCRYPTING/DECRYPTING why2_bool update; //BOOLEAN FOR UPDATING YOUR WHY WHY2_VERSION IF OLD IS USED + enum WHY2_TEXT_KEY_CHAIN_VERSIONS version; //VERSION OF tkch } why2_input_flags; typedef struct diff --git a/src/core/app/main.c b/src/core/app/main.c index d878c43..208759c 100644 --- a/src/core/app/main.c +++ b/src/core/app/main.c @@ -23,7 +23,7 @@ along with this program. If not, see . int main(void) { //SET FLAGS - why2_set_flags((why2_input_flags) {1, 1, 0}); + why2_set_flags((why2_input_flags) { 1, 1, 0, WHY2_v4 }); //RUN ENCRYPTION WITH WHY2_TEXT_TO_ENCRYPT, GENERATE NEW KEY AND DO NOT CHECK FOR ACTIVE WHY2_VERSION & PREVENT ANY OUTPUT why2_output_flags encryptedText = why2_encrypt_text(WHY2_TEXT_TO_ENCRYPT, NULL); diff --git a/src/core/lib/flags.c b/src/core/lib/flags.c index e606d9e..31a0db8 100644 --- a/src/core/lib/flags.c +++ b/src/core/lib/flags.c @@ -25,7 +25,7 @@ along with this program. If not, see . #include //CONSTS (this is just local) -#define DEFAULT_FLAGS (why2_input_flags) { 0, 0, 0 } +#define DEFAULT_FLAGS (why2_input_flags) { 0, 0, 0, WHY2_v4} #define DEFAULT_MEMORY_IDENTIFIER "" int encryptionOperation(int text, int encryptedText); diff --git a/src/core/lib/test/main.c b/src/core/lib/test/main.c index 54f102d..42cd11f 100644 --- a/src/core/lib/test/main.c +++ b/src/core/lib/test/main.c @@ -43,7 +43,8 @@ int main(void) { 0, //SKIP CHECK 0, //NO OUTPUT - 0 //UPDATE + 0, //UPDATE + WHY2_v4 //LATEST VERSION }; //SET FLAGS diff --git a/src/logger/app/main.c b/src/logger/app/main.c index a87e3ff..1b5c0a5 100644 --- a/src/logger/app/main.c +++ b/src/logger/app/main.c @@ -15,7 +15,8 @@ int main(void) { 1, 1, - 0 + 0, + WHY2_v4 } ); diff --git a/src/logger/lib/logger.c b/src/logger/lib/logger.c index 4722721..7d03717 100644 --- a/src/logger/lib/logger.c +++ b/src/logger/lib/logger.c @@ -135,7 +135,7 @@ void why2_write_log(int loggerFile, char *logMessage) why2_log_flags flags = why2_get_log_flags(); //SET ENCRYPTER FLAGS - if (!why2_get_flags_changed()) why2_set_flags((why2_input_flags) { 0, 1, 0 }); + if (!why2_get_flags_changed()) why2_set_flags((why2_input_flags) { 0, 1, 0, WHY2_v4 }); if (flags.key != NULL) //ENCRYPT TEXT IF KEY WAS CHANGED {