mbedtls icon indicating copy to clipboard operation
mbedtls copied to clipboard

Document the requirements on mbedtls_time_t

Open gilles-peskine-arm opened this issue 2 years ago • 1 comments

The documentation of mbedtls_time_t just says “The time_t datatype” and doesn't say what assumptions Mbed TLS makes on this type. It should state the assumptions. At least:

  • mbedtls_time_t is a signed arithmetic type (supporting addition, subtraction and comparison).
  • mbedtls_time_t is the number of seconds since an unspecified epoch.

These assumptions are based on current usage in ssl_tickets.c. There may be more assumptions based on usage elsewhere.

gilles-peskine-arm avatar Sep 09 '22 13:09 gilles-peskine-arm

There's an added subtlety about requirements that modules can have different requirements, e.g. an application that only uses TLS with PSK wouldn't care about how X509 uses mbedtls_time_t in relation with certificate validity, and conversely an application that uses X509 but not TLS wouldn't care about the ssl_tickets module. Something to keep in mind about making explicit requirements: they might exclude applications that work now because those applications don't use the parts of the library that have those requirements.

gilles-peskine-arm avatar Sep 09 '22 15:09 gilles-peskine-arm