Introduce the functions RECORD_LAYER_release, RECORD_LAYER_read_pending, and
[openssl.git] / ssl / ssl_lib.c
index af31831aeca80ffbdaedb672aefdcd194e4bd82c..9a29d9c60a6c0c5659651044e4b30c037f79b9db 100644 (file)
@@ -189,7 +189,6 @@ SSL3_ENC_METHOD ssl3_undef_enc_method = {
 
 int SSL_clear(SSL *s)
 {
-
     if (s->method == NULL) {
         SSLerr(SSL_F_SSL_CLEAR, SSL_R_NO_METHOD_SPECIFIED);
         return (0);
@@ -241,6 +240,9 @@ int SSL_clear(SSL *s)
             return (0);
     } else
         s->method->ssl_clear(s);
+
+    RECORD_LAYER_clear(&s->rlayer);
+
     return (1);
 }
 
@@ -280,6 +282,10 @@ SSL *SSL_new(SSL_CTX *ctx)
         goto err;
     memset(s, 0, sizeof(SSL));
 
+    RECORD_LAYER_set_ssl(&s->rlayer, s);
+    SSL3_RECORD_clear(RECORD_LAYER_get_rrec(&s->rlayer));
+    SSL3_RECORD_clear(RECORD_LAYER_get_wrec(&s->rlayer));
+
 #ifndef OPENSSL_NO_KRB5
     s->kssl_ctx = kssl_ctx_new();
 #endif                          /* OPENSSL_NO_KRB5 */
@@ -597,6 +603,8 @@ void SSL_free(SSL *s)
     if (s->method != NULL)
         s->method->ssl_free(s);
 
+    RECORD_LAYER_release(&s->rlayer);
+
     if (s->ctx)
         SSL_CTX_free(s->ctx);