RECORD_LAYER_reset_read_sequence(&s->rlayer);
mac_secret = &(s->s3->read_mac_secret[0]);
} else {
+ s->statem.invalid_enc_write_ctx = 1;
if (s->enc_write_ctx != NULL) {
reuse_dd = 1;
} else if ((s->enc_write_ctx = EVP_CIPHER_CTX_new()) == NULL) {
goto err;
}
+ s->statem.invalid_enc_write_ctx = 0;
OPENSSL_cleanse(exp_key, sizeof(exp_key));
OPENSSL_cleanse(exp_iv, sizeof(exp_iv));
return 1;
s->statem.in_init = 1;
s->statem.state = MSG_FLOW_ERROR;
ERR_put_error(ERR_LIB_SSL, func, reason, file, line);
- if (al != SSL_AD_NO_ALERT)
+ if (al != SSL_AD_NO_ALERT && !s->statem.invalid_enc_write_ctx)
ssl3_send_alert(s, SSL3_AL_FATAL, al);
}
/* Should we skip the CertificateVerify message? */
unsigned int no_cert_verify;
int use_timer;
+ int invalid_enc_write_ctx;
};
typedef struct ossl_statem_st OSSL_STATEM;
mac_secret = &(s->s3->read_mac_secret[0]);
mac_secret_size = &(s->s3->read_mac_secret_size);
} else {
+ s->statem.invalid_enc_write_ctx = 1;
if (s->ext.use_etm)
s->s3->flags |= TLS1_FLAGS_ENCRYPT_THEN_MAC_WRITE;
else
ERR_R_INTERNAL_ERROR);
goto err;
}
+ s->statem.invalid_enc_write_ctx = 0;
#ifdef SSL_DEBUG
printf("which = %04X\nkey=", which);
RECORD_LAYER_reset_read_sequence(&s->rlayer);
} else {
+ s->statem.invalid_enc_write_ctx = 1;
if (s->enc_write_ctx != NULL) {
EVP_CIPHER_CTX_reset(s->enc_write_ctx);
} else {
goto err;
}
+ s->statem.invalid_enc_write_ctx = 0;
ret = 1;
err:
OPENSSL_cleanse(secret, sizeof(secret));
insecret = s->client_app_traffic_secret;
if (sending) {
+ s->statem.invalid_enc_write_ctx = 1;
iv = s->write_iv;
ciph_ctx = s->enc_write_ctx;
RECORD_LAYER_reset_write_sequence(&s->rlayer);
memcpy(insecret, secret, hashlen);
+ s->statem.invalid_enc_write_ctx = 0;
ret = 1;
err:
OPENSSL_cleanse(secret, sizeof(secret));