New Configure option no-<cipher> (rsa, idea, rc5, ...).
[openssl.git] / ssl / ssltest.c
index ff686913d72022af6f45a53315324d33caa3d74f..54f24583455f6196829bce6fd1a823b9c8e9d88a 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#include "e_os.h"
-#include "bio.h"
-#include "crypto.h"
-#include "x509.h"
-#include "ssl.h"
-#include "err.h"
+#include <openssl/e_os.h>
+#include <openssl/bio.h>
+#include <openssl/crypto.h>
+#include <openssl/x509.h>
+#include <openssl/ssl.h>
+#include <openssl/err.h>
 #ifdef WINDOWS
 #include "../crypto/bio/bss_file.c"
 #endif
 
+#if defined(NO_RSA) && !defined(NO_SSL2)
+#define NO_SSL2
+#endif
+
 #define TEST_SERVER_CERT "../apps/server.pem"
 #define TEST_CLIENT_CERT "../apps/client.pem"
 
-#ifndef NOPROTO
 int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
-static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int export);
-#ifndef NO_DSA
-static DH *get_dh512(void);
-#endif
-#else
-int MS_CALLBACK verify_callback();
-static RSA MS_CALLBACK *tmp_rsa_cb();
-#ifndef NO_DSA
-static DH *get_dh512();
+#ifndef NO_RSA
+static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int export,int keylength);
 #endif
+#ifndef NO_DH
+static DH *get_dh512(void);
 #endif
-
 BIO *bio_err=NULL;
 BIO *bio_stdout=NULL;
 
@@ -98,13 +95,8 @@ static int s_nbio=0;
 #endif
 
 
-#ifndef  NOPROTO
 int doit(SSL *s_ssl,SSL *c_ssl,long bytes);
-#else
-int doit();
-#endif
-
-static void sv_usage()
+static void sv_usage(void)
        {
        fprintf(stderr,"usage: ssltest [args ...]\n");
        fprintf(stderr,"\n");
@@ -132,9 +124,7 @@ static void sv_usage()
        fprintf(stderr," -cipher arg   - The cipher list\n");
        }
 
-int main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
        {
        char *CApath=NULL,*CAfile=NULL;
        int badop=0;
@@ -243,7 +233,7 @@ bad:
 
 /*     if (cipher == NULL) cipher=getenv("SSL_CIPHER"); */
 
-       SSLeay_add_ssl_algorithms();
+       SSL_library_init();
        SSL_load_error_strings();
 
 #if !defined(NO_SSL2) && !defined(NO_SSL3)
@@ -373,9 +363,7 @@ end:
 #define C_DONE 1
 #define S_DONE 2
 
-int doit(s_ssl,c_ssl,count)
-SSL *s_ssl,*c_ssl;
-long count;
+int doit(SSL *s_ssl, SSL *c_ssl, long count)
        {
        MS_STATIC char cbuf[1024*8],sbuf[1024*8];
        long cw_num=count,cr_num=count;
@@ -674,9 +662,7 @@ err:
        return(ret);
        }
 
-int MS_CALLBACK verify_callback(ok, ctx)
-int ok;
-X509_STORE_CTX *ctx;
+int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
        {
        char *s,buf[256];
 
@@ -717,7 +703,7 @@ static unsigned char dh512_g[]={
        0x02,
        };
 
-static DH *get_dh512()
+static DH *get_dh512(void)
        {
        DH *dh=NULL;
 
@@ -730,23 +716,19 @@ static DH *get_dh512()
        }
 #endif
 
-static RSA MS_CALLBACK *tmp_rsa_cb(s,export)
-SSL *s;
-int export;
+#ifndef NO_RSA
+static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int export, int keylength)
        {
        static RSA *rsa_tmp=NULL;
 
        if (rsa_tmp == NULL)
                {
-               BIO_printf(bio_err,"Generating temp (512 bit) RSA key...");
+               BIO_printf(bio_err,"Generating temp (%d bit) RSA key...",keylength);
                BIO_flush(bio_err);
-#ifndef NO_RSA
-               rsa_tmp=RSA_generate_key(512,RSA_F4,NULL,NULL);
-#endif
+               rsa_tmp=RSA_generate_key(keylength,RSA_F4,NULL,NULL);
                BIO_printf(bio_err,"\n");
                BIO_flush(bio_err);
                }
        return(rsa_tmp);
        }
-
-
+#endif