diff --git a/include/misc.h b/include/misc.h index c862219..9399d47 100644 --- a/include/misc.h +++ b/include/misc.h @@ -5,11 +5,11 @@ #include -int checkVersion(inputFlags flags); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION void deallocateOutput(outputFlags flags); //DEALLOCATES flags -void checkKey(char *key, inputFlags flags); //CHECKS IF KEY IS VALID -void checkText(char *text, inputFlags flags); //CHECKS IF TEXT IS VALID +int checkVersion(inputFlags flags); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED +int checkKey(char *key, inputFlags flags); //CHECKS IF KEY IS VALID +int checkText(char *text, inputFlags flags); //CHECKS IF TEXT IS VALID unsigned long countIntLength(int number); //RETURNS LENGTH OF number unsigned long countUnusedKeySize(char *text, char *key); //COUNT unusedKeySize unsigned long compareTimeMicro(struct timeval startTime, struct timeval finishTime); //COMPARE TIMES IN MICROSECONDS diff --git a/src/lib/misc.c b/src/lib/misc.c index 3e751d8..2f651e8 100644 --- a/src/lib/misc.c +++ b/src/lib/misc.c @@ -287,21 +287,21 @@ void deallocateOutput(outputFlags flags) free(flags.usedKey); } -void checkKey(char *key, inputFlags flags) +int checkKey(char *key, inputFlags flags) { if (strlen(key) < getKeyLength()) { if (!flags.noOutput) fprintf(stderr, "Key must be at least %lu characters long!\n", getKeyLength()); - return noOutput(INVALID_KEY); + return INVALID_KEY; } } -void checkText(char *text, inputFlags flags) +int checkText(char *text, inputFlags flags) { if (strcmp(text, "") == 0) { if (!flags.noOutput) fprintf(stderr, "No text to encrypt!\n"); - return noOutput(INVALID_TEXT); + return INVALID_TEXT; } }