diff options
author | Daiki Ueno <ueno@gnu.org> | 2020-02-19 14:35:04 +0100 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2020-11-19 18:18:38 +0100 |
commit | e3d6a62938a5a53b89585ace73a13b0556f176a4 (patch) | |
tree | 85f9f33cafc7c19d5acad883b0b4a9ef17aa14b5 /lib/includes | |
parent | 9f5dcddcaa6e89c3d0f9446fb7f2733f2933c3d9 (diff) | |
download | gnutls-e3d6a62938a5a53b89585ace73a13b0556f176a4.tar.gz |
handshake: add functions to read/write handshake messages directly
This adds a couple of functions, gnutls_handshake_set_read_function()
and gnutls_handshake_write(), to allow QUIC implementations to
directly interact with the TLS state machine.
Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/includes')
-rw-r--r-- | lib/includes/gnutls/gnutls.h.in | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in index c45dd542c7..31709117b0 100644 --- a/lib/includes/gnutls/gnutls.h.in +++ b/lib/includes/gnutls/gnutls.h.in @@ -3192,6 +3192,55 @@ void gnutls_anti_replay_set_add_function(gnutls_anti_replay_t, void gnutls_anti_replay_set_ptr(gnutls_anti_replay_t, void *ptr); +/** + * gnutls_record_encryption_level_t: + * @GNUTLS_ENCRYPTION_LEVEL_INITIAL: initial level that doesn't involve any + * encryption + * @GNUTLS_ENCRYPTION_LEVEL_EARLY: early traffic secret is installed + * @GNUTLS_ENCRYPTION_LEVEL_HANDSHAKE: handshake traffic secret is installed + * @GNUTLS_ENCRYPTION_LEVEL_APPLICATION: application traffic secret is installed + * + * Enumeration of different levels of record encryption currently in place. + * This is used by gnutls_handshake_set_read_function() and + * gnutls_handshake_write(). + * + * Since: 3.7.0 + */ +typedef enum { + GNUTLS_ENCRYPTION_LEVEL_INITIAL, + GNUTLS_ENCRYPTION_LEVEL_EARLY, + GNUTLS_ENCRYPTION_LEVEL_HANDSHAKE, + GNUTLS_ENCRYPTION_LEVEL_APPLICATION +} gnutls_record_encryption_level_t; + + /** + * gnutls_handshake_read_func: + * @session: the current session + * @htype: the type of the handshake message (#gnutls_handshake_description_t) + * @level: #gnutls_record_encryption_level_t + * @data: the (const) data that was being sent + * @data_size: the size of data + * + * Function prototype for handshake intercepting hooks. It is set using + * gnutls_handshake_set_read_function(). + * + * Returns: Non zero on error. + * Since: 3.7.0 + */ +typedef int (*gnutls_handshake_read_func) (gnutls_session_t session, + gnutls_record_encryption_level_t level, + gnutls_handshake_description_t htype, + const void *data, size_t data_size); + +void +gnutls_handshake_set_read_function(gnutls_session_t session, + gnutls_handshake_read_func func); + +int +gnutls_handshake_write(gnutls_session_t session, + gnutls_record_encryption_level_t level, + const void *data, size_t data_size); + /* FIPS140-2 related functions */ unsigned gnutls_fips140_mode_enabled(void); |