Use EXIT() instead of exit().
This commit is contained in:
@@ -247,7 +247,7 @@ int main(int Argc, char *Argv[])
|
|||||||
if (!FIPS_mode_set(1,p)) {
|
if (!FIPS_mode_set(1,p)) {
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
in_FIPS_mode = 1;
|
in_FIPS_mode = 1;
|
||||||
if (getenv("OPENSSL_FIPS_MD5"))
|
if (getenv("OPENSSL_FIPS_MD5"))
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ int AESTest(EVP_CIPHER_CTX *ctx,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Unknown mode: %s\n", amode);
|
printf("Unknown mode: %s\n", amode);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
@@ -173,14 +173,14 @@ int AESTest(EVP_CIPHER_CTX *ctx,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Didn't handle mode %d\n",kt);
|
printf("Didn't handle mode %d\n",kt);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
if (dir)
|
if (dir)
|
||||||
{ /* encrypt */
|
{ /* encrypt */
|
||||||
if(!EVP_CipherInit(ctx, cipher, aKey, iVec, AES_ENCRYPT))
|
if(!EVP_CipherInit(ctx, cipher, aKey, iVec, AES_ENCRYPT))
|
||||||
{
|
{
|
||||||
ERR_print_errors_fp(stderr);
|
ERR_print_errors_fp(stderr);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
EVP_Cipher(ctx, ciphertext, (unsigned char*)plaintext, len);
|
EVP_Cipher(ctx, ciphertext, (unsigned char*)plaintext, len);
|
||||||
@@ -190,7 +190,7 @@ int AESTest(EVP_CIPHER_CTX *ctx,
|
|||||||
if(!EVP_CipherInit(ctx, cipher, aKey, iVec, AES_DECRYPT))
|
if(!EVP_CipherInit(ctx, cipher, aKey, iVec, AES_DECRYPT))
|
||||||
{
|
{
|
||||||
ERR_print_errors_fp(stderr);
|
ERR_print_errors_fp(stderr);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
EVP_Cipher(ctx, (unsigned char*)plaintext, ciphertext, len);
|
EVP_Cipher(ctx, (unsigned char*)plaintext, ciphertext, len);
|
||||||
}
|
}
|
||||||
@@ -849,7 +849,7 @@ int proc_file(char *rqfile)
|
|||||||
if(do_mct(amode, akeysz, aKey, iVec,
|
if(do_mct(amode, akeysz, aKey, iVec,
|
||||||
dir, (unsigned char*)plaintext, len,
|
dir, (unsigned char*)plaintext, len,
|
||||||
rfp) < 0)
|
rfp) < 0)
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -942,7 +942,7 @@ int main(int argc, char **argv)
|
|||||||
if(!FIPS_mode_set(1,argv[0]))
|
if(!FIPS_mode_set(1,argv[0]))
|
||||||
{
|
{
|
||||||
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
@@ -987,7 +987,7 @@ int main(int argc, char **argv)
|
|||||||
if (proc_file(rfn))
|
if (proc_file(rfn))
|
||||||
{
|
{
|
||||||
printf(">>> Processing failed for: %s <<<\n", rfn);
|
printf(">>> Processing failed for: %s <<<\n", rfn);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@@ -1000,5 +1000,6 @@ int main(int argc, char **argv)
|
|||||||
printf(">>> Processing failed for: %s <<<\n", fn);
|
printf(">>> Processing failed for: %s <<<\n", fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
EXIT(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,12 +103,12 @@ int DESTest(EVP_CIPHER_CTX *ctx,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Unknown mode: %s\n", amode);
|
printf("Unknown mode: %s\n", amode);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
if (akeysz != 64 && akeysz != 192)
|
if (akeysz != 64 && akeysz != 192)
|
||||||
{
|
{
|
||||||
printf("Invalid key size: %d\n", akeysz);
|
printf("Invalid key size: %d\n", akeysz);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -153,12 +153,12 @@ int DESTest(EVP_CIPHER_CTX *ctx,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Didn't handle mode %d\n",kt);
|
printf("Didn't handle mode %d\n",kt);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
if(!EVP_CipherInit(ctx, cipher, aKey, iVec, dir))
|
if(!EVP_CipherInit(ctx, cipher, aKey, iVec, dir))
|
||||||
{
|
{
|
||||||
ERR_print_errors_fp(stderr);
|
ERR_print_errors_fp(stderr);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
EVP_Cipher(ctx, out, in, len);
|
EVP_Cipher(ctx, out, in, len);
|
||||||
}
|
}
|
||||||
@@ -319,7 +319,7 @@ void do_mct(char *amode,
|
|||||||
if (imode == 6)
|
if (imode == 6)
|
||||||
{
|
{
|
||||||
printf("Unrecognized mode: %s\n", amode);
|
printf("Unrecognized mode: %s\n", amode);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0 ; i < 400 ; ++i)
|
for(i=0 ; i < 400 ; ++i)
|
||||||
@@ -770,7 +770,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
@@ -815,7 +815,7 @@ int main(int argc, char **argv)
|
|||||||
if (proc_file(rfn))
|
if (proc_file(rfn))
|
||||||
{
|
{
|
||||||
printf(">>> Processing failed for: %s <<<\n", rfn);
|
printf(">>> Processing failed for: %s <<<\n", rfn);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@@ -828,5 +828,6 @@ int main(int argc, char **argv)
|
|||||||
printf(">>> Processing failed for: %s <<<\n", fn);
|
printf(">>> Processing failed for: %s <<<\n", fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
EXIT(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ int main(int argc, char **argv)
|
|||||||
if(!FIPS_mode_set(1,argv[0]))
|
if(!FIPS_mode_set(1,argv[0]))
|
||||||
{
|
{
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
CRYPTO_malloc_debug_init();
|
CRYPTO_malloc_debug_init();
|
||||||
@@ -227,7 +227,7 @@ end:
|
|||||||
bio_err = NULL;
|
bio_err = NULL;
|
||||||
}
|
}
|
||||||
EXIT(!ret);
|
EXIT(!ret);
|
||||||
return(0);
|
return(!ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cb_exit(int ec)
|
static int cb_exit(int ec)
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ static void compare(const unsigned char *result,const unsigned char *expected,
|
|||||||
puts("\n expected:");
|
puts("\n expected:");
|
||||||
dump(expected,8);
|
dump(expected,8);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,14 +194,14 @@ static void run_test(const PRNGtest *t)
|
|||||||
if(RAND_bytes(buf,8) <= 0)
|
if(RAND_bytes(buf,8) <= 0)
|
||||||
{
|
{
|
||||||
ERR_print_errors_fp(stderr);
|
ERR_print_errors_fp(stderr);
|
||||||
exit(2);
|
EXIT(2);
|
||||||
}
|
}
|
||||||
compare(buf,t->block1,8);
|
compare(buf,t->block1,8);
|
||||||
for(n=0 ; n < 99 ; ++n)
|
for(n=0 ; n < 99 ; ++n)
|
||||||
if(RAND_bytes(buf,8) <= 0)
|
if(RAND_bytes(buf,8) <= 0)
|
||||||
{
|
{
|
||||||
ERR_print_errors_fp(stderr);
|
ERR_print_errors_fp(stderr);
|
||||||
exit(2);
|
EXIT(2);
|
||||||
}
|
}
|
||||||
compare(buf,t->block100,8);
|
compare(buf,t->block100,8);
|
||||||
FIPS_test_mode(0,NULL);
|
FIPS_test_mode(0,NULL);
|
||||||
|
|||||||
@@ -6,6 +6,11 @@
|
|||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/fips.h>
|
#include <openssl/fips.h>
|
||||||
|
#ifdef FLAT_INC
|
||||||
|
#include "e_os.h"
|
||||||
|
#else
|
||||||
|
#include "../e_os.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_FIPS
|
#ifndef OPENSSL_FIPS
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@@ -67,20 +72,20 @@ int main(int argc,char **argv)
|
|||||||
if(argc != 2)
|
if(argc != 2)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"%s <test vector file>\n",argv[0]);
|
fprintf(stderr,"%s <test vector file>\n",argv[0]);
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!FIPS_mode_set(1,argv[0]))
|
if(!FIPS_mode_set(1,argv[0]))
|
||||||
{
|
{
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
fp=fopen(argv[1],"r");
|
fp=fopen(argv[1],"r");
|
||||||
if(!fp)
|
if(!fp)
|
||||||
{
|
{
|
||||||
perror(argv[1]);
|
perror(argv[1]);
|
||||||
exit(2);
|
EXIT(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(phase=0 ; ; )
|
for(phase=0 ; ; )
|
||||||
@@ -140,6 +145,7 @@ int main(int argc,char **argv)
|
|||||||
else
|
else
|
||||||
montecarlo(buf,bit/8);
|
montecarlo(buf,bit/8);
|
||||||
}
|
}
|
||||||
return 0;
|
EXIT(0);
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ int main(int argc, char *argv[])
|
|||||||
fips_mode=1;
|
fips_mode=1;
|
||||||
#else
|
#else
|
||||||
fprintf(stderr,"not compiled with FIPS support, so exitting without running.\n");
|
fprintf(stderr,"not compiled with FIPS support, so exitting without running.\n");
|
||||||
exit(0);
|
EXIT(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (strcmp(*argv,"-server_auth") == 0)
|
else if (strcmp(*argv,"-server_auth") == 0)
|
||||||
@@ -568,7 +568,7 @@ bad:
|
|||||||
{
|
{
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
||||||
exit(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf(stderr,"*** IN FIPS MODE ***\n");
|
fprintf(stderr,"*** IN FIPS MODE ***\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user