diff options
author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2018-02-04 12:20:37 +0900 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2018-02-26 13:35:54 +0000 |
commit | b38ede8043439d99a3c6c174f17b91875cce66ac (patch) | |
tree | e4766b5fe52ffc7dbd61513a0c220027f479cee3 /ssl/statem | |
parent | e454f3add638fda5c2aa32cd368c8929c0b1eb09 (diff) |
Export keying material using early exporter master secret
This commit adds SSL_export_keying_material_early() which exports
keying material using early exporter master secret.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5252)
Diffstat (limited to 'ssl/statem')
-rw-r--r-- | ssl/statem/statem.c | 15 | ||||
-rw-r--r-- | ssl/statem/statem.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/ssl/statem/statem.c b/ssl/statem/statem.c index 818e648176..a574853487 100644 --- a/ssl/statem/statem.c +++ b/ssl/statem/statem.c @@ -951,3 +951,18 @@ int ossl_statem_export_allowed(SSL *s) return s->s3->previous_server_finished_len != 0 && s->statem.hand_state != TLS_ST_SW_FINISHED; } + +/* + * Return 1 if early TLS exporter is ready to export keying material, + * or 0 if otherwise. + */ +int ossl_statem_export_early_allowed(SSL *s) +{ + /* + * The early exporter secret is only present on the server if we + * have accepted early_data. It is present on the client as long + * as we have sent early_data. + */ + return s->ext.early_data == SSL_EARLY_DATA_ACCEPTED + || (!s->server && s->ext.early_data != SSL_EARLY_DATA_NOT_SENT); +} diff --git a/ssl/statem/statem.h b/ssl/statem/statem.h index 58cc4f4f85..193571878a 100644 --- a/ssl/statem/statem.h +++ b/ssl/statem/statem.h @@ -133,6 +133,7 @@ void ossl_statem_check_finish_init(SSL *s, int send); void ossl_statem_set_hello_verify_done(SSL *s); __owur int ossl_statem_app_data_allowed(SSL *s); __owur int ossl_statem_export_allowed(SSL *s); +__owur int ossl_statem_export_early_allowed(SSL *s); /* Flush the write BIO */ int statem_flush(SSL *s); |