easy-tls.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* -*- Mode: C; c-file-style: "bsd" -*- */
  2. /*
  3. * easy-tls.h -- generic TLS proxy.
  4. * $Id: easy-tls.h,v 1.1 2001/09/17 19:06:59 bodo Exp $
  5. */
  6. /*
  7. * (c) Copyright 1999 Bodo Moeller. All rights reserved.
  8. */
  9. #ifndef HEADER_TLS_H
  10. #define HEADER_TLS_H
  11. #ifndef HEADER_SSL_H
  12. typedef struct ssl_ctx_st SSL_CTX;
  13. #endif
  14. #define TLS_INFO_SIZE 512 /* max. # of bytes written to infofd */
  15. void tls_set_dhe1024(int i, void* apparg);
  16. /* Generate DHE parameters:
  17. * i >= 0 deterministic (i selects seed), i < 0 random (may take a while).
  18. * tls_create_ctx calls this with random non-negative i if the application
  19. * has never called it.*/
  20. void tls_rand_seed(void);
  21. int tls_rand_seed_from_file(const char *filename, size_t n, void *apparg);
  22. void tls_rand_seed_from_memory(const void *buf, size_t n);
  23. struct tls_create_ctx_args
  24. {
  25. int client_p;
  26. const char *certificate_file;
  27. const char *key_file;
  28. const char *ca_file;
  29. int verify_depth;
  30. int fail_unless_verified;
  31. int export_p;
  32. };
  33. struct tls_create_ctx_args tls_create_ctx_defaultargs(void);
  34. /* struct tls_create_ctx_args is similar to a conventional argument list,
  35. * but it can provide default values and allows for future extension. */
  36. SSL_CTX *tls_create_ctx(struct tls_create_ctx_args, void *apparg);
  37. struct tls_start_proxy_args
  38. {
  39. int fd;
  40. int client_p;
  41. SSL_CTX *ctx;
  42. pid_t *pid;
  43. int *infofd;
  44. };
  45. struct tls_start_proxy_args tls_start_proxy_defaultargs(void);
  46. /* tls_start_proxy return value *MUST* be checked!
  47. * 0 means ok, otherwise we've probably run out of some resources. */
  48. int tls_start_proxy(struct tls_start_proxy_args, void *apparg);
  49. #endif