]> git.ipfire.org Git - thirdparty/openssl.git/blame - demos/easy_tls/easy-tls.h
Run util/openssl-format-source -v -c .
[thirdparty/openssl.git] / demos / easy_tls / easy-tls.h
CommitLineData
5294dd70 1/* -*- Mode: C; c-file-style: "bsd" -*- */
c695ebe2 2/*-
5294dd70
BM
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
10#ifndef HEADER_TLS_H
ae5c8664 11# define HEADER_TLS_H
5294dd70 12
ae5c8664 13# ifndef HEADER_SSL_H
5294dd70 14typedef struct ssl_ctx_st SSL_CTX;
ae5c8664 15# endif
5294dd70 16
ae5c8664 17# define TLS_INFO_SIZE 512 /* max. # of bytes written to infofd */
5294dd70 18
ae5c8664
MC
19void tls_set_dhe1024(int i, void *apparg);
20/*
21 * Generate DHE parameters: i >= 0 deterministic (i selects seed), i < 0
22 * random (may take a while). tls_create_ctx calls this with random
23 * non-negative i if the application has never called it.
24 */
5294dd70
BM
25
26void tls_rand_seed(void);
27int tls_rand_seed_from_file(const char *filename, size_t n, void *apparg);
28void tls_rand_seed_from_memory(const void *buf, size_t n);
29
ae5c8664 30struct tls_create_ctx_args {
5294dd70
BM
31 int client_p;
32 const char *certificate_file;
33 const char *key_file;
34 const char *ca_file;
35 int verify_depth;
36 int fail_unless_verified;
37 int export_p;
38};
39struct tls_create_ctx_args tls_create_ctx_defaultargs(void);
ae5c8664
MC
40/*
41 * struct tls_create_ctx_args is similar to a conventional argument list, but
42 * it can provide default values and allows for future extension.
43 */
5294dd70
BM
44SSL_CTX *tls_create_ctx(struct tls_create_ctx_args, void *apparg);
45
ae5c8664 46struct tls_start_proxy_args {
5294dd70
BM
47 int fd;
48 int client_p;
49 SSL_CTX *ctx;
50 pid_t *pid;
51 int *infofd;
52};
53struct tls_start_proxy_args tls_start_proxy_defaultargs(void);
ae5c8664
MC
54/*
55 * tls_start_proxy return value *MUST* be checked! 0 means ok, otherwise
56 * we've probably run out of some resources.
57 */
5294dd70
BM
58int tls_start_proxy(struct tls_start_proxy_args, void *apparg);
59
60#endif