summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/apps
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2001-05-20 03:07:21 +0000
committerkris <kris@FreeBSD.org>2001-05-20 03:07:21 +0000
commit12896e829e9474d92c70a1528cc64270e9dc08ad (patch)
treeaf21ae7d0d7d432ead379f1689adfee9ffe965f6 /crypto/openssl/apps
parent7e55354aa4b06dead79c8a2c91756d71c0f02030 (diff)
downloadFreeBSD-src-12896e829e9474d92c70a1528cc64270e9dc08ad.zip
FreeBSD-src-12896e829e9474d92c70a1528cc64270e9dc08ad.tar.gz
Initial import of OpenSSL 0.9.6a
Diffstat (limited to 'crypto/openssl/apps')
-rw-r--r--crypto/openssl/apps/Makefile.ssl41
-rw-r--r--crypto/openssl/apps/passwd.c1
-rw-r--r--crypto/openssl/apps/s_client.c17
-rw-r--r--crypto/openssl/apps/s_server.c54
-rw-r--r--crypto/openssl/apps/speed.c4
-rw-r--r--crypto/openssl/apps/x509.c2
6 files changed, 89 insertions, 30 deletions
diff --git a/crypto/openssl/apps/Makefile.ssl b/crypto/openssl/apps/Makefile.ssl
index 438c052..d3f9ab0 100644
--- a/crypto/openssl/apps/Makefile.ssl
+++ b/crypto/openssl/apps/Makefile.ssl
@@ -18,6 +18,7 @@ RM= rm -f
PEX_LIBS=
EX_LIBS=
+EXE_EXT=
CFLAGS= -DMONOLITH $(INCLUDES) $(CFLAG)
@@ -32,7 +33,7 @@ PROGRAM= openssl
SCRIPTS=CA.sh CA.pl der_chop
-EXE= $(PROGRAM)
+EXE= $(PROGRAM)$(EXE_EXT)
E_EXE= verify asn1pars req dgst dh dhparam enc passwd gendh errstr \
ca crl rsa rsautl dsa dsaparam \
@@ -77,7 +78,7 @@ top:
all: exe
-exe: $(EXE)
+exe: $(PROGRAM)
req: sreq.o $(A_OBJ) $(DLIBCRYPTO)
$(CC) -o req $(CFLAG) sreq.o $(A_OBJ) $(RAND_OBJ) $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
@@ -718,15 +719,15 @@ s_client.o: ../include/openssl/mdc2.h ../include/openssl/obj_mac.h
s_client.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
s_client.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
s_client.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_client.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
-s_client.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
-s_client.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s_client.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-s_client.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-s_client.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-s_client.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-s_client.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-s_client.o: s_apps.h
+s_client.o: ../include/openssl/rand.h ../include/openssl/rc2.h
+s_client.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
+s_client.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
+s_client.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s_client.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+s_client.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+s_client.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+s_client.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+s_client.o: ../include/openssl/x509_vfy.h apps.h s_apps.h
s_server.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_server.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_server.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@@ -742,15 +743,15 @@ s_server.o: ../include/openssl/mdc2.h ../include/openssl/obj_mac.h
s_server.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
s_server.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
s_server.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_server.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
-s_server.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
-s_server.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s_server.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-s_server.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-s_server.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-s_server.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-s_server.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-s_server.o: s_apps.h
+s_server.o: ../include/openssl/rand.h ../include/openssl/rc2.h
+s_server.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
+s_server.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
+s_server.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s_server.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+s_server.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+s_server.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+s_server.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+s_server.o: ../include/openssl/x509_vfy.h apps.h s_apps.h
s_socket.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_socket.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_socket.o: ../include/openssl/buffer.h ../include/openssl/cast.h
diff --git a/crypto/openssl/apps/passwd.c b/crypto/openssl/apps/passwd.c
index 533b469..ea2b089 100644
--- a/crypto/openssl/apps/passwd.c
+++ b/crypto/openssl/apps/passwd.c
@@ -272,6 +272,7 @@ int MAIN(int argc, char **argv)
}
while (!done);
}
+ ret = 0;
err:
ERR_print_errors(bio_err);
diff --git a/crypto/openssl/apps/s_client.c b/crypto/openssl/apps/s_client.c
index c935317..aa19e0a 100644
--- a/crypto/openssl/apps/s_client.c
+++ b/crypto/openssl/apps/s_client.c
@@ -79,6 +79,7 @@ typedef unsigned int u_int;
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/pem.h>
+#include <openssl/rand.h>
#include "s_apps.h"
#ifdef WINDOWS
@@ -152,6 +153,7 @@ static void sc_usage(void)
BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug workarounds\n");
BIO_printf(bio_err," -cipher - preferred cipher to use, use the 'openssl ciphers'\n");
BIO_printf(bio_err," command to see what is available\n");
+ BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
}
@@ -179,6 +181,7 @@ int MAIN(int argc, char **argv)
int prexit = 0;
SSL_METHOD *meth=NULL;
BIO *sbio;
+ char *inrand=NULL;
#ifdef WINDOWS
struct timeval tv;
#endif
@@ -316,6 +319,11 @@ int MAIN(int argc, char **argv)
else if (strcmp(*argv,"-nbio") == 0)
{ c_nbio=1; }
#endif
+ else if (strcmp(*argv,"-rand") == 0)
+ {
+ if (--argc < 1) goto bad;
+ inrand= *(++argv);
+ }
else
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
@@ -332,7 +340,14 @@ bad:
goto end;
}
- app_RAND_load_file(NULL, bio_err, 0);
+ if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
+ && !RAND_status())
+ {
+ BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
+ }
+ if (inrand != NULL)
+ BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
+ app_RAND_load_files(inrand));
if (bio_c_out == NULL)
{
diff --git a/crypto/openssl/apps/s_server.c b/crypto/openssl/apps/s_server.c
index b593283..624dfb5 100644
--- a/crypto/openssl/apps/s_server.c
+++ b/crypto/openssl/apps/s_server.c
@@ -83,6 +83,7 @@ typedef unsigned int u_int;
#include <openssl/pem.h>
#include <openssl/x509.h>
#include <openssl/ssl.h>
+#include <openssl/rand.h>
#include "s_apps.h"
#ifdef WINDOWS
@@ -242,6 +243,7 @@ static void sv_usage(void)
BIO_printf(bio_err," -bugs - Turn on SSL bug compatibility\n");
BIO_printf(bio_err," -www - Respond to a 'GET /' with a status page\n");
BIO_printf(bio_err," -WWW - Respond to a 'GET /<path> HTTP/1.0' with file ./<path>\n");
+ BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
}
static int local_argc=0;
@@ -411,6 +413,7 @@ int MAIN(int argc, char *argv[])
int no_tmp_rsa=0,no_dhe=0,nocert=0;
int state=0;
SSL_METHOD *meth=NULL;
+ char *inrand=NULL;
#ifndef NO_DH
DH *dh=NULL;
#endif
@@ -565,6 +568,11 @@ int MAIN(int argc, char *argv[])
else if (strcmp(*argv,"-tls1") == 0)
{ meth=TLSv1_server_method(); }
#endif
+ else if (strcmp(*argv,"-rand") == 0)
+ {
+ if (--argc < 1) goto bad;
+ inrand= *(++argv);
+ }
else
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
@@ -581,7 +589,14 @@ bad:
goto end;
}
- app_RAND_load_file(NULL, bio_err, 0);
+ if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
+ && !RAND_status())
+ {
+ BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
+ }
+ if (inrand != NULL)
+ BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
+ app_RAND_load_files(inrand));
if (bio_s_out == NULL)
{
@@ -676,7 +691,8 @@ bad:
#ifndef NO_RSA
#if 1
- SSL_CTX_set_tmp_rsa_callback(ctx,tmp_rsa_cb);
+ if (!no_tmp_rsa)
+ SSL_CTX_set_tmp_rsa_callback(ctx,tmp_rsa_cb);
#else
if (!no_tmp_rsa && SSL_CTX_need_tmp_RSA(ctx))
{
@@ -1336,15 +1352,29 @@ static int www_body(char *hostname, int s, unsigned char *context)
/* skip the '/' */
p= &(buf[5]);
- dot=0;
+
+ dot = 1;
for (e=p; *e != '\0'; e++)
{
- if (e[0] == ' ') break;
- if ( (e[0] == '.') &&
- (strncmp(&(e[-1]),"/../",4) == 0))
- dot=1;
+ if (e[0] == ' ')
+ break;
+
+ switch (dot)
+ {
+ case 1:
+ dot = (e[0] == '.') ? 2 : 0;
+ break;
+ case 2:
+ dot = (e[0] == '.') ? 3 : 0;
+ break;
+ case 3:
+ dot = (e[0] == '/') ? -1 : 0;
+ break;
+ }
+ if (dot == 0)
+ dot = (e[0] == '/') ? 1 : 0;
}
-
+ dot = (dot == 3) || (dot == -1); /* filename contains ".." component */
if (*e == '\0')
{
@@ -1368,9 +1398,11 @@ static int www_body(char *hostname, int s, unsigned char *context)
break;
}
+#if 0
/* append if a directory lookup */
if (e[-1] == '/')
strcat(p,"index.html");
+#endif
/* if a directory, do the index thang */
if (stat(p,&st_buf) < 0)
@@ -1382,7 +1414,13 @@ static int www_body(char *hostname, int s, unsigned char *context)
}
if (S_ISDIR(st_buf.st_mode))
{
+#if 0 /* must check buffer size */
strcat(p,"/index.html");
+#else
+ BIO_puts(io,text);
+ BIO_printf(io,"'%s' is a directory\r\n",p);
+ break;
+#endif
}
if ((file=BIO_new_file(p,"r")) == NULL)
diff --git a/crypto/openssl/apps/speed.c b/crypto/openssl/apps/speed.c
index 627cab1..0679030 100644
--- a/crypto/openssl/apps/speed.c
+++ b/crypto/openssl/apps/speed.c
@@ -831,6 +831,7 @@ int MAIN(int argc, char **argv)
}
#endif
+#ifndef NO_DSA
dsa_c[R_DSA_512][0]=count/1000;
dsa_c[R_DSA_512][1]=count/1000/2;
for (i=1; i<DSA_NUM; i++)
@@ -848,6 +849,7 @@ int MAIN(int argc, char **argv)
}
}
}
+#endif
#define COND(d) (count < (d))
#define COUNT(d) (d)
@@ -1173,7 +1175,7 @@ int MAIN(int argc, char **argv)
{
BIO_printf(bio_err,"RSA verify failure. No RSA verify will be done.\n");
ERR_print_errors(bio_err);
- dsa_doit[j] = 0;
+ rsa_doit[j] = 0;
}
else
{
diff --git a/crypto/openssl/apps/x509.c b/crypto/openssl/apps/x509.c
index 76dd66d..9d09d75 100644
--- a/crypto/openssl/apps/x509.c
+++ b/crypto/openssl/apps/x509.c
@@ -867,8 +867,10 @@ bad:
BIO_printf(bio_err,"Generating certificate request\n");
+#ifndef NO_DSA
if (pk->type == EVP_PKEY_DSA)
digest=EVP_dss1();
+#endif
rq=X509_to_X509_REQ(x,pk,digest);
EVP_PKEY_free(pk);
OpenPOWER on IntegriCloud