vroughtime - a roughtime client in C¶
Vad är klockan relies on the project vroughtime by Oscar Reparaz for the client implementation of the roughtime protocol. It has been modified to support IETF draft version 06 of Roughtime. To do that the hardcoded query string has been replaced with a function to build a query dynamically.
-
vrt_ret_t vrt_make_query(uint8_t *nonce, uint32_t nonce_len, uint8_t *out_query, uint32_t *out_query_len, unsigned variant)¶
Make a roughtime query packet.
The value pointed to by out_query_len will be updated with the actual query length.
Protocol variants:
Variant 4 or earlier: The nonce size must be 64 bytes or larger (only the first 64 bytes will be used). The size of the out_query buffer must be at least 1024 bytes.
Variant 5 or later: The nonce size must be 32 bytes or larger (only the first 32 bytes will be used). The size of the out_query buffer must be at least 1036 bytes.
Variant 7 or later: Currently NOT supported by this implementation.
- Parameters
nonce – pointer to a nonce which should be unique for each query
nonce_len – length of the nonce
out_query – pointer to a buffer where the query will be writtern
out_query_len – pointer to the length of the query buffer
variant – protocol variant (i.e. the roughtime draft number)
-
vrt_ret_t vrt_parse_response(uint8_t *nonce_sent, uint32_t nonce_len, uint32_t *reply, uint32_t reply_len, uint8_t *pk, uint64_t *out_midpoint, uint32_t *out_radii, unsigned variant)¶
Parse a roughtime query response.
- Parameters
nonce_sent – pointer to the nonce transmitted in the query
nonce_len – lenght of the nonce sent (can be larger than the actual number used in the protocol, see the vrt_make_query function for more information
reply – pointer to buffer with response
reply_len – length of response
pk – public key for the server, must be 32 bytes long
out_midpoint – pointer to where the midpoint value from the response should be written
out_radii – pointer to where the radii value from the response should be written
variant – protocol variant (i.e. the roughtime draft number)