OpenVPN
ssl_verify_openssl.c
Go to the documentation of this file.
1/*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
7 *
8 * Copyright (C) 2002-2026 OpenVPN Inc <sales@openvpn.net>
9 * Copyright (C) 2010-2026 Sentyron B.V. <openvpn@sentyron.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, see <https://www.gnu.org/licenses/>.
22 */
23
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif
32
33#include "syshead.h"
34
35#if defined(ENABLE_CRYPTO_OPENSSL)
36
37#include "ssl_verify_openssl.h"
38
39#include "error.h"
40#include "ssl_openssl.h"
41#include "ssl_verify.h"
42#include "ssl_verify_backend.h"
43#include "openssl_compat.h"
44
45#include <openssl/bn.h>
46#include <openssl/err.h>
47#include <openssl/x509v3.h>
48
49int
50verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
51{
52 int ret = 0;
53 struct tls_session *session;
54 SSL *ssl;
55 struct gc_arena gc = gc_new();
56
57 /* get the tls_session pointer */
58 ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
59 ASSERT(ssl);
60 session = (struct tls_session *)SSL_get_ex_data(ssl, mydata_index);
62
63 X509 *current_cert = X509_STORE_CTX_get_current_cert(ctx);
66
67 /* did peer present cert which was signed by our root cert? */
68 if (!preverify_ok && !session->opt->verify_hash_no_ca)
69 {
70 /* get the X509 name */
73
74 if (!subject)
75 {
76 subject = "(Failed to retrieve certificate subject)";
77 }
78
79 /* Log and ignore missing CRL errors */
81 {
82 msg(D_TLS_DEBUG_LOW, "VERIFY WARNING: depth=%d, %s: %s",
85 ret = 1;
86 goto cleanup;
87 }
88
89 /* Remote site specified a certificate, but it's not correct */
90 msg(D_TLS_ERRORS, "VERIFY ERROR: depth=%d, error=%s: %s, serial=%s",
93 serial ? serial : "<not available>");
94
96
97 session->verified = false;
98 goto cleanup;
99 }
100
102 {
103 goto cleanup;
104 }
105
106 ret = 1;
107
108cleanup:
109 gc_free(&gc);
110
111 return ret;
112}
113
114bool
116{
117 int nid = OBJ_txt2nid(fieldname);
118 return nid == NID_subject_alt_name || nid == NID_issuer_alt_name;
119}
120
121static bool
122extract_x509_extension(X509 *cert, char *fieldname, char *out, size_t size)
123{
124 bool retval = false;
125 char *buf = 0;
126
128 {
129 msg(D_TLS_ERRORS, "ERROR: --x509-username-field 'ext:%s' not supported", fieldname);
130 return false;
131 }
132
133 int nid = OBJ_txt2nid(fieldname);
135 if (extensions)
136 {
137 int numalts;
138 int i;
139 /* get amount of alternatives,
140 * RFC2459 claims there MUST be at least
141 * one, but we don't depend on it...
142 */
143
145
146 /* loop through all alternatives */
147 for (i = 0; i < numalts; i++)
148 {
149 /* get a handle to alternative name number i */
151
152 switch (name->type)
153 {
154 case GEN_EMAIL:
155 if (ASN1_STRING_to_UTF8((unsigned char **)&buf, name->d.ia5) < 0)
156 {
157 continue;
158 }
159 if (strlen(buf) != name->d.ia5->length)
160 {
161 msg(D_TLS_ERRORS, "ASN1 ERROR: string contained terminating zero");
162 OPENSSL_free(buf);
163 }
164 else
165 {
166 strncpynt(out, buf, size);
167 OPENSSL_free(buf);
168 retval = true;
169 }
170 break;
171
172 default:
173 msg(D_TLS_DEBUG, "%s: ignoring general name field type %i", __func__,
174 name->type);
175 break;
176 }
177 }
179 }
180 return retval;
181}
182
183/*
184 * Extract a field from an X509 subject name.
185 *
186 * Example:
187 *
188 * /C=US/ST=CO/L=Denver/O=ORG/CN=First-CN/CN=Test-CA/Email=jim@yonan.net
189 *
190 * The common name is 'Test-CA'
191 *
192 * Return true on success, false on error (insufficient buffer size in 'out'
193 * to contain result is grounds for error).
194 */
195static result_t
196extract_x509_field_ssl(X509_NAME *x509, const char *field_name, char *out, size_t size)
197{
198 int lastpos = -1;
199 int tmp = -1;
202 unsigned char *buf = NULL;
203
205 if (field_name_obj == NULL)
206 {
207 msg(D_TLS_ERRORS, "Invalid X509 attribute name '%s'", field_name);
208 return FAILURE;
209 }
210
211 ASSERT(size > 0);
212 *out = '\0';
213 do
214 {
215 lastpos = tmp;
217 } while (tmp > -1);
218
220
221 /* Nothing found */
222 if (lastpos == -1)
223 {
224 return FAILURE;
225 }
226
228 if (!x509ne)
229 {
230 return FAILURE;
231 }
232
234 if (!asn1)
235 {
236 return FAILURE;
237 }
238 if (ASN1_STRING_to_UTF8(&buf, asn1) < 0)
239 {
240 return FAILURE;
241 }
242
243 strncpynt(out, (char *)buf, size);
244
245 const result_t ret = (strlen((char *)buf) < size) ? SUCCESS : FAILURE;
246 OPENSSL_free(buf);
247 return ret;
248}
249
251backend_x509_get_username(char *common_name, size_t cn_len, char *x509_username_field, X509 *peer_cert)
252{
253 if (strncmp("ext:", x509_username_field, 4) == 0)
254 {
255 if (!extract_x509_extension(peer_cert, x509_username_field + 4, common_name, cn_len))
256 {
257 return FAILURE;
258 }
259 }
260 else if (strcmp(LN_serialNumber, x509_username_field) == 0)
261 {
263 struct gc_arena gc = gc_new();
264 char *serial = format_hex_ex(asn1_i->data, asn1_i->length, 0, 1 | FHE_CAPS, NULL, &gc);
265
266 if (!serial || cn_len <= strlen(serial) + 2)
267 {
268 gc_free(&gc);
269 return FAILURE;
270 }
271 snprintf(common_name, cn_len, "0x%s", serial);
272 gc_free(&gc);
273 }
274 else
275 {
276 X509_NAME *x509_subject_name = X509_get_subject_name(peer_cert);
277 if (x509_subject_name == NULL)
278 {
279 msg(D_TLS_ERRORS, "X509 subject name is NULL");
280 return FAILURE;
281 }
282
283 if (FAILURE
284 == extract_x509_field_ssl(x509_subject_name, x509_username_field,
285 common_name, cn_len))
286 {
287 return FAILURE;
288 }
289 }
290
291 return SUCCESS;
292}
293
294char *
296{
297 ASN1_INTEGER *asn1_i;
298 BIGNUM *bignum;
299 char *openssl_serial, *serial;
300
301 asn1_i = X509_get_serialNumber(cert);
302 bignum = ASN1_INTEGER_to_BN(asn1_i, NULL);
303 openssl_serial = BN_bn2dec(bignum);
304
305 serial = string_alloc(openssl_serial, gc);
306
307 BN_free(bignum);
308 OPENSSL_free(openssl_serial);
309
310 return serial;
311}
312
313char *
315{
316 const ASN1_INTEGER *asn1_i = X509_get_serialNumber(cert);
317
318 return format_hex_ex(asn1_i->data, asn1_i->length, 0, 1, ":", gc);
319}
320
322backend_x509_write_pem(openvpn_x509_cert_t *cert, const char *filename)
323{
324 BIO *out = BIO_new_file(filename, "w");
325 if (!out)
326 {
327 goto err;
328 }
329
330 if (!PEM_write_bio_X509(out, cert))
331 {
332 goto err;
333 }
334 BIO_free(out);
335
336 return SUCCESS;
337err:
338 BIO_free(out);
339 crypto_msg(D_TLS_DEBUG_LOW, "Error writing X509 certificate to file %s", filename);
340 return FAILURE;
341}
342
343struct buffer
345{
346 const EVP_MD *sha1 = EVP_sha1();
347 struct buffer hash = alloc_buf_gc((size_t)EVP_MD_size(sha1), gc);
348 X509_digest(cert, EVP_sha1(), BPTR(&hash), NULL);
350 return hash;
351}
352
353struct buffer
355{
356 const EVP_MD *sha256 = EVP_sha256();
357 struct buffer hash = alloc_buf_gc((size_t)EVP_MD_size(sha256), gc);
358 X509_digest(cert, EVP_sha256(), BPTR(&hash), NULL);
360 return hash;
361}
362
363char *
365{
368 char *subject = NULL;
369
371 if (subject_bio == NULL)
372 {
373 goto err;
374 }
375
379
380 if (BIO_eof(subject_bio))
381 {
382 goto err;
383 }
384
386
387 subject = gc_malloc(subject_mem->length + 1, false, gc);
388
389 memcpy(subject, subject_mem->data, subject_mem->length);
390 subject[subject_mem->length] = '\0';
391
392err:
394 return subject;
395}
396
397
398/*
399 * x509-track implementation -- save X509 fields to environment,
400 * using the naming convention:
401 *
402 * X509_{cert_depth}_{name}={value}
403 *
404 * This function differs from x509_setenv below in the following ways:
405 *
406 * (1) Only explicitly named attributes in xt are saved, per usage
407 * of "x509-track" program options.
408 * (2) Only the level 0 cert info is saved unless the XT_FULL_CHAIN
409 * flag is set in xt->flags (corresponds with prepending a '+'
410 * to the name when specified by "x509-track" program option).
411 * (3) This function supports both X509 subject name fields as
412 * well as X509 V3 extensions.
413 * (4) This function can return the SHA1 fingerprint of a cert, e.g.
414 * x509-track "+SHA1"
415 * will return the SHA1 fingerprint for each certificate in the
416 * peer chain.
417 */
418
419void
420x509_track_add(const struct x509_track **ll_head, const char *name, msglvl_t msglevel,
421 struct gc_arena *gc)
422{
423 struct x509_track *xt;
424 ALLOC_OBJ_CLEAR_GC(xt, struct x509_track, gc);
425 if (*name == '+')
426 {
427 xt->flags |= XT_FULL_CHAIN;
428 ++name;
429 }
430 xt->name = name;
431 xt->nid = OBJ_txt2nid(name);
432 if (xt->nid != NID_undef)
433 {
434 xt->next = *ll_head;
435 *ll_head = xt;
436 }
437 else
438 {
439 msg(msglevel, "x509_track: no such attribute '%s'", name);
440 }
441}
442
443/* worker method for setenv_x509_track */
444static void
445do_setenv_x509(struct env_set *es, const char *name, char *value, int depth)
446{
447 char *name_expand;
448 size_t name_expand_size;
449
450 string_mod(value, CC_ANY, CC_CRLF, '?');
451 msg(D_X509_ATTR, "X509 ATTRIBUTE name='%s' value='%s' depth=%d", name, value, depth);
452 name_expand_size = 64 + strlen(name);
453 name_expand = (char *)malloc(name_expand_size);
454 check_malloc_return(name_expand);
455 snprintf(name_expand, name_expand_size, "X509_%d_%s", depth, name);
456 setenv_str(es, name_expand, value);
457 free(name_expand);
458}
459
460void
461x509_setenv_track(const struct x509_track *xt, struct env_set *es, const int depth, X509 *x509)
462{
463 struct gc_arena gc = gc_new();
464 X509_NAME *x509_name = X509_get_subject_name(x509);
465 const char nullc = '\0';
466
467 while (xt)
468 {
469 if (depth == 0 || (xt->flags & XT_FULL_CHAIN))
470 {
471 switch (xt->nid)
472 {
473 case NID_sha1:
474 case NID_sha256:
475 {
476 struct buffer fp_buf;
477 char *fp_str = NULL;
478
479 if (xt->nid == NID_sha1)
480 {
482 }
483 else
484 {
486 }
487
488 fp_str = format_hex_ex(BPTR(&fp_buf), BLEN(&fp_buf), 0, 1 | FHE_CAPS, ":", &gc);
489 do_setenv_x509(es, xt->name, fp_str, depth);
490 }
491 break;
492
493 default:
494 {
495 int i = X509_NAME_get_index_by_NID(x509_name, xt->nid, -1);
496 if (i >= 0)
497 {
499 if (ent)
500 {
502 unsigned char *buf = NULL;
503 if (ASN1_STRING_to_UTF8(&buf, val) >= 0)
504 {
505 do_setenv_x509(es, xt->name, (char *)buf, depth);
506 OPENSSL_free(buf);
507 }
508 }
509 }
510 else
511 {
512 i = X509_get_ext_by_NID(x509, xt->nid, -1);
513 if (i >= 0)
514 {
516 if (ext)
517 {
518 BIO *bio = BIO_new(BIO_s_mem());
519 if (bio)
520 {
521 if (X509V3_EXT_print(bio, ext, 0, 0))
522 {
523 if (BIO_write(bio, &nullc, 1) == 1)
524 {
525 char *str;
527 do_setenv_x509(es, xt->name, str, depth);
528 }
529 }
530 BIO_free(bio);
531 }
532 }
533 }
534 }
535 }
536 }
537 }
538 xt = xt->next;
539 }
540 gc_free(&gc);
541}
542
543/*
544 * Save X509 fields to environment, using the naming convention:
545 *
546 * X509_{cert_depth}_{name}={value}
547 */
548void
550{
551 int i, n;
552 int fn_nid;
554 ASN1_STRING *val;
556 const char *objbuf;
557 unsigned char *buf = NULL;
558 char *name_expand;
559 size_t name_expand_size;
561
563 for (i = 0; i < n; ++i)
564 {
566 if (!ent)
567 {
568 continue;
569 }
571 if (!fn)
572 {
573 continue;
574 }
576 if (!val)
577 {
578 continue;
579 }
581 if (fn_nid == NID_undef)
582 {
583 continue;
584 }
586 if (!objbuf)
587 {
588 continue;
589 }
590 if (ASN1_STRING_to_UTF8(&buf, val) < 0)
591 {
592 continue;
593 }
599 string_mod((char *)buf, CC_PRINT, CC_CRLF, '_');
600 setenv_str_incr(es, name_expand, (char *)buf);
601 free(name_expand);
602 OPENSSL_free(buf);
603 }
604}
605
608{
610 {
611 return SUCCESS;
612 }
614 {
615 /*
616 * Unfortunately, X509_check_purpose() does some weird thing that
617 * prevent it to take a const argument
618 */
621
622 /*
623 * old versions of OpenSSL allow us to make the less strict check we used to
624 * do. If this less strict check pass, warn user that this might not be the
625 * case when its distribution will update to OpenSSL 1.1
626 */
627 if (result == FAILURE)
628 {
631 result = (ns && ns->length > 0 && (ns->data[0] & NS_SSL_CLIENT)) ? SUCCESS : FAILURE;
632 if (result == SUCCESS)
633 {
634 msg(M_WARN, "X509: Certificate is a client certificate yet it's purpose "
635 "cannot be verified (check may fail in the future)");
636 }
638 }
639 return result;
640 }
642 {
643 /*
644 * Unfortunately, X509_check_purpose() does some weird thing that
645 * prevent it to take a const argument
646 */
649
650 /*
651 * old versions of OpenSSL allow us to make the less strict check we used to
652 * do. If this less strict check pass, warn user that this might not be the
653 * case when its distribution will update to OpenSSL 1.1
654 */
655 if (result == FAILURE)
656 {
659 result = (ns && ns->length > 0 && (ns->data[0] & NS_SSL_SERVER)) ? SUCCESS : FAILURE;
660 if (result == SUCCESS)
661 {
662 msg(M_WARN, "X509: Certificate is a server certificate yet it's purpose "
663 "cannot be verified (check may fail in the future)");
664 }
666 }
667 return result;
668 }
669
670 return FAILURE;
671}
672
674x509_verify_cert_ku(X509 *x509, const unsigned int *const expected_ku, size_t expected_len)
675{
677
678 if (ku == NULL)
679 {
680 msg(D_TLS_ERRORS, "Certificate does not have key usage extension");
681 return FAILURE;
682 }
683
685 {
686 /* Extension required, value checked by TLS library */
688 return SUCCESS;
689 }
690
691 unsigned int nku = 0;
692 for (int i = 0; i < 8; i++)
693 {
695 {
696 nku |= 1 << (7 - i);
697 }
698 }
699
700 /*
701 * Fixup if no LSB bits
702 */
703 if ((nku & 0xff) == 0)
704 {
705 nku >>= 8;
706 }
707
708 msg(D_HANDSHAKE, "Validating certificate key usage");
710 for (size_t i = 0; fFound != SUCCESS && i < expected_len; i++)
711 {
712 if (expected_ku[i] != 0 && (nku & expected_ku[i]) == expected_ku[i])
713 {
714 fFound = SUCCESS;
715 }
716 }
717
718 if (fFound != SUCCESS)
719 {
720 msg(D_TLS_ERRORS, "ERROR: Certificate has key usage %04x, expected one of:", nku);
721 for (size_t i = 0; i < expected_len && expected_ku[i]; i++)
722 {
723 msg(D_TLS_ERRORS, " * %04x", expected_ku[i]);
724 }
725 }
726
728
729 return fFound;
730}
731
734{
737
739 {
740 msg(D_HANDSHAKE, "Certificate does not have extended key usage extension");
741 }
742 else
743 {
744 int i;
745
746 msg(D_HANDSHAKE, "Validating certificate extended key usage");
747 for (i = 0; SUCCESS != fFound && i < sk_ASN1_OBJECT_num(eku); i++)
748 {
750 char szOid[1024];
751
752 if (SUCCESS != fFound && OBJ_obj2txt(szOid, sizeof(szOid), oid, 0) != -1)
753 {
754 msg(D_HANDSHAKE, "++ Certificate has EKU (str) %s, expects %s", szOid,
757 {
758 fFound = SUCCESS;
759 }
760 }
761 if (SUCCESS != fFound && OBJ_obj2txt(szOid, sizeof(szOid), oid, 1) != -1)
762 {
763 msg(D_HANDSHAKE, "++ Certificate has EKU (oid) %s, expects %s", szOid,
766 {
767 fFound = SUCCESS;
768 }
769 }
770 }
771 }
772
773 if (eku != NULL)
774 {
776 }
777
778 return fFound;
779}
780
781bool
783{
784 if (!opt->crl_file || (opt->ssl_flags & SSLF_CRL_VERIFY_DIR))
785 {
786 return false;
787 }
788
790 if (!store)
791 {
792 crypto_msg(M_FATAL, "Cannot get certificate store");
793 }
794
796 for (int i = 0; i < sk_X509_OBJECT_num(objs); i++)
797 {
799 ASSERT(obj);
801 {
802 return false;
803 }
804 }
805 return true;
806}
807
808#endif /* defined(ENABLE_CRYPTO_OPENSSL) */
void * gc_malloc(size_t size, bool clear, struct gc_arena *a)
Definition buffer.c:336
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
Definition buffer.c:89
char * format_hex_ex(const uint8_t *data, size_t size, size_t maxoutput, unsigned int space_break_flags, const char *separator, struct gc_arena *gc)
Definition buffer.c:483
bool string_mod(char *str, const unsigned int inclusive, const unsigned int exclusive, const char replace)
Modifies a string in place by replacing certain classes of characters of it with a specified characte...
Definition buffer.c:1045
char * string_alloc(const char *str, struct gc_arena *gc)
Definition buffer.c:648
#define CC_ANY
any character
Definition buffer.h:877
#define BPTR(buf)
Definition buffer.h:123
static bool buf_inc_len(struct buffer *buf, int inc)
Definition buffer.h:588
#define CC_CRLF
carriage return or newline
Definition buffer.h:914
#define ALLOC_OBJ_CLEAR_GC(dptr, type, gc)
Definition buffer.h:1101
#define BLEN(buf)
Definition buffer.h:126
static void strncpynt(char *dest, const char *src, size_t maxlen)
Definition buffer.h:361
static void check_malloc_return(void *p)
Definition buffer.h:1107
static void gc_free(struct gc_arena *a)
Definition buffer.h:1025
#define CC_PRINT
printable (>= 32, != 127)
Definition buffer.h:885
#define FHE_CAPS
Definition buffer.h:498
static struct gc_arena gc_new(void)
Definition buffer.h:1017
#define crypto_msg(flags,...)
Retrieve any OpenSSL errors, then print the supplied error message.
void setenv_str(struct env_set *es, const char *name, const char *value)
Definition env_set.c:307
void setenv_str_incr(struct env_set *es, const char *name, const char *value)
Store the supplied name value pair in the env_set.
Definition env_set.c:329
#define D_TLS_DEBUG_LOW
Definition errlevel.h:76
#define D_X509_ATTR
Definition errlevel.h:102
#define D_HANDSHAKE
Definition errlevel.h:71
#define D_TLS_ERRORS
Definition errlevel.h:58
#define D_TLS_DEBUG
Definition errlevel.h:164
int verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
Verify that the remote OpenVPN peer's certificate allows setting up a VPN tunnel.
OpenSSL compatibility stub.
#define M_FATAL
Definition error.h:90
#define msg(flags,...)
Definition error.h:152
unsigned int msglvl_t
Definition error.h:77
#define ASSERT(x)
Definition error.h:219
#define M_WARN
Definition error.h:92
void usage(void)
Definition options.c:4834
#define SSLF_CRL_VERIFY_DIR
Definition ssl_common.h:428
int mydata_index
Allocate space in SSL objects in which to store a struct tls_session pointer back to parent.
Definition ssl_openssl.c:88
Control Channel OpenSSL Backend.
result_t verify_cert(struct tls_session *session, openvpn_x509_cert_t *cert, int cert_depth)
Definition ssl_verify.c:577
void cert_hash_remember(struct tls_session *session, const int error_depth, const struct buffer *cert_hash)
Definition ssl_verify.c:194
Control Channel Verification Module.
#define OPENVPN_KU_REQUIRED
Require keyUsage to be present in cert (0xFFFF is an invalid KU value)
Definition ssl_verify.h:257
#define XT_FULL_CHAIN
Definition ssl_verify.h:241
#define NS_CERT_CHECK_CLIENT
Do not perform Netscape certificate type verification.
Definition ssl_verify.h:254
#define NS_CERT_CHECK_NONE
Do not perform Netscape certificate type verification.
Definition ssl_verify.h:250
#define NS_CERT_CHECK_SERVER
Do not perform Netscape certificate type verification.
Definition ssl_verify.h:252
Control Channel Verification Module library-specific backend interface.
result_t
Result of verification function.
@ FAILURE
@ SUCCESS
mbedtls_x509_crt openvpn_x509_cert_t
char * x509_get_subject(X509 *cert, struct gc_arena *gc)
static result_t extract_x509_field_ssl(X509_NAME *x509, const char *field_name, char *out, size_t size)
struct buffer x509_get_sha1_fingerprint(X509 *cert, struct gc_arena *gc)
result_t x509_verify_cert_ku(X509 *x509, const unsigned int *const expected_ku, size_t expected_len)
bool tls_verify_crl_missing(const struct tls_options *opt)
Return true iff a CRL is configured, but is not loaded.
result_t backend_x509_write_pem(openvpn_x509_cert_t *cert, const char *filename)
struct buffer x509_get_sha256_fingerprint(X509 *cert, struct gc_arena *gc)
result_t x509_verify_cert_eku(X509 *x509, const char *const expected_oid)
static void do_setenv_x509(struct env_set *es, const char *name, char *value, int depth)
static bool extract_x509_extension(X509 *cert, char *fieldname, char *out, size_t size)
bool x509_username_field_ext_supported(const char *fieldname)
Return true iff the supplied extension field is supported by the –x509-username-field option.
char * backend_x509_get_serial_hex(openvpn_x509_cert_t *cert, struct gc_arena *gc)
result_t x509_verify_ns_cert_type(openvpn_x509_cert_t *peer_cert, const int usage)
void x509_setenv_track(const struct x509_track *xt, struct env_set *es, const int depth, X509 *x509)
char * backend_x509_get_serial(openvpn_x509_cert_t *cert, struct gc_arena *gc)
void x509_track_add(const struct x509_track **ll_head, const char *name, msglvl_t msglevel, struct gc_arena *gc)
void x509_setenv(struct env_set *es, int cert_depth, openvpn_x509_cert_t *peer_cert)
result_t backend_x509_get_username(char *common_name, size_t cn_len, char *x509_username_field, X509 *peer_cert)
Control Channel Verification Module OpenSSL backend.
Wrapper structure for dynamically allocated memory.
Definition buffer.h:60
int len
Length in bytes of the actual content within the allocated memory.
Definition buffer.h:65
Structure containing the hash for a single certificate.
Definition ssl_verify.h:58
Garbage collection arena used to keep track of dynamically allocated memory.
Definition buffer.h:116
Definition list.h:53
unsigned int ssl_flags
Definition ssl_common.h:434
struct tls_root_ctx * ssl_ctx
Definition ssl_common.h:311
const char * crl_file
Definition ssl_common.h:356
SSL_CTX * ctx
Definition ssl_openssl.h:41
Security parameter state of a single session within a VPN tunnel.
Definition ssl_common.h:489
unsigned int flags
Definition ssl_verify.h:242
const struct x509_track * next
Definition ssl_verify.h:239
const char * name
Definition ssl_verify.h:240
struct env_set * es
static int cleanup(void **state)
struct gc_arena gc
Definition test_ssl.c:131