x509_internal.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Copyright (c) 2003, Roger Dingledine
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2019, 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. int tor_x509_check_cert_lifetime_internal(int severity,
  32. const tor_x509_cert_impl_t *cert,
  33. time_t now,
  34. int past_tolerance,
  35. int future_tolerance);
  36. void tor_x509_cert_impl_free_(tor_x509_cert_impl_t *cert);
  37. #define tor_x509_cert_impl_free(cert) \
  38. FREE_AND_NULL(tor_x509_cert_impl_t, tor_x509_cert_impl_free_, (cert))
  39. tor_x509_cert_impl_t *tor_x509_cert_impl_dup_(tor_x509_cert_impl_t *cert);
  40. #ifdef ENABLE_OPENSSL
  41. int tor_x509_cert_set_cached_der_encoding(tor_x509_cert_t *cert);
  42. #else
  43. #define tor_x509_cert_set_cached_der_encoding(cert) (0)
  44. #endif
  45. #endif /* !defined(TOR_X509_INTERNAL_H) */