summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbeck <>1999-01-04 07:59:58 +0000
committerbeck <>1999-01-04 07:59:58 +0000
commit2ab850a424d07c3f877cbfc628f24480be0e7bac (patch)
tree390ed99e97618ae9ee2bf82a32afe655e6a80caa
parent6dc7513a633fd54f42172958ea7fc81510efc8dd (diff)
downloadopenbsd-2ab850a424d07c3f877cbfc628f24480be0e7bac.tar.gz
openbsd-2ab850a424d07c3f877cbfc628f24480be0e7bac.tar.bz2
openbsd-2ab850a424d07c3f877cbfc628f24480be0e7bac.zip
ssl lib test scripts. Need to be tested so as not to break build process
before this libssl dir is added to the upper level Makefile.
-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.sh25
-rw-r--r--src/regress/lib/libssl/testenc.sh61
-rw-r--r--src/regress/lib/libssl/testrsa.sh35
8 files changed, 187 insertions, 0 deletions
diff --git a/src/regress/lib/libssl/Makefile b/src/regress/lib/libssl/Makefile
new file mode 100644
index 0000000000..5eb5fc6455
--- /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
8 sh ${.CURDIR}/testdsa.sh
9# sh ${.CURDIR}/testrsa.sh
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..4c9668c906
--- /dev/null
+++ b/src/regress/lib/libssl/testdsa.sh
@@ -0,0 +1,25 @@
1#!/bin/sh
2
3#Test DSA certificate generation of ssleay
4
5# Generate DSA paramter set
6ssleay dsaparam 512 -out dsa512.pem
7if [ $? != 0 ]; then
8 exit 1;
9fi
10
11
12# Denerate a DSA certificate
13ssleay req -config ssleay.cnf -x509 -newkey dsa:dsa512.pem -out testdsa.pem -keyout testdsa.key
14if [ $? != 0 ]; then
15 exit 1;
16fi
17
18
19# Now check the certificate
20ssleay x509 -text -in testdsa.pem
21if [ $? != 0 ]; then
22 exit 1;
23fi
24
25exit 0
diff --git a/src/regress/lib/libssl/testenc.sh b/src/regress/lib/libssl/testenc.sh
new file mode 100644
index 0000000000..ab3278f27e
--- /dev/null
+++ b/src/regress/lib/libssl/testenc.sh
@@ -0,0 +1,61 @@
1#!/bin/sh
2
3testsrc=./ssleay.cnf
4test=./p
5cmd=/usr/sbin/ssleay
6
7cat $testsrc >$test;
8
9echo cat
10$cmd enc < $test > $test.cipher
11$cmd enc < $test.cipher >$test.clear
12cmp $test $test.clear
13if [ $? != 0 ]
14then
15 exit 1
16else
17 /bin/rm $test.cipher $test.clear
18fi
19echo base64
20$cmd enc -a -e < $test > $test.cipher
21$cmd enc -a -d < $test.cipher >$test.clear
22cmp $test $test.clear
23if [ $? != 0 ]
24then
25 exit 1
26else
27 /bin/rm $test.cipher $test.clear
28fi
29
30for i in rc4 \
31 des-cfb des-ede-cfb des-ede3-cfb \
32 des-ofb des-ede-ofb des-ede3-ofb \
33 des-ecb des-ede des-ede3 desx \
34 des-cbc des-ede-cbc des-ede3-cbc \
35 rc2-ecb rc2-cfb rc2-ofb rc2-cbc \
36 bf-ecb bf-cfb bf-ofb bf-cbc rc4 \
37 cast5-ecb cast5-cfb cast5-ofb cast5-cbc
38do
39 echo $i
40 $cmd $i -bufsize 113 -e -k test < $test > $test.$i.cipher
41 $cmd $i -bufsize 157 -d -k test < $test.$i.cipher >$test.$i.clear
42 cmp $test $test.$i.clear
43 if [ $? != 0 ]
44 then
45 exit 1
46 else
47 /bin/rm $test.$i.cipher $test.$i.clear
48 fi
49
50 echo $i base64
51 $cmd $i -bufsize 113 -a -e -k test < $test > $test.$i.cipher
52 $cmd $i -bufsize 157 -a -d -k test < $test.$i.cipher >$test.$i.clear
53 cmp $test $test.$i.clear
54 if [ $? != 0 ]
55 then
56 exit 1
57 else
58 /bin/rm $test.$i.cipher $test.$i.clear
59 fi
60done
61rm -f $test
diff --git a/src/regress/lib/libssl/testrsa.sh b/src/regress/lib/libssl/testrsa.sh
new file mode 100644
index 0000000000..79c578834a
--- /dev/null
+++ b/src/regress/lib/libssl/testrsa.sh
@@ -0,0 +1,35 @@
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
14
15# Generate RSA private key
16ssleay genrsa -out rsakey.pem
17if [ $? != 0 ]; then
18 exit 1;
19fi
20
21
22# Denerate an RSA certificate
23ssleay req -config ssleay.cnf -key rsakey.pem -new -x509 -days 365 -out rsacert.pem
24if [ $? != 0 ]; then
25 exit 1;
26fi
27
28
29# Now check the certificate
30ssleay x509 -text -in rsacert.pem
31if [ $? != 0 ]; then
32 exit 1;
33fi
34
35exit 0