/* Systemd passes FDs, starting immediately after stderr,
* so the first FD we'll get is '3'. */
if (!(svc = virNetServerServiceNewFD(3 + i, 0,
-#if WITH_GNUTLS
NULL,
-#endif
false, 0, 1)))
return -1;
VIR_DEBUG("Setting up networking natively");
if (!(svc = virNetServerServiceNewUNIX(sock_path, 0700, 0, 0,
-#if WITH_GNUTLS
NULL,
-#endif
false, 0, 1)))
return -1;
/* Systemd passes FDs, starting immediately after stderr,
* so the first FD we'll get is '3'. */
if (!(svc = virNetServerServiceNewFD(3 + i, 0,
-#if WITH_GNUTLS
NULL,
-#endif
false, 0, 1)))
return -1;
VIR_DEBUG("Setting up networking natively");
if (!(svc = virNetServerServiceNewUNIX(sock_path, 0700, 0, 0,
-#if WITH_GNUTLS
NULL,
-#endif
false, 0, 1)))
return -1;
0700,
0,
0,
-#if WITH_GNUTLS
NULL,
-#endif
false,
0,
5)))
#include <config.h>
-#ifdef WITH_GNUTLS
-# include <gnutls/gnutls.h>
-# include <gnutls/x509.h>
-#endif
+#include <gnutls/gnutls.h>
+#include <gnutls/x509.h>
#include "locking/domain_lock.h"
#include "viralloc.h"
}
-#ifdef WITH_GNUTLS
static char *
qemuDomainExtractTLSSubject(const char *certdir)
{
VIR_FREE(pemdata);
return NULL;
}
-#endif
+
static qemuMigrationCookieGraphicsPtr
qemuMigrationCookieGraphicsSpiceAlloc(virQEMUDriverPtr driver,
if (!glisten || !(listenAddr = glisten->address))
listenAddr = cfg->spiceListen;
-#ifdef WITH_GNUTLS
if (cfg->spiceTLS &&
!(mig->tlsSubject = qemuDomainExtractTLSSubject(cfg->spiceTLSx509certdir)))
goto error;
-#endif
+
if (VIR_STRDUP(mig->listen, listenAddr) < 0)
goto error;
virNetServerServicePtr svcAdm = NULL;
virNetServerServicePtr svcRO = NULL;
virNetServerServicePtr svcTCP = NULL;
-#if WITH_GNUTLS
virNetServerServicePtr svcTLS = NULL;
-#endif
gid_t unix_sock_gid = 0;
int unix_sock_ro_mask = 0;
int unix_sock_rw_mask = 0;
unix_sock_rw_mask,
unix_sock_gid,
config->auth_unix_rw,
-#if WITH_GNUTLS
NULL,
-#endif
false,
config->max_queued_clients,
config->max_client_requests,
unix_sock_ro_mask,
unix_sock_gid,
config->auth_unix_ro,
-#if WITH_GNUTLS
NULL,
-#endif
true,
config->max_queued_clients,
config->max_client_requests,
unix_sock_adm_mask,
unix_sock_gid,
REMOTE_AUTH_NONE,
-#if WITH_GNUTLS
NULL,
-#endif
false,
config->admin_max_queued_clients,
config->admin_max_client_requests)))
config->tcp_port,
AF_UNSPEC,
config->auth_tcp,
-#if WITH_GNUTLS
NULL,
-#endif
false,
config->max_queued_clients,
config->max_client_requests)))
goto cleanup;
}
-#if WITH_GNUTLS
if (config->listen_tls) {
virNetTLSContextPtr ctxt = NULL;
virObjectUnref(ctxt);
}
-#else
- (void)privileged;
- if (config->listen_tls) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("This libvirtd build does not support TLS"));
- goto cleanup;
- }
-#endif
}
#if WITH_SASL
if (config->auth_unix_rw == REMOTE_AUTH_SASL ||
(sock_path_ro && config->auth_unix_ro == REMOTE_AUTH_SASL) ||
-# if WITH_GNUTLS
(ipsock && config->listen_tls && config->auth_tls == REMOTE_AUTH_SASL) ||
-# endif
(ipsock && config->listen_tcp && config->auth_tcp == REMOTE_AUTH_SASL)) {
saslCtxt = virNetSASLContextNewServer(
(const char *const*)config->sasl_allowed_username_list);
ret = 0;
cleanup:
-#if WITH_GNUTLS
virObjectUnref(svcTLS);
-#endif
virObjectUnref(svcTCP);
virObjectUnref(svcRO);
virObjectUnref(svcAdm);
if (!sasl)
goto authfail;
-# if WITH_GNUTLS
/* Inform SASL that we've got an external SSF layer from TLS */
if (virNetServerClientHasTLSSession(client)) {
int ssf;
if (virNetSASLSessionExtKeySize(sasl, ssf) < 0)
goto authfail;
}
-# endif
if (virNetServerClientIsSecure(client))
/* If we've got TLS or UNIX domain sock, we don't care about SSF */
# include <signal.h>
-# ifdef WITH_GNUTLS
-# include "virnettlscontext.h"
-# endif
+# include "virnettlscontext.h"
# include "virobject.h"
# include "virjson.h"
# include "virnetserverprogram.h"
int keepaliveInterval;
unsigned int keepaliveCount;
-#ifdef WITH_GNUTLS
virNetTLSContextPtr tls;
-#endif
virNetServerClientPrivNew clientPrivNew;
virNetServerClientPrivPreExecRestart clientPrivPreExecRestart;
virNetServerServiceGetAuth(svc),
virNetServerServiceIsReadonly(svc),
virNetServerServiceGetMaxRequests(svc),
-#if WITH_GNUTLS
virNetServerServiceGetTLSContext(svc),
-#endif
srv->clientPrivNew,
srv->clientPrivPreExecRestart,
srv->clientPrivFree,
return -1;
}
-#if WITH_GNUTLS
int virNetServerSetTLSContext(virNetServerPtr srv,
virNetTLSContextPtr tls)
{
srv->tls = virObjectRef(tls);
return 0;
}
-#endif
/**
#ifndef __VIR_NET_SERVER_H__
# define __VIR_NET_SERVER_H__
-# ifdef WITH_GNUTLS
-# include "virnettlscontext.h"
-# endif
+# include "virnettlscontext.h"
# include "virnetserverprogram.h"
# include "virnetserverclient.h"
# include "virnetserverservice.h"
int virNetServerAddProgram(virNetServerPtr srv,
virNetServerProgramPtr prog);
-# if WITH_GNUTLS
int virNetServerSetTLSContext(virNetServerPtr srv,
virNetTLSContextPtr tls);
-# endif
int virNetServerAddClient(virNetServerPtr srv,
int auth;
bool auth_pending;
bool readonly;
-#if WITH_GNUTLS
virNetTLSContextPtr tlsCtxt;
virNetTLSSessionPtr tls;
-#endif
#if WITH_SASL
virNetSASLSessionPtr sasl;
#endif
VIR_DEBUG("tls=%p hs=%d, rx=%p tx=%p",
-#ifdef WITH_GNUTLS
client->tls,
client->tls ? virNetTLSSessionGetHandshakeStatus(client->tls) : -1,
-#else
- NULL, -1,
-#endif
client->rx,
client->tx);
if (!client->sock || client->wantClose)
return 0;
-#if WITH_GNUTLS
if (client->tls) {
switch (virNetTLSSessionGetHandshakeStatus(client->tls)) {
case VIR_NET_TLS_HANDSHAKE_RECVING:
mode |= VIR_EVENT_HANDLE_WRITABLE;
}
} else {
-#endif
/* If there is a message on the rx queue, and
* we're not in middle of a delayedClose, then
* we're wanting more input */
then monitor for writability on socket */
if (client->tx)
mode |= VIR_EVENT_HANDLE_WRITABLE;
-#if WITH_GNUTLS
}
-#endif
VIR_DEBUG("mode=0%o", mode);
return mode;
}
}
-#ifdef WITH_GNUTLS
/* Check the client's access. */
static int
virNetServerClientCheckAccess(virNetServerClientPtr client)
return 0;
}
-#endif
+
static void virNetServerClientDispatchMessage(virNetServerClientPtr client,
virNetMessagePtr msg)
virNetSocketPtr sock,
int auth,
bool auth_pending,
-#ifdef WITH_GNUTLS
virNetTLSContextPtr tls,
-#endif
bool readonly,
size_t nrequests_max,
long long timestamp)
client->auth = auth;
client->auth_pending = auth_pending;
client->readonly = readonly;
-#ifdef WITH_GNUTLS
client->tlsCtxt = virObjectRef(tls);
-#endif
client->nrequests_max = nrequests_max;
client->conn_time = timestamp;
int auth,
bool readonly,
size_t nrequests_max,
-#ifdef WITH_GNUTLS
virNetTLSContextPtr tls,
-#endif
virNetServerClientPrivNew privNew,
virNetServerClientPrivPreExecRestart privPreExecRestart,
virFreeCallback privFree,
time_t now;
bool auth_pending = !virNetServerClientAuthMethodImpliesAuthenticated(auth);
- VIR_DEBUG("sock=%p auth=%d tls=%p", sock, auth,
-#ifdef WITH_GNUTLS
- tls
-#else
- NULL
-#endif
- );
+ VIR_DEBUG("sock=%p auth=%d tls=%p", sock, auth, tls);
if ((now = time(NULL)) == (time_t)-1) {
virReportSystemError(errno, "%s", _("failed to get current time"));
}
if (!(client = virNetServerClientNewInternal(id, sock, auth, auth_pending,
-#ifdef WITH_GNUTLS
- tls,
-#endif
- readonly, nrequests_max,
+ tls, readonly, nrequests_max,
now)))
return NULL;
sock,
auth,
auth_pending,
-#ifdef WITH_GNUTLS
NULL,
-#endif
readonly,
nrequests_max,
timestamp))) {
return client->conn_time;
}
-#ifdef WITH_GNUTLS
bool virNetServerClientHasTLSSession(virNetServerClientPtr client)
{
bool has;
virObjectUnlock(client);
return size;
}
-#endif
int virNetServerClientGetFD(virNetServerClientPtr client)
{
}
#endif
-#if WITH_GNUTLS
if (client->tls) {
const char *identity = virNetTLSSessionGetX509DName(client->tls);
if (virIdentitySetX509DName(ret, identity) < 0)
goto error;
}
-#endif
if (client->sock &&
virNetSocketGetSELinuxContext(client->sock, &seccontext) < 0)
{
bool secure = false;
virObjectLock(client);
-#if WITH_GNUTLS
if (client->tls)
secure = true;
-#endif
#if WITH_SASL
if (client->sasl)
secure = true;
#endif
if (client->sockTimer > 0)
virEventRemoveTimeout(client->sockTimer);
-#if WITH_GNUTLS
virObjectUnref(client->tls);
virObjectUnref(client->tlsCtxt);
-#endif
virObjectUnref(client->sock);
}
if (client->sock)
virNetSocketRemoveIOCallback(client->sock);
-#if WITH_GNUTLS
if (client->tls) {
virObjectUnref(client->tls);
client->tls = NULL;
}
-#endif
client->wantClose = true;
while (client->rx) {
{
virObjectLock(client);
-#if WITH_GNUTLS
if (!client->tlsCtxt) {
-#endif
/* Plain socket, so prepare to read first message */
if (virNetServerClientRegisterEvent(client) < 0)
goto error;
-#if WITH_GNUTLS
} else {
int ret;
goto error;
}
}
-#endif
virObjectUnlock(client);
return 0;
}
-#if WITH_GNUTLS
static void
virNetServerClientDispatchHandshake(virNetServerClientPtr client)
{
client->wantClose = true;
}
}
-#endif
+
static void
virNetServerClientDispatchEvent(virNetSocketPtr sock, int events, void *opaque)
if (events & (VIR_EVENT_HANDLE_WRITABLE |
VIR_EVENT_HANDLE_READABLE)) {
-#if WITH_GNUTLS
if (client->tls &&
virNetTLSSessionGetHandshakeStatus(client->tls) !=
VIR_NET_TLS_HANDSHAKE_COMPLETE) {
virNetServerClientDispatchHandshake(client);
} else {
-#endif
if (events & VIR_EVENT_HANDLE_WRITABLE)
virNetServerClientDispatchWrite(client);
if (events & VIR_EVENT_HANDLE_READABLE &&
client->rx)
msg = virNetServerClientDispatchRead(client);
-#if WITH_GNUTLS
}
-#endif
}
/* NB, will get HANGUP + READABLE at same time upon
else
ret = VIR_CLIENT_TRANS_TCP;
-#ifdef WITH_GNUTLS
if (client->tls)
ret = VIR_CLIENT_TRANS_TLS;
-#endif
virObjectUnlock(client);
int auth,
bool readonly,
size_t nrequests_max,
-# ifdef WITH_GNUTLS
virNetTLSContextPtr tls,
-# endif
virNetServerClientPrivNew privNew,
virNetServerClientPrivPreExecRestart privPreExecRestart,
virFreeCallback privFree,
void *privOpaque)
-# ifdef WITH_GNUTLS
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(7) ATTRIBUTE_NONNULL(9);
-# else
- ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(6) ATTRIBUTE_NONNULL(8);
-# endif
virNetServerClientPtr virNetServerClientNewPostExecRestart(virNetServerPtr srv,
virJSONValuePtr object,
unsigned long long virNetServerClientGetID(virNetServerClientPtr client);
long long virNetServerClientGetTimestamp(virNetServerClientPtr client);
-# ifdef WITH_GNUTLS
bool virNetServerClientHasTLSSession(virNetServerClientPtr client);
virNetTLSSessionPtr virNetServerClientGetTLSSession(virNetServerClientPtr client);
int virNetServerClientGetTLSKeySize(virNetServerClientPtr client);
-# endif
# ifdef WITH_SASL
bool virNetServerClientHasSASLSession(virNetServerClientPtr client);
bool readonly;
size_t nrequests_client_max;
-#if WITH_GNUTLS
virNetTLSContextPtr tls;
-#endif
virNetServerServiceDispatchFunc dispatchFunc;
void *dispatchOpaque;
mode_t mask,
gid_t grp,
int auth,
-#if WITH_GNUTLS
virNetTLSContextPtr tls,
-#endif
bool readonly,
size_t max_queued_clients,
size_t nrequests_client_max,
mask,
grp,
auth,
-#if WITH_GNUTLS
tls,
-#endif
readonly,
max_queued_clients,
nrequests_client_max);
*/
return virNetServerServiceNewFD((*cur_fd)++,
auth,
-#if WITH_GNUTLS
tls,
-#endif
readonly,
max_queued_clients,
nrequests_client_max);
const char *service,
int family,
int auth,
-#if WITH_GNUTLS
virNetTLSContextPtr tls,
-#endif
bool readonly,
size_t max_queued_clients,
size_t nrequests_client_max)
svc->auth = auth;
svc->readonly = readonly;
svc->nrequests_client_max = nrequests_client_max;
-#if WITH_GNUTLS
svc->tls = virObjectRef(tls);
-#endif
if (virNetSocketNewListenTCP(nodename,
service,
mode_t mask,
gid_t grp,
int auth,
-#if WITH_GNUTLS
virNetTLSContextPtr tls,
-#endif
bool readonly,
size_t max_queued_clients,
size_t nrequests_client_max)
svc->auth = auth;
svc->readonly = readonly;
svc->nrequests_client_max = nrequests_client_max;
-#if WITH_GNUTLS
svc->tls = virObjectRef(tls);
-#endif
if (VIR_ALLOC_N(svc->socks, 1) < 0)
goto error;
virNetServerServicePtr virNetServerServiceNewFD(int fd,
int auth,
-#if WITH_GNUTLS
virNetTLSContextPtr tls,
-#endif
bool readonly,
size_t max_queued_clients,
size_t nrequests_client_max)
svc->auth = auth;
svc->readonly = readonly;
svc->nrequests_client_max = nrequests_client_max;
-#if WITH_GNUTLS
svc->tls = virObjectRef(tls);
-#endif
if (VIR_ALLOC_N(svc->socks, 1) < 0)
goto error;
return svc->nrequests_client_max;
}
-#if WITH_GNUTLS
virNetTLSContextPtr virNetServerServiceGetTLSContext(virNetServerServicePtr svc)
{
return svc->tls;
}
-#endif
void virNetServerServiceSetDispatcher(virNetServerServicePtr svc,
virNetServerServiceDispatchFunc func,
virObjectUnref(svc->socks[i]);
VIR_FREE(svc->socks);
-#if WITH_GNUTLS
virObjectUnref(svc->tls);
-#endif
}
void virNetServerServiceToggle(virNetServerServicePtr svc,
mode_t mask,
gid_t grp,
int auth,
-# if WITH_GNUTLS
virNetTLSContextPtr tls,
-# endif
bool readonly,
size_t max_queued_clients,
size_t nrequests_client_max,
const char *service,
int family,
int auth,
-# if WITH_GNUTLS
virNetTLSContextPtr tls,
-# endif
bool readonly,
size_t max_queued_clients,
size_t nrequests_client_max);
mode_t mask,
gid_t grp,
int auth,
-# if WITH_GNUTLS
virNetTLSContextPtr tls,
-# endif
bool readonly,
size_t max_queued_clients,
size_t nrequests_client_max);
virNetServerServicePtr virNetServerServiceNewFD(int fd,
int auth,
-# if WITH_GNUTLS
virNetTLSContextPtr tls,
-# endif
bool readonly,
size_t max_queued_clients,
size_t nrequests_client_max);
int virNetServerServiceGetAuth(virNetServerServicePtr svc);
bool virNetServerServiceIsReadonly(virNetServerServicePtr svc);
size_t virNetServerServiceGetMaxRequests(virNetServerServicePtr svc);
-# ifdef WITH_GNUTLS
virNetTLSContextPtr virNetServerServiceGetTLSContext(virNetServerServicePtr svc);
-# endif
void virNetServerServiceSetDispatcher(virNetServerServicePtr svc,
virNetServerServiceDispatchFunc func,
#include "viralloc.h"
#include "virrandom.h"
-#ifdef WITH_GNUTLS
-# include <gnutls/gnutls.h>
-# include <gnutls/crypto.h>
-#endif
+#include <gnutls/gnutls.h>
+#include <gnutls/crypto.h>
VIR_LOG_INIT("util.crypto");
#define VIR_CRYPTO_LARGEST_DIGEST_SIZE VIR_CRYPTO_HASH_SIZE_SHA256
-#if WITH_GNUTLS
struct virHashInfo {
gnutls_digest_algorithm_t algorithm;
return hashinfo[hash].hashlen;
}
-#else
-ssize_t
-virCryptoHashBuf(virCryptoHash hash,
- const char *input ATTRIBUTE_UNUSED,
- unsigned char *output ATTRIBUTE_UNUSED)
-{
- virReportError(VIR_ERR_INVALID_ARG,
- _("algorithm=%d is not supported"), hash);
- return -1;
-}
-#endif
+
int
virCryptoHashString(virCryptoHash hash,
switch (algorithm) {
case VIR_CRYPTO_CIPHER_AES256CBC:
-#ifdef WITH_GNUTLS
return true;
-#else
- return false;
-#endif
case VIR_CRYPTO_CIPHER_NONE:
case VIR_CRYPTO_CIPHER_LAST:
}
-#ifdef WITH_GNUTLS
/* virCryptoEncryptDataAESgntuls:
*
* Performs the AES gnutls encryption
_("algorithm=%d is not supported"), algorithm);
return -1;
}
-
-#else
-
-int
-virCryptoEncryptData(virCryptoCipher algorithm,
- uint8_t *enckey ATTRIBUTE_UNUSED,
- size_t enckeylen ATTRIBUTE_UNUSED,
- uint8_t *iv ATTRIBUTE_UNUSED,
- size_t ivlen ATTRIBUTE_UNUSED,
- uint8_t *data ATTRIBUTE_UNUSED,
- size_t datalen ATTRIBUTE_UNUSED,
- uint8_t **ciphertext ATTRIBUTE_UNUSED,
- size_t *ciphertextlen ATTRIBUTE_UNUSED)
-{
- virReportError(VIR_ERR_INVALID_ARG,
- _("algorithm=%d is not supported"), algorithm);
- return -1;
-}
-#endif
DO_TEST("disk-drive-network-sheepdog", NONE);
DO_TEST("disk-drive-network-rbd-auth", NONE);
DO_TEST("disk-drive-network-source-auth", NONE);
-# ifdef WITH_GNUTLS
DO_TEST("disk-drive-network-rbd-auth-AES",
QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_VIRTIO_SCSI);
-# endif
DO_TEST("disk-drive-network-rbd-ipv6", NONE);
DO_TEST_FAILURE("disk-drive-network-rbd-no-colon", NONE);
DO_TEST("disk-drive-network-vxhs", QEMU_CAPS_VXHS);
if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509secretUUID,
"6fd3f62d-9fe7-4a4e-a869-7acd6376d8ea") < 0)
return EXIT_FAILURE;
-# ifdef WITH_GNUTLS
DO_TEST("serial-tcp-tlsx509-secret-chardev",
QEMU_CAPS_OBJECT_SECRET,
QEMU_CAPS_DEVICE_ISA_SERIAL,
QEMU_CAPS_OBJECT_TLS_CREDS_X509);
-# else
- DO_TEST_FAILURE("serial-tcp-tlsx509-secret-chardev",
- QEMU_CAPS_OBJECT_SECRET,
- QEMU_CAPS_DEVICE_ISA_SERIAL,
- QEMU_CAPS_OBJECT_TLS_CREDS_X509);
-# endif
driver.config->chardevTLS = 0;
VIR_FREE(driver.config->chardevTLSx509certdir);
DO_TEST("serial-many-chardev",
DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
-# ifdef WITH_GNUTLS
DO_TEST("luks-disks", QEMU_CAPS_OBJECT_SECRET);
DO_TEST("luks-disks-source", QEMU_CAPS_OBJECT_SECRET);
DO_TEST_PARSE_ERROR("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET);
DO_TEST("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_QCOW2_LUKS);
-# else
- DO_TEST_FAILURE("luks-disks", QEMU_CAPS_OBJECT_SECRET);
-# endif
DO_TEST_PARSE_ERROR("luks-disk-invalid", NONE);
DO_TEST_PARSE_ERROR("luks-disks-source-both", QEMU_CAPS_OBJECT_SECRET);
DO_TEST("hostdev-scsi-virtio-iscsi-auth",
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_DEVICE_SCSI_GENERIC);
-# ifdef WITH_GNUTLS
DO_TEST("disk-hostdev-scsi-virtio-iscsi-auth-AES",
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_OBJECT_SECRET,
QEMU_CAPS_ISCSI_PASSWORD_SECRET);
-# endif
DO_TEST("hostdev-scsi-vhost-scsi-ccw",
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_CCW);
#include "testutils.h"
-#if WITH_GNUTLS
-# include "vircrypto.h"
-# include "virrandom.h"
+#include "vircrypto.h"
+#include "virrandom.h"
-# define VIR_FROM_THIS VIR_FROM_NONE
+#define VIR_FROM_THIS VIR_FROM_NONE
struct testCryptoHashData {
virCryptoHash hash;
0x1b, 0x8c, 0x3f, 0x48,
0x27, 0xae, 0xb6, 0x7a};
-# define VIR_CRYPTO_HASH(h, i, o) \
+#define VIR_CRYPTO_HASH(h, i, o) \
do { \
struct testCryptoHashData data = { \
.hash = h, \
VIR_CRYPTO_HASH(VIR_CRYPTO_HASH_MD5, "The quick brown fox", "a2004f37730b9445670a738fa0fc9ee5");
VIR_CRYPTO_HASH(VIR_CRYPTO_HASH_SHA256, "The quick brown fox", "5cac4f980fedc3d3f1f99b4be3472c9b30d56523e632d151237ec9309048bda9");
-# undef VIR_CRYPTO_HASH
+#undef VIR_CRYPTO_HASH
-# define VIR_CRYPTO_ENCRYPT(a, n, i, il, c, cl) \
+#define VIR_CRYPTO_ENCRYPT(a, n, i, il, c, cl) \
do { \
struct testCryptoEncryptData data = { \
.algorithm = a, \
VIR_CRYPTO_ENCRYPT(VIR_CRYPTO_CIPHER_AES256CBC, "aes265cbc",
secretdata, 7, expected_ciphertext, 16);
-# undef VIR_CRYPTO_ENCRYPT
+#undef VIR_CRYPTO_ENCRYPT
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
/* Forces usage of not so random virRandomBytes */
VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virrandommock.so")
-#else
-static int
-mymain(void)
-{
- return EXIT_AM_SKIP;
-}
-
-VIR_TEST_MAIN(mymain);
-#endif /* WITH_GNUTLS */
#include "testutils.h"
-#if WITH_GNUTLS
-# include "virfile.h"
-# include "virfilecache.h"
+#include "virfile.h"
+#include "virfilecache.h"
-# define VIR_FROM_THIS VIR_FROM_NONE
+#define VIR_FROM_THIS VIR_FROM_NONE
struct _testFileCacheObj {
virFileCacheSetPriv(cache, &testPriv);
-# define TEST_RUN(name, newData, expectData, expectSave) \
+#define TEST_RUN(name, newData, expectData, expectSave) \
do { \
testFileCacheData data = { \
cache, name, newData, expectData, expectSave \
}
VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virfilecachemock.so")
-#else
-static int
-mymain(void)
-{
- return EXIT_AM_SKIP;
-}
-
-VIR_TEST_MAIN(mymain);
-#endif /* WITH_GNUTLS */
NULL,
family,
VIR_NET_SERVER_SERVICE_AUTH_NONE,
-# ifdef WITH_GNUTLS
NULL,
-# endif
true,
5,
2)))
NULL,
family,
VIR_NET_SERVER_SERVICE_AUTH_POLKIT,
-# ifdef WITH_GNUTLS
NULL,
-# endif
false,
25,
5)))
VIR_NET_SERVER_SERVICE_AUTH_SASL,
true,
15,
-# ifdef WITH_GNUTLS
NULL,
-# endif
testClientNew,
testClientPreExec,
testClientFree,
VIR_NET_SERVER_SERVICE_AUTH_POLKIT,
true,
66,
-# ifdef WITH_GNUTLS
NULL,
-# endif
testClientNew,
testClientPreExec,
testClientFree,
sv[0] = -1;
if (!(client = virNetServerClientNew(1, sock, 0, false, 1,
-# ifdef WITH_GNUTLS
NULL,
-# endif
testClientNew,
NULL,
testClientFree,
#ifndef WIN32
+# include <stdio.h>
+# include <gnutls/gnutls.h>
+
# include "internal.h"
# include "virstring.h"
# include "virrandom.h"
}
-# ifdef WITH_GNUTLS
-# include <stdio.h>
-# include <gnutls/gnutls.h>
-
static int (*real_gnutls_dh_params_generate2)(gnutls_dh_params_t dparams,
unsigned int bits);
return gnutls_dh_params_cpy(dparams, params_cache);
}
-# endif
#else /* WIN32 */
/* Can't mock on WIN32 */
#endif