nts_client_misc.c
error_t ntsClientParseNewCookieForNtpv4Record(NtsClientContext *context, const uint8_t *body, size_t length)
Parse New Cookie for NTPv4 record.
Definition: nts_client_misc.c:651
void ntsClientChangeState(NtsClientContext *context, NtsClientState newState)
Update NTS client state.
Definition: nts_client_misc.c:57
void ntpDumpPacket(const NtpHeader *packet, size_t length)
Dump NTP packet for debugging purpose.
Definition: ntp_debug.c:108
error_t tlsSetConnectionEnd(TlsContext *context, TlsConnectionEnd entity)
Set operation mode (client or server)
Definition: tls.c:349
error_t ntsClientParseNtpv4PortRecord(NtsClientContext *context, const uint8_t *body, size_t length)
Parse NTPv4 Port Negotiation record.
Definition: nts_client_misc.c:718
Key material generation.
error_t ntsClientOpenNtpConnection(NtsClientContext *context)
Open NTP connection.
Definition: nts_client_misc.c:823
error_t ntsClientOpenNtsKeConnection(NtsClientContext *context)
Open NTS-KE connection.
Definition: nts_client_misc.c:74
error_t tlsExportKeyingMaterial(TlsContext *context, const char_t *label, bool_t useContextValue, const uint8_t *contextValue, size_t contextValueLen, uint8_t *output, size_t outputLen)
Export keying material per RFC 5705 standard.
Definition: tls_key_material.c:448
@ NTS_CLIENT_STATE_NTS_KE_DISCONNECTING
Definition: nts_client.h:149
char_t * ipAddrToString(const IpAddr *ipAddr, char_t *str)
Convert a binary IP address to a string representation.
Definition: ip.c:805
void ntpDumpExtensions(const uint8_t *extensions, size_t length)
Dump NTP extension fields.
Definition: ntp_debug.c:212
void ntsClientCloseNtpConnection(NtsClientContext *context)
Close NTP connection.
Definition: nts_client_misc.c:1308
NTS client (Network Time Security)
error_t tlsRestoreSessionState(TlsContext *context, const TlsSessionState *session)
Restore TLS session.
Definition: tls.c:2700
void ntsDumpNtsKeRecords(const uint8_t *records, size_t length)
Dump NTS-KE records.
Definition: nts_debug.c:83
error_t tlsSetVersion(TlsContext *context, uint16_t versionMin, uint16_t versionMax)
Set minimum and maximum versions permitted.
Definition: tls.c:285
error_t ntsClientParseNtsNextProtoNegoRecord(NtsClientContext *context, const uint8_t *body, size_t length)
Parse NTS Next Protocol Negotiation record.
Definition: nts_client_misc.c:526
error_t ntsClientParseEndOfMessageRecord(NtsClientContext *context, const uint8_t *body, size_t length)
Parse End of Message record.
Definition: nts_client_misc.c:454
Data logging functions for debugging purpose (NTP)
error_t ntsClientSendNtpRequest(NtsClientContext *context)
Send NTP request to the server.
Definition: nts_client_misc.c:862
AES (Advanced Encryption Standard)
error_t ntsClientShutdownNtsKeConnection(NtsClientContext *context)
Shutdown NTS-KE connection.
Definition: nts_client_misc.c:740
error_t socketReceiveFrom(Socket *socket, IpAddr *srcIpAddr, uint16_t *srcPort, void *data, size_t size, size_t *received, uint_t flags)
Receive a datagram from a connectionless socket.
Definition: socket.c:1714
error_t socketConnect(Socket *socket, const IpAddr *remoteIpAddr, uint16_t remotePort)
Establish a connection to a specified socket.
Definition: socket.c:1349
error_t socketShutdown(Socket *socket, uint_t how)
Disable reception, transmission, or both.
Definition: socket.c:2020
error_t ntsClientReceiveNtpResponse(NtsClientContext *context)
Wait for NTP response.
Definition: nts_client_misc.c:992
error_t ntsClientReceiveNtsKeResponse(NtsClientContext *context)
Receive NTS-KE response.
Definition: nts_client_misc.c:316
error_t tlsSaveSessionState(const TlsContext *context, TlsSessionState *session)
Save TLS session.
Definition: tls.c:2631
Socket * socketOpen(uint_t type, uint_t protocol)
Create a socket (UDP or TCP)
Definition: socket.c:125
error_t ntsClientParseWarningRecord(NtsClientContext *context, const uint8_t *body, size_t length)
Parse Warning record.
Definition: nts_client_misc.c:587
error_t tlsRead(TlsContext *context, void *data, size_t size, size_t *received, uint_t flags)
Receive application data from a the remote host using TLS.
Definition: tls.c:1989
error_t ntsClientEstablishNtsKeConnection(NtsClientContext *context)
Establish NTS-KE connection.
Definition: nts_client_misc.c:162
error_t ntsClientCheckNtpTimeout(NtsClientContext *context)
Determine whether a timeout error has occurred (NTP phase)
Definition: nts_client_misc.c:1326
const NtpExtension * ntpGetExtension(const uint8_t *extensions, size_t length, uint16_t type, uint_t index)
Search a NTP packet for a given extension.
Definition: ntp_common.c:53
error_t ntsClientDecryptNtpResponse(NtsClientContext *context, const IpAddr *ipAddr, uint16_t port, const uint8_t *message, size_t length)
Decrypt NTP response.
Definition: nts_client_misc.c:1079
error_t ntsClientParseErrorRecord(NtsClientContext *context, const uint8_t *body, size_t length)
Parse Error record.
Definition: nts_client_misc.c:569
Synthetic Initialization Vector (SIV)
void ntsClientCloseNtsKeConnection(NtsClientContext *context)
Close NTS-KE connection.
Definition: nts_client_misc.c:769
error_t tlsSetBufferSize(TlsContext *context, size_t txBufferSize, size_t rxBufferSize)
Set TLS buffer size.
Definition: tls.c:521
error_t ntsClientParseNtpv4ServerRecord(NtsClientContext *context, const uint8_t *body, size_t length)
Parse NTPv4 Server Negotiation record.
Definition: nts_client_misc.c:686
error_t sivDecrypt(const CipherAlgo *cipher, const uint8_t *k, size_t kLen, const DataChunk *ad, uint_t adLen, const uint8_t *c, uint8_t *p, size_t length, const uint8_t *v)
Authenticated decryption using SIV.
Definition: siv.c:133
error_t ntsClientParseNtpResponse(NtsClientContext *context, NtpTimestamp *timestamp)
Parse NTP response.
Definition: nts_client_misc.c:1267
error_t ntsClientSendNtsKeRequest(NtsClientContext *context)
Send NTS-KE request.
Definition: nts_client_misc.c:256
error_t ntsClientParseAeadAlgoNegoRecord(NtsClientContext *context, const uint8_t *body, size_t length)
Parse AEAD Algorithm Negotiation record.
Definition: nts_client_misc.c:605
#define NTS_CLIENT_MAX_NTP_RETRANSMIT_TIMEOUT
Definition: nts_client.h:69
error_t tlsWrite(TlsContext *context, const void *data, size_t length, size_t *written, uint_t flags)
Send application data to the remote host using TLS.
Definition: tls.c:1854
error_t socketSendTo(Socket *socket, const IpAddr *destIpAddr, uint16_t destPort, const void *data, size_t length, size_t *written, uint_t flags)
Send a datagram to a specific destination.
Definition: socket.c:1507
error_t ntsClientCheckNtsKeTimeout(NtsClientContext *context)
Determine whether a timeout error has occurred (NTS-KE phase)
Definition: nts_client_misc.c:787
error_t tlsSetAlpnProtocolList(TlsContext *context, const char_t *protocolList)
Set the list of supported ALPN protocols.
Definition: tls.c:884
Definitions common to NTP client and server.
error_t sivEncrypt(const CipherAlgo *cipher, const uint8_t *k, size_t kLen, const DataChunk *ad, uint_t adLen, const uint8_t *p, uint8_t *c, size_t length, uint8_t *v)
Authenticated encryption using SIV.
Definition: siv.c:65
#define NTS_CLIENT_MAX_NTP_SERVER_NAME_LEN
Definition: nts_client.h:104
TCP/IP stack core.
Data logging functions for debugging purpose (NTS)
error_t ntsClientFormatNtsKeRequest(NtsClientContext *context)
Format NTS-KE request.
Definition: nts_client_misc.c:188
error_t socketSetTimeout(Socket *socket, systime_t timeout)
Set timeout value for blocking operations.
Definition: socket.c:148
void ntsDumpNtsKeRecord(const NtsKeRecord *record, size_t length)
Dump NTS-KE record.
Definition: nts_debug.c:121
Debugging facilities.
Helper functions for NTS client.
@ NTP_EXTENSION_TYPE_NTS_AEAD
NTS Authenticator and Encrypted Extension Fields.
Definition: ntp_common.h:157