/* The number of consecutive empty records we have received */
size_t empty_record_count;
+ /*
+ * Do we need to send a prefix empty record before application data as a
+ * countermeasure against known-IV weakness (necessary for SSLv3 and
+ * TLSv1.0)
+ */
+ int need_empty_fragments;
+
/* cryptographic state */
EVP_CIPHER_CTX *enc_ctx;
goto err;
}
+ if ((rl->options & SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS) == 0
+ && rl->version <= TLS1_VERSION
+ && !EVP_CIPHER_is_a(ciph, "NULL")
+ && !EVP_CIPHER_is_a(ciph, "RC4")) {
+ /*
+ * Enable vulnerability countermeasure for CBC ciphers with known-IV
+ * problem (http://www.openssl.org/~bodo/tls-cbc.txt)
+ */
+ rl->need_empty_fragments = 1;
+ }
+
*retrl = rl;
return OSSL_RECORD_RETURN_SUCCESS;
err:
* ourselves.
* Do we need to do that recursion in order to add an empty record prefix?
*/
- prefix = s->s3.need_empty_fragments
+ prefix = rl->need_empty_fragments
&& !clear
&& templates[0].type == SSL3_RT_APPLICATION_DATA;
/* Calls SSLfatal() as required */
ret = ssl3_generate_key_block(s, p, num);
- if (!(s->options & SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS)) {
- /*
- * enable vulnerability countermeasure for CBC ciphers with known-IV
- * problem (http://www.openssl.org/~bodo/tls-cbc.txt)
- */
- s->s3.need_empty_fragments = 1;
-
- if (s->session->cipher != NULL) {
- if (s->session->cipher->algorithm_enc == SSL_eNULL)
- s->s3.need_empty_fragments = 0;
-
- if (s->session->cipher->algorithm_enc == SSL_RC4)
- s->s3.need_empty_fragments = 0;
- }
- }
-
return ret;
}
unsigned char write_mac_secret[EVP_MAX_MD_SIZE];
unsigned char server_random[SSL3_RANDOM_SIZE];
unsigned char client_random[SSL3_RANDOM_SIZE];
- /* flags for countermeasure against known-IV weakness */
- int need_empty_fragments;
+
/* used during startup, digest all incoming/outgoing packets */
BIO *handshake_buffer;
/*
BIO_dump_indent(trc_out, p, num, 4);
} OSSL_TRACE_END(TLS);
- if (!(s->options & SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS)
- && SSL_CONNECTION_GET_SSL(s)->method->version <= TLS1_VERSION) {
- /*
- * enable vulnerability countermeasure for CBC ciphers with known-IV
- * problem (http://www.openssl.org/~bodo/tls-cbc.txt)
- */
- s->s3.need_empty_fragments = 1;
-
- if (s->session->cipher != NULL) {
- if (s->session->cipher->algorithm_enc == SSL_eNULL)
- s->s3.need_empty_fragments = 0;
-
- if (s->session->cipher->algorithm_enc == SSL_RC4)
- s->s3.need_empty_fragments = 0;
- }
- }
-
ret = 1;
err:
return ret;