/*
* Copyright (C) 2017 Nikos Mavrogiannopoulos
*
* Author: Nikos Mavrogiannopoulos
*
* This file is part of GnuTLS.
*
* GnuTLS is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* GnuTLS is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see
*/
/* This tests key import for gnutls_ocsp_resp_t APIs */
#ifdef HAVE_CONFIG_H
#include
#endif
#include
#include
#include
#include
#include
#include
#include
#include "ocsp-common.h"
#include "utils.h"
#define testfail(fmt, ...) \
fail("%s: "fmt, name, ##__VA_ARGS__)
static void load_list(const char *name, const gnutls_datum_t *txt,
unsigned int nocsps,
int format,
unsigned flags, int exp_err)
{
gnutls_ocsp_resp_t *ocsps;
unsigned int i, size;
int ret;
ret = gnutls_ocsp_resp_list_import2(&ocsps, &size, txt, format, flags);
if (ret < 0) {
if (exp_err == ret)
return;
testfail("gnutls_x509_crt_list_import: %s\n", gnutls_strerror(ret));
}
for (i=0;i