diff --git a/src/pwcrypt.c b/src/pwcrypt.c index 7197305..0bae32d 100644 --- a/src/pwcrypt.c +++ b/src/pwcrypt.c @@ -533,7 +533,9 @@ int pwcrypt_encrypt_file(const char* input_file_path, size_t input_file_path_len if (input_file == NULL || output_file == NULL) { - return PWCRYPT_ERROR_FILE_FAILURE; + pwcrypt_fprintf(stderr, "pwcrypt: \"pwcrypt_encrypt_file\" function failed to open input and/or output file."); + r = PWCRYPT_ERROR_FILE_FAILURE; + goto exit; } r = ccrush_compress_file(input_file_path, temp_file_path, 4096, (int)compress); diff --git a/tests/tests.c b/tests/tests.c index 02c0f9f..3d67ba9 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -218,6 +218,10 @@ static void encrypt_and_decrypt_file_wrong_args_fail() TEST_CHECK(r == PWCRYPT_ERROR_INVALID_ARGS); + r = pwcrypt_encrypt_file(tmp_in_file, strlen(tmp_in_file), 6, (uint8_t*)"Weak Pw", 7, 0, 0, 0, 0, tmp_out_file, strlen(tmp_out_file)); + + TEST_CHECK(r != 0); + r = pwcrypt_encrypt_file(tmp_in_file, strlen(tmp_in_file) - 3, 6, (uint8_t*)"Test Password 456 ^^ ~ ? ยจ", 27, 0, 0, 0, 0, tmp_out_file, strlen(tmp_out_file)); TEST_CHECK(r == PWCRYPT_ERROR_INVALID_ARGS);