summaryrefslogtreecommitdiff
path: root/src/regress/lib/libssl
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>1999-03-26 18:24:03 +0000
committercvs2svn <admin@example.com>1999-03-26 18:24:03 +0000
commit3fc228fb4c1a39aceaee3d7013365042a6077bd0 (patch)
treeaf769f6648929b3b2c1f9e053a3754fa989ce302 /src/regress/lib/libssl
parent536c76cbb863bab152f19842ab88772c01e922c7 (diff)
downloadopenbsd-OPENBSD_2_5.tar.gz
openbsd-OPENBSD_2_5.tar.bz2
openbsd-OPENBSD_2_5.zip
This commit was manufactured by cvs2git to create branch 'OPENBSD_2_5'.OPENBSD_2_5
Diffstat (limited to '')
-rw-r--r--src/regress/lib/libssl/Makefile11
-rw-r--r--src/regress/lib/libssl/README8
-rw-r--r--src/regress/lib/libssl/ssleay.cnf27
-rw-r--r--src/regress/lib/libssl/test_client.sh11
-rw-r--r--src/regress/lib/libssl/test_server.sh9
-rw-r--r--src/regress/lib/libssl/testdsa.sh27
-rw-r--r--src/regress/lib/libssl/testenc.sh63
-rw-r--r--src/regress/lib/libssl/testrsa.sh36
8 files changed, 192 insertions, 0 deletions
diff --git a/src/regress/lib/libssl/Makefile b/src/regress/lib/libssl/Makefile
new file mode 100644
index 0000000000..3f7d48fd2e
--- /dev/null
+++ b/src/regress/lib/libssl/Makefile
@@ -0,0 +1,11 @@
1
2CLEANFILES+= testdsa.key testdsa.pem rsakey.pem rsacert.pem dsa512.pem
3
4install:
5
6regress:
7 sh ${.CURDIR}/testenc.sh ${.OBJDIR} ${.CURDIR}
8 sh ${.CURDIR}/testdsa.sh ${.OBJDIR} ${.CURDIR}
9# sh ${.CURDIR}/testrsa.sh ${.OBJDIR} ${.CURDIR}
10
11.include <bsd.prog.mk>
diff --git a/src/regress/lib/libssl/README b/src/regress/lib/libssl/README
new file mode 100644
index 0000000000..b1bab65fd1
--- /dev/null
+++ b/src/regress/lib/libssl/README
@@ -0,0 +1,8 @@
1testenc.sh tests encryption routines
2testdsa.sh tests DSA certificate generation
3test_server.sh starts a tls1 server using the above generated certificate
4test_client.sh starts a client to talk to the server.
5testrsa.sh tests RSA certificate generation - this SHOULD FAIL with the
6 version of the library in openbsd because all the RSA routines
7 are (currently) stubbed.
8
diff --git a/src/regress/lib/libssl/ssleay.cnf b/src/regress/lib/libssl/ssleay.cnf
new file mode 100644
index 0000000000..c8439860c3
--- /dev/null
+++ b/src/regress/lib/libssl/ssleay.cnf
@@ -0,0 +1,27 @@
1#
2# SSLeay example configuration file.
3# This is mostly being used for generation of certificate requests.
4#
5# hacked by iang to do DSA certs - Server
6
7RANDFILE = ./.rnd
8
9####################################################################
10[ req ]
11distinguished_name = req_distinguished_name
12encrypt_rsa_key = no
13
14[ req_distinguished_name ]
15countryName = Country Name (2 letter code)
16countryName_default = CA
17countryName_value = CA
18
19organizationName = Organization Name (eg, company)
20organizationName_value = Shake it Vera
21
220.commonName = Common Name (eg, YOUR name)
230.commonName_value = Wastelandus
24
251.commonName = Common Name (eg, YOUR name)
261.commonName_value = Maximus
27
diff --git a/src/regress/lib/libssl/test_client.sh b/src/regress/lib/libssl/test_client.sh
new file mode 100644
index 0000000000..36a8f84532
--- /dev/null
+++ b/src/regress/lib/libssl/test_client.sh
@@ -0,0 +1,11 @@
1#!/bin/sh
2
3echo
4echo This starts a tls1 mode client to talk to the server run by
5echo ./testserver.sh. You should start the server first.
6echo
7echo type in this window after ssl negotiation and your output should
8echo be echoed by the server.
9echo
10echo
11/usr/sbin/ssleay s_client -tls1
diff --git a/src/regress/lib/libssl/test_server.sh b/src/regress/lib/libssl/test_server.sh
new file mode 100644
index 0000000000..5467c52459
--- /dev/null
+++ b/src/regress/lib/libssl/test_server.sh
@@ -0,0 +1,9 @@
1#!/bin/sh
2
3echo This starts a tls1 mode server using the DSA certificate in ./server.pem
4echo Run ./testclient.sh in another window and type at it, you should
5echo see the results of the ssl negotiation, and stuff you type in the client
6echo should echo in this window
7echo
8echo
9/usr/sbin/ssleay s_server -tls1 -key testdsa.key -cert testdsa.pem
diff --git a/src/regress/lib/libssl/testdsa.sh b/src/regress/lib/libssl/testdsa.sh
new file mode 100644
index 0000000000..dc5d7b97b5
--- /dev/null
+++ b/src/regress/lib/libssl/testdsa.sh
@@ -0,0 +1,27 @@
1#!/bin/sh
2
3#Test DSA certificate generation of ssleay
4
5cd $1
6
7# Generate DSA paramter set
8ssleay dsaparam 512 -out dsa512.pem
9if [ $? != 0 ]; then
10 exit 1;
11fi
12
13
14# Denerate a DSA certificate
15ssleay req -config $2/ssleay.cnf -x509 -newkey dsa:dsa512.pem -out testdsa.pem -keyout testdsa.key
16if [ $? != 0 ]; then
17 exit 1;
18fi
19
20
21# Now check the certificate
22ssleay x509 -text -in testdsa.pem
23if [ $? != 0 ]; then
24 exit 1;
25fi
26
27exit 0
diff --git a/src/regress/lib/libssl/testenc.sh b/src/regress/lib/libssl/testenc.sh
new file mode 100644
index 0000000000..85997bfbe5
--- /dev/null
+++ b/src/regress/lib/libssl/testenc.sh
@@ -0,0 +1,63 @@
1#!/bin/sh
2
3testsrc=$2/ssleay.cnf
4test=$1/p
5cmd=/usr/sbin/ssleay
6
7cd $1
8
9cat $testsrc >$test;
10
11echo cat
12$cmd enc < $test > $test.cipher
13$cmd enc < $test.cipher >$test.clear
14cmp $test $test.clear
15if [ $? != 0 ]
16then
17 exit 1
18else
19 /bin/rm $test.cipher $test.clear
20fi
21echo base64
22$cmd enc -a -e < $test > $test.cipher
23$cmd enc -a -d < $test.cipher >$test.clear
24cmp $test $test.clear
25if [ $? != 0 ]
26then
27 exit 1
28else
29 /bin/rm $test.cipher $test.clear
30fi
31
32for i in rc4 \
33 des-cfb des-ede-cfb des-ede3-cfb \
34 des-ofb des-ede-ofb des-ede3-ofb \
35 des-ecb des-ede des-ede3 desx \
36 des-cbc des-ede-cbc des-ede3-cbc \
37 rc2-ecb rc2-cfb rc2-ofb rc2-cbc \
38 bf-ecb bf-cfb bf-ofb bf-cbc rc4 \
39 cast5-ecb cast5-cfb cast5-ofb cast5-cbc
40do
41 echo $i
42 $cmd $i -bufsize 113 -e -k test < $test > $test.$i.cipher
43 $cmd $i -bufsize 157 -d -k test < $test.$i.cipher >$test.$i.clear
44 cmp $test $test.$i.clear
45 if [ $? != 0 ]
46 then
47 exit 1
48 else
49 /bin/rm $test.$i.cipher $test.$i.clear
50 fi
51
52 echo $i base64
53 $cmd $i -bufsize 113 -a -e -k test < $test > $test.$i.cipher
54 $cmd $i -bufsize 157 -a -d -k test < $test.$i.cipher >$test.$i.clear
55 cmp $test $test.$i.clear
56 if [ $? != 0 ]
57 then
58 exit 1
59 else
60 /bin/rm $test.$i.cipher $test.$i.clear
61 fi
62done
63rm -f $test
diff --git a/src/regress/lib/libssl/testrsa.sh b/src/regress/lib/libssl/testrsa.sh
new file mode 100644
index 0000000000..3f4c328acd
--- /dev/null
+++ b/src/regress/lib/libssl/testrsa.sh
@@ -0,0 +1,36 @@
1#!/bin/sh
2
3#Test RSA certificate generation of ssleay
4
5echo
6echo RSA paramters test - NOTE THAT THIS WILL ONLY WORK IF YOU HAVE
7echo compiled libssl with the src-patent tree, currently living in
8echo ~ryker/src-patent.tar.gz on cvs.
9echo
10echo This will *not* work with what\'s in the tree, rsa is not in that.
11echo
12sleep 3
13
14cd $1
15
16# Generate RSA private key
17ssleay genrsa -out rsakey.pem
18if [ $? != 0 ]; then
19 exit 1;
20fi
21
22
23# Denerate an RSA certificate
24ssleay req -config $2/ssleay.cnf -key rsakey.pem -new -x509 -days 365 -out rsacert.pem
25if [ $? != 0 ]; then
26 exit 1;
27fi
28
29
30# Now check the certificate
31ssleay x509 -text -in rsacert.pem
32if [ $? != 0 ]; then
33 exit 1;
34fi
35
36exit 0