return 0;
}
+/**
+ * gnutls_db_check_entry_time:
+ * @entry: is a pointer to a #gnutls_datum_t structure.
+ * @t: is the time of the session handshake
+ *
+ * This function returns the time that this entry was active.
+ * It can be used for database entry expiration.
+ *
+ **/
+time_t
+gnutls_db_check_entry_time (gnutls_datum_t *entry)
+{
+uint32_t t;
+
+ if (entry->size < 4)
+ return gnutls_assert_val(0);
+
+ memcpy(&t, entry->data, 4);
+ return t;
+}
+
/* Checks if both db_store and db_retrieve functions have
* been set up.
*/
_gnutls_buffer_init (&sb);
+ /* first is the timestamp */
+ BUFFER_APPEND_NUM(&sb, session->security_parameters.timestamp);
+
id = gnutls_auth_get_type (session);
BUFFER_APPEND (&sb, &id, 1);
return ret;
}
+ /* the timestamp is first */
+ BUFFER_POP_NUM (&sb, session->security_parameters.timestamp);
+
if (_gnutls_get_auth_info (session) != NULL)
{
_gnutls_free_auth_info (session);
* 1 byte the session ID size
* x bytes the session ID (32 bytes max)
*
- * 4 bytes a timestamp
* 4 bytes the new record padding flag
* 4 bytes the ECC curve
* -------------------
BUFFER_APPEND_NUM (ps, session->security_parameters.max_record_send_size);
BUFFER_APPEND_NUM (ps, session->security_parameters.max_record_recv_size);
- BUFFER_APPEND_NUM (ps, session->security_parameters.timestamp);
BUFFER_APPEND_NUM (ps, session->security_parameters.new_record_padding);
BUFFER_APPEND_NUM (ps, session->security_parameters.ecc_curve);
BUFFER_POP_NUM (ps,
session->internals.
resumed_security_parameters.max_record_recv_size);
- BUFFER_POP_NUM (ps,
- session->internals.resumed_security_parameters.timestamp);
BUFFER_POP_NUM (ps,
session->internals.resumed_security_parameters.new_record_padding);
void *gnutls_db_get_ptr (gnutls_session_t session);
int gnutls_db_check_entry (gnutls_session_t session,
gnutls_datum_t session_entry);
+ time_t gnutls_db_check_entry_time (gnutls_datum_t *entry);
typedef int (*gnutls_handshake_post_client_hello_func) (gnutls_session_t);
void