summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/apps
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2002-09-10 16:31:53 +0000
committermarkus <markus@openbsd.org>2002-09-10 16:31:53 +0000
commit1f9308f95cf5f2eb77b454500c9bb49d76673ef3 (patch)
treec6825952eba2bd0bea9ff46656b25ab7eea8284b /lib/libssl/src/apps
parentUpdate list of supported CMD and Promise devices. (diff)
downloadwireguard-openbsd-1f9308f95cf5f2eb77b454500c9bb49d76673ef3.tar.xz
wireguard-openbsd-1f9308f95cf5f2eb77b454500c9bb49d76673ef3.zip
merge openssl-0.9.7-beta3, tested on vax by miod@
Diffstat (limited to 'lib/libssl/src/apps')
-rw-r--r--lib/libssl/src/apps/Makefile.ssl11
-rw-r--r--lib/libssl/src/apps/apps.c21
-rw-r--r--lib/libssl/src/apps/apps.h8
-rw-r--r--lib/libssl/src/apps/ca.c10
-rw-r--r--lib/libssl/src/apps/dgst.c56
-rw-r--r--lib/libssl/src/apps/enc.c2
-rw-r--r--lib/libssl/src/apps/nseq.c2
-rw-r--r--lib/libssl/src/apps/openssl.c2
-rw-r--r--lib/libssl/src/apps/pkcs7.c2
-rw-r--r--lib/libssl/src/apps/s_client.c10
-rw-r--r--lib/libssl/src/apps/s_server.c10
-rw-r--r--lib/libssl/src/apps/s_time.c6
-rw-r--r--lib/libssl/src/apps/x509.c2
13 files changed, 88 insertions, 54 deletions
diff --git a/lib/libssl/src/apps/Makefile.ssl b/lib/libssl/src/apps/Makefile.ssl
index 0900c3ae90f..c92009e82f0 100644
--- a/lib/libssl/src/apps/Makefile.ssl
+++ b/lib/libssl/src/apps/Makefile.ssl
@@ -14,6 +14,7 @@ MAKE= make -f Makefile.ssl
MAKEDEPPROG= makedepend
MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
MAKEFILE= Makefile.ssl
+PERL= perl
RM= rm -f
# KRB5 stuff
KRB5_INCLUDES=
@@ -122,7 +123,7 @@ lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
depend:
- $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(SRC)
+ $(MAKEDEPEND) $(CFLAG) $(INCLUDES) $(DEPFLAG) $(PROGS) $(SRC)
dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
@@ -133,10 +134,10 @@ clean:
rm -f req
$(DLIBSSL):
- (cd ../ssl; $(MAKE))
+ (cd ../ssl; $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}')
$(DLIBCRYPTO):
- (cd ../crypto; $(MAKE))
+ (cd ../crypto; $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}')
$(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
$(RM) $(PROGRAM)
@@ -146,8 +147,8 @@ $(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
$(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBKRB5) $(LIBCRYPTO) $(EX_LIBS) ; \
fi
-(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; \
- LIBPATH="`pwd`"; LD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; \
- export LD_LIBRARY_PATH SHLIB_PATH LIBPATH; \
+ LIBPATH="`pwd`"; LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; \
+ export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH; \
$(PERL) tools/c_rehash certs)
progs.h: progs.pl
diff --git a/lib/libssl/src/apps/apps.c b/lib/libssl/src/apps/apps.c
index aca750b1f0e..a302119d7f0 100644
--- a/lib/libssl/src/apps/apps.c
+++ b/lib/libssl/src/apps/apps.c
@@ -129,7 +129,11 @@
#ifdef OPENSSL_SYS_WINDOWS
#define strcasecmp _stricmp
#else
-#include <strings.h>
+# ifdef NO_STRINGS_H
+ int strcasecmp();
+# else
+# include <strings.h>
+# endif /* NO_STRINGS_H */
#endif
#ifdef OPENSSL_SYS_WINDOWS
@@ -490,7 +494,7 @@ static int ui_close(UI *ui)
{
return UI_method_get_closer(UI_OpenSSL())(ui);
}
-int setup_ui_method()
+int setup_ui_method(void)
{
ui_method = UI_create_method("OpenSSL application user interface");
UI_method_set_opener(ui_method, ui_open);
@@ -499,7 +503,7 @@ int setup_ui_method()
UI_method_set_closer(ui_method, ui_close);
return 0;
}
-void destroy_ui_method()
+void destroy_ui_method(void)
{
if(ui_method)
{
@@ -925,7 +929,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format,
}
#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
-EVP_PKEY *
+static EVP_PKEY *
load_netscape_key(BIO *err, BIO *key, const char *file,
const char *key_descrip, int format)
{
@@ -1213,7 +1217,7 @@ static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_T
void print_name(BIO *out, char *title, X509_NAME *nm, unsigned long lflags)
{
- char buf[256];
+ char *buf;
char mline = 0;
int indent = 0;
if(title) BIO_puts(out, title);
@@ -1222,9 +1226,10 @@ void print_name(BIO *out, char *title, X509_NAME *nm, unsigned long lflags)
indent = 4;
}
if(lflags == XN_FLAG_COMPAT) {
- X509_NAME_oneline(nm,buf,256);
- BIO_puts(out,buf);
+ buf = X509_NAME_oneline(nm, 0, 0);
+ BIO_puts(out, buf);
BIO_puts(out, "\n");
+ OPENSSL_free(buf);
} else {
if(mline) BIO_puts(out, "\n");
X509_NAME_print_ex(out, nm, indent, lflags);
@@ -1263,7 +1268,7 @@ X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath)
}
/* Try to load an engine in a shareable library */
-ENGINE *try_load_engine(BIO *err, const char *engine, int debug)
+static ENGINE *try_load_engine(BIO *err, const char *engine, int debug)
{
ENGINE *e = ENGINE_by_id("dynamic");
if (e)
diff --git a/lib/libssl/src/apps/apps.h b/lib/libssl/src/apps/apps.h
index 5b3836ab228..a88902ac133 100644
--- a/lib/libssl/src/apps/apps.h
+++ b/lib/libssl/src/apps/apps.h
@@ -134,10 +134,6 @@ long app_RAND_load_files(char *file); /* `file' is a list of files to read,
* (see e_os.h). The string is
* destroyed! */
-#ifdef OPENSSL_NO_STDIO
-BIO_METHOD *BIO_s_file();
-#endif
-
#ifdef OPENSSL_SYS_WIN32
#define rename(from,to) WIN32_rename((from),(to))
int WIN32_rename(char *oldname,char *newname);
@@ -217,8 +213,8 @@ typedef struct pw_cb_data
int password_callback(char *buf, int bufsiz, int verify,
PW_CB_DATA *cb_data);
-int setup_ui_method();
-void destroy_ui_method();
+int setup_ui_method(void);
+void destroy_ui_method(void);
int should_retry(int i);
int args_from_file(char *file, int *argc, char **argv[]);
diff --git a/lib/libssl/src/apps/ca.c b/lib/libssl/src/apps/ca.c
index 51d9470aa18..322956de571 100644
--- a/lib/libssl/src/apps/ca.c
+++ b/lib/libssl/src/apps/ca.c
@@ -80,7 +80,11 @@
#ifdef OPENSSL_SYS_WINDOWS
#define strcasecmp _stricmp
#else
-#include <strings.h>
+# ifdef NO_STRINGS_H
+ int strcasecmp();
+# else
+# include <strings.h>
+# endif /* NO_STRINGS_H */
#endif
#ifndef W_OK
@@ -1450,13 +1454,13 @@ bad:
}
if ((crldays == 0) && (crlhours == 0))
{
- BIO_printf(bio_err,"cannot lookup how long until the next CRL is issuer\n");
+ BIO_printf(bio_err,"cannot lookup how long until the next CRL is issued\n");
goto err;
}
if (verbose) BIO_printf(bio_err,"making CRL\n");
if ((crl=X509_CRL_new()) == NULL) goto err;
- if (!X509_CRL_set_issuer_name(crl, X509_get_issuer_name(x509))) goto err;
+ if (!X509_CRL_set_issuer_name(crl, X509_get_subject_name(x509))) goto err;
tmptm = ASN1_TIME_new();
if (!tmptm) goto err;
diff --git a/lib/libssl/src/apps/dgst.c b/lib/libssl/src/apps/dgst.c
index 0620b32bb4d..e21c3d83ac1 100644
--- a/lib/libssl/src/apps/dgst.c
+++ b/lib/libssl/src/apps/dgst.c
@@ -73,8 +73,9 @@
#undef PROG
#define PROG dgst_main
-void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
- EVP_PKEY *key, unsigned char *sigin, int siglen);
+int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
+ EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
+ const char *file);
int MAIN(int, char **);
@@ -319,22 +320,36 @@ int MAIN(int argc, char **argv)
if (argc == 0)
{
BIO_set_fp(in,stdin,BIO_NOCLOSE);
- do_fp(out, buf,inp,separator, out_bin, sigkey, sigbuf, siglen);
+ err=do_fp(out, buf,inp,separator, out_bin, sigkey, sigbuf,
+ siglen,"","(stdin)");
}
else
{
name=OBJ_nid2sn(md->type);
for (i=0; i<argc; i++)
{
+ char *tmp,*tofree=NULL;
+ int r;
+
if (BIO_read_filename(in,argv[i]) <= 0)
{
perror(argv[i]);
err++;
continue;
}
- if(!out_bin) BIO_printf(out, "%s(%s)= ",name,argv[i]);
- do_fp(out, buf,inp,separator, out_bin, sigkey,
- sigbuf, siglen);
+ if(!out_bin)
+ {
+ tmp=tofree=OPENSSL_malloc(strlen(name)+strlen(argv[i])+5);
+ sprintf(tmp,"%s(%s)= ",name,argv[i]);
+ }
+ else
+ tmp="";
+ r=do_fp(out,buf,inp,separator,out_bin,sigkey,sigbuf,
+ siglen,tmp,argv[i]);
+ if(r)
+ err=r;
+ if(tofree)
+ OPENSSL_free(tofree);
(void)BIO_reset(bmd);
}
}
@@ -353,8 +368,9 @@ end:
EXIT(err);
}
-void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
- EVP_PKEY *key, unsigned char *sigin, int siglen)
+int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
+ EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
+ const char *file)
{
int len;
int i;
@@ -362,21 +378,33 @@ void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
for (;;)
{
i=BIO_read(bp,(char *)buf,BUFSIZE);
- if (i <= 0) break;
+ if(i < 0)
+ {
+ BIO_printf(bio_err, "Read Error in %s\n",file);
+ ERR_print_errors(bio_err);
+ return 1;
+ }
+ if (i == 0) break;
}
if(sigin)
{
EVP_MD_CTX *ctx;
BIO_get_md_ctx(bp, &ctx);
i = EVP_VerifyFinal(ctx, sigin, (unsigned int)siglen, key);
- if(i > 0) BIO_printf(out, "Verified OK\n");
- else if(i == 0) BIO_printf(out, "Verification Failure\n");
+ if(i > 0)
+ BIO_printf(out, "Verified OK\n");
+ else if(i == 0)
+ {
+ BIO_printf(out, "Verification Failure\n");
+ return 1;
+ }
else
{
BIO_printf(bio_err, "Error Verifying Data\n");
ERR_print_errors(bio_err);
+ return 1;
}
- return;
+ return 0;
}
if(key)
{
@@ -386,7 +414,7 @@ void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
{
BIO_printf(bio_err, "Error Signing Data\n");
ERR_print_errors(bio_err);
- return;
+ return 1;
}
}
else
@@ -395,6 +423,7 @@ void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
if(binout) BIO_write(out, buf, len);
else
{
+ BIO_write(out,title,strlen(title));
for (i=0; i<len; i++)
{
if (sep && (i != 0))
@@ -403,5 +432,6 @@ void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
}
BIO_printf(out, "\n");
}
+ return 0;
}
diff --git a/lib/libssl/src/apps/enc.c b/lib/libssl/src/apps/enc.c
index 2c3af751708..1ba2ea2f68e 100644
--- a/lib/libssl/src/apps/enc.c
+++ b/lib/libssl/src/apps/enc.c
@@ -78,7 +78,7 @@ int set_hex(char *in,unsigned char *out,int size);
#define BSIZE (8*1024)
#define PROG enc_main
-void show_ciphers(const OBJ_NAME *name,void *bio_)
+static void show_ciphers(const OBJ_NAME *name,void *bio_)
{
BIO *bio=bio_;
static int n;
diff --git a/lib/libssl/src/apps/nseq.c b/lib/libssl/src/apps/nseq.c
index 93adcdfef8d..c26f62cb613 100644
--- a/lib/libssl/src/apps/nseq.c
+++ b/lib/libssl/src/apps/nseq.c
@@ -58,9 +58,9 @@
#include <stdio.h>
#include <string.h>
+#include "apps.h"
#include <openssl/pem.h>
#include <openssl/err.h>
-#include "apps.h"
#undef PROG
#define PROG nseq_main
diff --git a/lib/libssl/src/apps/openssl.c b/lib/libssl/src/apps/openssl.c
index c17458ef7cf..1c4a4291aa3 100644
--- a/lib/libssl/src/apps/openssl.c
+++ b/lib/libssl/src/apps/openssl.c
@@ -114,6 +114,7 @@
#include <string.h>
#include <stdlib.h>
#define OPENSSL_C /* tells apps.h to use complete apps_startup() */
+#include "apps.h"
#include <openssl/bio.h>
#include <openssl/crypto.h>
#include <openssl/lhash.h>
@@ -123,7 +124,6 @@
#include <openssl/ssl.h>
#include <openssl/engine.h>
#define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */
-#include "apps.h"
#include "progs.h"
#include "s_apps.h"
#include <openssl/err.h>
diff --git a/lib/libssl/src/apps/pkcs7.c b/lib/libssl/src/apps/pkcs7.c
index 1cc91509a2b..0cced40f0f1 100644
--- a/lib/libssl/src/apps/pkcs7.c
+++ b/lib/libssl/src/apps/pkcs7.c
@@ -89,7 +89,7 @@ int MAIN(int argc, char **argv)
int informat,outformat;
char *infile,*outfile,*prog;
int print_certs=0,text=0,noout=0;
- int ret=0;
+ int ret=1;
char *engine=NULL;
apps_startup();
diff --git a/lib/libssl/src/apps/s_client.c b/lib/libssl/src/apps/s_client.c
index 9c0dbc2bf6f..658a79d3906 100644
--- a/lib/libssl/src/apps/s_client.c
+++ b/lib/libssl/src/apps/s_client.c
@@ -433,6 +433,11 @@ bad:
goto end;
}
+ OpenSSL_add_ssl_algorithms();
+ SSL_load_error_strings();
+
+ e = setup_engine(bio_err, engine_id, 1);
+
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
&& !RAND_status())
{
@@ -455,11 +460,6 @@ bad:
}
}
- OpenSSL_add_ssl_algorithms();
- SSL_load_error_strings();
-
- e = setup_engine(bio_err, engine_id, 1);
-
ctx=SSL_CTX_new(meth);
if (ctx == NULL)
{
diff --git a/lib/libssl/src/apps/s_server.c b/lib/libssl/src/apps/s_server.c
index 78d90fad55d..497abf44efe 100644
--- a/lib/libssl/src/apps/s_server.c
+++ b/lib/libssl/src/apps/s_server.c
@@ -683,6 +683,11 @@ bad:
goto end;
}
+ SSL_load_error_strings();
+ OpenSSL_add_ssl_algorithms();
+
+ e = setup_engine(bio_err, engine_id, 1);
+
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
&& !RAND_status())
{
@@ -715,11 +720,6 @@ bad:
s_dkey_file=NULL;
}
- SSL_load_error_strings();
- OpenSSL_add_ssl_algorithms();
-
- e = setup_engine(bio_err, engine_id, 1);
-
ctx=SSL_CTX_new(meth);
if (ctx == NULL)
{
diff --git a/lib/libssl/src/apps/s_time.c b/lib/libssl/src/apps/s_time.c
index 2fb853d0719..752158460aa 100644
--- a/lib/libssl/src/apps/s_time.c
+++ b/lib/libssl/src/apps/s_time.c
@@ -85,7 +85,7 @@
#include OPENSSL_UNISTD
#endif
-#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
+#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC))
#define TIMES
#endif
@@ -109,10 +109,6 @@
#include <sys/timeb.h>
#endif
-#ifdef _AIX
-#include <sys/select.h>
-#endif
-
#if defined(sun) || defined(__ultrix)
#define _POSIX_SOURCE
#include <limits.h>
diff --git a/lib/libssl/src/apps/x509.c b/lib/libssl/src/apps/x509.c
index dce5f326306..a797da0ffad 100644
--- a/lib/libssl/src/apps/x509.c
+++ b/lib/libssl/src/apps/x509.c
@@ -915,8 +915,10 @@ bad:
BIO_printf(bio_err,"Generating certificate request\n");
+#ifndef OPENSSL_NO_DSA
if (pk->type == EVP_PKEY_DSA)
digest=EVP_dss1();
+#endif
rq=X509_to_X509_REQ(x,pk,digest);
EVP_PKEY_free(pk);