x509_internal.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Copyright (c) 2003, Roger Dingledine
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2018, The Tor Project, Inc. */
  4. /* See LICENSE for licensing information */
  5. #ifndef TOR_X509_INTERNAL_H
  6. #define TOR_X509_INTERNAL_H
  7. /**
  8. * \file x509.h
  9. * \brief Internal headers for tortls.c
  10. **/
  11. #include "lib/crypt_ops/crypto_rsa.h"
  12. #include "lib/testsupport/testsupport.h"
  13. /**
  14. * How skewed do we allow our clock to be with respect to certificates that
  15. * seem to be expired? (seconds)
  16. */
  17. #define TOR_X509_PAST_SLOP (2*24*60*60)
  18. /**
  19. * How skewed do we allow our clock to be with respect to certificates that
  20. * seem to come from the future? (seconds)
  21. */
  22. #define TOR_X509_FUTURE_SLOP (30*24*60*60)
  23. MOCK_DECL(tor_x509_cert_impl_t *, tor_tls_create_certificate,
  24. (crypto_pk_t *rsa,
  25. crypto_pk_t *rsa_sign,
  26. const char *cname,
  27. const char *cname_sign,
  28. unsigned int cert_lifetime));
  29. MOCK_DECL(tor_x509_cert_t *, tor_x509_cert_new,
  30. (tor_x509_cert_impl_t *x509_cert));
  31. const tor_x509_cert_impl_t *tor_x509_cert_get_impl(
  32. const tor_x509_cert_t *cert);
  33. int tor_x509_check_cert_lifetime_internal(int severity,
  34. const tor_x509_cert_impl_t *cert,
  35. time_t now,
  36. int past_tolerance,
  37. int future_tolerance);
  38. void tor_x509_cert_impl_free_(tor_x509_cert_impl_t *cert);
  39. #ifdef ENABLE_OPENSSL
  40. int tor_x509_cert_set_cached_der_encoding(tor_x509_cert_t *cert);
  41. #else
  42. #define tor_x509_cert_set_cached_der_encoding(cert) (0)
  43. #endif
  44. #endif