summaryrefslogtreecommitdiff
path: root/src/regress
diff options
context:
space:
mode:
Diffstat (limited to 'src/regress')
-rw-r--r--src/regress/lib/libtls/verify/verifytest.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/regress/lib/libtls/verify/verifytest.c b/src/regress/lib/libtls/verify/verifytest.c
index bb8b372014..81dcb90a67 100644
--- a/src/regress/lib/libtls/verify/verifytest.c
+++ b/src/regress/lib/libtls/verify/verifytest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: verifytest.c,v 1.1 2014/11/01 11:55:27 jsing Exp $ */ 1/* $OpenBSD: verifytest.c,v 1.2 2014/12/07 16:56:17 bcook Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -20,8 +20,9 @@
20#include <stdlib.h> 20#include <stdlib.h>
21 21
22#include <openssl/x509v3.h> 22#include <openssl/x509v3.h>
23#include <tls.h>
23 24
24extern int tls_check_hostname(X509 *cert, const char *host); 25extern int tls_check_hostname(struct tls *ctx, X509 *cert, const char *host);
25 26
26struct verify_test { 27struct verify_test {
27 const char common_name[128]; 28 const char common_name[128];
@@ -162,6 +163,7 @@ do_verify_test(int test_no, struct verify_test *vt)
162 GENERAL_NAME *alt_name; 163 GENERAL_NAME *alt_name;
163 X509_NAME *name; 164 X509_NAME *name;
164 X509 *cert; 165 X509 *cert;
166 struct tls *tls;
165 167
166 /* Build certificate structure. */ 168 /* Build certificate structure. */
167 if ((cert = X509_new()) == NULL) 169 if ((cert = X509_new()) == NULL)
@@ -174,6 +176,8 @@ do_verify_test(int test_no, struct verify_test *vt)
174 if (X509_set_subject_name(cert, name) == 0) 176 if (X509_set_subject_name(cert, name) == 0)
175 errx(1, "failed to set subject name"); 177 errx(1, "failed to set subject name");
176 X509_NAME_free(name); 178 X509_NAME_free(name);
179 if ((tls = tls_client()) == NULL)
180 errx(1, "failed to malloc tls_client");
177 181
178 if (vt->alt_name_type != 0) { 182 if (vt->alt_name_type != 0) {
179 if ((alt_name_stack = sk_GENERAL_NAME_new_null()) == NULL) 183 if ((alt_name_stack = sk_GENERAL_NAME_new_null()) == NULL)
@@ -209,7 +213,7 @@ do_verify_test(int test_no, struct verify_test *vt)
209 sk_GENERAL_NAME_pop_free(alt_name_stack, GENERAL_NAME_free); 213 sk_GENERAL_NAME_pop_free(alt_name_stack, GENERAL_NAME_free);
210 } 214 }
211 215
212 if (tls_check_hostname(cert, vt->hostname) != vt->want) { 216 if (tls_check_hostname(tls, cert, vt->hostname) != vt->want) {
213 fprintf(stderr, "FAIL: test %i failed with common name " 217 fprintf(stderr, "FAIL: test %i failed with common name "
214 "'%s', alt name '%s' and hostname '%s'\n", test_no, 218 "'%s', alt name '%s' and hostname '%s'\n", test_no,
215 vt->common_name, vt->alt_name, vt->hostname); 219 vt->common_name, vt->alt_name, vt->hostname);