cleaning up a little

This commit is contained in:
Bodo Möller 2000-03-12 23:27:14 +00:00
parent 3a6a39c373
commit 863fe2ecac
15 changed files with 76 additions and 559 deletions

View file

@ -937,12 +937,11 @@ sub dofile
{ {
grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a); grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
} }
($ff=$f) =~ s/\..*$//; open(OUT,">$f.new") || die "unable to open $f.new:$!\n";
open(OUT,">$ff.new") || die "unable to open $f:$!\n";
print OUT @a; print OUT @a;
close(OUT); close(OUT);
rename($f,"$ff.bak") || die "unable to rename $f\n" if -e $f; rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f;
rename("$ff.new",$f) || die "unable to rename $ff.new\n"; rename("$f.new",$f) || die "unable to rename $f.new\n";
} }
sub print_table_entry sub print_table_entry

View file

@ -1,131 +0,0 @@
/* apps/eay.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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

View file

@ -56,10 +56,6 @@
* [including the GNU Public Licence.] * [including the GNU Public Licence.]
*/ */
#ifndef DEBUG
#undef DEBUG
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -77,12 +73,6 @@
#include "s_apps.h" #include "s_apps.h"
#include <openssl/err.h> #include <openssl/err.h>
/*
#ifdef WINDOWS
#include "bss_file.c"
#endif
*/
static unsigned long MS_CALLBACK hash(FUNCTION *a); static unsigned long MS_CALLBACK hash(FUNCTION *a);
static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b); static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b);
static LHASH *prog_init(void ); static LHASH *prog_init(void );
@ -90,15 +80,6 @@ static int do_cmd(LHASH *prog,int argc,char *argv[]);
LHASH *config=NULL; LHASH *config=NULL;
char *default_config_file=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 */ /* Make sure there is only one when MONOLITH is defined */
#ifdef MONOLITH #ifdef MONOLITH
BIO *bio_err=NULL; BIO *bio_err=NULL;
@ -120,15 +101,6 @@ int main(int Argc, char *Argv[])
arg.data=NULL; arg.data=NULL;
arg.count=0; 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); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
apps_startup(); apps_startup();
@ -235,12 +207,6 @@ end:
EVP_cleanup(); EVP_cleanup();
ERR_free_strings(); 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); CRYPTO_mem_leaks(bio_err);
if (bio_err != NULL) if (bio_err != NULL)
{ {

View file

@ -1,15 +0,0 @@
-----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-----

View file

@ -1,50 +0,0 @@
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-----

View file

@ -1,47 +0,0 @@
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-----

View file

@ -1,49 +0,0 @@
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-----

View file

@ -84,7 +84,6 @@ typedef fd_mask fd_set;
#define PORT_STR "4433" #define PORT_STR "4433"
#define PROTOCOL "tcp" #define PROTOCOL "tcp"
int do_accept(int acc_sock, int *sock, char **host);
int do_server(int port, int *ret, int (*cb) (), char *context); int do_server(int port, int *ret, int (*cb) (), char *context);
#ifdef HEADER_X509_H #ifdef HEADER_X509_H
int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx); int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
@ -97,17 +96,9 @@ 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); int set_cert_stuff(char *ctx, char *cert_file, char *key_file);
#endif #endif
int init_client(int *sock, char *server, int port); 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); int should_retry(int i);
void sock_cleanup(void );
int extract_port(char *str, short *port_ptr); int extract_port(char *str, short *port_ptr);
int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p); 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, long MS_CALLBACK bio_dump_cb(BIO *bio, int cmd, const char *argp,
int argi, long argl, long ret); int argi, long argl, long ret);

View file

@ -1,4 +1,4 @@
/* apps/s_cb.c */ /* apps/s_cb.c - callback functions used by s_client, s_server, and s_time */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *

View file

