diff --git a/Implementierung/src/io.c b/Implementierung/src/io.c index 048aee7..942f235 100644 --- a/Implementierung/src/io.c +++ b/Implementierung/src/io.c @@ -36,7 +36,7 @@ uint8_t* read_file(const char* path, size_t* size) { uint8_t* data = malloc(statOfFile.st_size); if (data == NULL) { printf("Failure: malloc returns NULL"); - return -1; + return EXIT_FAILURE; } size_t bytesRead = diff --git a/Implementierung/src/md2_impls/md2_0.c b/Implementierung/src/md2_impls/md2_0.c index c344325..941b352 100644 --- a/Implementierung/src/md2_impls/md2_0.c +++ b/Implementierung/src/md2_impls/md2_0.c @@ -27,7 +27,7 @@ void md2_hash_0(size_t len, const uint8_t buf[len], uint8_t out[16]) { uint8_t* newBuf = calloc(len + 16, sizeof(uint8_t)); if (newBuf == NULL) { printf("Failure: calloc returns NULL"); - return -1; + return EXIT_FAILURE; } memcpy(newBuf, buf, len - paddingNeeded); @@ -50,7 +50,7 @@ void md2_hash_0(size_t len, const uint8_t buf[len], uint8_t out[16]) { uint8_t* messageDigestBuf = calloc(48, sizeof(uint8_t)); if (messageDigestBuf == NULL) { printf("Failure: calloc returns NULL"); - return -1; + return EXIT_FAILURE; } diff --git a/Implementierung/src/md2_impls/md2_1.c b/Implementierung/src/md2_impls/md2_1.c index ff2f1ff..d4fb80b 100644 --- a/Implementierung/src/md2_impls/md2_1.c +++ b/Implementierung/src/md2_impls/md2_1.c @@ -48,7 +48,7 @@ void md2_hash_1(size_t len, const uint8_t buf[len], uint8_t out[16]) uint8_t* newBuf = aligned_alloc(16, sizeof(uint8_t)*(len + 16)); if (newBuf == NULL) { printf("Failure: aligned_alloc returns NULL"); - return -1; + return EXIT_FAILURE; } for(size_t i = 0; i < 16; i++) { @@ -66,7 +66,7 @@ void md2_hash_1(size_t len, const uint8_t buf[len], uint8_t out[16]) uint8_t *messageDigestBuf = aligned_alloc(16, sizeof(uint8_t) * 48); if (messageDigestBuf == NULL) { printf("Failure: aligned_alloc returns NULL"); - return -1; + return EXIT_FAILURE; } for (size_t i = 0; i < 48; i++) { diff --git a/Implementierung/src/md2_impls/md2_2.c b/Implementierung/src/md2_impls/md2_2.c index b0955ba..5253ce7 100644 --- a/Implementierung/src/md2_impls/md2_2.c +++ b/Implementierung/src/md2_impls/md2_2.c @@ -52,7 +52,7 @@ void md2_hash_2(size_t len, const uint8_t buf[len], uint8_t out[16]) { uint8_t* messageDigestBuf = calloc(48, sizeof(uint8_t)); if (messageDigestBuf == NULL) { printf("Failure: calloc returns NULL"); - return -1; + return EXIT_FAILURE; } // === step 4 === @@ -60,13 +60,13 @@ void md2_hash_2(size_t len, const uint8_t buf[len], uint8_t out[16]) { uint8_t* checksum = calloc(16, sizeof(uint8_t)); if (checksum == NULL) { printf("Failure: calloc returns NULL"); - return -1; + return EXIT_FAILURE; } uint8_t* data = malloc(16); if (data == NULL) { printf("Failure: malloc returns NULL"); - return -1; + return EXIT_FAILURE; } size_t bytes_left_to_read = file_stat.st_size; size_t bytes_left_to_process = 0;