x509_internal.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. 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. tor_x509_cert_impl_t *tor_x509_cert_impl_dup_(tor_x509_cert_impl_t *cert);
  38. #ifdef ENABLE_OPENSSL
  39. int tor_x509_cert_set_cached_der_encoding(tor_x509_cert_t *cert);
  40. #else
  41. #define tor_x509_cert_set_cached_der_encoding(cert) (0)
  42. #endif
  43. #endif