Implement cert verification.
[radsecproxy.git] / lib / rsp_tlscommon.h
1 /*
2  * Copyright (C) 2006-2008 Stig Venaas <venaas@uninett.no>
3  *
4  * Permission to use, copy, modify, and distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  */
8
9 #include <openssl/ssl.h>
10
11 #if defined (__cplusplus)
12 extern "C" {
13 #endif
14
15 struct tls {
16     char *name;
17     char *cacertfile;
18     char *cacertpath;
19     char *certfile;
20     char *certkeyfile;
21     char *certkeypwd;
22     uint8_t crlcheck;
23     char **policyoids;
24     uint32_t cacheexpiry;
25     uint32_t tlsexpiry;
26     uint32_t dtlsexpiry;
27     X509_VERIFY_PARAM *vpm;
28     SSL_CTX *tlsctx;
29     SSL_CTX *dtlsctx;
30 };
31
32 #if defined(RADPROT_TLS) || defined(RADPROT_DTLS)
33 void ssl_init();
34 struct tls *tlsgettls(char *alt1, char *alt2);
35 SSL_CTX *tlsgetctx(uint8_t type, struct tls *t);
36 X509 *verifytlscert(SSL *ssl);
37 int subjectaltnameaddr(X509 *cert, int family, const struct in6_addr *addr);
38 int subjectaltnameregexp(X509 *cert, int type, const char *exact,  const regex_t *regex);
39 int cnregexp(X509 *cert, const char *exact, const regex_t *regex);
40 int verifyconfcert(X509 *cert, struct clsrvconf *conf);
41 #endif
42
43 #if defined (__cplusplus)
44 }
45 #endif
46
47 /* Local Variables: */
48 /* c-file-style: "stroustrup" */
49 /* End: */