diff --git a/signature/encryption-through-signing/rsa-private-encrypt-app.c b/signature/encryption-through-signing/rsa-private-encrypt-app.c index 38af25f2..9507072f 100644 --- a/signature/encryption-through-signing/rsa-private-encrypt-app.c +++ b/signature/encryption-through-signing/rsa-private-encrypt-app.c @@ -80,8 +80,10 @@ int main(void) return -99; } ret = (int) fwrite(out, 1, RSA_TEST_BYTES, fStream); - check_ret(ret, "fwrite the rsa key to file"); fclose(fStream); + if (ret <= 0) { + printf("Something went wrong writing to file %s\n", fName); + } return ret; } diff --git a/signature/encryption-through-signing/rsa-public-decrypt-app.c b/signature/encryption-through-signing/rsa-public-decrypt-app.c index 699b0862..4784f608 100644 --- a/signature/encryption-through-signing/rsa-public-decrypt-app.c +++ b/signature/encryption-through-signing/rsa-public-decrypt-app.c @@ -48,7 +48,7 @@ int main(void) /* Decode the public key from buffer "tmp" into RsaKey stucture "key" */ ret = wc_RsaPublicKeyDecode(tmp, &idx, &key, (word32)bytes); - check_ret(ret, "wc_RsaPrivateKeyDecode"); + check_ret(ret, "wc_RsaPublicKeyDecode"); fStream = fopen(fName, "rb"); if (!fStream) { @@ -56,8 +56,11 @@ int main(void) return -99; } ret = (int) fread(out, 1, RSA_TEST_BYTES, fStream); - check_ret(ret, "fread the rsa key to file"); fclose(fStream); + if (ret <= 0) { + printf("Something went wrong, please check the file: %s\n", fName); + return ret; + } idx = (word32)ret; /* number of bytes read in from the file */ XMEMSET(plain, 0, plainSz);