summaryrefslogtreecommitdiff
path: root/tests/crypto-tls-x509-helpers.h
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2021-03-10 07:33:14 +0100
committerThomas Huth <thuth@redhat.com>2021-03-12 15:46:30 +0100
commitda668aa15b99150a8595c491aee00d5d2426aaf9 (patch)
tree0463b0a303e807bdab46460f6c702be611bd7179 /tests/crypto-tls-x509-helpers.h
parent363fc963054d8e82cfd55fa9b9aa130692a8dbd7 (diff)
downloadqemu-da668aa15b99150a8595c491aee00d5d2426aaf9.zip
tests: Move unit tests into a separate directory
The main tests directory still looks very crowded, and it's not clear which files are part of a unit tests and which belong to a different test subsystem. Let's clean up the mess and move the unit tests to a separate directory. Message-Id: <20210310063314.1049838-1-thuth@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/crypto-tls-x509-helpers.h')
-rw-r--r--tests/crypto-tls-x509-helpers.h132
1 files changed, 0 insertions, 132 deletions
diff --git a/tests/crypto-tls-x509-helpers.h b/tests/crypto-tls-x509-helpers.h
deleted file mode 100644
index 8fcd7785ab..0000000000
--- a/tests/crypto-tls-x509-helpers.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2015 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * Author: Daniel P. Berrange <berrange@redhat.com>
- */
-
-#ifndef TESTS_CRYPTO_TLS_X509_HELPERS_H
-#define TESTS_CRYPTO_TLS_X509_HELPERS_H
-
-#include <gnutls/gnutls.h>
-#include <gnutls/x509.h>
-
-#if !(defined WIN32) && \
- defined(CONFIG_TASN1)
-# define QCRYPTO_HAVE_TLS_TEST_SUPPORT
-#endif
-
-#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
-# include <libtasn1.h>
-
-
-/*
- * This contains parameter about how to generate
- * certificates.
- */
-typedef struct QCryptoTLSTestCertReq QCryptoTLSTestCertReq;
-struct QCryptoTLSTestCertReq {
- gnutls_x509_crt_t crt;
-
- const char *filename;
-
- /* Identifying information */
- const char *country;
- const char *cn;
- const char *altname1;
- const char *altname2;
- const char *ipaddr1;
- const char *ipaddr2;
-
- /* Basic constraints */
- bool basicConstraintsEnable;
- bool basicConstraintsCritical;
- bool basicConstraintsIsCA;
-
- /* Key usage */
- bool keyUsageEnable;
- bool keyUsageCritical;
- int keyUsageValue;
-
- /* Key purpose (aka Extended key usage) */
- bool keyPurposeEnable;
- bool keyPurposeCritical;
- const char *keyPurposeOID1;
- const char *keyPurposeOID2;
-
- /* zero for current time, or non-zero for hours from now */
- int start_offset;
- /* zero for 24 hours from now, or non-zero for hours from now */
- int expire_offset;
-};
-
-void test_tls_generate_cert(QCryptoTLSTestCertReq *req,
- gnutls_x509_crt_t ca);
-void test_tls_write_cert_chain(const char *filename,
- gnutls_x509_crt_t *certs,
- size_t ncerts);
-void test_tls_discard_cert(QCryptoTLSTestCertReq *req);
-
-void test_tls_init(const char *keyfile);
-void test_tls_cleanup(const char *keyfile);
-
-# define TLS_CERT_REQ(varname, cavarname, \
- country, commonname, \
- altname1, altname2, \
- ipaddr1, ipaddr2, \
- basicconsenable, basicconscritical, basicconsca, \
- keyusageenable, keyusagecritical, keyusagevalue, \
- keypurposeenable, keypurposecritical, \
- keypurposeoid1, keypurposeoid2, \
- startoffset, endoffset) \
- static QCryptoTLSTestCertReq varname = { \
- NULL, WORKDIR #varname "-ctx.pem", \
- country, commonname, altname1, altname2, \
- ipaddr1, ipaddr2, \
- basicconsenable, basicconscritical, basicconsca, \
- keyusageenable, keyusagecritical, keyusagevalue, \
- keypurposeenable, keypurposecritical, \
- keypurposeoid1, keypurposeoid2, \
- startoffset, endoffset \
- }; \
- test_tls_generate_cert(&varname, cavarname.crt)
-
-# define TLS_ROOT_REQ(varname, \
- country, commonname, \
- altname1, altname2, \
- ipaddr1, ipaddr2, \
- basicconsenable, basicconscritical, basicconsca, \
- keyusageenable, keyusagecritical, keyusagevalue, \
- keypurposeenable, keypurposecritical, \
- keypurposeoid1, keypurposeoid2, \
- startoffset, endoffset) \
- static QCryptoTLSTestCertReq varname = { \
- NULL, WORKDIR #varname "-ctx.pem", \
- country, commonname, altname1, altname2, \
- ipaddr1, ipaddr2, \
- basicconsenable, basicconscritical, basicconsca, \
- keyusageenable, keyusagecritical, keyusagevalue, \
- keypurposeenable, keypurposecritical, \
- keypurposeoid1, keypurposeoid2, \
- startoffset, endoffset \
- }; \
- test_tls_generate_cert(&varname, NULL)
-
-extern const asn1_static_node pkix_asn1_tab[];
-
-#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */
-
-#endif