Consistency with s2_... and s23_... variants (no real functional
[openssl.git] / ssl / s3_clnt.c
index 36068780e7f5044f5d1074c0dbfb5ea833b3cb2c..c3be69b928c3a1a71867cba29039d38f27317771 100644 (file)
@@ -62,9 +62,7 @@
 #include <openssl/objects.h>
 #include <openssl/evp.h>
 #include "ssl_locl.h"
-#ifndef OPENSSL_NO_KRB5
 #include "kssl_lcl.h"
-#endif
 #include <openssl/md5.h>
 
 static SSL_METHOD *ssl3_get_client_method(int ver);
@@ -121,8 +119,8 @@ int ssl3_connect(SSL *s)
        else if (s->ctx->info_callback != NULL)
                cb=s->ctx->info_callback;
        
-       if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s); 
        s->in_handshake++;
+       if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s); 
 
        for (;;)
                {
@@ -443,9 +441,9 @@ int ssl3_connect(SSL *s)
                skip=0;
                }
 end:
+       s->in_handshake--;
        if (cb != NULL)
                cb(s,SSL_CB_CONNECT_EXIT,ret);
-       s->in_handshake--;
        return(ret);
        }
 
@@ -556,7 +554,7 @@ static int ssl3_get_server_hello(SSL *s)
                &ok);
 
        if (!ok) return((int)n);
-       d=p=(unsigned char *)s->init_buf->data;
+       d=p=(unsigned char *)s->init_msg;
 
        if ((p[0] != (s->version>>8)) || (p[1] != (s->version&0xff)))
                {
@@ -712,7 +710,7 @@ static int ssl3_get_server_certificate(SSL *s)
                SSLerr(SSL_F_SSL3_GET_SERVER_CERTIFICATE,SSL_R_BAD_MESSAGE_TYPE);
                goto f_err;
                }
-       d=p=(unsigned char *)s->init_buf->data;
+       d=p=(unsigned char *)s->init_msg;
 
        if ((sk=sk_X509_new_null()) == NULL)
                {
@@ -897,7 +895,7 @@ static int ssl3_get_key_exchange(SSL *s)
                return(1);
                }
 
-       param=p=(unsigned char *)s->init_buf->data;
+       param=p=(unsigned char *)s->init_msg;
 
        if (s->session->sess_cert != NULL)
                {
@@ -1091,12 +1089,12 @@ static int ssl3_get_key_exchange(SSL *s)
                        q=md_buf;
                        for (num=2; num > 0; num--)
                                {
-                               EVP_DigestInit(&md_ctx,(num == 2)
-                                       ?s->ctx->md5:s->ctx->sha1);
+                               EVP_DigestInit_ex(&md_ctx,(num == 2)
+                                       ?s->ctx->md5:s->ctx->sha1, NULL);
                                EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE);
                                EVP_DigestUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE);
                                EVP_DigestUpdate(&md_ctx,param,param_len);
-                               EVP_DigestFinal(&md_ctx,q,(unsigned int *)&i);
+                               EVP_DigestFinal_ex(&md_ctx,q,(unsigned int *)&i);
                                q+=i;
                                j+=i;
                                }
@@ -1122,7 +1120,7 @@ static int ssl3_get_key_exchange(SSL *s)
                        if (pkey->type == EVP_PKEY_DSA)
                        {
                        /* lets do DSS */
-                       EVP_VerifyInit(&md_ctx,EVP_dss1());
+                       EVP_VerifyInit_ex(&md_ctx,EVP_dss1(), NULL);
                        EVP_VerifyUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE);
                        EVP_VerifyUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE);
                        EVP_VerifyUpdate(&md_ctx,param,param_len);
@@ -1220,7 +1218,7 @@ static int ssl3_get_certificate_request(SSL *s)
                        }
                }
 
-       d=p=(unsigned char *)s->init_buf->data;
+       d=p=(unsigned char *)s->init_msg;
 
        if ((ca_sk=sk_X509_NAME_new(ca_dn_cmp)) == NULL)
                {
@@ -1521,17 +1519,18 @@ static int ssl3_send_client_key_exchange(SSL *s)
                            goto err;
 
                        /*  20010420 VRS.  Tried it this way; failed.
-                       **      EVP_EncryptInit(&ciph_ctx,enc, NULL,NULL);
+                       **      EVP_EncryptInit_ex(&ciph_ctx,enc, NULL,NULL);
                        **      EVP_CIPHER_CTX_set_key_length(&ciph_ctx,
                        **                              kssl_ctx->length);
-                       **      EVP_EncryptInit(&ciph_ctx,NULL, key,iv);
+                       **      EVP_EncryptInit_ex(&ciph_ctx,NULL, key,iv);
                        */
 
                        memset(iv, 0, EVP_MAX_IV_LENGTH);  /* per RFC 1510 */
-                       EVP_EncryptInit(&ciph_ctx,enc, kssl_ctx->key,iv);
+                       EVP_EncryptInit_ex(&ciph_ctx,enc, NULL,
+                               kssl_ctx->key,iv);
                        EVP_EncryptUpdate(&ciph_ctx,epms,&outl,tmp_buf,
-                                               SSL_MAX_MASTER_KEY_LENGTH);
-                       EVP_EncryptFinal(&ciph_ctx,&(epms[outl]),&padl);
+                               SSL_MAX_MASTER_KEY_LENGTH);
+                       EVP_EncryptFinal_ex(&ciph_ctx,&(epms[outl]),&padl);
                        outl += padl;
                        EVP_CIPHER_CTX_cleanup(&ciph_ctx);