Use EXIT() instead of exit().
authorRichard Levitte <levitte@openssl.org>
Tue, 11 Jan 2005 18:25:28 +0000 (18:25 +0000)
committerRichard Levitte <levitte@openssl.org>
Tue, 11 Jan 2005 18:25:28 +0000 (18:25 +0000)
apps/openssl.c
fips/aes/fips_aesavs.c
fips/des/fips_desmovs.c
fips/dsa/fips_dsatest.c
fips/rand/fips_randtest.c
fips/sha1/fips_sha1test.c
ssl/ssltest.c

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