From c99f9b8ff30d442dcdc8d1306311f4a5b4c252b8 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 3 Dec 2002 23:23:11 +0000 Subject: [PATCH] Recent changes from 0.9.6-stable --- apps/asn1pars.c | 2 +- apps/ca.c | 2 +- apps/ciphers.c | 2 +- apps/crl.c | 2 +- apps/crl2p7.c | 4 ++-- apps/dgst.c | 2 +- apps/dh.c | 2 +- apps/dhparam.c | 2 +- apps/dsa.c | 2 +- apps/dsaparam.c | 2 +- apps/enc.c | 2 +- apps/errstr.c | 2 +- apps/gendh.c | 2 +- apps/gendsa.c | 2 +- apps/genrsa.c | 2 +- apps/nseq.c | 4 ++-- apps/openssl.c | 2 +- apps/passwd.c | 4 ++-- apps/pkcs12.c | 2 +- apps/pkcs7.c | 4 ++-- apps/rand.c | 2 +- apps/req.c | 2 +- apps/rsa.c | 2 +- apps/s_client.c | 2 +- apps/s_server.c | 2 +- apps/s_time.c | 4 ++-- apps/sess_id.c | 2 +- apps/speed.c | 2 +- apps/spkac.c | 2 +- apps/verify.c | 2 +- apps/version.c | 2 +- apps/x509.c | 2 +- crypto/mem_clr.c | 2 +- e_os.h | 30 +++++++++++++++--------------- 34 files changed, 53 insertions(+), 53 deletions(-) diff --git a/apps/asn1pars.c b/apps/asn1pars.c index 5339166e08..8cc13ee2d1 100644 --- a/apps/asn1pars.c +++ b/apps/asn1pars.c @@ -328,6 +328,6 @@ end: if (at != NULL) ASN1_TYPE_free(at); if (osk != NULL) sk_free(osk); OBJ_cleanup(); - EXIT(ret); + OPENSSL_EXIT(ret); } diff --git a/apps/ca.c b/apps/ca.c index 71dd6756fc..b315f3f346 100644 --- a/apps/ca.c +++ b/apps/ca.c @@ -1307,7 +1307,7 @@ err: X509_CRL_free(crl); CONF_free(conf); OBJ_cleanup(); - EXIT(ret); + OPENSSL_EXIT(ret); } static void lookup_fail(char *name, char *tag) diff --git a/apps/ciphers.c b/apps/ciphers.c index b6e2f966d8..0dc30d65e4 100644 --- a/apps/ciphers.c +++ b/apps/ciphers.c @@ -202,6 +202,6 @@ end: if (ctx != NULL) SSL_CTX_free(ctx); if (ssl != NULL) SSL_free(ssl); if (STDout != NULL) BIO_free_all(STDout); - EXIT(ret); + OPENSSL_EXIT(ret); } diff --git a/apps/crl.c b/apps/crl.c index 3b5725f23f..648a32ee4c 100644 --- a/apps/crl.c +++ b/apps/crl.c @@ -364,7 +364,7 @@ end: X509_STORE_CTX_cleanup(&ctx); X509_STORE_free(store); } - EXIT(ret); + OPENSSL_EXIT(ret); } static X509_CRL *load_crl(char *infile, int format) diff --git a/apps/crl2p7.c b/apps/crl2p7.c index 7f853b65ab..3ef55dd2bb 100644 --- a/apps/crl2p7.c +++ b/apps/crl2p7.c @@ -166,7 +166,7 @@ bad: BIO_printf(bio_err," -certfile arg certificates file of chain to a trusted CA\n"); BIO_printf(bio_err," (can be used more than once)\n"); BIO_printf(bio_err," -nocrl no crl to load, just certs from '-certfile'\n"); - EXIT(1); + OPENSSL_EXIT(1); } ERR_load_crypto_strings(); @@ -278,7 +278,7 @@ end: if (p7 != NULL) PKCS7_free(p7); if (crl != NULL) X509_CRL_free(crl); - EXIT(ret); + OPENSSL_EXIT(ret); } /* diff --git a/apps/dgst.c b/apps/dgst.c index 05eeb88485..2086d8539d 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -362,7 +362,7 @@ end: EVP_PKEY_free(sigkey); if(sigbuf) OPENSSL_free(sigbuf); if (bmd != NULL) BIO_free(bmd); - EXIT(err); + OPENSSL_EXIT(err); } void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, diff --git a/apps/dh.c b/apps/dh.c index 229ba2f63a..1198d15539 100644 --- a/apps/dh.c +++ b/apps/dh.c @@ -346,6 +346,6 @@ end: if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); if (dh != NULL) DH_free(dh); - EXIT(ret); + OPENSSL_EXIT(ret); } #endif diff --git a/apps/dhparam.c b/apps/dhparam.c index 9d5705f8bf..d946957f16 100644 --- a/apps/dhparam.c +++ b/apps/dhparam.c @@ -532,7 +532,7 @@ end: if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); if (dh != NULL) DH_free(dh); - EXIT(ret); + OPENSSL_EXIT(ret); } /* dh_cb is identical to dsa_cb in apps/dsaparam.c */ diff --git a/apps/dsa.c b/apps/dsa.c index 49ca9003ac..4dbd5d5c39 100644 --- a/apps/dsa.c +++ b/apps/dsa.c @@ -320,6 +320,6 @@ end: if(dsa != NULL) DSA_free(dsa); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); - EXIT(ret); + OPENSSL_EXIT(ret); } #endif diff --git a/apps/dsaparam.c b/apps/dsaparam.c index 0c2529e285..ea29b0cf65 100644 --- a/apps/dsaparam.c +++ b/apps/dsaparam.c @@ -357,7 +357,7 @@ end: if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); - EXIT(ret); + OPENSSL_EXIT(ret); } static void MS_CALLBACK dsa_cb(int p, int n, void *arg) diff --git a/apps/enc.c b/apps/enc.c index 418cb879c0..6f3a879612 100644 --- a/apps/enc.c +++ b/apps/enc.c @@ -631,7 +631,7 @@ end: if (benc != NULL) BIO_free(benc); if (b64 != NULL) BIO_free(b64); if(pass) OPENSSL_free(pass); - EXIT(ret); + OPENSSL_EXIT(ret); } int set_hex(char *in, unsigned char *out, int size) diff --git a/apps/errstr.c b/apps/errstr.c index e392328f93..de7d5fd650 100644 --- a/apps/errstr.c +++ b/apps/errstr.c @@ -121,5 +121,5 @@ int MAIN(int argc, char **argv) ret++; } } - EXIT(ret); + OPENSSL_EXIT(ret); } diff --git a/apps/gendh.c b/apps/gendh.c index e81109eaac..d906b0441e 100644 --- a/apps/gendh.c +++ b/apps/gendh.c @@ -211,7 +211,7 @@ end: ERR_print_errors(bio_err); if (out != NULL) BIO_free_all(out); if (dh != NULL) DH_free(dh); - EXIT(ret); + OPENSSL_EXIT(ret); } static void MS_CALLBACK dh_cb(int p, int n, void *arg) diff --git a/apps/gendsa.c b/apps/gendsa.c index 1c0ec371d2..e7ec294031 100644 --- a/apps/gendsa.c +++ b/apps/gendsa.c @@ -247,6 +247,6 @@ end: if (out != NULL) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); if(passout) OPENSSL_free(passout); - EXIT(ret); + OPENSSL_EXIT(ret); } #endif diff --git a/apps/genrsa.c b/apps/genrsa.c index e7445e6a49..5ad2958ea6 100644 --- a/apps/genrsa.c +++ b/apps/genrsa.c @@ -252,7 +252,7 @@ err: if(passout) OPENSSL_free(passout); if (ret != 0) ERR_print_errors(bio_err); - EXIT(ret); + OPENSSL_EXIT(ret); } static void MS_CALLBACK genrsa_cb(int p, int n, void *arg) diff --git a/apps/nseq.c b/apps/nseq.c index 1d73d1ad52..da5277d4c4 100644 --- a/apps/nseq.c +++ b/apps/nseq.c @@ -102,7 +102,7 @@ int MAIN(int argc, char **argv) BIO_printf (bio_err, "-in file input file\n"); BIO_printf (bio_err, "-out file output file\n"); BIO_printf (bio_err, "-toseq output NS Sequence file\n"); - EXIT(1); + OPENSSL_EXIT(1); } if (infile) { @@ -162,6 +162,6 @@ end: BIO_free_all(out); NETSCAPE_CERT_SEQUENCE_free(seq); - EXIT(ret); + OPENSSL_EXIT(ret); } diff --git a/apps/openssl.c b/apps/openssl.c index 55af53f3e2..95e1e00a8d 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -215,7 +215,7 @@ end: BIO_free(bio_err); bio_err=NULL; } - EXIT(ret); + OPENSSL_EXIT(ret); } #define LIST_STANDARD_COMMANDS "list-standard-commands" diff --git a/apps/passwd.c b/apps/passwd.c index ea2b089e24..eaa90312fc 100644 --- a/apps/passwd.c +++ b/apps/passwd.c @@ -284,7 +284,7 @@ err: BIO_free(in); if (out) BIO_free_all(out); - EXIT(ret); + OPENSSL_EXIT(ret); } @@ -498,6 +498,6 @@ err: int MAIN(int argc, char **argv) { fputs("Program not available.\n", stderr) - EXIT(1); + OPENSSL_EXIT(1); } #endif diff --git a/apps/pkcs12.c b/apps/pkcs12.c index 196770fc04..816f7c635f 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -689,7 +689,7 @@ int MAIN(int argc, char **argv) if (canames) sk_free(canames); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); - EXIT(ret); + OPENSSL_EXIT(ret); } int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass, diff --git a/apps/pkcs7.c b/apps/pkcs7.c index 68590c0784..54afc8b14c 100644 --- a/apps/pkcs7.c +++ b/apps/pkcs7.c @@ -163,7 +163,7 @@ bad: BIO_printf(bio_err," -text print full details of certificates\n"); BIO_printf(bio_err," -noout don't output encoded data\n"); BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); - EXIT(1); + OPENSSL_EXIT(1); } ERR_load_crypto_strings(); @@ -316,5 +316,5 @@ end: if (p7 != NULL) PKCS7_free(p7); if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); - EXIT(ret); + OPENSSL_EXIT(ret); } diff --git a/apps/rand.c b/apps/rand.c index 8d95a52151..b06057f7c8 100644 --- a/apps/rand.c +++ b/apps/rand.c @@ -173,5 +173,5 @@ err: ERR_print_errors(bio_err); if (out) BIO_free_all(out); - EXIT(ret); + OPENSSL_EXIT(ret); } diff --git a/apps/req.c b/apps/req.c index 9d80dd3b23..8a36e4ae1d 100644 --- a/apps/req.c +++ b/apps/req.c @@ -949,7 +949,7 @@ end: #ifndef NO_DSA if (dsa_params != NULL) DSA_free(dsa_params); #endif - EXIT(ex); + OPENSSL_EXIT(ex); } static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, int attribs) diff --git a/apps/rsa.c b/apps/rsa.c index 45ffaaa282..89cb5c46c4 100644 --- a/apps/rsa.c +++ b/apps/rsa.c @@ -416,7 +416,7 @@ end: if(rsa != NULL) RSA_free(rsa); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); - EXIT(ret); + OPENSSL_EXIT(ret); } #else /* !NO_RSA */ diff --git a/apps/s_client.c b/apps/s_client.c index 90bfda91e5..0b63a395e5 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -807,7 +807,7 @@ end: BIO_free(bio_c_out); bio_c_out=NULL; } - EXIT(ret); + OPENSSL_EXIT(ret); } diff --git a/apps/s_server.c b/apps/s_server.c index 85f530ecc9..f81a206245 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -775,7 +775,7 @@ end: BIO_free(bio_s_out); bio_s_out=NULL; } - EXIT(ret); + OPENSSL_EXIT(ret); } static void print_stats(BIO *bio, SSL_CTX *ssl_ctx) diff --git a/apps/s_time.c b/apps/s_time.c index 2d8e2b24d2..c8719a6a22 100644 --- a/apps/s_time.c +++ b/apps/s_time.c @@ -461,7 +461,7 @@ int MAIN(int argc, char **argv) if (tm_cipher == NULL ) { fprintf( stderr, "No CIPHER specified\n" ); -/* EXIT(1); */ +/* OPENSSL_EXIT(1); */ } if (!(perform & 1)) goto next; @@ -628,7 +628,7 @@ end: SSL_CTX_free(tm_ctx); tm_ctx=NULL; } - EXIT(ret); + OPENSSL_EXIT(ret); } /*********************************************************************** diff --git a/apps/sess_id.c b/apps/sess_id.c index 60cc3f1e49..cf15006ca7 100644 --- a/apps/sess_id.c +++ b/apps/sess_id.c @@ -272,7 +272,7 @@ bad: end: if (out != NULL) BIO_free_all(out); if (x != NULL) SSL_SESSION_free(x); - EXIT(ret); + OPENSSL_EXIT(ret); } static SSL_SESSION *load_sess_id(char *infile, int format) diff --git a/apps/speed.c b/apps/speed.c index 643a9a6df9..67c0300be7 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -1447,7 +1447,7 @@ end: if (dsa_key[i] != NULL) DSA_free(dsa_key[i]); #endif - EXIT(mret); + OPENSSL_EXIT(mret); } static void print_message(char *s, long num, int length) diff --git a/apps/spkac.c b/apps/spkac.c index d7e46782f7..26a1d759f0 100644 --- a/apps/spkac.c +++ b/apps/spkac.c @@ -315,5 +315,5 @@ end: BIO_free(key); EVP_PKEY_free(pkey); if(passin) OPENSSL_free(passin); - EXIT(ret); + OPENSSL_EXIT(ret); } diff --git a/apps/verify.c b/apps/verify.c index f384de6d29..2f814314a8 100644 --- a/apps/verify.c +++ b/apps/verify.c @@ -239,7 +239,7 @@ end: if (cert_ctx != NULL) X509_STORE_free(cert_ctx); sk_X509_pop_free(untrusted, X509_free); sk_X509_pop_free(trusted, X509_free); - EXIT(ret); + OPENSSL_EXIT(ret); } static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose) diff --git a/apps/version.c b/apps/version.c index f5c9adc254..b67f2d1812 100644 --- a/apps/version.c +++ b/apps/version.c @@ -128,5 +128,5 @@ int MAIN(int argc, char **argv) } if (cflags) printf("%s\n",SSLeay_version(SSLEAY_CFLAGS)); end: - EXIT(ret); + OPENSSL_EXIT(ret); } diff --git a/apps/x509.c b/apps/x509.c index a0e4e3564c..a9bc6835c9 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -988,7 +988,7 @@ end: sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free); sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free); if (passin) OPENSSL_free(passin); - EXIT(ret); + OPENSSL_EXIT(ret); } static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest, diff --git a/crypto/mem_clr.c b/crypto/mem_clr.c index 0b72966cfa..e4b7f540b0 100644 --- a/crypto/mem_clr.c +++ b/crypto/mem_clr.c @@ -68,7 +68,7 @@ void OPENSSL_cleanse(void *ptr, size_t len) while(loop--) { *(p++) = cleanse_ctr; - cleanse_ctr += (17 + (((unsigned char *)&p)[sizeof(unsigned char *)-1] & 0xF)); + cleanse_ctr += (17 + (unsigned char)((int)p & 0xF)); } if(memchr(ptr, cleanse_ctr, len)) cleanse_ctr += 63; diff --git a/e_os.h b/e_os.h index 30008fa781..58df717722 100644 --- a/e_os.h +++ b/e_os.h @@ -219,10 +219,11 @@ extern "C" { # define _kbhit kbhit # endif -# if defined(WIN16) && !defined(MONOLITH) && defined(SSLEAY) && defined(_WINEXITNOPERSIST) -# define EXIT(n) do { if (n == 0) _wsetexit(_WINEXITNOPERSIST); return(n); } while(0) +# if defined(WIN16) && defined(SSLEAY) && defined(_WINEXITNOPERSIST) +# define EXIT(n) _wsetexit(_WINEXITNOPERSIST) +# define OPENSSL_EXIT(n) do { if (n == 0) EXIT(n); return(n); } while(0) # else -# define EXIT(n) return(n) +# define EXIT(n) return(n) # endif # define LIST_SEPARATOR_CHAR ';' # ifndef X_OK @@ -275,18 +276,13 @@ extern "C" { the status is tagged as an error, which I believe is what is wanted here. -- 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) \ __VMS_EXIT = 1; \ else \ __VMS_EXIT = (n << 3) | 2; \ __VMS_EXIT |= 0x10000000; \ - exit(__VMS_EXIT); \ - return(__VMS_EXIT); } while(0) -# else -# define EXIT(n) return(n) -# endif + exit(__VMS_EXIT); } while(0) # define NO_SYS_PARAM_H # else /* !defined VMS */ @@ -317,11 +313,7 @@ extern "C" { # define RFILE ".rnd" # define LIST_SEPARATOR_CHAR ':' # define NUL_DEV "/dev/null" -# ifndef MONOLITH -# define EXIT(n) do { exit(n); return(n); } while(0) -# else -# define EXIT(n) return(n) -# endif +# define EXIT(n) exit(n) # endif # define SSLeay_getpid() getpid() @@ -441,6 +433,14 @@ extern char *sys_errlist[]; extern int sys_nerr; (((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum]) #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. -- 2.25.1