Fail if test fails.

This commit is contained in:
Ben Laurie 1999-03-12 20:41:09 +00:00
parent 2a04d1e453
commit b4899bb1fa
2 changed files with 11 additions and 2 deletions

View File

@ -5,6 +5,9 @@
Changes between 0.9.1c and 0.9.2 Changes between 0.9.1c and 0.9.2
*) Make rsa_oaep_test return non-zero on error.
[Ulf Moeller <ulf@fitug.de>]
*) Add support for native Solaris shared libraries. Configure *) Add support for native Solaris shared libraries. Configure
solaris-sparc-sc4-pic, make, then run shlib/solaris-sc4.sh. It'd be nice solaris-sparc-sc4-pic, make, then run shlib/solaris-sc4.sh. It'd be nice
if someone would make that last step automatic. if someone would make that last step automatic.

View File

@ -184,6 +184,7 @@ int key3(RSA *key, unsigned char *c)
int main() int main()
{ {
int err=0;
int v; int v;
RSA *key; RSA *key;
unsigned char ptext[256]; unsigned char ptext[256];
@ -216,6 +217,7 @@ int main()
if (num != clen) if (num != clen)
{ {
printf("Encryption failed!\n"); printf("Encryption failed!\n");
err=1;
goto next; goto next;
} }
@ -224,6 +226,7 @@ int main()
if (num != plen || memcmp(ptext, ptext_ex, num) != 0) if (num != plen || memcmp(ptext, ptext_ex, num) != 0)
{ {
printf("Decryption failed!\n"); printf("Decryption failed!\n");
err=1;
goto next; goto next;
} }
@ -240,12 +243,15 @@ int main()
RSA_PKCS1_OAEP_PADDING); RSA_PKCS1_OAEP_PADDING);
if (num != plen || memcmp(ptext, ptext_ex, num) != 0) if (num != plen || memcmp(ptext, ptext_ex, num) != 0)
{
printf("Decryption failed!\n"); printf("Decryption failed!\n");
err=1;
}
else else
printf("Encyption/decryption successful!\n"); printf("Encryption/decryption successful!\n");
next: next:
RSA_free(key); RSA_free(key);
} }
return (0); return err;
} }