summaryrefslogtreecommitdiffstats
path: root/ssl/statem/statem.h
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2018-08-07 10:25:54 +0100
committerMatt Caswell <matt@openssl.org>2018-08-08 10:16:58 +0100
commit7426cd343d99d3d82e3fb06c8df18e5cc6bcec75 (patch)
treea0dac1b700927151c1a81d04d1f8cb037fd8be10 /ssl/statem/statem.h
parentb4f001eb1a9e0bd0fda8f3c7dfbccb6422ad8c47 (diff)
Ensure that we write out alerts correctly after early_data
If we sent early_data and then received back an HRR, the enc_write_ctx was stale resulting in errors if an alert needed to be sent. Thanks to Quarkslab for reporting this. In any case it makes little sense to encrypt alerts using the client_early_traffic_secret, so we add special handling for alerts sent after early_data. All such alerts are sent in plaintext. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6887)
Diffstat (limited to 'ssl/statem/statem.h')
-rw-r--r--ssl/statem/statem.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/ssl/statem/statem.h b/ssl/statem/statem.h
index 95dd881208..0799870178 100644
--- a/ssl/statem/statem.h
+++ b/ssl/statem/statem.h
@@ -71,6 +71,15 @@ typedef enum {
WRITE_STATE_POST_WORK
} WRITE_STATE;
+typedef enum {
+ /* The enc_write_ctx can be used normally */
+ ENC_WRITE_STATE_VALID,
+ /* The enc_write_ctx cannot be used */
+ ENC_WRITE_STATE_INVALID,
+ /* Write alerts in plaintext, but otherwise use the enc_write_ctx */
+ ENC_WRITE_STATE_WRITE_PLAIN_ALERTS
+} ENC_WRITE_STATES;
+
/*****************************************************************************
* *
* This structure should be considered "opaque" to anything outside of the *
@@ -100,7 +109,7 @@ struct ossl_statem_st {
/* Should we skip the CertificateVerify message? */
unsigned int no_cert_verify;
int use_timer;
- int invalid_enc_write_ctx;
+ ENC_WRITE_STATES enc_write_state;
};
typedef struct ossl_statem_st OSSL_STATEM;