Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / boringssl / src / ssl / s3_enc.c
index ee85c17..d574b25 100644 (file)
 
 #include "ssl_locl.h"
 
-static unsigned char ssl3_pad_1[48]={
+static const uint8_t ssl3_pad_1[48]={
        0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
        0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
        0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
@@ -152,7 +152,7 @@ static unsigned char ssl3_pad_1[48]={
        0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
        0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36 };
 
-static unsigned char ssl3_pad_2[48]={
+static const uint8_t ssl3_pad_2[48]={
        0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,
        0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,
        0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,
@@ -369,13 +369,8 @@ int ssl3_setup_key_block(SSL *s)
 
                if (s->session->cipher != NULL)
                        {
-                       if (s->session->cipher->algorithm_enc == SSL_eNULL)
-                               s->s3->need_record_splitting = 0;
-
-#ifndef OPENSSL_NO_RC4
                        if (s->session->cipher->algorithm_enc == SSL_RC4)
                                s->s3->need_record_splitting = 0;
-#endif
                        }
                }
 
@@ -502,7 +497,7 @@ void ssl3_free_digest_list(SSL *s)
 
 void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len)
        {
-       if (s->s3->handshake_buffer && !(s->s3->flags & TLS1_FLAGS_KEEP_HANDSHAKE)) 
+       if (s->s3->handshake_buffer)
                {
                BIO_write (s->s3->handshake_buffer,(void *)buf,len);
                } 
@@ -549,12 +544,9 @@ int ssl3_digest_cached_records(SSL *s)
                        s->s3->handshake_dgst[i]=NULL;
                        }
                }
-       if (!(s->s3->flags & TLS1_FLAGS_KEEP_HANDSHAKE))
-               {
-               /* Free handshake_buffer BIO */
-               BIO_free(s->s3->handshake_buffer);
-               s->s3->handshake_buffer = NULL;
-               }
+       /* Free handshake_buffer BIO */
+       BIO_free(s->s3->handshake_buffer);
+       s->s3->handshake_buffer = NULL;
 
        return 1;
        }
@@ -767,7 +759,7 @@ int ssl3_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p,
        EVP_MD_CTX_init(&ctx);
        for (i=0; i<3; i++)
                {
-               EVP_DigestInit_ex(&ctx,s->ctx->sha1, NULL);
+               EVP_DigestInit_ex(&ctx, EVP_sha1(), NULL);
                EVP_DigestUpdate(&ctx,salt[i],strlen((const char *)salt[i]));
                EVP_DigestUpdate(&ctx,p,len);
                EVP_DigestUpdate(&ctx,&(s->s3->client_random[0]),
@@ -776,7 +768,7 @@ int ssl3_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p,
                        SSL3_RANDOM_SIZE);
                EVP_DigestFinal_ex(&ctx,buf,&n);
 
-               EVP_DigestInit_ex(&ctx,s->ctx->md5, NULL);
+               EVP_DigestInit_ex(&ctx, EVP_md5(), NULL);
                EVP_DigestUpdate(&ctx,p,len);
                EVP_DigestUpdate(&ctx,buf,n);
                EVP_DigestFinal_ex(&ctx,out,&n);