static int verify_chain(SSL *ssl, STACK_OF(X509) *chain)
{
- int ret;
+ int ret = -1;
X509_STORE_CTX *store_ctx;
SSL_CTX *ssl_ctx = SSL_get_SSL_CTX(ssl);
X509_STORE *store = SSL_CTX_get_cert_store(ssl_ctx);
return -1;
if (!X509_STORE_CTX_init(store_ctx, store, cert, chain))
- return 0;
- X509_STORE_CTX_set_ex_data(store_ctx, store_ctx_idx, ssl);
+ goto end;
+ if (!X509_STORE_CTX_set_ex_data(store_ctx, store_ctx_idx, ssl))
+ goto end;
X509_STORE_CTX_set_default(store_ctx,
SSL_is_server(ssl) ? "ssl_client" : "ssl_server");
SSL_set_verify_result(ssl, X509_STORE_CTX_get_error(store_ctx));
X509_STORE_CTX_cleanup(store_ctx);
+end:
X509_STORE_CTX_free(store_ctx);
return (ret);
return 1;
}
-static int test_tlsafile(SSL_CTX *ctx, const char *basename,
+static int test_tlsafile(SSL_CTX *ctx, const char *base_name,
BIO *f, const char *path)
{
char *line;
STACK_OF(X509) *chain;
int ntlsa;
int ncert;
+ int noncheck;
int want;
int want_depth;
int off;
continue;
++testno;
- if (sscanf(line, "%d %d %d %d%n", &ntlsa, &ncert, &want, &want_depth, &off) != 4
+ if (sscanf(line, "%d %d %d %d %d%n",
+ &ntlsa, &ncert, &noncheck, &want, &want_depth, &off) != 5
|| !allws(line + off)) {
fprintf(stderr, "Expected tlsa count, cert count and result"
" at test %d of %s\n", testno, path);
if ((ssl = SSL_new(ctx)) == NULL)
return -1;
SSL_set_connect_state(ssl);
- if (SSL_dane_enable(ssl, basename) <= 0) {
+ if (SSL_dane_enable(ssl, base_name) <= 0) {
SSL_free(ssl);
return -1;
}
+ if (noncheck)
+ SSL_dane_set_flags(ssl, DANE_FLAG_NO_DANE_EE_NAMECHECKS);
for (i = 0; i < ntlsa; ++i) {
if ((line = read_to_eol(f)) == NULL || !tlsa_import_rr(ssl, line)) {