* Author: Daniel P. Berrange <berrange@redhat.com>
*/
-#include <stdlib.h>
-#include <fcntl.h>
+#include "qemu/osdep.h"
-#include "config-host.h"
#include "crypto-tls-x509-helpers.h"
+#include "crypto/init.h"
#include "qemu/sockets.h"
#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
void test_tls_init(const char *keyfile)
{
- gnutls_global_init();
+ qcrypto_init(&error_abort);
if (asn1_array2tree(pkix_asn1_tab, &pkix_asn1, NULL) != ASN1_SUCCESS) {
abort();
*datalen = res->ai_addrlen;
*data = g_new(char, *datalen);
memcpy(*data, res->ai_addr, *datalen);
+ freeaddrinfo(res);
}
/*
* If no 'ca' is set then we are self signing
* the cert. This is done for the root CA certs
*/
- err = gnutls_x509_crt_sign(crt, ca ? ca : crt, privkey);
+ err = gnutls_x509_crt_sign2(crt, ca ? ca : crt, privkey,
+ GNUTLS_DIG_SHA256, 0);
if (err < 0) {
g_critical("Failed to sign certificate %s",
gnutls_strerror(err));
if (!g_file_set_contents(filename, buffer, offset, NULL)) {
abort();
}
+ g_free(buffer);
}