X-Git-Url: https://www.bearssl.org/gitweb//home/git/?p=BearSSL;a=blobdiff_plain;f=inc%2Fbearssl_ssl.h;h=0876ff9e2ca64a4a59eae29cadc4c6629d70ec7d;hp=3faf1bef4ca394f660525bc7ba4d4fbbe71df1ad;hb=ab68048011dee644262fd0190a83a13162c14140;hpb=d16eee962a72a600c370f18f2ae25b36b4f532df diff --git a/inc/bearssl_ssl.h b/inc/bearssl_ssl.h index 3faf1be..0876ff9 100644 --- a/inc/bearssl_ssl.h +++ b/inc/bearssl_ssl.h @@ -544,13 +544,6 @@ typedef struct { */ unsigned char client_random[32]; unsigned char server_random[32]; - /* obsolete - unsigned char session_id[32]; - unsigned char session_id_len; - uint16_t version; - uint16_t cipher_suite; - unsigned char master_secret[48]; - */ br_ssl_session_parameters session; /* @@ -926,6 +919,31 @@ br_ssl_engine_get_server_name(br_ssl_engine_context *cc) return cc->server_name; } +/* + * Get a copy of the session parameters. The session parameters are + * filled during the handshake, so this function shall not be called + * before completion of the handshake. + */ +static inline void +br_ssl_engine_get_session_parameters(const br_ssl_engine_context *cc, + br_ssl_session_parameters *pp) +{ + memcpy(pp, &cc->session, sizeof *pp); +} + +/* + * Set the session parameters to the provided value. This function + * is meant to be used in the client, before doing a new handshake; + * a session resumption will be attempted with these parameters. In + * the server, this function has no effect. + */ +static inline void +br_ssl_engine_set_session_parameters(br_ssl_engine_context *cc, + const br_ssl_session_parameters *pp) +{ + memcpy(&cc->session, pp, sizeof *pp); +} + /* * An SSL engine (client or server) has, at any time, a state which is * the combination of zero, one or more of these flags: