diff options
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/Makefile.ssl | 218 | ||||
| -rw-r--r-- | apps/app_rand.c | 10 | ||||
| -rw-r--r-- | apps/ca.c | 26 | ||||
| -rw-r--r-- | apps/ciphers.c | 5 | ||||
| -rw-r--r-- | apps/crl.c | 29 | ||||
| -rw-r--r-- | apps/dh.c | 5 | ||||
| -rw-r--r-- | apps/dhparam.c | 210 | ||||
| -rw-r--r-- | apps/eay.c | 131 | ||||
| -rw-r--r-- | apps/errstr.c | 5 | ||||
| -rw-r--r-- | apps/gendh.c | 5 | ||||
| -rw-r--r-- | apps/gendsa.c | 2 | ||||
| -rw-r--r-- | apps/genrsa.c | 2 | ||||
| -rw-r--r-- | apps/makeapps.com | 4 | ||||
| -rw-r--r-- | apps/openssl.c | 50 | ||||
| -rw-r--r-- | apps/passwd.c | 8 | ||||
| -rw-r--r-- | apps/pkcs12.c | 65 | ||||
| -rw-r--r-- | apps/progs.h | 2 | ||||
| -rw-r--r-- | apps/rand.c | 140 | ||||
| -rw-r--r-- | apps/req.c | 4 | ||||
| -rw-r--r-- | apps/rsa.c | 1 | ||||
| -rw-r--r-- | apps/rsa/01.pem | 15 | ||||
| -rw-r--r-- | apps/rsa/1.txt | 50 | ||||
| -rw-r--r-- | apps/rsa/SecureServer.pem | 47 | ||||
| -rw-r--r-- | apps/rsa/s.txt | 49 | ||||
| -rw-r--r-- | apps/s_apps.h | 9 | ||||
| -rw-r--r-- | apps/s_cb.c | 2 | ||||
| -rw-r--r-- | apps/s_client.c | 12 | ||||
| -rw-r--r-- | apps/s_socket.c | 172 | ||||
| -rw-r--r-- | apps/smime.c | 113 | ||||
| -rw-r--r-- | apps/speed.c | 6 | ||||
| -rw-r--r-- | apps/spkac.c | 2 | ||||
| -rw-r--r-- | apps/testdsa.h | 3 | ||||
| -rw-r--r-- | apps/testrsa.h | 1 | ||||
| -rw-r--r-- | apps/tkca | 66 | ||||
| -rw-r--r-- | apps/winrand.c | 149 | ||||
| -rw-r--r-- | apps/x509.c | 43 |
36 files changed, 861 insertions, 800 deletions
diff --git a/apps/Makefile.ssl b/apps/Makefile.ssl index 0d0cd888b47..15d8c3bd110 100644 --- a/apps/Makefile.ssl +++ b/apps/Makefile.ssl @@ -38,7 +38,7 @@ E_EXE= verify asn1pars req dgst dh dhparam enc passwd gendh errstr \ ca crl rsa dsa dsaparam \ x509 genrsa gendsa s_server s_client speed \ s_time version pkcs7 crl2pkcs7 sess_id ciphers nseq pkcs12 \ - pkcs8 spkac smime rand + pkcs8 spkac smime PROGS= $(PROGRAM).c @@ -54,14 +54,18 @@ E_OBJ= verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o er rsa.o dsa.o dsaparam.o \ x509.o genrsa.o gendsa.o s_server.o s_client.o speed.o \ s_time.o $(A_OBJ) $(S_OBJ) $(RAND_OBJ) version.o sess_id.o \ - ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o rand.o + ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o + +# pem_mail.o E_SRC= verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.c gendh.c errstr.c ca.c \ pkcs7.c crl2p7.c crl.c \ rsa.c dsa.c dsaparam.c \ x509.c genrsa.c gendsa.c s_server.c s_client.c speed.c \ s_time.c $(A_SRC) $(S_SRC) $(RAND_SRC) version.c sess_id.c \ - ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c rand.c + ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c + +# pem_mail.c SRC=$(E_SRC) @@ -135,7 +139,7 @@ $(DLIBCRYPTO): $(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL) $(RM) $(PROGRAM) $(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS) - @(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; $(PERL) tools/c_rehash certs) + @(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; sh tools/c_rehash certs) progs.h: progs.pl $(PERL) progs.pl $(E_EXE) >progs.h @@ -197,20 +201,20 @@ ca.o: ../include/openssl/blowfish.h ../include/openssl/bn.h ca.o: ../include/openssl/buffer.h ../include/openssl/cast.h ca.o: ../include/openssl/conf.h ../include/openssl/crypto.h ca.o: ../include/openssl/des.h ../include/openssl/dh.h ../include/openssl/dsa.h -ca.o: ../include/openssl/e_os.h ../include/openssl/e_os.h -ca.o: ../include/openssl/e_os2.h ../include/openssl/err.h -ca.o: ../include/openssl/evp.h ../include/openssl/idea.h -ca.o: ../include/openssl/lhash.h ../include/openssl/md2.h -ca.o: ../include/openssl/md5.h ../include/openssl/mdc2.h -ca.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h -ca.o: ../include/openssl/opensslv.h ../include/openssl/pem.h -ca.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h -ca.o: ../include/openssl/rc2.h ../include/openssl/rc4.h -ca.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h -ca.o: ../include/openssl/rsa.h ../include/openssl/safestack.h -ca.o: ../include/openssl/sha.h ../include/openssl/stack.h -ca.o: ../include/openssl/txt_db.h ../include/openssl/x509.h -ca.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h +ca.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h +ca.o: ../include/openssl/err.h ../include/openssl/evp.h +ca.o: ../include/openssl/idea.h ../include/openssl/lhash.h +ca.o: ../include/openssl/md2.h ../include/openssl/md5.h +ca.o: ../include/openssl/mdc2.h ../include/openssl/objects.h +ca.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h +ca.o: ../include/openssl/pem.h ../include/openssl/pem2.h +ca.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h +ca.o: ../include/openssl/rc4.h ../include/openssl/rc5.h +ca.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h +ca.o: ../include/openssl/safestack.h ../include/openssl/sha.h +ca.o: ../include/openssl/stack.h ../include/openssl/txt_db.h +ca.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h +ca.o: ../include/openssl/x509v3.h apps.h ciphers.o: ../include/openssl/asn1.h ../include/openssl/bio.h ciphers.o: ../include/openssl/blowfish.h ../include/openssl/bn.h ciphers.o: ../include/openssl/buffer.h ../include/openssl/cast.h @@ -237,19 +241,19 @@ crl.o: ../include/openssl/buffer.h ../include/openssl/cast.h crl.o: ../include/openssl/conf.h ../include/openssl/crypto.h crl.o: ../include/openssl/des.h ../include/openssl/dh.h crl.o: ../include/openssl/dsa.h ../include/openssl/e_os.h -crl.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h -crl.o: ../include/openssl/err.h ../include/openssl/evp.h -crl.o: ../include/openssl/idea.h ../include/openssl/lhash.h -crl.o: ../include/openssl/md2.h ../include/openssl/md5.h -crl.o: ../include/openssl/mdc2.h ../include/openssl/objects.h -crl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h -crl.o: ../include/openssl/pem.h ../include/openssl/pem2.h -crl.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h -crl.o: ../include/openssl/rc4.h ../include/openssl/rc5.h -crl.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h -crl.o: ../include/openssl/safestack.h ../include/openssl/sha.h -crl.o: ../include/openssl/stack.h ../include/openssl/x509.h -crl.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h +crl.o: ../include/openssl/e_os2.h ../include/openssl/err.h +crl.o: ../include/openssl/evp.h ../include/openssl/idea.h +crl.o: ../include/openssl/lhash.h ../include/openssl/md2.h +crl.o: ../include/openssl/md5.h ../include/openssl/mdc2.h +crl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h +crl.o: ../include/openssl/opensslv.h ../include/openssl/pem.h +crl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h +crl.o: ../include/openssl/rc2.h ../include/openssl/rc4.h +crl.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h +crl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h +crl.o: ../include/openssl/sha.h ../include/openssl/stack.h +crl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h +crl.o: ../include/openssl/x509v3.h apps.h crl2p7.o: ../include/openssl/asn1.h ../include/openssl/bio.h crl2p7.o: ../include/openssl/blowfish.h ../include/openssl/bn.h crl2p7.o: ../include/openssl/buffer.h ../include/openssl/cast.h @@ -448,22 +452,21 @@ openssl.o: ../include/openssl/buffer.h ../include/openssl/cast.h openssl.o: ../include/openssl/conf.h ../include/openssl/crypto.h openssl.o: ../include/openssl/des.h ../include/openssl/dh.h openssl.o: ../include/openssl/dsa.h ../include/openssl/e_os.h -openssl.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h -openssl.o: ../include/openssl/err.h ../include/openssl/evp.h -openssl.o: ../include/openssl/idea.h ../include/openssl/lhash.h -openssl.o: ../include/openssl/md2.h ../include/openssl/md5.h -openssl.o: ../include/openssl/mdc2.h ../include/openssl/objects.h -openssl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h -openssl.o: ../include/openssl/pem.h ../include/openssl/pem2.h -openssl.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h -openssl.o: ../include/openssl/rc4.h ../include/openssl/rc5.h -openssl.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h -openssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h -openssl.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h -openssl.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h -openssl.o: ../include/openssl/stack.h ../include/openssl/tls1.h -openssl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h -openssl.o: progs.h s_apps.h +openssl.o: ../include/openssl/e_os2.h ../include/openssl/err.h +openssl.o: ../include/openssl/evp.h ../include/openssl/idea.h +openssl.o: ../include/openssl/lhash.h ../include/openssl/md2.h +openssl.o: ../include/openssl/md5.h ../include/openssl/mdc2.h +openssl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h +openssl.o: ../include/openssl/opensslv.h ../include/openssl/pem.h +openssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h +openssl.o: ../include/openssl/rc2.h ../include/openssl/rc4.h +openssl.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h +openssl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h +openssl.o: ../include/openssl/sha.h ../include/openssl/ssl.h +openssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h +openssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h +openssl.o: ../include/openssl/tls1.h ../include/openssl/x509.h +openssl.o: ../include/openssl/x509_vfy.h apps.h progs.h s_apps.h passwd.o: ../include/openssl/asn1.h ../include/openssl/bio.h passwd.o: ../include/openssl/blowfish.h ../include/openssl/bn.h passwd.o: ../include/openssl/buffer.h ../include/openssl/cast.h @@ -534,42 +537,25 @@ pkcs8.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h pkcs8.o: ../include/openssl/safestack.h ../include/openssl/sha.h pkcs8.o: ../include/openssl/stack.h ../include/openssl/x509.h pkcs8.o: ../include/openssl/x509_vfy.h apps.h -rand.o: ../include/openssl/asn1.h ../include/openssl/bio.h -rand.o: ../include/openssl/blowfish.h ../include/openssl/bn.h -rand.o: ../include/openssl/buffer.h ../include/openssl/cast.h -rand.o: ../include/openssl/crypto.h ../include/openssl/des.h -rand.o: ../include/openssl/dh.h ../include/openssl/dsa.h -rand.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h -rand.o: ../include/openssl/err.h ../include/openssl/evp.h -rand.o: ../include/openssl/idea.h ../include/openssl/md2.h -rand.o: ../include/openssl/md5.h ../include/openssl/mdc2.h -rand.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h -rand.o: ../include/openssl/opensslv.h ../include/openssl/pkcs7.h -rand.o: ../include/openssl/rand.h ../include/openssl/rc2.h -rand.o: ../include/openssl/rc4.h ../include/openssl/rc5.h -rand.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h -rand.o: ../include/openssl/safestack.h ../include/openssl/sha.h -rand.o: ../include/openssl/stack.h ../include/openssl/x509.h -rand.o: ../include/openssl/x509_vfy.h apps.h req.o: ../include/openssl/asn1.h ../include/openssl/bio.h req.o: ../include/openssl/blowfish.h ../include/openssl/bn.h req.o: ../include/openssl/buffer.h ../include/openssl/cast.h req.o: ../include/openssl/conf.h ../include/openssl/crypto.h req.o: ../include/openssl/des.h ../include/openssl/dh.h req.o: ../include/openssl/dsa.h ../include/openssl/e_os.h -req.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h -req.o: ../include/openssl/err.h ../include/openssl/evp.h -req.o: ../include/openssl/idea.h ../include/openssl/lhash.h -req.o: ../include/openssl/md2.h ../include/openssl/md5.h -req.o: ../include/openssl/mdc2.h ../include/openssl/objects.h -req.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h -req.o: ../include/openssl/pem.h ../include/openssl/pem2.h -req.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h -req.o: ../include/openssl/rc4.h ../include/openssl/rc5.h -req.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h -req.o: ../include/openssl/safestack.h ../include/openssl/sha.h -req.o: ../include/openssl/stack.h ../include/openssl/x509.h -req.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h +req.o: ../include/openssl/e_os2.h ../include/openssl/err.h +req.o: ../include/openssl/evp.h ../include/openssl/idea.h +req.o: ../include/openssl/lhash.h ../include/openssl/md2.h +req.o: ../include/openssl/md5.h ../include/openssl/mdc2.h +req.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h +req.o: ../include/openssl/opensslv.h ../include/openssl/pem.h +req.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h +req.o: ../include/openssl/rc2.h ../include/openssl/rc4.h +req.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h +req.o: ../include/openssl/rsa.h ../include/openssl/safestack.h +req.o: ../include/openssl/sha.h ../include/openssl/stack.h +req.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h +req.o: ../include/openssl/x509v3.h apps.h rsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h rsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h rsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h @@ -748,41 +734,39 @@ speed.o: ./testrsa.h apps.h spkac.o: ../include/openssl/asn1.h ../include/openssl/bio.h spkac.o: ../include/openssl/blowfish.h ../include/openssl/bn.h spkac.o: ../include/openssl/buffer.h ../include/openssl/cast.h -spkac.o: ../include/openssl/conf.h ../include/openssl/crypto.h -spkac.o: ../include/openssl/des.h ../include/openssl/dh.h -spkac.o: ../include/openssl/dsa.h ../include/openssl/e_os.h +spkac.o: ../include/openssl/crypto.h ../include/openssl/des.h +spkac.o: ../include/openssl/dh.h ../include/openssl/dsa.h spkac.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h spkac.o: ../include/openssl/err.h ../include/openssl/evp.h -spkac.o: ../include/openssl/idea.h ../include/openssl/lhash.h -spkac.o: ../include/openssl/md2.h ../include/openssl/md5.h -spkac.o: ../include/openssl/mdc2.h ../include/openssl/objects.h -spkac.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h -spkac.o: ../include/openssl/pem.h ../include/openssl/pem2.h -spkac.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h -spkac.o: ../include/openssl/rc4.h ../include/openssl/rc5.h -spkac.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h -spkac.o: ../include/openssl/safestack.h ../include/openssl/sha.h -spkac.o: ../include/openssl/stack.h ../include/openssl/x509.h -spkac.o: ../include/openssl/x509_vfy.h apps.h +spkac.o: ../include/openssl/idea.h ../include/openssl/md2.h +spkac.o: ../include/openssl/md5.h ../include/openssl/mdc2.h +spkac.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h +spkac.o: ../include/openssl/opensslv.h ../include/openssl/pem.h +spkac.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h +spkac.o: ../include/openssl/rc2.h ../include/openssl/rc4.h +spkac.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h +spkac.o: ../include/openssl/rsa.h ../include/openssl/safestack.h +spkac.o: ../include/openssl/sha.h ../include/openssl/stack.h +spkac.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h verify.o: ../include/openssl/asn1.h ../include/openssl/bio.h verify.o: ../include/openssl/blowfish.h ../include/openssl/bn.h verify.o: ../include/openssl/buffer.h ../include/openssl/cast.h verify.o: ../include/openssl/conf.h ../include/openssl/crypto.h verify.o: ../include/openssl/des.h ../include/openssl/dh.h verify.o: ../include/openssl/dsa.h ../include/openssl/e_os.h -verify.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h -verify.o: ../include/openssl/err.h ../include/openssl/evp.h -verify.o: ../include/openssl/idea.h ../include/openssl/lhash.h -verify.o: ../include/openssl/md2.h ../include/openssl/md5.h -verify.o: ../include/openssl/mdc2.h ../include/openssl/objects.h -verify.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h -verify.o: ../include/openssl/pem.h ../include/openssl/pem2.h -verify.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h -verify.o: ../include/openssl/rc4.h ../include/openssl/rc5.h -verify.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h -verify.o: ../include/openssl/safestack.h ../include/openssl/sha.h -verify.o: ../include/openssl/stack.h ../include/openssl/x509.h -verify.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h +verify.o: ../include/openssl/e_os2.h ../include/openssl/err.h +verify.o: ../include/openssl/evp.h ../include/openssl/idea.h +verify.o: ../include/openssl/lhash.h ../include/openssl/md2.h +verify.o: ../include/openssl/md5.h ../include/openssl/mdc2.h +verify.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h +verify.o: ../include/openssl/opensslv.h ../include/openssl/pem.h +verify.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h +verify.o: ../include/openssl/rc2.h ../include/openssl/rc4.h +verify.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h +verify.o: ../include/openssl/rsa.h ../include/openssl/safestack.h +verify.o: ../include/openssl/sha.h ../include/openssl/stack.h +verify.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h +verify.o: ../include/openssl/x509v3.h apps.h version.o: ../include/openssl/asn1.h ../include/openssl/bio.h version.o: ../include/openssl/blowfish.h ../include/openssl/bn.h version.o: ../include/openssl/buffer.h ../include/openssl/cast.h @@ -805,16 +789,16 @@ x509.o: ../include/openssl/buffer.h ../include/openssl/cast.h x509.o: ../include/openssl/conf.h ../include/openssl/crypto.h x509.o: ../include/openssl/des.h ../include/openssl/dh.h x509.o: ../include/openssl/dsa.h ../include/openssl/e_os.h -x509.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h -x509.o: ../include/openssl/err.h ../include/openssl/evp.h -x509.o: ../include/openssl/idea.h ../include/openssl/lhash.h -x509.o: ../include/openssl/md2.h ../include/openssl/md5.h -x509.o: ../include/openssl/mdc2.h ../include/openssl/objects.h -x509.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h -x509.o: ../include/openssl/pem.h ../include/openssl/pem2.h -x509.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h -x509.o: ../include/openssl/rc4.h ../include/openssl/rc5.h -x509.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h -x509.o: ../include/openssl/safestack.h ../include/openssl/sha.h -x509.o: ../include/openssl/stack.h ../include/openssl/x509.h -x509.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h +x509.o: ../include/openssl/e_os2.h ../include/openssl/err.h +x509.o: ../include/openssl/evp.h ../include/openssl/idea.h +x509.o: ../include/openssl/lhash.h ../include/openssl/md2.h +x509.o: ../include/openssl/md5.h ../include/openssl/mdc2.h +x509.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h +x509.o: ../include/openssl/opensslv.h ../include/openssl/pem.h +x509.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h +x509.o: ../include/openssl/rc2.h ../include/openssl/rc4.h +x509.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h +x509.o: ../include/openssl/rsa.h ../include/openssl/safestack.h +x509.o: ../include/openssl/sha.h ../include/openssl/stack.h +x509.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h +x509.o: ../include/openssl/x509v3.h apps.h diff --git a/apps/app_rand.c b/apps/app_rand.c index 1146f9f7f38..f7f133831d2 100644 --- a/apps/app_rand.c +++ b/apps/app_rand.c @@ -56,7 +56,7 @@ * [including the GNU Public Licence.] */ /* ==================================================================== - * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. + * Copyright (c) 1998-1999 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -109,9 +109,7 @@ * */ -#define NON_MAIN #include "apps.h" -#undef NON_MAIN #include <openssl/bio.h> #include <openssl/rand.h> @@ -164,7 +162,7 @@ long app_RAND_load_files(char *name) char *p,*n; int last; long tot=0; - int egd; + int egd; for (;;) { @@ -176,9 +174,9 @@ long app_RAND_load_files(char *name) name=p+1; if (*n == '\0') break; - egd=RAND_egd(n); + egd=RAND_egd(n); if (egd > 0) tot+=egd; - tot+=RAND_load_file(n,-1); + tot+=RAND_load_file(n,1024L*1024L); if (last) break; } if (tot > 512) diff --git a/apps/ca.c b/apps/ca.c index 62747ec47c4..e22beda0972 100644 --- a/apps/ca.c +++ b/apps/ca.c @@ -263,7 +263,7 @@ int MAIN(int argc, char **argv) long l; const EVP_MD *dgst=NULL; STACK_OF(CONF_VALUE) *attribs=NULL; - STACK_OF(X509) *cert_sk=NULL; + STACK *cert_sk=NULL; BIO *hex=NULL; #undef BSIZE #define BSIZE 256 @@ -817,7 +817,7 @@ bad: goto err; } - if ((cert_sk=sk_X509_new_null()) == NULL) + if ((cert_sk=sk_new_null()) == NULL) { BIO_printf(bio_err,"Malloc failure\n"); goto err; @@ -834,7 +834,7 @@ bad: total_done++; BIO_printf(bio_err,"\n"); if (!BN_add_word(serial,1)) goto err; - if (!sk_X509_push(cert_sk,x)) + if (!sk_push(cert_sk,(char *)x)) { BIO_printf(bio_err,"Malloc failure\n"); goto err; @@ -858,7 +858,7 @@ bad: total_done++; BIO_printf(bio_err,"\n"); if (!BN_add_word(serial,1)) goto err; - if (!sk_X509_push(cert_sk,x)) + if (!sk_push(cert_sk,(char *)x)) { BIO_printf(bio_err,"Malloc failure\n"); goto err; @@ -877,7 +877,7 @@ bad: total_done++; BIO_printf(bio_err,"\n"); if (!BN_add_word(serial,1)) goto err; - if (!sk_X509_push(cert_sk,x)) + if (!sk_push(cert_sk,(char *)x)) { BIO_printf(bio_err,"Malloc failure\n"); goto err; @@ -896,7 +896,7 @@ bad: total_done++; BIO_printf(bio_err,"\n"); if (!BN_add_word(serial,1)) goto err; - if (!sk_X509_push(cert_sk,x)) + if (!sk_push(cert_sk,(char *)x)) { BIO_printf(bio_err,"Malloc failure\n"); goto err; @@ -907,7 +907,7 @@ bad: * and a data base and serial number that need * updating */ - if (sk_X509_num(cert_sk) > 0) + if (sk_num(cert_sk) > 0) { if (!batch) { @@ -923,7 +923,7 @@ bad: } } - BIO_printf(bio_err,"Write out database with %d new entries\n",sk_X509_num(cert_sk)); + BIO_printf(bio_err,"Write out database with %d new entries\n",sk_num(cert_sk)); strncpy(buf[0],serialfile,BSIZE-4); @@ -955,12 +955,12 @@ bad: if (verbose) BIO_printf(bio_err,"writing new certificates\n"); - for (i=0; i<sk_X509_num(cert_sk); i++) + for (i=0; i<sk_num(cert_sk); i++) { int k; unsigned char *n; - x=sk_X509_value(cert_sk,i); + x=(X509 *)sk_value(cert_sk,i); j=x->cert_info->serialNumber->length; p=(char *)x->cert_info->serialNumber->data; @@ -999,7 +999,7 @@ bad: write_new_certificate(Sout,x, output_der, notext); } - if (sk_X509_num(cert_sk)) + if (sk_num(cert_sk)) { /* Rename the database and the serial file */ strncpy(buf[2],serialfile,BSIZE-4); @@ -1233,7 +1233,7 @@ err: BIO_free(out); BIO_free(in); - sk_X509_pop_free(cert_sk,X509_free); + sk_pop_free(cert_sk,X509_free); if (ret) ERR_print_errors(bio_err); app_RAND_write_file(randfile, bio_err); @@ -1662,7 +1662,7 @@ again2: } if (j < 0) { - BIO_printf(bio_err,"The %s field needed to be the same in the\nCA certificate (%s) and the request (%s)\n",cv->name,((str2 == NULL)?"NULL":(char *)str2->data),((str == NULL)?"NULL":(char *)str->data)); + BIO_printf(bio_err,"The %s field needed to be the same in the\nCA certificate (%s) and the request (%s)\n",cv->name,((str == NULL)?"NULL":(char *)str->data),((str2 == NULL)?"NULL":(char *)str2->data)); goto err; } } diff --git a/apps/ciphers.c b/apps/ciphers.c index 72b2009e187..f8e9e7be2e6 100644 --- a/apps/ciphers.c +++ b/apps/ciphers.c @@ -74,7 +74,6 @@ static char *ciphers_usage[]={ " -v - verbose mode, a textual listing of the ciphers in SSLeay\n", " -ssl2 - SSL2 mode\n", " -ssl3 - SSL3 mode\n", -" -tls1 - TLS1 mode\n", NULL }; @@ -123,10 +122,6 @@ int MAIN(int argc, char **argv) else if (strcmp(*argv,"-ssl3") == 0) meth=SSLv3_client_method(); #endif -#ifndef NO_TLS1 - else if (strcmp(*argv,"-tls1") == 0) - meth=TLSv1_client_method(); -#endif else if ((strncmp(*argv,"-h",2) == 0) || (strcmp(*argv,"-?") == 0)) { diff --git a/apps/crl.c b/apps/crl.c index b1c3325f21e..338f46d97c5 100644 --- a/apps/crl.c +++ b/apps/crl.c @@ -104,7 +104,6 @@ int MAIN(int argc, char **argv) int informat,outformat; char *infile=NULL,*outfile=NULL; int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0; - int fingerprint = 0; char **pp,buf[256]; X509_STORE *store = NULL; X509_STORE_CTX ctx; @@ -112,7 +111,6 @@ int MAIN(int argc, char **argv) X509_OBJECT xobj; EVP_PKEY *pkey; int do_ver = 0; - const EVP_MD *md_alg,*digest=EVP_md5(); apps_startup(); @@ -185,13 +183,6 @@ int MAIN(int argc, char **argv) nextupdate= ++num; else if (strcmp(*argv,"-noout") == 0) noout= ++num; - else if (strcmp(*argv,"-fingerprint") == 0) - fingerprint= ++num; - else if ((md_alg=EVP_get_digestbyname(*argv + 1))) - { - /* ok */ - digest=md_alg; - } else { BIO_printf(bio_err,"unknown option %s\n",*argv); @@ -283,26 +274,6 @@ bad: BIO_printf(bio_out,"NONE"); BIO_printf(bio_out,"\n"); } - if (fingerprint == i) - { - int j; - unsigned int n; - unsigned char md[EVP_MAX_MD_SIZE]; - - if (!X509_CRL_digest(x,digest,md,&n)) - { - BIO_printf(bio_err,"out of memory\n"); - goto end; - } - BIO_printf(bio_out,"%s Fingerprint=", - OBJ_nid2sn(EVP_MD_type(digest))); - for (j=0; j<(int)n; j++) - { - BIO_printf(bio_out,"%02X%c",md[j], - (j+1 == (int)n) - ?'\n':':'); - } - } } } diff --git a/apps/dh.c b/apps/dh.c index 674963f81a9..b3c20e2b5c1 100644 --- a/apps/dh.c +++ b/apps/dh.c @@ -1,5 +1,4 @@ /* apps/dh.c */ -/* obsoleted by dhparam.c */ /* Copyright (C) 1995-1998 Eric Young ([email protected]) * All rights reserved. * @@ -235,8 +234,8 @@ bad: } if (i & DH_CHECK_P_NOT_PRIME) printf("p value is not prime\n"); - if (i & DH_CHECK_P_NOT_SAFE_PRIME) - printf("p value is not a safe prime\n"); + if (i & DH_CHECK_P_NOT_STRONG_PRIME) + printf("p value is not a strong prime\n"); if (i & DH_UNABLE_TO_CHECK_GENERATOR) printf("unable to check the generator value\n"); if (i & DH_NOT_SUITABLE_GENERATOR) diff --git a/apps/dhparam.c b/apps/dhparam.c index 709547ff5e6..293a400d0c5 100644 --- a/apps/dhparam.c +++ b/apps/dhparam.c @@ -55,59 +55,6 @@ * copied and put under another distribution licence * [including the GNU Public Licence.] */ -/* ==================================================================== - * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. - * - * 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 above 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 acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * [email protected]. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED 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 OpenSSL PROJECT OR - * ITS 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. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * ([email protected]). This product includes software written by Tim - * Hudson ([email protected]). - * - */ #ifndef NO_DH #include <stdio.h> @@ -122,10 +69,6 @@ #include <openssl/x509.h> #include <openssl/pem.h> -#ifndef NO_DSA -#include <openssl/dsa.h> -#endif - #undef PROG #define PROG dhparam_main @@ -135,7 +78,6 @@ * -outform arg - output format - default PEM * -in arg - input file - default stdin * -out arg - output file - default stdout - * -dsaparam - read or generate DSA parameters, convert to DH * -check - check the parameters are ok * -noout * -text @@ -150,9 +92,6 @@ int MAIN(int argc, char **argv) { DH *dh=NULL; int i,badops=0,text=0; -#ifndef NO_DSA - int dsaparam=0; -#endif BIO *in=NULL,*out=NULL; int informat,outformat,check=0,noout=0,C=0,ret=1; char *infile,*outfile,*prog; @@ -199,10 +138,6 @@ int MAIN(int argc, char **argv) check=1; else if (strcmp(*argv,"-text") == 0) text=1; -#ifndef NO_DSA - else if (strcmp(*argv,"-dsaparam") == 0) - dsaparam=1; -#endif else if (strcmp(*argv,"-C") == 0) C=1; else if (strcmp(*argv,"-noout") == 0) @@ -231,16 +166,13 @@ bad: BIO_printf(bio_err," -outform arg output format - one of DER PEM\n"); BIO_printf(bio_err," -in arg input file\n"); BIO_printf(bio_err," -out arg output file\n"); -#ifndef NO_DSA - BIO_printf(bio_err," -dsaparam read or generate DSA parameters, convert to DH\n"); -#endif BIO_printf(bio_err," -check check the DH parameters\n"); BIO_printf(bio_err," -text print a text form of the DH parameters\n"); BIO_printf(bio_err," -C Output C code\n"); BIO_printf(bio_err," -2 generate parameters using 2 as the generator value\n"); BIO_printf(bio_err," -5 generate parameters using 5 as the generator value\n"); BIO_printf(bio_err," numbits number of bits in to generate (default 512)\n"); - BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); + BIO_printf(bio_err," -rand file:file:...\n"); BIO_printf(bio_err," - load the file (or the files in the directory) into\n"); BIO_printf(bio_err," the random number generator\n"); BIO_printf(bio_err," -noout no output\n"); @@ -249,25 +181,8 @@ bad: ERR_load_crypto_strings(); - if (g && !num) - num = DEFBITS; - -#ifndef NO_DSA - if (dsaparam) - { - if (g) - { - BIO_printf(bio_err, "generator may not be chosen for DSA parameters\n"); - goto end; - } - } - else -#endif - { - /* DH parameters */ - if (num && !g) - g = 2; - } + if(g && !num) num = DEFBITS; + else if(num && !g) g = 2; if(num) { @@ -279,40 +194,11 @@ bad: BIO_printf(bio_err,"%ld semi-random bytes loaded\n", app_RAND_load_files(inrand)); -#ifndef NO_DSA - if (dsaparam) - { - DSA *dsa; + BIO_printf(bio_err,"Generating DH parameters, %d bit long strong prime, generator of %d\n",num,g); + BIO_printf(bio_err,"This is going to take a long time\n"); + dh=DH_generate_parameters(num,g,dh_cb,bio_err); - BIO_printf(bio_err,"Generating DSA parameters, %d bit long prime\n",num); - dsa = DSA_generate_parameters(num, NULL, 0, NULL, NULL, dh_cb, bio_err); - if (dsa == NULL) - { - ERR_print_errors(bio_err); - goto end; - } - - dh = DSA_dup_DH(dsa); - DSA_free(dsa); - if (dh == NULL) - { - ERR_print_errors(bio_err); - goto end; - } - } - else -#endif - { - BIO_printf(bio_err,"Generating DH parameters, %d bit long safe prime, generator %d\n",num,g); - BIO_printf(bio_err,"This is going to take a long time\n"); - dh=DH_generate_parameters(num,g,dh_cb,bio_err); - - if (dh == NULL) - { - ERR_print_errors(bio_err); - goto end; - } - } + if (dh == NULL) goto end; app_RAND_write_file(NULL, bio_err); } else { @@ -334,56 +220,24 @@ bad: } } - if (informat != FORMAT_ASN1 && informat != FORMAT_PEM) + if (informat == FORMAT_ASN1) + dh=d2i_DHparams_bio(in,NULL); + else if (informat == FORMAT_PEM) + dh=PEM_read_bio_DHparams(in,NULL,NULL,NULL); + else { BIO_printf(bio_err,"bad input format specified\n"); goto end; } - -#ifndef NO_DSA - if (dsaparam) + if (dh == NULL) { - DSA *dsa; - - if (informat == FORMAT_ASN1) - dsa=d2i_DSAparams_bio(in,NULL); - else /* informat == FORMAT_PEM */ - dsa=PEM_read_bio_DSAparams(in,NULL,NULL,NULL); - - if (dsa == NULL) - { - BIO_printf(bio_err,"unable to load DSA parameters\n"); - ERR_print_errors(bio_err); - goto end; - } - - dh = DSA_dup_DH(dsa); - DSA_free(dsa); - if (dh == NULL) - { - ERR_print_errors(bio_err); - goto end; - } - } - else -#endif - { - if (informat == FORMAT_ASN1) - dh=d2i_DHparams_bio(in,NULL); - else /* informat == FORMAT_PEM */ - dh=PEM_read_bio_DHparams(in,NULL,NULL,NULL); - - if (dh == NULL) - { - BIO_printf(bio_err,"unable to load DH parameters\n"); - ERR_print_errors(bio_err); - goto end; - } + BIO_printf(bio_err,"unable to load DH parameters\n"); + ERR_print_errors(bio_err); + goto end; } - - /* dh != NULL */ + } - + out=BIO_new(BIO_s_file()); if (out == NULL) { @@ -401,6 +255,7 @@ bad: } } + if (text) { @@ -416,8 +271,8 @@ bad: } if (i & DH_CHECK_P_NOT_PRIME) printf("p value is not prime\n"); - if (i & DH_CHECK_P_NOT_SAFE_PRIME) - printf("p value is not a safe prime\n"); + if (i & DH_CHECK_P_NOT_STRONG_PRIME) + printf("p value is not a strong prime\n"); if (i & DH_UNABLE_TO_CHECK_GENERATOR) printf("unable to check the generator value\n"); if (i & DH_NOT_SUITABLE_GENERATOR) @@ -438,29 +293,25 @@ bad: perror("Malloc"); goto end; } - printf("#ifndef HEADER_DH_H\n" - "#include <openssl/dh.h>\n" - "#endif\n"); - printf("DH *get_dh%d()\n\t{\n",bits); - l=BN_bn2bin(dh->p,data); - printf("\tstatic unsigned char dh%d_p[]={",bits); + printf("static unsigned char dh%d_p[]={",bits); for (i=0; i<l; i++) { - if ((i%12) == 0) printf("\n\t\t"); + if ((i%12) == 0) printf("\n\t"); printf("0x%02X,",data[i]); } - printf("\n\t\t};\n"); + printf("\n\t};\n"); l=BN_bn2bin(dh->g,data); - printf("\tstatic unsigned char dh%d_g[]={",bits); + printf("static unsigned char dh%d_g[]={",bits); for (i=0; i<l; i++) { - if ((i%12) == 0) printf("\n\t\t"); + if ((i%12) == 0) printf("\n\t"); printf("0x%02X,",data[i]); } - printf("\n\t\t};\n"); + printf("\n\t};\n\n"); + printf("DH *get_dh%d()\n\t{\n",bits); printf("\tDH *dh;\n\n"); printf("\tif ((dh=DH_new()) == NULL) return(NULL);\n"); printf("\tdh->p=BN_bin2bn(dh%d_p,sizeof(dh%d_p),NULL);\n", @@ -468,9 +319,7 @@ bad: printf("\tdh->g=BN_bin2bn(dh%d_g,sizeof(dh%d_g),NULL);\n", bits,bits); printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n"); - printf("\t\t{ DH_free(dh); return(NULL); }\n"); - if (dh->length) - printf("\tdh->length = %d;\n", dh->length); + printf("\t\treturn(NULL);\n"); printf("\treturn(dh);\n\t}\n"); Free(data); } @@ -501,7 +350,6 @@ end: EXIT(ret); } -/* dh_cb is identical to dsa_cb in apps/dsaparam.c */ static void MS_CALLBACK dh_cb(int p, int n, void *arg) { char c='*'; diff --git a/apps/eay.c b/apps/eay.c new file mode 100644 index 00000000000..a84aa382bde --- /dev/null +++ b/apps/eay.c @@ -0,0 +1,131 @@ +/* apps/eay.c */ +/* Copyright (C) 1995-1998 Eric Young ([email protected]) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young ([email protected]). + * 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 ([email protected]). + * + * 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 ([email protected])" + * 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 ([email protected])" + * + * 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> + +#define MONOLITH +#define USE_SOCKETS + +#include "openssl/e_os.h" + +#include <openssl/bio.h> +#include <openssl/stack.h> +#include <openssl/lhash.h> + +#include <openssl/err.h> + +#include <openssl/bn.h> + +#include <openssl/evp.h> + +#include <openssl/rand.h> +#include <openssl/conf.h> +#include <openssl/txt_db.h> + +#include <openssl/err.h> + +#include <openssl/x509.h> +#include <openssl/pkcs7.h> +#include <openssl/pem.h> +#include <openssl/asn1.h> +#include <openssl/objects.h> + +#define MONOLITH + +#include "openssl.c" +#include "apps.c" +#include "asn1pars.c" +#ifndef NO_RSA +#include "ca.c" +#include "genrsa.c" +#include "req.c" +#include "rsa.c" +#endif +#ifndef NO_DH +#include "gendh.c" +#include "dh.c" +#endif +#include "crl.c" +#include "crl2p7.c" +#include "dgst.c" +#include "enc.c" +#include "errstr.c" +#if !defined(NO_SSL2) || !defined(NO_SSL3) +#ifndef NO_SOCK +#include "s_cb.c" +#include "s_client.c" +#include "s_server.c" +#include "s_socket.c" +#include "s_time.c" +#endif +#endif +#include "speed.c" +#include "verify.c" +#include "version.c" +#include "x509.c" +#include "ciphers.c" +#include "sess_id.c" +#include "pkcs7.c" +#ifndef NO_DSA +#include "dsaparam.c" +#include "dsa.c" +#include "gendsa.c" +#endif + diff --git a/apps/errstr.c b/apps/errstr.c index 2c620464769..4650379589d 100644 --- a/apps/errstr.c +++ b/apps/errstr.c @@ -104,10 +104,7 @@ int MAIN(int argc, char **argv) for (i=1; i<argc; i++) { if (sscanf(argv[i],"%lx",&l)) - { - ERR_error_string_n(l, buf, sizeof buf); - printf("%s\n",buf); - } + printf("%s\n",ERR_error_string(l,buf)); else { printf("%s: bad error code\n",argv[i]); diff --git a/apps/gendh.c b/apps/gendh.c index caf5e8d736b..1f6be965996 100644 --- a/apps/gendh.c +++ b/apps/gendh.c @@ -1,5 +1,4 @@ /* apps/gendh.c */ -/* obsoleted by dhparam.c */ /* Copyright (C) 1995-1998 Eric Young ([email protected]) * All rights reserved. * @@ -128,7 +127,7 @@ bad: BIO_printf(bio_err," -2 use 2 as the generator value\n"); /* BIO_printf(bio_err," -3 use 3 as the generator value\n"); */ BIO_printf(bio_err," -5 use 5 as the generator value\n"); - BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); + BIO_printf(bio_err," -rand file:file:...\n"); BIO_printf(bio_err," - load the file (or the files in the directory) into\n"); BIO_printf(bio_err," the random number generator\n"); goto end; @@ -160,7 +159,7 @@ bad: BIO_printf(bio_err,"%ld semi-random bytes loaded\n", app_RAND_load_files(inrand)); - BIO_printf(bio_err,"Generating DH parameters, %d bit long safe prime, generator %d\n",num,g); + BIO_printf(bio_err,"Generating DH parameters, %d bit long strong prime, generator of %d\n",num,g); BIO_printf(bio_err,"This is going to take a long time\n"); dh=DH_generate_parameters(num,g,dh_cb,bio_err); diff --git a/apps/gendsa.c b/apps/gendsa.c index b1a1c4fcfae..d69a93da451 100644 --- a/apps/gendsa.c +++ b/apps/gendsa.c @@ -145,7 +145,7 @@ bad: #ifndef NO_IDEA BIO_printf(bio_err," -idea - encrypt the generated key with IDEA in cbc mode\n"); #endif - BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); + BIO_printf(bio_err," -rand file:file:...\n"); BIO_printf(bio_err," - load the file (or the files in the directory) into\n"); BIO_printf(bio_err," the random number generator\n"); BIO_printf(bio_err," dsaparam-file\n"); diff --git a/apps/genrsa.c b/apps/genrsa.c index 6fe578d69fe..dc63ff02bd8 100644 --- a/apps/genrsa.c +++ b/apps/genrsa.c @@ -154,7 +154,7 @@ bad: BIO_printf(bio_err," -passout arg output file pass phrase source\n"); BIO_printf(bio_err," -f4 use F4 (0x10001) for the E value\n"); BIO_printf(bio_err," -3 use 3 for the E value\n"); - BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); + BIO_printf(bio_err," -rand file:file:...\n"); BIO_printf(bio_err," load the file (or the files in the directory) into\n"); BIO_printf(bio_err," the random number generator\n"); goto err; diff --git a/apps/makeapps.com b/apps/makeapps.com index 94acbf82199..5ef6a8904ee 100644 --- a/apps/makeapps.com +++ b/apps/makeapps.com @@ -157,13 +157,13 @@ $ LIB_FILES = "VERIFY;ASN1PARS;REQ;DGST;DH;DHPARAM;ENC;PASSWD;GENDH;ERRSTR;"+- "RSA;DSA;DSAPARAM;"+- "X509;GENRSA;GENDSA;S_SERVER;S_CLIENT;SPEED;"+- "S_TIME;APPS;S_CB;S_SOCKET;APP_RAND;VERSION;SESS_ID;"+- - "CIPHERS;NSEQ;PKCS12;PKCS8;SPKAC;SMIME;RAND" + "CIPHERS;NSEQ;PKCS12;PKCS8;SPKAC;SMIME" $ APP_FILES := OPENSSL,'OBJ_DIR'VERIFY.OBJ,ASN1PARS.OBJ,REQ.OBJ,DGST.OBJ,DH.OBJ,DHPARAM.OBJ,ENC.OBJ,PASSWD.OBJ,GENDH.OBJ,ERRSTR.OBJ,- CA.OBJ,PKCS7.OBJ,CRL2P7.OBJ,CRL.OBJ,- RSA.OBJ,DSA.OBJ,DSAPARAM.OBJ,- X509.OBJ,GENRSA.OBJ,GENDSA.OBJ,S_SERVER.OBJ,S_CLIENT.OBJ,SPEED.OBJ,- S_TIME.OBJ,APPS.OBJ,S_CB.OBJ,S_SOCKET.OBJ,APP_RAND.OBJ,VERSION.OBJ,SESS_ID.OBJ,- - CIPHERS.OBJ,NSEQ.OBJ,PKCS12.OBJ,PKCS8.OBJ,SPKAC.OBJ,SMIME.OBJ,RAND.OBJ + CIPHERS.OBJ,NSEQ.OBJ,PKCS12.OBJ,PKCS8.OBJ,SPKAC.OBJ,SMIME.OBJ $ TCPIP_PROGRAMS = ",," $ IF COMPILER .EQS. "VAXC" THEN - TCPIP_PROGRAMS = ",OPENSSL," diff --git a/apps/openssl.c b/apps/openssl.c index a2a263062df..748c6ce71a1 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -56,10 +56,13 @@ * [including the GNU Public Licence.] */ +#ifndef DEBUG +#undef DEBUG +#endif + #include <stdio.h> #include <string.h> #include <stdlib.h> -#define OPENSSL_C /* tells apps.h to use complete apps_startup() */ #include <openssl/bio.h> #include <openssl/crypto.h> #include <openssl/lhash.h> @@ -68,11 +71,18 @@ #include <openssl/pem.h> #include <openssl/ssl.h> #define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */ +#define OPENSSL_C /* tells apps.h to use complete apps_startup() */ #include "apps.h" #include "progs.h" #include "s_apps.h" #include <openssl/err.h> +/* +#ifdef WINDOWS +#include "bss_file.c" +#endif +*/ + static unsigned long MS_CALLBACK hash(FUNCTION *a); static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b); static LHASH *prog_init(void ); @@ -80,6 +90,15 @@ static int do_cmd(LHASH *prog,int argc,char *argv[]); LHASH *config=NULL; char *default_config_file=NULL; +#ifdef DEBUG +static void sig_stop(int i) + { + char *a=NULL; + + *a='\0'; + } +#endif + /* Make sure there is only one when MONOLITH is defined */ #ifdef MONOLITH BIO *bio_err=NULL; @@ -101,6 +120,15 @@ int main(int Argc, char *Argv[]) arg.data=NULL; arg.count=0; +#if defined(DEBUG) && !defined(WINDOWS) && !defined(MSDOS) +#ifdef SIGBUS + signal(SIGBUS,sig_stop); +#endif +#ifdef SIGSEGV + signal(SIGSEGV,sig_stop); +#endif +#endif + CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); apps_startup(); @@ -206,7 +234,13 @@ end: EVP_cleanup(); ERR_free_strings(); - + +#ifdef LEVITTE_DEBUG + CRYPTO_push_info("Just to make sure I get a memory leak I can see :-)"); + (void)Malloc(1024); + CRYPTO_pop_info(); +#endif + CRYPTO_mem_leaks(bio_err); if (bio_err != NULL) { @@ -233,18 +267,6 @@ static int do_cmd(LHASH *prog, int argc, char *argv[]) { ret=fp->func(argc,argv); } - else if ((strncmp(argv[0],"no-",3)) == 0) - { - BIO *bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE); - f.name=argv[0]+3; - ret = (lh_retrieve(prog,&f) != NULL); - if (!ret) - BIO_printf(bio_stdout, "%s\n", argv[0]); - else - BIO_printf(bio_stdout, "%s\n", argv[0]+3); - BIO_free(bio_stdout); - goto end; - } else if ((strcmp(argv[0],"quit") == 0) || (strcmp(argv[0],"q") == 0) || (strcmp(argv[0],"exit") == 0) || diff --git a/apps/passwd.c b/apps/passwd.c index 4650ea503dd..c7e21d2081a 100644 --- a/apps/passwd.c +++ b/apps/passwd.c @@ -63,7 +63,6 @@ int MAIN(int argc, char **argv) int in_stdin = 0; char *salt = NULL, *passwd = NULL, **passwds = NULL; char *salt_malloc = NULL, *passwd_malloc = NULL; - size_t passwd_malloc_size = 0; int pw_source_defined = 0; BIO *in = NULL, *out = NULL; int i, badopt, opt_done; @@ -197,10 +196,7 @@ int MAIN(int argc, char **argv) if (passwds == NULL) { /* no passwords on the command line */ - - passwd_malloc_size = pw_maxlen + 2; - /* longer than necessary so that we can warn about truncation */ - passwd = passwd_malloc = Malloc(passwd_malloc_size); + passwd = passwd_malloc = Malloc(pw_maxlen + 1); if (passwd_malloc == NULL) goto err; } @@ -212,7 +208,7 @@ int MAIN(int argc, char **argv) passwds = passwds_static; if (in == NULL) - if (EVP_read_pw_string(passwd_malloc, passwd_malloc_size, "Password: ", 0) != 0) + if (EVP_read_pw_string(passwd_malloc, pw_maxlen + 1, "Password: ", 0) != 0) goto err; passwds[0] = passwd_malloc; } diff --git a/apps/pkcs12.c b/apps/pkcs12.c index a45b2da72f1..d535a71335b 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -80,8 +80,7 @@ EVP_CIPHER *enc; int get_cert_chain(X509 *cert, STACK_OF(X509) **chain); int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen, int options, char *pempass); -int dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, char *pass, - int passlen, int options, char *pempass); +int dump_certs_pkeys_bags(BIO *out, STACK *bags, char *pass, int passlen, int options, char *pempass); int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bags, char *pass, int passlen, int options, char *pempass); int print_attribs(BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst, char *name); void hex_prin(BIO *out, unsigned char *buf, int len); @@ -266,7 +265,7 @@ int MAIN(int argc, char **argv) BIO_printf (bio_err, "-password p set import/export password source\n"); BIO_printf (bio_err, "-passin p input file pass phrase source\n"); BIO_printf (bio_err, "-passout p output file pass phrase source\n"); - BIO_printf(bio_err, "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); + BIO_printf(bio_err, "-rand file:file:...\n"); BIO_printf(bio_err, " load the file (or the files in the directory) into\n"); BIO_printf(bio_err, " the random number generator\n"); goto end; @@ -361,8 +360,7 @@ int MAIN(int argc, char **argv) if (export_cert) { EVP_PKEY *key; - STACK_OF(PKCS12_SAFEBAG) *bags; - STACK_OF(PKCS7) *safes; + STACK *bags, *safes; PKCS12_SAFEBAG *bag; PKCS8_PRIV_KEY_INFO *p8; PKCS7 *authsafe; @@ -407,7 +405,7 @@ int MAIN(int argc, char **argv) goto end; } - bags = sk_PKCS12_SAFEBAG_new (NULL); + bags = sk_new (NULL); /* Add any more certificates asked for */ if (certsin) { @@ -447,7 +445,7 @@ int MAIN(int argc, char **argv) PKCS12_add_localkeyid(bag, keyid, keyidlen); } else if((catmp = sk_shift(canames))) PKCS12_add_friendlyname(bag, catmp, -1); - sk_PKCS12_SAFEBAG_push(bags, bag); + sk_push(bags, (char *)bag); } sk_X509_pop_free(certs, X509_free); if (canames) sk_free(canames); @@ -461,15 +459,15 @@ int MAIN(int argc, char **argv) /* Turn certbags into encrypted authsafe */ authsafe = PKCS12_pack_p7encdata(cert_pbe, cpass, -1, NULL, 0, iter, bags); - sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); + sk_pop_free(bags, PKCS12_SAFEBAG_free); if (!authsafe) { ERR_print_errors (bio_err); goto end; } - safes = sk_PKCS7_new (NULL); - sk_PKCS7_push (safes, authsafe); + safes = sk_new (NULL); + sk_push (safes, (char *)authsafe); /* Make a shrouded key bag */ p8 = EVP_PKEY2PKCS8 (key); @@ -479,18 +477,18 @@ int MAIN(int argc, char **argv) PKCS8_PRIV_KEY_INFO_free(p8); if (name) PKCS12_add_friendlyname (bag, name, -1); PKCS12_add_localkeyid (bag, keyid, keyidlen); - bags = sk_PKCS12_SAFEBAG_new(NULL); - sk_PKCS12_SAFEBAG_push (bags, bag); + bags = sk_new(NULL); + sk_push (bags, (char *)bag); /* Turn it into unencrypted safe bag */ authsafe = PKCS12_pack_p7data (bags); - sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); - sk_PKCS7_push (safes, authsafe); + sk_pop_free(bags, PKCS12_SAFEBAG_free); + sk_push (safes, (char *)authsafe); p12 = PKCS12_init (NID_pkcs7_data); M_PKCS12_pack_authsafes (p12, safes); - sk_PKCS7_pop_free(safes, PKCS7_free); + sk_pop_free(safes, PKCS7_free); PKCS12_set_mac (p12, mpass, -1, NULL, 0, maciter, NULL); @@ -530,16 +528,11 @@ int MAIN(int argc, char **argv) #ifdef CRYPTO_MDEBUG CRYPTO_push_info("verify MAC"); #endif - /* If we enter empty password try no password first */ - if(!macpass[0] && PKCS12_verify_mac(p12, NULL, 0)) { - /* If mac and crypto pass the same set it to NULL too */ - if(!twopass) cpass = NULL; - } else if (!PKCS12_verify_mac(p12, mpass, -1)) { + if (!PKCS12_verify_mac (p12, mpass, -1)) { BIO_printf (bio_err, "Mac verify error: invalid password?\n"); ERR_print_errors (bio_err); goto end; - } - BIO_printf (bio_err, "MAC verified OK\n"); + } else BIO_printf (bio_err, "MAC verified OK\n"); #ifdef CRYPTO_MDEBUG CRYPTO_pop_info(); #endif @@ -556,9 +549,9 @@ int MAIN(int argc, char **argv) #ifdef CRYPTO_MDEBUG CRYPTO_pop_info(); #endif + PKCS12_free(p12); ret = 0; end: - PKCS12_free(p12); if(export_cert || inrand) app_RAND_write_file(NULL, bio_err); #ifdef CRYPTO_MDEBUG CRYPTO_remove_all_info(); @@ -573,14 +566,12 @@ int MAIN(int argc, char **argv) int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass, int passlen, int options, char *pempass) { - STACK_OF(PKCS7) *asafes; - STACK_OF(PKCS12_SAFEBAG) *bags; + STACK *asafes, *bags; int i, bagnid; PKCS7 *p7; - if (!( asafes = M_PKCS12_unpack_authsafes (p12))) return 0; - for (i = 0; i < sk_PKCS7_num (asafes); i++) { - p7 = sk_PKCS7_value (asafes, i); + for (i = 0; i < sk_num (asafes); i++) { + p7 = (PKCS7 *) sk_value (asafes, i); bagnid = OBJ_obj2nid (p7->type); if (bagnid == NID_pkcs7_data) { bags = M_PKCS12_unpack_p7data (p7); @@ -596,25 +587,23 @@ int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass, if (!bags) return 0; if (!dump_certs_pkeys_bags (out, bags, pass, passlen, options, pempass)) { - sk_PKCS12_SAFEBAG_pop_free (bags, PKCS12_SAFEBAG_free); + sk_pop_free (bags, PKCS12_SAFEBAG_free); return 0; } - sk_PKCS12_SAFEBAG_pop_free (bags, PKCS12_SAFEBAG_free); + sk_pop_free (bags, PKCS12_SAFEBAG_free); } - sk_PKCS7_pop_free (asafes, PKCS7_free); + sk_pop_free (asafes, PKCS7_free); return 1; } -int dump_certs_pkeys_bags (BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, - char *pass, int passlen, int options, char *pempass) +int dump_certs_pkeys_bags (BIO *out, STACK *bags, char *pass, + int passlen, int options, char *pempass) { int i; - for (i = 0; i < sk_PKCS12_SAFEBAG_num (bags); i++) { + for (i = 0; i < sk_num (bags); i++) { if (!dump_certs_pkeys_bag (out, - sk_PKCS12_SAFEBAG_value (bags, i), - pass, passlen, - options, pempass)) - return 0; + (PKCS12_SAFEBAG *)sk_value (bags, i), pass, passlen, + options, pempass)) return 0; } return 1; } diff --git a/apps/progs.h b/apps/progs.h index 7d2238493a4..ffb21bd64fd 100644 --- a/apps/progs.h +++ b/apps/progs.h @@ -33,7 +33,6 @@ extern int pkcs12_main(int argc,char *argv[]); extern int pkcs8_main(int argc,char *argv[]); extern int spkac_main(int argc,char *argv[]); extern int smime_main(int argc,char *argv[]); -extern int rand_main(int argc,char *argv[]); #define FUNC_TYPE_GENERAL 1 #define FUNC_TYPE_MD 2 @@ -104,7 +103,6 @@ FUNCTION functions[] = { {FUNC_TYPE_GENERAL,"pkcs8",pkcs8_main}, {FUNC_TYPE_GENERAL,"spkac",spkac_main}, {FUNC_TYPE_GENERAL,"smime",smime_main}, - {FUNC_TYPE_GENERAL,"rand",rand_main}, {FUNC_TYPE_MD,"md2",dgst_main}, {FUNC_TYPE_MD,"md5",dgst_main}, {FUNC_TYPE_MD,"sha",dgst_main}, diff --git a/apps/rand.c b/apps/rand.c deleted file mode 100644 index fa9bc023f40..00000000000 --- a/apps/rand.c +++ /dev/null @@ -1,140 +0,0 @@ -/* apps/rand.c */ - -#include "apps.h" - -#include <ctype.h> -#include <stdio.h> -#include <string.h> - -#include <openssl/bio.h> -#include <openssl/err.h> -#include <openssl/rand.h> - -#undef PROG -#define PROG rand_main - -/* -out file - write to file - * -rand file:file - PRNG seed files - * -base64 - encode output - * num - write 'num' bytes - */ - -int MAIN(int, char **); - -int MAIN(int argc, char **argv) - { - int i, r, ret = 1; - int badopt; - char *outfile = NULL; - char *inrand = NULL; - int base64 = 0; - BIO *out = NULL; - int num = -1; - - apps_startup(); - - if (bio_err == NULL) - if ((bio_err = BIO_new(BIO_s_file())) != NULL) - BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT); - - badopt = 0; - i = 0; - while (!badopt && argv[++i] != NULL) - { - if (strcmp(argv[i], "-out") == 0) - { - if ((argv[i+1] != NULL) && (outfile == NULL)) - outfile = argv[++i]; - else - badopt = 1; - } - else if (strcmp(argv[i], "-rand") == 0) - { - if ((argv[i+1] != NULL) && (inrand == NULL)) - inrand = argv[++i]; - else - badopt = 1; - } - else if (strcmp(argv[i], "-base64") == 0) - { - if (!base64) - base64 = 1; - else - badopt = 1; - } - else if (isdigit((unsigned char)argv[i][0])) - { - if (num < 0) - { - r = sscanf(argv[i], "%d", &num); - if (r == 0 || num < 0) - badopt = 1; - } - else - badopt = 1; - } - else - badopt = 1; - } - - if (num < 0) - badopt = 1; - - if (badopt) - { - BIO_printf(bio_err, "Usage: rand [options] num\n"); - BIO_printf(bio_err, "where options are\n"); - BIO_printf(bio_err, "-out file - write to file\n"); - BIO_printf(bio_err, "-rand file%cfile%c... - seed PRNG from files\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); - BIO_printf(bio_err, "-base64 - encode output\n"); - goto err; - } - - app_RAND_load_file(NULL, bio_err, (inrand != NULL)); - if (inrand != NULL) - BIO_printf(bio_err,"%ld semi-random bytes loaded\n", - app_RAND_load_files(inrand)); - - out = BIO_new(BIO_s_file()); - if (out == NULL) - goto err; - if (outfile != NULL) - r = BIO_write_filename(out, outfile); - else - r = BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT); - if (r <= 0) - goto err; - - if (base64) - { - BIO *b64 = BIO_new(BIO_f_base64()); - if (b64 == NULL) - goto err; - out = BIO_push(b64, out); - } - - while (num > 0) - { - unsigned char buf[4096]; - int chunk; - - chunk = num; - if (chunk > sizeof buf) - chunk = sizeof buf; - r = RAND_bytes(buf, chunk); - if (r <= 0) - goto err; - BIO_write(out, buf, chunk); - num -= chunk; - } - BIO_flush(out); - - app_RAND_write_file(NULL, bio_err); - ret = 0; - -err: - ERR_print_errors(bio_err); - if (out) - BIO_free_all(out); - EXIT(ret); - } diff --git a/apps/req.c b/apps/req.c index eb338eeb1b2..97bb0d0ed87 100644 --- a/apps/req.c +++ b/apps/req.c @@ -878,8 +878,8 @@ end: EVP_PKEY_free(pkey); X509_REQ_free(req); X509_free(x509ss); - if(passargin && passin) Free(passin); - if(passargout && passout) Free(passout); + if(passin) Free(passin); + if(passout) Free(passout); OBJ_cleanup(); #ifndef NO_DSA if (dsa_params != NULL) DSA_free(dsa_params); diff --git a/apps/rsa.c b/apps/rsa.c index 9d4c2e65640..53d234ca350 100644 --- a/apps/rsa.c +++ b/apps/rsa.c @@ -179,6 +179,7 @@ bad: BIO_printf(bio_err," -outform arg output format - one of DER NET PEM\n"); BIO_printf(bio_err," -in arg input file\n"); BIO_printf(bio_err," -passin arg input file pass phrase source\n"); + BIO_printf(bio_err," -in arg input file\n"); BIO_printf(bio_err," -out arg output file\n"); BIO_printf(bio_err," -passout arg output file pass phrase source\n"); BIO_printf(bio_err," -des encrypt PEM output with cbc des\n"); diff --git a/apps/rsa/01.pem b/apps/rsa/01.pem new file mode 100644 index 00000000000..36ec57598ef --- /dev/null +++ b/apps/rsa/01.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICTjCCAbsCEGiuFKTJn6nzmiPPLxUZs1owDQYJKoZIhvcNAQEEBQAwXzELMAkG +A1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYD +VQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk4 +MDUxODAwMDAwMFoXDTk5MDUxODIzNTk1OVowdTELMAkGA1UEBhMCVVMxETAPBgNV +BAgTCE5ldyBZb3JrMREwDwYDVQQHFAhOZXcgWW9yazEeMBwGA1UEChQVSW5kdXN0 +cmlhbCBQcmVzcyBJbmMuMSAwHgYDVQQDFBd3d3cuaW5kdXN0cmlhbHByZXNzLmNv +bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAqiH9xUJNHvqCmaDon27ValJb +qTLymF3yKKWBxbODLWjX7yKjewoqWhotaEARI6jXPqomU87gFU1tH4r/bgwh3FmU +MK3qo92XOsvwNAHzXzWRXQNJmm54g2F1RUt00pgYiOximDse1t9RL5POCDEbfX8D +gugrE/WwkS2FrSoc5/cCAwEAATANBgkqhkiG9w0BAQQFAAN+AIw7fvF0EtEvrNS/ +LYuqAgUw/tH0FLgCkqKLmYYm/yR+Z0hD2eP/UhF+jAwmV8rHtBnaTM7oN23RVW2k +Cf8soiGfr2PYtfufpXtd7azUFa+WJCWnp0N29EG0BR1JOFC0Q/4dh/X9qulM8luq +Pjrmw2eSgbdmmdumWAcNPVbV +-----END CERTIFICATE----- diff --git a/apps/rsa/1.txt b/apps/rsa/1.txt new file mode 100644 index 00000000000..95a862e150e --- /dev/null +++ b/apps/rsa/1.txt @@ -0,0 +1,50 @@ +issuer= /C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority +subject=/C=US/ST=New York/L=New York/O=Industrial Press Inc./CN=www.industrialpress.com +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 68:ae:14:a4:c9:9f:a9:f3:9a:23:cf:2f:15:19:b3:5a + Signature Algorithm: md5WithRSAEncryption + Issuer: C=US, O=RSA Data Security, Inc., OU=Secure Server Certification Authority + Validity + Not Before: May 18 00:00:00 1998 GMT + Not After : May 18 23:59:59 1999 GMT + Subject: C=US, ST=New York, L=New York, O=Industrial Press Inc., CN=www.industrialpress.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:aa:21:fd:c5:42:4d:1e:fa:82:99:a0:e8:9f:6e: + d5:6a:52:5b:a9:32:f2:98:5d:f2:28:a5:81:c5:b3: + 83:2d:68:d7:ef:22:a3:7b:0a:2a:5a:1a:2d:68:40: + 11:23:a8:d7:3e:aa:26:53:ce:e0:15:4d:6d:1f:8a: + ff:6e:0c:21:dc:59:94:30:ad:ea:a3:dd:97:3a:cb: + f0:34:01:f3:5f:35:91:5d:03:49:9a:6e:78:83:61: + 75:45:4b:74:d2:98:18:88:ec:62:98:3b:1e:d6:df: + 51:2f:93:ce:08:31:1b:7d:7f:03:82:e8:2b:13:f5: + b0:91:2d:85:ad:2a:1c:e7:f7 + Exponent: 65537 (0x10001) + Signature Algorithm: md5WithRSAEncryption + 8c:3b:7e:f1:74:12:d1:2f:ac:d4:bf:2d:8b:aa:02:05:30:fe: + d1:f4:14:b8:02:92:a2:8b:99:86:26:ff:24:7e:67:48:43:d9: + e3:ff:52:11:7e:8c:0c:26:57:ca:c7:b4:19:da:4c:ce:e8:37: + 6d:d1:55:6d:a4:09:ff:2c:a2:21:9f:af:63:d8:b5:fb:9f:a5: + 7b:5d:ed:ac:d4:15:af:96:24:25:a7:a7:43:76:f4:41:b4:05: + 1d:49:38:50:b4:43:fe:1d:87:f5:fd:aa:e9:4c:f2:5b:aa:3e: + 3a:e6:c3:67:92:81:b7:66:99:db:a6:58:07:0d:3d:56:d5 +-----BEGIN CERTIFICATE----- +MIICTjCCAbsCEGiuFKTJn6nzmiPPLxUZs1owDQYJKoZIhvcNAQEEBQAwXzELMAkG +A1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYD +VQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk4 +MDUxODAwMDAwMFoXDTk5MDUxODIzNTk1OVowdTELMAkGA1UEBhMCVVMxETAPBgNV +BAgTCE5ldyBZb3JrMREwDwYDVQQHFAhOZXcgWW9yazEeMBwGA1UEChQVSW5kdXN0 +cmlhbCBQcmVzcyBJbmMuMSAwHgYDVQQDFBd3d3cuaW5kdXN0cmlhbHByZXNzLmNv +bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAqiH9xUJNHvqCmaDon27ValJb +qTLymF3yKKWBxbODLWjX7yKjewoqWhotaEARI6jXPqomU87gFU1tH4r/bgwh3FmU +MK3qo92XOsvwNAHzXzWRXQNJmm54g2F1RUt00pgYiOximDse1t9RL5POCDEbfX8D +gugrE/WwkS2FrSoc5/cCAwEAATANBgkqhkiG9w0BAQQFAAN+AIw7fvF0EtEvrNS/ +LYuqAgUw/tH0FLgCkqKLmYYm/yR+Z0hD2eP/UhF+jAwmV8rHtBnaTM7oN23RVW2k +Cf8soiGfr2PYtfufpXtd7azUFa+WJCWnp0N29EG0BR1JOFC0Q/4dh/X9qulM8luq +Pjrmw2eSgbdmmdumWAcNPVbV +-----END CERTIFICATE----- diff --git a/apps/rsa/SecureServer.pem b/apps/rsa/SecureServer.pem new file mode 100644 index 00000000000..7c8ffb2cd85 --- /dev/null +++ b/apps/rsa/SecureServer.pem @@ -0,0 +1,47 @@ +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 02:ad:66:7e:4e:45:fe:5e:57:6f:3c:98:19:5e:dd:c0 + Signature Algorithm: md2WithRSAEncryption + Issuer: C=US, O=RSA Data Security, Inc., OU=Secure Server Certification Authority + Validity + Not Before: Nov 9 00:00:00 1994 GMT + Not After : Jan 7 23:59:59 2010 GMT + Subject: C=US, O=RSA Data Security, Inc., OU=Secure Server Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1000 bit) + Modulus (1000 bit): + 00:92:ce:7a:c1:ae:83:3e:5a:aa:89:83:57:ac:25: + 01:76:0c:ad:ae:8e:2c:37:ce:eb:35:78:64:54:03: + e5:84:40:51:c9:bf:8f:08:e2:8a:82:08:d2:16:86: + 37:55:e9:b1:21:02:ad:76:68:81:9a:05:a2:4b:c9: + 4b:25:66:22:56:6c:88:07:8f:f7:81:59:6d:84:07: + 65:70:13:71:76:3e:9b:77:4c:e3:50:89:56:98:48: + b9:1d:a7:29:1a:13:2e:4a:11:59:9c:1e:15:d5:49: + 54:2c:73:3a:69:82:b1:97:39:9c:6d:70:67:48:e5: + dd:2d:d6:c8:1e:7b + Exponent: 65537 (0x10001) + Signature Algorithm: md2WithRSAEncryption + 65:dd:7e:e1:b2:ec:b0:e2:3a:e0:ec:71:46:9a:19:11:b8:d3: + c7:a0:b4:03:40:26:02:3e:09:9c:e1:12:b3:d1:5a:f6:37:a5: + b7:61:03:b6:5b:16:69:3b:c6:44:08:0c:88:53:0c:6b:97:49: + c7:3e:35:dc:6c:b9:bb:aa:df:5c:bb:3a:2f:93:60:b6:a9:4b: + 4d:f2:20:f7:cd:5f:7f:64:7b:8e:dc:00:5c:d7:fa:77:ca:39: + 16:59:6f:0e:ea:d3:b5:83:7f:4d:4d:42:56:76:b4:c9:5f:04: + f8:38:f8:eb:d2:5f:75:5f:cd:7b:fc:e5:8e:80:7c:fc:50 +-----BEGIN CERTIFICATE----- +MIICNDCCAaECEAKtZn5ORf5eV288mBle3cAwDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYD +VQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk0 +MTEwOTAwMDAwMFoXDTEwMDEwNzIzNTk1OVowXzELMAkGA1UEBhMCVVMxIDAeBgNV +BAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYDVQQLEyVTZWN1cmUgU2Vy +dmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGbMA0GCSqGSIb3DQEBAQUAA4GJ +ADCBhQJ+AJLOesGugz5aqomDV6wlAXYMra6OLDfO6zV4ZFQD5YRAUcm/jwjiioII +0haGN1XpsSECrXZogZoFokvJSyVmIlZsiAeP94FZbYQHZXATcXY+m3dM41CJVphI +uR2nKRoTLkoRWZweFdVJVCxzOmmCsZc5nG1wZ0jl3S3WyB57AgMBAAEwDQYJKoZI +hvcNAQECBQADfgBl3X7hsuyw4jrg7HFGmhkRuNPHoLQDQCYCPgmc4RKz0Vr2N6W3 +YQO2WxZpO8ZECAyIUwxrl0nHPjXcbLm7qt9cuzovk2C2qUtN8iD3zV9/ZHuO3ABc +1/p3yjkWWW8O6tO1g39NTUJWdrTJXwT4OPjr0l91X817/OWOgHz8UA== +-----END CERTIFICATE----- diff --git a/apps/rsa/s.txt b/apps/rsa/s.txt new file mode 100644 index 00000000000..7de7e0764fa --- /dev/null +++ b/apps/rsa/s.txt @@ -0,0 +1,49 @@ +issuer= /C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority +subject=/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 02:ad:66:7e:4e:45:fe:5e:57:6f:3c:98:19:5e:dd:c0 + Signature Algorithm: md2WithRSAEncryption + Issuer: C=US, O=RSA Data Security, Inc., OU=Secure Server Certification Authority + Validity + Not Before: Nov 9 00:00:00 1994 GMT + Not After : Jan 7 23:59:59 2010 GMT + Subject: C=US, O=RSA Data Security, Inc., OU=Secure Server Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1000 bit) + Modulus (1000 bit): + 00:92:ce:7a:c1:ae:83:3e:5a:aa:89:83:57:ac:25: + 01:76:0c:ad:ae:8e:2c:37:ce:eb:35:78:64:54:03: + e5:84:40:51:c9:bf:8f:08:e2:8a:82:08:d2:16:86: + 37:55:e9:b1:21:02:ad:76:68:81:9a:05:a2:4b:c9: + 4b:25:66:22:56:6c:88:07:8f:f7:81:59:6d:84:07: + 65:70:13:71:76:3e:9b:77:4c:e3:50:89:56:98:48: + b9:1d:a7:29:1a:13:2e:4a:11:59:9c:1e:15:d5:49: + 54:2c:73:3a:69:82:b1:97:39:9c:6d:70:67:48:e5: + dd:2d:d6:c8:1e:7b + Exponent: 65537 (0x10001) + Signature Algorithm: md2WithRSAEncryption + 65:dd:7e:e1:b2:ec:b0:e2:3a:e0:ec:71:46:9a:19:11:b8:d3: + c7:a0:b4:03:40:26:02:3e:09:9c:e1:12:b3:d1:5a:f6:37:a5: + b7:61:03:b6:5b:16:69:3b:c6:44:08:0c:88:53:0c:6b:97:49: + c7:3e:35:dc:6c:b9:bb:aa:df:5c:bb:3a:2f:93:60:b6:a9:4b: + 4d:f2:20:f7:cd:5f:7f:64:7b:8e:dc:00:5c:d7:fa:77:ca:39: + 16:59:6f:0e:ea:d3:b5:83:7f:4d:4d:42:56:76:b4:c9:5f:04: + f8:38:f8:eb:d2:5f:75:5f:cd:7b:fc:e5:8e:80:7c:fc:50 +-----BEGIN CERTIFICATE----- +MIICNDCCAaECEAKtZn5ORf5eV288mBle3cAwDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYD +VQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk0 +MTEwOTAwMDAwMFoXDTEwMDEwNzIzNTk1OVowXzELMAkGA1UEBhMCVVMxIDAeBgNV +BAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYDVQQLEyVTZWN1cmUgU2Vy +dmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGbMA0GCSqGSIb3DQEBAQUAA4GJ +ADCBhQJ+AJLOesGugz5aqomDV6wlAXYMra6OLDfO6zV4ZFQD5YRAUcm/jwjiioII +0haGN1XpsSECrXZogZoFokvJSyVmIlZsiAeP94FZbYQHZXATcXY+m3dM41CJVphI +uR2nKRoTLkoRWZweFdVJVCxzOmmCsZc5nG1wZ0jl3S3WyB57AgMBAAEwDQYJKoZI +hvcNAQECBQADfgBl3X7hsuyw4jrg7HFGmhkRuNPHoLQDQCYCPgmc4RKz0Vr2N6W3 +YQO2WxZpO8ZECAyIUwxrl0nHPjXcbLm7qt9cuzovk2C2qUtN8iD3zV9/ZHuO3ABc +1/p3yjkWWW8O6tO1g39NTUJWdrTJXwT4OPjr0l91X817/OWOgHz8UA== +-----END CERTIFICATE----- diff --git a/apps/s_apps.h b/apps/s_apps.h index 57af7c0f8cf..1a0e9f9f92f 100644 --- a/apps/s_apps.h +++ b/apps/s_apps.h @@ -84,6 +84,7 @@ typedef fd_mask fd_set; #define PORT_STR "4433" #define PROTOCOL "tcp" +int do_accept(int acc_sock, int *sock, char **host); int do_server(int port, int *ret, int (*cb) (), char *context); #ifdef HEADER_X509_H int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx); @@ -96,9 +97,17 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file); int set_cert_stuff(char *ctx, char *cert_file, char *key_file); #endif int init_client(int *sock, char *server, int port); +int init_client_ip(int *sock,unsigned char ip[4], int port); +int nbio_init_client_ip(int *sock,unsigned char ip[4], int port); +int nbio_sock_error(int sock); +int spawn(int argc, char **argv, int *in, int *out); +int init_server(int *sock, int port); +int init_server_long(int *sock, int port,char *ip); int should_retry(int i); +void sock_cleanup(void ); int extract_port(char *str, short *port_ptr); int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p); +int host_ip(char *str, unsigned char ip[4]); long MS_CALLBACK bio_dump_cb(BIO *bio, int cmd, const char *argp, int argi, long argl, long ret); diff --git a/apps/s_cb.c b/apps/s_cb.c index fd622597d62..fdb11a1d11d 100644 --- a/apps/s_cb.c +++ b/apps/s_cb.c @@ -1,4 +1,4 @@ -/* apps/s_cb.c - callback functions used by s_client, s_server, and s_time */ +/* apps/s_cb.c */ /* Copyright (C) 1995-1998 Eric Young ([email protected]) * All rights reserved. * diff --git a/apps/s_client.c b/apps/s_client.c index e629f8e7f13..c4c3b0e94a5 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -117,7 +117,6 @@ static void sc_usage(void); static void print_stuff(BIO *berr,SSL *con,int full); static BIO *bio_c_out=NULL; static int c_quiet=0; -static int c_ign_eof=0; static void sc_usage(void) { @@ -144,7 +143,6 @@ static void sc_usage(void) #endif BIO_printf(bio_err," -crlf - convert LF from terminal into CRLF\n"); BIO_printf(bio_err," -quiet - no s_client output\n"); - BIO_printf(bio_err," -ign_eof - ignore input eof (default when -quiet)\n"); BIO_printf(bio_err," -ssl2 - just use SSLv2\n"); BIO_printf(bio_err," -ssl3 - just use SSLv3\n"); BIO_printf(bio_err," -tls1 - just use TLSv1\n"); @@ -194,7 +192,6 @@ int MAIN(int argc, char **argv) apps_startup(); c_Pause=0; c_quiet=0; - c_ign_eof=0; c_debug=0; c_showcerts=0; @@ -252,12 +249,7 @@ int MAIN(int argc, char **argv) else if (strcmp(*argv,"-crlf") == 0) crlf=1; else if (strcmp(*argv,"-quiet") == 0) - { c_quiet=1; - c_ign_eof=1; - } - else if (strcmp(*argv,"-ign_eof") == 0) - c_ign_eof=1; else if (strcmp(*argv,"-pause") == 0) c_Pause=1; else if (strcmp(*argv,"-debug") == 0) @@ -719,13 +711,13 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240 else i=read(fileno(stdin),cbuf,BUFSIZZ); - if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] == 'Q'))) + if ((!c_quiet) && ((i <= 0) || (cbuf[0] == 'Q'))) { BIO_printf(bio_err,"DONE\n"); goto shut; } - if ((!c_ign_eof) && (cbuf[0] == 'R')) + if ((!c_quiet) && (cbuf[0] == 'R')) { BIO_printf(bio_err,"RENEGOTIATING\n"); SSL_renegotiate(con); diff --git a/apps/s_socket.c b/apps/s_socket.c index 081b1a57d17..888b66df18e 100644 --- a/apps/s_socket.c +++ b/apps/s_socket.c @@ -1,4 +1,4 @@ -/* apps/s_socket.c - socket-related functions used by s_client and s_server */ +/* apps/s_socket.c */ /* Copyright (C) 1995-1998 Eric Young ([email protected]) * All rights reserved. * @@ -79,17 +79,16 @@ typedef unsigned int u_int; #include "s_apps.h" #include <openssl/ssl.h> -static struct hostent *GetHostByName(char *name); -#ifdef WINDOWS -static void sock_cleanup(void); +#ifdef VMS +#if (__VMS_VER < 70000000) /* FIONBIO used as a switch to enable ioctl, + and that isn't in VMS < 7.0 */ +#undef FIONBIO +#endif +#include <processes.h> /* for vfork() */ #endif -static int sock_init(void); -static int init_client_ip(int *sock,unsigned char ip[4], int port); -static int init_server(int *sock, int port); -static int init_server_long(int *sock, int port,char *ip); -static int do_accept(int acc_sock, int *sock, char **host); -static int host_ip(char *str, unsigned char ip[4]); +static struct hostent *GetHostByName(char *name); +int sock_init(void ); #ifdef WIN16 #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ #else @@ -132,19 +131,19 @@ static BOOL CALLBACK enumproc(HWND hwnd,LPARAM lParam) #endif /* WIN32 */ #endif /* WINDOWS */ -#ifdef WINDOWS -static void sock_cleanup(void) +void sock_cleanup(void) { +#ifdef WINDOWS if (wsa_init_done) { wsa_init_done=0; WSACancelBlockingCall(); WSACleanup(); } - } #endif + } -static int sock_init(void) +int sock_init(void) { #ifdef WINDOWS if (!wsa_init_done) @@ -188,7 +187,7 @@ int init_client(int *sock, char *host, int port) return(init_client_ip(sock,ip,port)); } -static int init_client_ip(int *sock, unsigned char ip[4], int port) +int init_client_ip(int *sock, unsigned char ip[4], int port) { unsigned long addr; struct sockaddr_in them; @@ -219,6 +218,75 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port) return(1); } +int nbio_sock_error(int sock) + { + int j,i; + int size; + + size=sizeof(int); + /* Note: under VMS with SOCKETSHR the third parameter is currently + * of type (int *) whereas under other systems it is (void *) if + * you don't have a cast it will choke the compiler: if you do + * have a cast then you can either go for (int *) or (void *). + */ + i=getsockopt(sock,SOL_SOCKET,SO_ERROR,(char *)&j,(void *)&size); + if (i < 0) + return(1); + else + return(j); + } + +int nbio_init_client_ip(int *sock, unsigned char ip[4], int port) + { + unsigned long addr; + struct sockaddr_in them; + int s,i; + + if (!sock_init()) return(0); + + memset((char *)&them,0,sizeof(them)); + them.sin_family=AF_INET; + them.sin_port=htons((unsigned short)port); + addr= (unsigned long) + ((unsigned long)ip[0]<<24L)| + ((unsigned long)ip[1]<<16L)| + ((unsigned long)ip[2]<< 8L)| + ((unsigned long)ip[3]); + them.sin_addr.s_addr=htonl(addr); + + if (*sock <= 0) + { +#ifdef FIONBIO + unsigned long l=1; +#endif + + s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); + if (s == INVALID_SOCKET) { perror("socket"); return(0); } + + i=0; + i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i)); + if (i < 0) { perror("keepalive"); return(0); } + *sock=s; + +#ifdef FIONBIO + BIO_socket_ioctl(s,FIONBIO,&l); +#endif + } + else + s= *sock; + + i=connect(s,(struct sockaddr *)&them,sizeof(them)); + if (i == INVALID_SOCKET) + { + if (BIO_sock_should_retry(i)) + return(-1); + else + return(0); + } + else + return(1); + } + int do_server(int port, int *ret, int (*cb)(), char *context) { int sock; @@ -251,7 +319,7 @@ int do_server(int port, int *ret, int (*cb)(), char *context) } } -static int init_server_long(int *sock, int port, char *ip) +int init_server_long(int *sock, int port, char *ip) { int ret=0; struct sockaddr_in server; @@ -301,12 +369,12 @@ err: return(ret); } -static int init_server(int *sock, int port) +int init_server(int *sock, int port) { return(init_server_long(sock, port, NULL)); } -static int do_accept(int acc_sock, int *sock, char **host) +int do_accept(int acc_sock, int *sock, char **host) { int ret,i; struct hostent *h1,*h2; @@ -422,7 +490,7 @@ err: return(0); } -static int host_ip(char *str, unsigned char ip[4]) +int host_ip(char *str, unsigned char ip[4]) { unsigned int in[4]; int i; @@ -538,3 +606,69 @@ static struct hostent *GetHostByName(char *name) return(ret); } } + +#ifndef MSDOS +int spawn(int argc, char **argv, int *in, int *out) + { + int pid; +#define CHILD_READ p1[0] +#define CHILD_WRITE p2[1] +#define PARENT_READ p2[0] +#define PARENT_WRITE p1[1] + int p1[2],p2[2]; + + if ((pipe(p1) < 0) || (pipe(p2) < 0)) return(-1); + +#ifdef VMS + if ((pid=vfork()) == 0) +#else + if ((pid=fork()) == 0) +#endif + { /* child */ + if (dup2(CHILD_WRITE,fileno(stdout)) < 0) + perror("dup2"); + if (dup2(CHILD_WRITE,fileno(stderr)) < 0) + perror("dup2"); + if (dup2(CHILD_READ,fileno(stdin)) < 0) + perror("dup2"); + close(CHILD_READ); + close(CHILD_WRITE); + + close(PARENT_READ); + close(PARENT_WRITE); + execvp(argv[0],argv); + perror("child"); + exit(1); + } + + /* parent */ + *in= PARENT_READ; + *out=PARENT_WRITE; + close(CHILD_READ); + close(CHILD_WRITE); + return(pid); + } +#endif /* MSDOS */ + + +#ifdef undef + /* Turn on synchronous sockets so that we can do a WaitForMultipleObjects + * on sockets */ + { + SOCKET s; + int optionValue = SO_SYNCHRONOUS_NONALERT; + int err; + + err = setsockopt( + INVALID_SOCKET, + SOL_SOCKET, + SO_OPENTYPE, + (char *)&optionValue, + sizeof(optionValue)); + if (err != NO_ERROR) { + /* failed for some reason... */ + BIO_printf(bio_err, "failed to setsockopt(SO_OPENTYPE, SO_SYNCHRONOUS_ALERT) - %d\n", + WSAGetLastError()); + } + } +#endif diff --git a/apps/smime.c b/apps/smime.c index 7dc66d6ecd5..77633cfb600 100644 --- a/apps/smime.c +++ b/apps/smime.c @@ -272,7 +272,7 @@ int MAIN(int argc, char **argv) BIO_printf (bio_err, "-text include or delete text MIME headers\n"); BIO_printf (bio_err, "-CApath dir trusted certificates directory\n"); BIO_printf (bio_err, "-CAfile file trusted certificates file\n"); - BIO_printf(bio_err, "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); + BIO_printf(bio_err, "-rand file:file:...\n"); BIO_printf(bio_err, " load the file (or the files in the directory) into\n"); BIO_printf(bio_err, " the random number generator\n"); BIO_printf (bio_err, "cert.pem recipient certificate(s) for encryption\n"); @@ -309,6 +309,9 @@ int MAIN(int argc, char **argv) goto end; #endif } +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("load encryption certificates"); +#endif encerts = sk_X509_new_null(); while (*args) { if(!(cert = load_cert(*args))) { @@ -319,29 +322,50 @@ int MAIN(int argc, char **argv) cert = NULL; args++; } +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif } if(signerfile && (operation == SMIME_SIGN)) { +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("load signer certificate"); +#endif if(!(signer = load_cert(signerfile))) { BIO_printf(bio_err, "Can't read signer certificate file %s\n", signerfile); goto end; } +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif } if(certfile) { +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("load other certfiles"); +#endif if(!(other = load_certs(certfile))) { BIO_printf(bio_err, "Can't read certificate file %s\n", certfile); ERR_print_errors(bio_err); goto end; } +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif } if(recipfile && (operation == SMIME_DECRYPT)) { +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("load recipient certificate"); +#endif if(!(recip = load_cert(recipfile))) { BIO_printf(bio_err, "Can't read recipient certificate file %s\n", recipfile); ERR_print_errors(bio_err); goto end; } +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif } if(operation == SMIME_DECRYPT) { @@ -351,13 +375,22 @@ int MAIN(int argc, char **argv) } else keyfile = NULL; if(keyfile) { +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("load keyfile"); +#endif if(!(key = load_key(keyfile, passin))) { BIO_printf(bio_err, "Can't read recipient certificate file %s\n", keyfile); ERR_print_errors(bio_err); goto end; } +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif } +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("open input files"); +#endif if (infile) { if (!(in = BIO_new_file(infile, inmode))) { BIO_printf (bio_err, @@ -365,7 +398,13 @@ int MAIN(int argc, char **argv) goto end; } } else in = BIO_new_fp(stdin, BIO_NOCLOSE); +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("open output files"); +#endif if (outfile) { if (!(out = BIO_new_file(outfile, outmode))) { BIO_printf (bio_err, @@ -373,23 +412,50 @@ int MAIN(int argc, char **argv) goto end; } } else out = BIO_new_fp(stdout, BIO_NOCLOSE); +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif if(operation == SMIME_VERIFY) { +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("setup_verify"); +#endif if(!(store = setup_verify(CAfile, CApath))) goto end; +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif } ret = 3; if(operation == SMIME_ENCRYPT) { +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("PKCS7_encrypt"); +#endif p7 = PKCS7_encrypt(encerts, in, cipher, flags); +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif } else if(operation == SMIME_SIGN) { +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("PKCS7_sign"); +#endif p7 = PKCS7_sign(signer, key, other, in, flags); BIO_reset(in); +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif } else { +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("SMIME_read_PKCS7"); +#endif if(!(p7 = SMIME_read_PKCS7(in, &indata))) { BIO_printf(bio_err, "Error reading S/MIME message\n"); goto end; } +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif } if(!p7) { @@ -399,25 +465,45 @@ int MAIN(int argc, char **argv) ret = 4; if(operation == SMIME_DECRYPT) { +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("PKCS7_decrypt"); +#endif if(!PKCS7_decrypt(p7, key, recip, out, flags)) { BIO_printf(bio_err, "Error decrypting PKCS#7 structure\n"); goto end; } +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif } else if(operation == SMIME_VERIFY) { STACK_OF(X509) *signers; +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("PKCS7_verify"); +#endif if(PKCS7_verify(p7, other, store, indata, out, flags)) { BIO_printf(bio_err, "Verification Successful\n"); } else { BIO_printf(bio_err, "Verification Failure\n"); goto end; } +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); + CRYPTO_push_info("PKCS7_get0_signers"); +#endif signers = PKCS7_get0_signers(p7, other, flags); +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); + CRYPTO_push_info("save_certs"); +#endif if(!save_certs(signerfile, signers)) { BIO_printf(bio_err, "Error writing signers to %s\n", signerfile); ret = 5; goto end; } +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif sk_X509_free(signers); } else if(operation == SMIME_PK7OUT) { PEM_write_bio_PKCS7(out, p7); @@ -429,6 +515,9 @@ int MAIN(int argc, char **argv) } ret = 0; end: +#ifdef CRYPTO_MDEBUG + CRYPTO_remove_all_info(); +#endif if (need_rand) app_RAND_write_file(NULL, bio_err); if(ret) ERR_print_errors(bio_err); @@ -494,9 +583,20 @@ static X509_STORE *setup_verify(char *CAfile, char *CApath) { X509_STORE *store; X509_LOOKUP *lookup; +#ifdef CRYPTO_MDEBUG + CRYPTO_push_info("X509_STORE_new"); +#endif if(!(store = X509_STORE_new())) goto end; +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); + CRYPTO_push_info("X509_STORE_add_lookup(...file)"); +#endif lookup=X509_STORE_add_lookup(store,X509_LOOKUP_file()); if (lookup == NULL) goto end; +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); + CRYPTO_push_info("X509_LOOKUP_load_file"); +#endif if (CAfile) { if(!X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM)) { BIO_printf(bio_err, "Error loading file %s\n", CAfile); @@ -504,14 +604,25 @@ static X509_STORE *setup_verify(char *CAfile, char *CApath) } } else X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT); +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); + CRYPTO_push_info("X509_STORE_add_lookup(...hash_dir)"); +#endif lookup=X509_STORE_add_lookup(store,X509_LOOKUP_hash_dir()); if (lookup == NULL) goto end; +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); + CRYPTO_push_info("X509_LOOKUP_add_dir"); +#endif if (CApath) { if(!X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM)) { BIO_printf(bio_err, "Error loading directory %s\n", CApath); goto end; } } else X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT); +#ifdef CRYPTO_MDEBUG + CRYPTO_pop_info(); +#endif ERR_clear_error(); return store; diff --git a/apps/speed.c b/apps/speed.c index f7a8e00a8bc..b3130def8b9 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -1030,11 +1030,6 @@ int MAIN(int argc, char **argv) RAND_pseudo_bytes(buf,20); #ifndef NO_DSA - if (RAND_status() != 1) - { - RAND_seed(rnd_seed, sizeof rnd_seed); - rnd_fake = 1; - } for (j=0; j<DSA_NUM; j++) { unsigned int kk; @@ -1094,7 +1089,6 @@ int MAIN(int argc, char **argv) dsa_doit[j]=0; } } - if (rnd_fake) RAND_cleanup(); #endif fprintf(stdout,"%s\n",SSLeay_version(SSLEAY_VERSION)); diff --git a/apps/spkac.c b/apps/spkac.c index f3ee7e34e3a..b35354a8d79 100644 --- a/apps/spkac.c +++ b/apps/spkac.c @@ -63,10 +63,8 @@ #include <time.h> #include "apps.h" #include <openssl/bio.h> -#include <openssl/conf.h> #include <openssl/err.h> #include <openssl/evp.h> -#include <openssl/lhash.h> #include <openssl/x509.h> #include <openssl/pem.h> diff --git a/apps/testdsa.h b/apps/testdsa.h index f0bfbb1ffa2..a322978f8c2 100644 --- a/apps/testdsa.h +++ b/apps/testdsa.h @@ -1,5 +1,4 @@ /* NOCW */ -/* used by apps/speed.c */ DSA *get_dsa512(void ); DSA *get_dsa1024(void ); DSA *get_dsa2048(void ); @@ -147,5 +146,3 @@ DSA *get_dsa2048() return(dsa); } -static const char rnd_seed[] = "string to make the random number generator think it has entropy"; -static int rnd_fake = 0; diff --git a/apps/testrsa.h b/apps/testrsa.h index 3007d792b0d..9a0e811c73f 100644 --- a/apps/testrsa.h +++ b/apps/testrsa.h @@ -1,5 +1,4 @@ /* apps/testrsa.h */ -/* used by apps/speed.c */ /* Copyright (C) 1995-1998 Eric Young ([email protected]) * All rights reserved. * diff --git a/apps/tkca b/apps/tkca new file mode 100644 index 00000000000..bdaf21606af --- /dev/null +++ b/apps/tkca @@ -0,0 +1,66 @@ +#!/usr/local/bin/perl5 +# +# This is only something I'm playing with, it does not work :-) +# + +use Tk; + +my $main=MainWindow->new(); +my $f=$main->Frame(-relief => "ridge", -borderwidth => 2); +$f->pack(-fill => 'x'); + +my $ff=$f->Frame; +$ff->pack(-fill => 'x'); +my $l=$ff->Label(-text => "TkCA - SSLeay", + -relief => "ridge", -borderwidth => 2); +$l->pack(-fill => 'x', -ipady => 5); + +my $l=$ff->Button(-text => "Certify"); +$l->pack(-fill => 'x', -ipady => 5); + +my $l=$ff->Button(-text => "Review"); +$l->pack(-fill => 'x', -ipady => 5); + +my $l=$ff->Button(-text => "Revoke"); +$l->pack(-fill => 'x', -ipady => 5); + +my $l=$ff->Button(-text => "Generate CRL"); +$l->pack(-fill => 'x', -ipady => 5); + +my($db)=&load_db("demoCA/index.txt"); + +MainLoop; + +sub load_db + { + my(%ret); + my($file)=@_; + my(*IN); + my(%db_serial,%db_name,@f,@db_s); + + $ret{'serial'}=\%db_serial; + $ret{'name'}=\%db_name; + + open(IN,"<$file") || die "unable to open $file:$!\n"; + while (<IN>) + { + chop; + s/([^\\])\t/\1\t\t/g; + my(@f)=split(/\t\t/); + die "wrong number of fields in $file, line $.\n" + if ($#f != 5); + + my(%f); + $f{'type'}=$f[0]; + $f{'exp'}=$f[1]; + $f{'rev'}=$f[2]; + $f{'serial'}=$f[3]; + $f{'file'}=$f[4]; + $f{'name'}=$f[5]; + die "serial number $f{'serial'} appears twice (line $.)\n" + if (defined($db{$f{'serial'}})) + $db_serial{$f{'serial'}}=\%f; + $db_name{$f{'name'}}.=$f{'serial'}." "; + } + return \%ret; + } diff --git a/apps/winrand.c b/apps/winrand.c deleted file mode 100644 index d042258b504..00000000000 --- a/apps/winrand.c +++ /dev/null @@ -1,149 +0,0 @@ -/* apps/winrand.c */ -/* ==================================================================== - * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. - * - * 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 above 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 acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * [email protected]. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED 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 OpenSSL PROJECT OR - * ITS 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. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * ([email protected]). This product includes software written by Tim - * Hudson ([email protected]). - * - */ - -/* Usage: winrand [filename] - * - * Collects entropy from mouse movements and other events and writes - * random data to filename or .rnd - */ - -#include <windows.h> -#include <openssl/opensslv.h> -#include <openssl/rand.h> - -LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); -const char *filename; - -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, - PSTR cmdline, int iCmdShow) - { - static char appname[] = "OpenSSL"; - HWND hwnd; - MSG msg; - WNDCLASSEX wndclass; - char buffer[200]; - - if (cmdline[0] == '\0') - filename = RAND_file_name(buffer, sizeof buffer); - else - filename = cmdline; - - RAND_load_file(filename, -1); - - wndclass.cbSize = sizeof(wndclass); - wndclass.style = CS_HREDRAW | CS_VREDRAW; - wndclass.lpfnWndProc = WndProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = hInstance; - wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); - wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = appname; - wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION); - RegisterClassEx(&wndclass); - - hwnd = CreateWindow(appname, OPENSSL_VERSION_TEXT, - WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); - - ShowWindow(hwnd, iCmdShow); - UpdateWindow(hwnd); - - - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return msg.wParam; - } - -LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) - { - HDC hdc; - PAINTSTRUCT ps; - RECT rect; - char buffer[200]; - static int seeded = 0; - - switch (iMsg) - { - case WM_PAINT: - hdc = BeginPaint(hwnd, &ps); - GetClientRect(hwnd, &rect); - DrawText(hdc, "Seeding the PRNG. Please move the mouse!", -1, - &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); - EndPaint(hwnd, &ps); - return 0; - - case WM_DESTROY: - PostQuitMessage(0); - return 0; - } - - if (RAND_event(iMsg, wParam, lParam) == 1 && seeded == 0) - { - seeded = 1; - if (RAND_write_file(filename) <= 0) - MessageBox(hwnd, "Couldn't write random file!", - "OpenSSL", MB_OK | MB_ICONERROR); - PostQuitMessage(0); - } - - return DefWindowProc(hwnd, iMsg, wParam, lParam); - } diff --git a/apps/x509.c b/apps/x509.c index 0184c62bb28..d5c0d0404e5 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -113,8 +113,6 @@ static char *x509_usage[]={ " -addreject arg - reject certificate for a given purpose\n", " -setalias arg - set certificate alias\n", " -days arg - How long till expiry of a signed certificate - def 30 days\n", -" -checkend arg - check whether the cert expires in the next arg seconds\n", -" exit 1 if so, 0 if not\n", " -signkey arg - self sign cert with arg\n", " -x509toreq - output a certification request object\n", " -req - input is a certificate request, sign and output.\n", @@ -128,7 +126,7 @@ static char *x509_usage[]={ " -md2/-md5/-sha1/-mdc2 - digest to use\n", " -extfile - configuration file with X509V3 extensions to add\n", " -extensions - section from config file with X509V3 extensions to add\n", -" -clrext - delete extensions before signing and input certificate\n", +" -crlext - delete extensions before signing and input certificate\n", NULL }; @@ -175,7 +173,6 @@ int MAIN(int argc, char **argv) LHASH *extconf = NULL; char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; int need_rand = 0; - int checkend=0,checkoffset=0; reqfile=0; @@ -356,12 +353,6 @@ int MAIN(int argc, char **argv) startdate= ++num; else if (strcmp(*argv,"-enddate") == 0) enddate= ++num; - else if (strcmp(*argv,"-checkend") == 0) - { - if (--argc < 1) goto bad; - checkoffset=atoi(*(++argv)); - checkend=1; - } else if (strcmp(*argv,"-noout") == 0) noout= ++num; else if (strcmp(*argv,"-trustout") == 0) @@ -374,15 +365,8 @@ int MAIN(int argc, char **argv) aliasout= ++num; else if (strcmp(*argv,"-CAcreateserial") == 0) CA_createserial= ++num; - else if (strcmp(*argv,"-clrext") == 0) - clrext = 1; -#if 1 /* stay backwards-compatible with 0.9.5; this should go away soon */ else if (strcmp(*argv,"-crlext") == 0) - { - BIO_printf(bio_err,"use -clrext instead of -crlext\n"); clrext = 1; - } -#endif else if ((md_alg=EVP_get_digestbyname(*argv + 1))) { /* ok */ @@ -483,18 +467,13 @@ bad: if (BIO_read_filename(in,infile) <= 0) { perror(infile); - BIO_free(in); goto end; } } req=PEM_read_bio_X509_REQ(in,NULL,NULL,NULL); BIO_free(in); - if (req == NULL) - { - ERR_print_errors(bio_err); - goto end; - } + if (req == NULL) { perror(infile); goto end; } if ( (req->req_info == NULL) || (req->req_info->pubkey == NULL) || @@ -848,24 +827,6 @@ bad: } } - if(checkend) - { - time_t t=ASN1_UTCTIME_get(X509_get_notAfter(x)); - time_t tnow=time(NULL); - - if(tnow+checkoffset > t) - { - BIO_printf(out,"Certificate will expire\n"); - ret=1; - } - else - { - BIO_printf(out,"Certificate will not expire\n"); - ret=0; - } - goto end; - } - if (noout) { ret=0; |
