提交 1c3e4a36 编写于 作者: R Richard Levitte

EXIT() may mean return(). That's confusing, so let's have it really mean

exit() in whatever way works for the intended platform, and define
OPENSSL_EXIT() to have the old meaning (the name is of course because
it's only used in the openssl program)
上级 47079915
...@@ -361,7 +361,7 @@ end: ...@@ -361,7 +361,7 @@ end:
if (osk != NULL) sk_free(osk); if (osk != NULL) sk_free(osk);
OBJ_cleanup(); OBJ_cleanup();
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf) static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf)
......
...@@ -1652,7 +1652,7 @@ err: ...@@ -1652,7 +1652,7 @@ err:
NCONF_free(conf); NCONF_free(conf);
OBJ_cleanup(); OBJ_cleanup();
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static void lookup_fail(char *name, char *tag) static void lookup_fail(char *name, char *tag)
......
...@@ -203,6 +203,6 @@ end: ...@@ -203,6 +203,6 @@ end:
if (ssl != NULL) SSL_free(ssl); if (ssl != NULL) SSL_free(ssl);
if (STDout != NULL) BIO_free_all(STDout); if (STDout != NULL) BIO_free_all(STDout);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
...@@ -377,7 +377,7 @@ end: ...@@ -377,7 +377,7 @@ end:
X509_STORE_free(store); X509_STORE_free(store);
} }
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static X509_CRL *load_crl(char *infile, int format) static X509_CRL *load_crl(char *infile, int format)
......
...@@ -280,7 +280,7 @@ end: ...@@ -280,7 +280,7 @@ end:
if (crl != NULL) X509_CRL_free(crl); if (crl != NULL) X509_CRL_free(crl);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
/* /*
......
...@@ -365,7 +365,7 @@ end: ...@@ -365,7 +365,7 @@ end:
if(sigbuf) OPENSSL_free(sigbuf); if(sigbuf) OPENSSL_free(sigbuf);
if (bmd != NULL) BIO_free(bmd); if (bmd != NULL) BIO_free(bmd);
apps_shutdown(); apps_shutdown();
EXIT(err); OPENSSL_EXIT(err);
} }
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
......
...@@ -333,6 +333,6 @@ end: ...@@ -333,6 +333,6 @@ end:
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
if (dh != NULL) DH_free(dh); if (dh != NULL) DH_free(dh);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
#endif #endif
...@@ -519,7 +519,7 @@ end: ...@@ -519,7 +519,7 @@ end:
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
if (dh != NULL) DH_free(dh); if (dh != NULL) DH_free(dh);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
/* dh_cb is identical to dsa_cb in apps/dsaparam.c */ /* dh_cb is identical to dsa_cb in apps/dsaparam.c */
......
...@@ -314,6 +314,6 @@ end: ...@@ -314,6 +314,6 @@ end:
if(passin) OPENSSL_free(passin); if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout); if(passout) OPENSSL_free(passout);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
#endif #endif
...@@ -372,7 +372,7 @@ end: ...@@ -372,7 +372,7 @@ end:
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
if (dsa != NULL) DSA_free(dsa); if (dsa != NULL) DSA_free(dsa);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static void MS_CALLBACK dsa_cb(int p, int n, void *arg) static void MS_CALLBACK dsa_cb(int p, int n, void *arg)
......
...@@ -390,6 +390,6 @@ end: ...@@ -390,6 +390,6 @@ end:
if (passout) if (passout)
OPENSSL_free(passout); OPENSSL_free(passout);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
#endif #endif
...@@ -679,7 +679,7 @@ end: ...@@ -679,7 +679,7 @@ end:
if (group != NULL) if (group != NULL)
EC_GROUP_free(group); EC_GROUP_free(group);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
int ecparam_print_var(BIO *out, BIGNUM *in, const char *var, int ecparam_print_var(BIO *out, BIGNUM *in, const char *var,
......
...@@ -586,7 +586,7 @@ end: ...@@ -586,7 +586,7 @@ end:
if (b64 != NULL) BIO_free(b64); if (b64 != NULL) BIO_free(b64);
if(pass) OPENSSL_free(pass); if(pass) OPENSSL_free(pass);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
int set_hex(char *in, unsigned char *out, int size) int set_hex(char *in, unsigned char *out, int size)
......
...@@ -516,5 +516,5 @@ end: ...@@ -516,5 +516,5 @@ end:
sk_pop_free(post_cmds, identity); sk_pop_free(post_cmds, identity);
if (bio_out != NULL) BIO_free_all(bio_out); if (bio_out != NULL) BIO_free_all(bio_out);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
...@@ -122,5 +122,5 @@ int MAIN(int argc, char **argv) ...@@ -122,5 +122,5 @@ int MAIN(int argc, char **argv)
} }
} }
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
...@@ -198,7 +198,7 @@ end: ...@@ -198,7 +198,7 @@ end:
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
if (dh != NULL) DH_free(dh); if (dh != NULL) DH_free(dh);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static void MS_CALLBACK dh_cb(int p, int n, void *arg) static void MS_CALLBACK dh_cb(int p, int n, void *arg)
......
...@@ -246,6 +246,6 @@ end: ...@@ -246,6 +246,6 @@ end:
if (dsa != NULL) DSA_free(dsa); if (dsa != NULL) DSA_free(dsa);
if(passout) OPENSSL_free(passout); if(passout) OPENSSL_free(passout);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
#endif #endif
...@@ -258,7 +258,7 @@ err: ...@@ -258,7 +258,7 @@ err:
if (ret != 0) if (ret != 0)
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static void MS_CALLBACK genrsa_cb(int p, int n, void *arg) static void MS_CALLBACK genrsa_cb(int p, int n, void *arg)
......
...@@ -102,7 +102,7 @@ int MAIN(int argc, char **argv) ...@@ -102,7 +102,7 @@ int MAIN(int argc, char **argv)
BIO_printf (bio_err, "-in file input file\n"); BIO_printf (bio_err, "-in file input file\n");
BIO_printf (bio_err, "-out file output file\n"); BIO_printf (bio_err, "-out file output file\n");
BIO_printf (bio_err, "-toseq output NS Sequence file\n"); BIO_printf (bio_err, "-toseq output NS Sequence file\n");
EXIT(1); OPENSSL_EXIT(1);
} }
if (infile) { if (infile) {
...@@ -162,6 +162,6 @@ end: ...@@ -162,6 +162,6 @@ end:
BIO_free_all(out); BIO_free_all(out);
NETSCAPE_CERT_SEQUENCE_free(seq); NETSCAPE_CERT_SEQUENCE_free(seq);
EXIT(ret); OPENSSL_EXIT(ret);
} }
...@@ -899,7 +899,7 @@ end: ...@@ -899,7 +899,7 @@ end:
SSL_CTX_free(ctx); SSL_CTX_free(ctx);
} }
EXIT(ret); OPENSSL_EXIT(ret);
} }
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer, static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
......
...@@ -358,7 +358,7 @@ end: ...@@ -358,7 +358,7 @@ end:
BIO_free(bio_err); BIO_free(bio_err);
bio_err=NULL; bio_err=NULL;
} }
EXIT(ret); OPENSSL_EXIT(ret);
} }
#define LIST_STANDARD_COMMANDS "list-standard-commands" #define LIST_STANDARD_COMMANDS "list-standard-commands"
......
...@@ -292,7 +292,7 @@ err: ...@@ -292,7 +292,7 @@ err:
if (out) if (out)
BIO_free_all(out); BIO_free_all(out);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
...@@ -505,6 +505,6 @@ err: ...@@ -505,6 +505,6 @@ err:
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
fputs("Program not available.\n", stderr) fputs("Program not available.\n", stderr)
EXIT(1); OPENSSL_EXIT(1);
} }
#endif #endif
...@@ -651,7 +651,7 @@ int MAIN(int argc, char **argv) ...@@ -651,7 +651,7 @@ int MAIN(int argc, char **argv)
if(passin) OPENSSL_free(passin); if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout); if(passout) OPENSSL_free(passout);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass, int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass,
......
...@@ -301,5 +301,5 @@ end: ...@@ -301,5 +301,5 @@ end:
if (in != NULL) BIO_free(in); if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
...@@ -213,5 +213,5 @@ err: ...@@ -213,5 +213,5 @@ err:
if (out) if (out)
BIO_free_all(out); BIO_free_all(out);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
...@@ -1150,7 +1150,7 @@ end: ...@@ -1150,7 +1150,7 @@ end:
if (ec_params != NULL) EC_KEY_free(ec_params); if (ec_params != NULL) EC_KEY_free(ec_params);
#endif #endif
apps_shutdown(); apps_shutdown();
EXIT(ex); OPENSSL_EXIT(ex);
} }
static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs, static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs,
......
...@@ -369,7 +369,7 @@ end: ...@@ -369,7 +369,7 @@ end:
if(passin) OPENSSL_free(passin); if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout); if(passout) OPENSSL_free(passout);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
#else /* !OPENSSL_NO_RSA */ #else /* !OPENSSL_NO_RSA */
......
...@@ -917,7 +917,7 @@ end: ...@@ -917,7 +917,7 @@ end:
bio_c_out=NULL; bio_c_out=NULL;
} }
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
......
...@@ -946,7 +946,7 @@ end: ...@@ -946,7 +946,7 @@ end:
bio_s_out=NULL; bio_s_out=NULL;
} }
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static void print_stats(BIO *bio, SSL_CTX *ssl_ctx) static void print_stats(BIO *bio, SSL_CTX *ssl_ctx)
......
...@@ -642,7 +642,7 @@ end: ...@@ -642,7 +642,7 @@ end:
tm_ctx=NULL; tm_ctx=NULL;
} }
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
/*********************************************************************** /***********************************************************************
......
...@@ -273,7 +273,7 @@ end: ...@@ -273,7 +273,7 @@ end:
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
if (x != NULL) SSL_SESSION_free(x); if (x != NULL) SSL_SESSION_free(x);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static SSL_SESSION *load_sess_id(char *infile, int format) static SSL_SESSION *load_sess_id(char *infile, int format)
......
...@@ -2316,7 +2316,7 @@ end: ...@@ -2316,7 +2316,7 @@ end:
#endif #endif
apps_shutdown(); apps_shutdown();
EXIT(mret); OPENSSL_EXIT(mret);
} }
static void print_message(const char *s, long num, int length) static void print_message(const char *s, long num, int length)
......
...@@ -295,5 +295,5 @@ end: ...@@ -295,5 +295,5 @@ end:
EVP_PKEY_free(pkey); EVP_PKEY_free(pkey);
if(passin) OPENSSL_free(passin); if(passin) OPENSSL_free(passin);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
...@@ -232,7 +232,7 @@ end: ...@@ -232,7 +232,7 @@ end:
sk_X509_pop_free(untrusted, X509_free); sk_X509_pop_free(untrusted, X509_free);
sk_X509_pop_free(trusted, X509_free); sk_X509_pop_free(trusted, X509_free);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e) static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e)
......
...@@ -212,5 +212,5 @@ int MAIN(int argc, char **argv) ...@@ -212,5 +212,5 @@ int MAIN(int argc, char **argv)
if (dir) printf("%s\n",SSLeay_version(SSLEAY_DIR)); if (dir) printf("%s\n",SSLeay_version(SSLEAY_DIR));
end: end:
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
...@@ -1029,7 +1029,7 @@ end: ...@@ -1029,7 +1029,7 @@ end:
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free); sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
if (passin) OPENSSL_free(passin); if (passin) OPENSSL_free(passin);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static ASN1_INTEGER *load_serial(char *CAfile, char *serialfile, int create) static ASN1_INTEGER *load_serial(char *CAfile, char *serialfile, int create)
......
...@@ -243,10 +243,11 @@ extern "C" { ...@@ -243,10 +243,11 @@ extern "C" {
# define _kbhit kbhit # define _kbhit kbhit
# endif # endif
# if defined(WIN16) && !defined(MONOLITH) && defined(SSLEAY) && defined(_WINEXITNOPERSIST) # if defined(WIN16) && defined(SSLEAY) && defined(_WINEXITNOPERSIST)
# define EXIT(n) do { if (n == 0) _wsetexit(_WINEXITNOPERSIST); return(n); } while(0) # define EXIT(n) _wsetexit(_WINEXITNOPERSIST)
# define OPENSSL_EXIT(n) do { if (n == 0) EXIT(n); return(n); } while(0)
# else # else
# define EXIT(n) return(n) # define EXIT(n) return(n)
# endif # endif
# define LIST_SEPARATOR_CHAR ';' # define LIST_SEPARATOR_CHAR ';'
# ifndef X_OK # ifndef X_OK
...@@ -302,18 +303,13 @@ extern "C" { ...@@ -302,18 +303,13 @@ extern "C" {
the status is tagged as an error, which I believe is what is wanted here. the status is tagged as an error, which I believe is what is wanted here.
-- Richard Levitte -- Richard Levitte
*/ */
# if !defined(MONOLITH) || defined(OPENSSL_C) # define EXIT(n) do { int __VMS_EXIT = n; \
# define EXIT(n) do { int __VMS_EXIT = n; \
if (__VMS_EXIT == 0) \ if (__VMS_EXIT == 0) \
__VMS_EXIT = 1; \ __VMS_EXIT = 1; \
else \ else \
__VMS_EXIT = (n << 3) | 2; \ __VMS_EXIT = (n << 3) | 2; \
__VMS_EXIT |= 0x10000000; \ __VMS_EXIT |= 0x10000000; \
exit(__VMS_EXIT); \ exit(__VMS_EXIT); } while(0)
return(__VMS_EXIT); } while(0)
# else
# define EXIT(n) return(n)
# endif
# define NO_SYS_PARAM_H # define NO_SYS_PARAM_H
# else # else
/* !defined VMS */ /* !defined VMS */
...@@ -344,11 +340,7 @@ extern "C" { ...@@ -344,11 +340,7 @@ extern "C" {
# define RFILE ".rnd" # define RFILE ".rnd"
# define LIST_SEPARATOR_CHAR ':' # define LIST_SEPARATOR_CHAR ':'
# define NUL_DEV "/dev/null" # define NUL_DEV "/dev/null"
# ifndef MONOLITH # define EXIT(n) exit(n)
# define EXIT(n) do { exit(n); return(n); } while(0)
# else
# define EXIT(n) return(n)
# endif
# endif # endif
# define SSLeay_getpid() getpid() # define SSLeay_getpid() getpid()
...@@ -475,6 +467,14 @@ extern char *sys_errlist[]; extern int sys_nerr; ...@@ -475,6 +467,14 @@ extern char *sys_errlist[]; extern int sys_nerr;
(((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum]) (((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum])
#endif #endif
#ifndef OPENSSL_EXIT
# if defined(MONOLITH) && !defined(OPENSSL_C)
# define OPENSSL_EXIT(n) return(n)
# else
# define OPENSSL_EXIT(n) do { EXIT(n); return(n); } while(0)
# endif
#endif
/***********************************************/ /***********************************************/
/* do we need to do this for getenv. /* do we need to do this for getenv.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册