Close files.
[openssl.git] / ssl / s2_srvr.c
index c058b522bceee082e0175e61998c11e8e3352a47..e7eff6f6137e330a968eb5bb6053ee42388d9841 100644 (file)
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_RSA
 #include <stdio.h>
-#include "bio.h"
-#include "rand.h"
-#include "objects.h"
+#include <openssl/bio.h>
+#include <openssl/rand.h>
+#include <openssl/objects.h>
 #include "ssl_locl.h"
-#include "evp.h"
+#include <openssl/evp.h>
 
-#ifndef NOPROTO
 static SSL_METHOD *ssl2_get_server_method(int ver);
 static int get_client_master_key(SSL *s);
 static int get_client_hello(SSL *s);
@@ -74,22 +74,9 @@ static int server_finish(SSL *s);
 static int request_certificate(SSL *s);
 static int ssl_rsa_private_decrypt(CERT *c, int len, unsigned char *from,
        unsigned char *to,int padding);
-#else
-static SSL_METHOD *ssl2_get_server_method();
-static int get_client_master_key();
-static int get_client_hello();
-static int server_hello(); 
-static int get_client_finished();
-static int server_verify();
-static int server_finish();
-static int request_certificate();
-static int ssl_rsa_private_decrypt();
-#endif
-
 #define BREAK  break
 
-static SSL_METHOD *ssl2_get_server_method(ver)
-int ver;
+static SSL_METHOD *ssl2_get_server_method(int ver)
        {
        if (ver == SSL2_VERSION)
                return(SSLv2_server_method());
@@ -97,24 +84,23 @@ int ver;
                return(NULL);
        }
 
-SSL_METHOD *SSLv2_server_method()
+SSL_METHOD *SSLv2_server_method(void)
        {
        static int init=1;
        static SSL_METHOD SSLv2_server_data;
 
        if (init)
                {
-               init=0;
                memcpy((char *)&SSLv2_server_data,(char *)sslv2_base_method(),
                        sizeof(SSL_METHOD));
                SSLv2_server_data.ssl_accept=ssl2_accept;
                SSLv2_server_data.get_ssl_method=ssl2_get_server_method;
+               init=0;
                }
        return(&SSLv2_server_data);
        }
 
-int ssl2_accept(s)
-SSL *s;
+int ssl2_accept(SSL *s)
        {
        unsigned long l=time(NULL);
        BUF_MEM *buf=NULL;
@@ -334,8 +320,7 @@ end:
        return(ret);
        }
 
-static int get_client_master_key(s)
-SSL *s;
+static int get_client_master_key(SSL *s)
        {
        int export,i,n,keya,ek;
        unsigned char *p;
@@ -460,8 +445,7 @@ SSL *s;
        return(1);
        }
 
-static int get_client_hello(s)
-SSL *s;
+static int get_client_hello(SSL *s)
        {
        int i,n;
        unsigned char *p;
@@ -603,8 +587,7 @@ mem_err:
        return(0);
        }
 
-static int server_hello(s)
-SSL *s;
+static int server_hello(SSL *s)
        {
        unsigned char *p,*d;
        int n,hit;
@@ -694,8 +677,7 @@ SSL *s;
        return(ssl2_do_write(s));
        }
 
-static int get_client_finished(s)
-SSL *s;
+static int get_client_finished(SSL *s)
        {
        unsigned char *p;
        int i;
@@ -737,8 +719,7 @@ SSL *s;
        return(1);
        }
 
-static int server_verify(s)
-SSL *s;
+static int server_verify(SSL *s)
        {
        unsigned char *p;
 
@@ -756,8 +737,7 @@ SSL *s;
        return(ssl2_do_write(s));
        }
 
-static int server_finish(s)
-SSL *s;
+static int server_finish(SSL *s)
        {
        unsigned char *p;
 
@@ -780,8 +760,7 @@ SSL *s;
        }
 
 /* send the request and check the response */
-static int request_certificate(s)
-SSL *s;
+static int request_certificate(SSL *s)
        {
        unsigned char *p,*p2,*buf2;
        unsigned char *ccd;
@@ -938,12 +917,8 @@ end:
        return(ret);
        }
 
-static int ssl_rsa_private_decrypt(c, len, from, to,padding)
-CERT *c;
-int len;
-unsigned char *from;
-unsigned char *to;
-int padding;
+static int ssl_rsa_private_decrypt(CERT *c, int len, unsigned char *from,
+            unsigned char *to, int padding)
        {
        RSA *rsa;
        int i;
@@ -966,4 +941,4 @@ int padding;
                SSLerr(SSL_F_SSL_RSA_PRIVATE_DECRYPT,ERR_R_RSA_LIB);
        return(i);
        }
-
+#endif