summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRalf S. Engelschall <rse@openssl.org>1998-12-21 10:52:47 +0000
committerRalf S. Engelschall <rse@openssl.org>1998-12-21 10:52:47 +0000
commitd02b48c63a58ea4367a0e905979f140b7d090f86 (patch)
tree504f62ed3d84799f785b9cd9fab255a21b0e1b0e /apps
Import of old SSLeay release: SSLeay 0.8.1b
Diffstat (limited to 'apps')
-rw-r--r--apps/CA.sh132
-rw-r--r--apps/Makefile.ssl144
-rw-r--r--apps/apps.c325
-rw-r--r--apps/apps.h154
-rw-r--r--apps/asn1pars.c219
-rw-r--r--apps/bss_file.c324
-rw-r--r--apps/c512-key.pem9
-rw-r--r--apps/c512-req.pem8
-rw-r--r--apps/ca-cert.srl1
-rw-r--r--apps/ca-key.pem15
-rw-r--r--apps/ca-req.pem11
-rw-r--r--apps/ca.c1916
-rw-r--r--apps/ciphers.c191
-rw-r--r--apps/client.pem24
-rw-r--r--apps/crl.c330
-rw-r--r--apps/crl.out8
-rw-r--r--apps/crl2p7.c334
-rw-r--r--apps/demoCA/cacert.pem14
-rw-r--r--apps/demoCA/index.txt39
-rw-r--r--apps/demoCA/private/cakey.pem24
-rw-r--r--apps/demoCA/serial1
-rw-r--r--apps/der_chop305
-rw-r--r--apps/dgst.c227
-rw-r--r--apps/dh.c312
-rw-r--r--apps/dh1024.pem5
-rw-r--r--apps/dsa-ca.pem43
-rw-r--r--apps/dsa-pca.pem49
-rw-r--r--apps/dsa.c257
-rw-r--r--apps/dsa1024.pem9
-rw-r--r--apps/dsa512.pem6
-rw-r--r--apps/dsaparam.c340
-rw-r--r--apps/eay.c130
-rw-r--r--apps/enc.c545
-rw-r--r--apps/errstr.c116
-rw-r--r--apps/f5
-rw-r--r--apps/g_ssleay.pl110
-rw-r--r--apps/gendh.c234
-rw-r--r--apps/gendsa.c220
-rw-r--r--apps/genrsa.c277
-rw-r--r--apps/mklinks7
-rw-r--r--apps/openssl.c339
-rw-r--r--apps/openssl.cnf116
-rw-r--r--apps/pca-cert.srl1
-rw-r--r--apps/pca-key.pem15
-rw-r--r--apps/pca-req.pem11
-rw-r--r--apps/pem_mail.c170
-rw-r--r--apps/pkcs7.c313
-rw-r--r--apps/privkey.pem15
-rw-r--r--apps/progs.h223
-rw-r--r--apps/progs.pl110
-rw-r--r--apps/req.c1097
-rw-r--r--apps/rmlinks6
-rw-r--r--apps/rsa.c303
-rw-r--r--apps/rsa8192.pem101
-rw-r--r--apps/s1024key.pem15
-rw-r--r--apps/s1024req.pem11
-rw-r--r--apps/s512-key.pem9
-rw-r--r--apps/s512-req.pem8
-rw-r--r--apps/s_apps.h122
-rw-r--r--apps/s_cb.c243
-rw-r--r--apps/s_client.c717
-rw-r--r--apps/s_server.c1112
-rw-r--r--apps/s_socket.c684
-rw-r--r--apps/s_time.c648
-rw-r--r--apps/server.pem369
-rw-r--r--apps/server2.pem376
-rw-r--r--apps/sess_id.c305
-rw-r--r--apps/set/set-g-ca.pem21
-rw-r--r--apps/set/set-m-ca.pem21
-rw-r--r--apps/set/set_b_ca.pem23
-rw-r--r--apps/set/set_c_ca.pem21
-rw-r--r--apps/set/set_d_ct.pem21
-rw-r--r--apps/set/set_root.pem21
-rw-r--r--apps/speed.c1068
-rw-r--r--apps/ssleay.c339
-rw-r--r--apps/ssleay.cnf116
-rw-r--r--apps/stuff/pkcs12.derbin0 -> 1281 bytes
-rw-r--r--apps/stuff/pkcs7.ex125
-rw-r--r--apps/stuff/pkcs7.ex211
-rw-r--r--apps/stuff/pkcs7.ex312
-rw-r--r--apps/stuff/pkcs7.pem46
-rw-r--r--apps/test.ssl16
-rw-r--r--apps/testCA.pem8
-rw-r--r--apps/testdsa.h155
-rw-r--r--apps/testrsa.h531
-rw-r--r--apps/tkca66
-rw-r--r--apps/verify.c240
-rw-r--r--apps/version.c128
-rw-r--r--apps/x509.c1042
89 files changed, 18790 insertions, 0 deletions
diff --git a/apps/CA.sh b/apps/CA.sh
new file mode 100644
index 0000000000..1942b985a2
--- /dev/null
+++ b/apps/CA.sh
@@ -0,0 +1,132 @@
+#!/bin/sh
+#
+# CA - wrapper around ca to make it easier to use ... basically ca requires
+# some setup stuff to be done before you can use it and this makes
+# things easier between now and when Eric is convinced to fix it :-)
+#
+# CA -newca ... will setup the right stuff
+# CA -newreq ... will generate a certificate request
+# CA -sign ... will sign the generated request and output
+#
+# At the end of that grab newreq.pem and newcert.pem (one has the key
+# and the other the certificate) and cat them together and that is what
+# you want/need ... I'll make even this a little cleaner later.
+#
+#
+# 12-Jan-96 tjh Added more things ... including CA -signcert which
+# converts a certificate to a request and then signs it.
+# 10-Jan-96 eay Fixed a few more bugs and added the SSLEAY_CONFIG
+# environment variable so this can be driven from
+# a script.
+# 25-Jul-96 eay Cleaned up filenames some more.
+# 11-Jun-96 eay Fixed a few filename missmatches.
+# 03-May-96 eay Modified to use 'ssleay cmd' instead of 'cmd'.
+# 18-Apr-96 tjh Original hacking
+#
+# Tim Hudson
+# tjh@cryptsoft.com
+#
+
+# default ssleay.cnf file has setup as per the following
+# demoCA ... where everything is stored
+
+DAYS="-days 365"
+REQ="ssleay req $SSLEAY_CONFIG"
+CA="ssleay ca $SSLEAY_CONFIG"
+VERIFY="ssleay verify"
+X509="ssleay x509"
+
+CATOP=./demoCA
+CAKEY=./cakey.pem
+CACERT=./cacert.pem
+
+for i
+do
+case $i in
+-\?|-h|-help)
+ echo "usage: CA -newcert|-newreq|-newca|-sign|-verify" >&2
+ exit 0
+ ;;
+-newcert)
+ # create a certificate
+ $REQ -new -x509 -keyout newreq.pem -out newreq.pem $DAYS
+ RET=$?
+ echo "Certificate (and private key) is in newreq.pem"
+ ;;
+-newreq)
+ # create a certificate request
+ $REQ -new -keyout newreq.pem -out newreq.pem $DAYS
+ RET=$?
+ echo "Request (and private key) is in newreq.pem"
+ ;;
+-newca)
+ # if explictly asked for or it doesn't exist then setup the directory
+ # structure that Eric likes to manage things
+ NEW="1"
+ if [ "$NEW" -o ! -f ${CATOP}/serial ]; then
+ # create the directory hierarchy
+ mkdir ${CATOP}
+ mkdir ${CATOP}/certs
+ mkdir ${CATOP}/crl
+ mkdir ${CATOP}/newcerts
+ mkdir ${CATOP}/private
+ echo "01" > ${CATOP}/serial
+ touch ${CATOP}/index.txt
+ fi
+ if [ ! -f ${CATOP}/private/$CAKEY ]; then
+ echo "CA certificate filename (or enter to create)"
+ read FILE
+
+ # ask user for existing CA certificate
+ if [ "$FILE" ]; then
+ cp $FILE ${CATOP}/private/$CAKEY
+ RET=$?
+ else
+ echo "Making CA certificate ..."
+ $REQ -new -x509 -keyout ${CATOP}/private/$CAKEY \
+ -out ${CATOP}/$CACERT $DAYS
+ RET=$?
+ fi
+ fi
+ ;;
+-xsign)
+ $CA -policy policy_anything -infiles newreq.pem
+ RET=$?
+ ;;
+-sign|-signreq)
+ $CA -policy policy_anything -out newcert.pem -infiles newreq.pem
+ RET=$?
+ cat newcert.pem
+ echo "Signed certificate is in newcert.pem"
+ ;;
+-signcert)
+ echo "Cert passphrase will be requested twice - bug?"
+ $X509 -x509toreq -in newreq.pem -signkey newreq.pem -out tmp.pem
+ $CA -policy policy_anything -out newcert.pem -infiles tmp.pem
+ cat newcert.pem
+ echo "Signed certificate is in newcert.pem"
+ ;;
+-verify)
+ shift
+ if [ -z "$1" ]; then
+ $VERIFY -CAfile $CATOP/$CACERT newcert.pem
+ RET=$?
+ else
+ for j
+ do
+ $VERIFY -CAfile $CATOP/$CACERT $j
+ if [ $? != 0 ]; then
+ RET=$?
+ fi
+ done
+ fi
+ exit 0
+ ;;
+*)
+ echo "Unknown arg $i";
+ exit 1
+ ;;
+esac
+done
+exit $RET
+
diff --git a/apps/Makefile.ssl b/apps/Makefile.ssl
new file mode 100644
index 0000000000..4fac51faa3
--- /dev/null
+++ b/apps/Makefile.ssl
@@ -0,0 +1,144 @@
+#
+# SSLeay/apps/Makefile.ssl
+#
+
+DIR= apps
+TOP= ..
+CC= cc
+INCLUDES= -I../include
+CFLAG= -g -static
+INSTALLTOP= /usr/local/ssl
+MAKE= make -f Makefile.ssl
+MAKEDEPEND= makedepend -f Makefile.ssl
+MAKEFILE= Makefile.ssl
+RM= /bin/rm -f
+
+PEX_LIBS=
+EX_LIBS=
+
+CFLAGS= -DMONOLITH $(INCLUDES) $(CFLAG)
+
+GENERAL=Makefile
+
+DLIBCRYPTO=../libcrypto.a
+DLIBSSL=../libssl.a
+LIBCRYPTO=-L.. -lcrypto
+LIBSSL=-L.. -lssl
+
+SSLEAY= ssleay
+
+SCRIPTS=CA.sh der_chop
+
+EXE= $(SSLEAY)
+
+E_EXE= verify asn1pars req dgst dh enc gendh gendsa errstr ca crl \
+ rsa dsa dsaparam \
+ x509 genrsa s_server s_client speed \
+ s_time version pkcs7 crl2pkcs7 sess_id ciphers
+
+PROGS= $(SSLEAY).c
+
+A_OBJ=apps.o
+A_SRC=apps.c
+S_OBJ= s_cb.o s_socket.o
+S_SRC= s_cb.c s_socket.c
+
+E_OBJ= verify.o asn1pars.o req.o dgst.o dh.o enc.o gendh.o errstr.o ca.o \
+ gendsa.o pkcs7.o crl2p7.o crl.o \
+ rsa.o dsa.o dsaparam.o \
+ x509.o genrsa.o s_server.o s_client.o speed.o \
+ s_time.o $(A_OBJ) $(S_OBJ) version.o sess_id.o \
+ ciphers.o
+
+# pem_mail.o
+
+E_SRC= verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c \
+ gendsa.c pkcs7.c crl2p7.c crl.c \
+ rsa.c dsa.c dsaparam.c \
+ x509.c genrsa.c s_server.c s_client.c speed.c \
+ s_time.c $(A_SRC) $(S_SRC) version.c sess_id.c \
+ ciphers.c
+
+# pem_mail.c
+
+SRC=$(E_SRC)
+
+EXHEADER=
+HEADER= apps.h progs.h s_apps.h \
+ testdsa.h testrsa.h \
+ $(EXHEADER)
+
+ALL= $(GENERAL) $(SRC) $(HEADER)
+
+top:
+ @(cd ..; $(MAKE) DIRS=$(DIR) all)
+
+all: exe
+
+exe: $(EXE)
+
+req: sreq.o $(A_OBJ) $(DLIBCRYPTO)
+ $(CC) -o req $(CFLAG) sreq.o $(A_OBJ) $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
+
+sreq.o: req.c
+ $(CC) -c $(INCLUDES) $(CFLAG) -o sreq.o req.c
+
+files:
+ perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
+
+install: mklinks
+ @for i in $(EXE) $(SCRIPTS) mklinks; \
+ do \
+ (echo installing $$i; \
+ cp $$i $(INSTALLTOP)/bin/$$i; \
+ chmod 755 $(INSTALLTOP)/bin/$$i ); \
+ done; \
+ cp ssleay.cnf $(INSTALLTOP)/lib
+ chmod 644 $(INSTALLTOP)/lib/ssleay.cnf
+ cd $(INSTALLTOP)/bin; \
+ /bin/sh ./mklinks; \
+ /bin/rm -f ./mklinks
+
+tags:
+ ctags $(SRC)
+
+tests:
+
+links:
+ /bin/rm -f Makefile
+ $(TOP)/util/point.sh Makefile.ssl Makefile ;
+
+lint:
+ lint -DLINT $(INCLUDES) $(SRC)>fluff
+
+depend:
+ $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(SRC)
+
+dclean:
+ perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
+ mv -f Makefile.new $(MAKEFILE)
+
+errors:
+
+clean:
+ /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff $(EXE)
+ /bin/rm -f req
+
+$(DLIBSSL):
+ (cd ../ssl; $(MAKE))
+
+$(DLIBCRYPTO):
+ (cd ../crypto; $(MAKE))
+
+$(SSLEAY): progs.h $(E_OBJ) $(SSLEAY).o $(DLIBCRYPTO) $(DLIBSSL)
+ $(RM) $(SSLEAY)
+ $(CC) -o $(SSLEAY) $(CFLAGS) $(SSLEAY).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS)
+
+progs.h:
+ perl ./g_ssleay.pl $(E_EXE) >progs.h
+ $(RM) $(SSLEAY).o
+
+mklinks:
+ perl ./g_ssleay.pl $(E_EXE) >progs.h
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/apps/apps.c b/apps/apps.c
new file mode 100644
index 0000000000..7c9510e3b5
--- /dev/null
+++ b/apps/apps.c
@@ -0,0 +1,325 @@
+/* apps/apps.c */
+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay@cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the library
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ * the apps directory (application code) you must include an acknowledgement:
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#define NON_MAIN
+#include "apps.h"
+#undef NON_MAIN
+
+#ifdef WIN16
+#define APPS_WIN16
+#ifdef FLAT_BUILD
+#include "bss_file.c"
+#else
+#include "../crypto/bio/bss_file.c"
+#endif
+#endif
+
+#ifndef NOPROTO
+int app_init(long mesgwin);
+#else
+int app_init();
+#endif
+
+#ifdef undef /* never finished - probably never will be :-) */
+int args_from_file(file,argc,argv)
+char *file;
+int *argc;
+char **argv[];
+ {
+ FILE *fp;
+ int num,i;
+ unsigned int len;
+ static char *buf=NULL;
+ static char **arg=NULL;
+ char *p;
+ struct stat stbuf;
+
+ if (stat(file,&stbuf) < 0) return(0);
+
+ fp=fopen(file,"r");
+ if (fp == NULL)
+ return(0);
+
+ *argc=0;
+ *argv=NULL;
+
+ len=(unsigned int)stbuf.st_size;
+ if (buf != NULL) Free(buf);
+ buf=(char *)Malloc(len+1);
+ if (buf == NULL) return(0);
+
+ len=fread(buf,1,len,fp);
+ if (len <= 1) return(0);
+ buf[len]='\0';
+
+ i=0;
+ for (p=buf; *p; p++)
+ if (*p == '\n') i++;
+ if (arg != NULL) Free(arg);
+ arg=(char **)Malloc(sizeof(char *)*(i*2));
+
+ *argv=arg;
+ num=0;
+ p=buf;
+ for (;;)
+ {
+ if (!*p) break;
+ if (*p == '#') /* comment line */
+ {
+ while (*p && (*p != '\n')) p++;
+ continue;
+ }
+ /* else we have a line */
+ *(arg++)=p;
+ num++;
+ while (*p && ((*p != ' ') && (*p != '\t') && (*p != '\n')))
+ p++;
+ if (!*p) break;
+ if (*p == '\n')
+ {
+ *(p++)='\0';