Merge branch 'OpenSSL_1_0_2-stable' into agl-1.0.2aead
[oweals/openssl.git] / ssl / s3_pkt.c
index 02a5f9df756c25968d1571d7df3e2bac827bb9bc..0cdf1dfb3ea3a5a31261d8a39235f657ad915f1f 100644 (file)
@@ -775,7 +775,12 @@ static int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
                else
                        eivlen = 0;
                }
-       else 
+       else if (s->aead_write_ctx != NULL &&
+                s->aead_write_ctx->variable_nonce_included_in_record)
+               {
+               eivlen = s->aead_write_ctx->variable_nonce_len;
+               }
+       else
                eivlen = 0;
 
        /* lets setup the record stuff. */