@ -1,4 +1,4 @@
/* apps/s_socket.c */ /* apps/s_socket.c - socket-related functions used by s_client and s_server */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *
@ -79,16 +79,15 @@ typedef unsigned int u_int;
#include "s_apps.h" #include "s_apps.h"
#include <openssl/ssl.h> #include <openssl/ssl.h>
#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 struct hostent *GetHostByName(char *name); static struct hostent *GetHostByName(char *name);
int sock_init(void ); static void sock_cleanup(void);
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]);
#ifdef WIN16 #ifdef WIN16
#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */
#else #else
@ -131,7 +130,7 @@ static BOOL CALLBACK enumproc(HWND hwnd,LPARAM lParam)
#endif /* WIN32 */ #endif /* WIN32 */
#endif /* WINDOWS */ #endif /* WINDOWS */
void sock_cleanup(void) static void sock_cleanup(void)
{ {
#ifdef WINDOWS #ifdef WINDOWS
if (wsa_init_done) if (wsa_init_done)
@ -143,7 +142,7 @@ void sock_cleanup(void)
#endif #endif
} }
int sock_init(void) static int sock_init(void)
{ {
#ifdef WINDOWS #ifdef WINDOWS
if (!wsa_init_done) if (!wsa_init_done)
@ -187,7 +186,7 @@ int init_client(int *sock, char *host, int port)
return(init_client_ip(sock,ip,port)); return(init_client_ip(sock,ip,port));
} }
int init_client_ip(int *sock, unsigned char ip[4], int port) static int init_client_ip(int *sock, unsigned char ip[4], int port)
{ {
unsigned long addr; unsigned long addr;
struct sockaddr_in them; struct sockaddr_in them;
@ -218,75 +217,6 @@ int init_client_ip(int *sock, unsigned char ip[4], int port)
return(1); 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 do_server(int port, int *ret, int (*cb)(), char *context)
{ {
int sock; int sock;
@ -319,7 +249,7 @@ int do_server(int port, int *ret, int (*cb)(), char *context)
} }
} }
int init_server_long(int *sock, int port, char *ip) static int init_server_long(int *sock, int port, char *ip)
{ {
int ret=0; int ret=0;
struct sockaddr_in server; struct sockaddr_in server;
@ -369,12 +299,12 @@ err:
return(ret); return(ret);
} }
int init_server(int *sock, int port) static int init_server(int *sock, int port)
{ {
return(init_server_long(sock, port, NULL)); return(init_server_long(sock, port, NULL));
} }
int do_accept(int acc_sock, int *sock, char **host) static int do_accept(int acc_sock, int *sock, char **host)
{ {
int ret,i; int ret,i;
struct hostent *h1,*h2; struct hostent *h1,*h2;
@ -490,7 +420,7 @@ err:
return(0); return(0);
} }
int host_ip(char *str, unsigned char ip[4]) static int host_ip(char *str, unsigned char ip[4])
{ {
unsigned int in[4]; unsigned int in[4];
int i; int i;
@ -606,69 +536,3 @@ static struct hostent *GetHostByName(char *name)
return(ret); 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

View file

@ -1,4 +1,5 @@
/* NOCW */ /* NOCW */
/* used by apps/speed.c */
DSA *get_dsa512(void ); DSA *get_dsa512(void );
DSA *get_dsa1024(void ); DSA *get_dsa1024(void );
DSA *get_dsa2048(void ); DSA *get_dsa2048(void );

View file

@ -1,4 +1,5 @@
/* apps/testrsa.h */ /* apps/testrsa.h */
/* used by apps/speed.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *

View file

@ -1,66 +0,0 @@
#!/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;
}

View file

@ -55,6 +55,59 @@
* copied and put under another distribution licence * copied and put under another distribution licence
* [including the GNU Public 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
* openssl-core@openssl.org.
*
* 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
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#define ENTROPY_NEEDED 16 /* require 128 bits = 16 bytes of randomness */ #define ENTROPY_NEEDED 16 /* require 128 bits = 16 bytes of randomness */

View file

@ -164,7 +164,7 @@ int SSL_SESSION_print(BIO *bp, SSL_SESSION *x)
} }
if (BIO_puts(bp,"\n") <= 0) goto err; if (BIO_puts(bp,"\n") <= 0) goto err;
if (BIO_puts(bp, " Verify return code ") <= 0) goto err; if (BIO_puts(bp, " Verify return code: ") <= 0) goto err;
sprintf(str, "%ld (%s)\n", x->verify_result, sprintf(str, "%ld (%s)\n", x->verify_result,
X509_verify_cert_error_string(x->verify_result)); X509_verify_cert_error_string(x->verify_result));
if (BIO_puts(bp,str) <= 0) goto err; if (BIO_puts(bp,str) <= 0) goto err;