mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:45:07 -05:00
nts: provide time function to gnutls
Use the internal time instead of system time for validation checks in gnutls.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "nts_ke_session.h"
|
||||
|
||||
#include "conf.h"
|
||||
#include "local.h"
|
||||
#include "logging.h"
|
||||
#include "memory.h"
|
||||
#include "siv.h"
|
||||
@@ -537,6 +538,20 @@ read_write_socket(int fd, int event, void *arg)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static time_t
|
||||
get_time(time_t *t)
|
||||
{
|
||||
struct timespec now;
|
||||
|
||||
LCL_ReadCookedTime(&now, NULL);
|
||||
if (t)
|
||||
*t = now.tv_sec;
|
||||
|
||||
return now.tv_sec;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static int gnutls_initialised = 0;
|
||||
|
||||
static void
|
||||
@@ -558,6 +573,8 @@ init_gnutls(void)
|
||||
if (r < 0)
|
||||
LOG_FATAL("Could not initialise %s : %s", "priority cache", gnutls_strerror(r));
|
||||
|
||||
gnutls_global_set_time_function(get_time);
|
||||
|
||||
gnutls_initialised = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user