Skip to content

Commit

Permalink
tests: call qcrypto_init instead of gnutls_global_init
Browse files Browse the repository at this point in the history
Calling qcrypto_init ensures that all relevant initialization is
done. In particular this honours the debugging settings and thread
settings.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
  • Loading branch information
berrange committed Jul 24, 2018
1 parent 3bae150 commit dbddad7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/crypto/init.h
Expand Up @@ -21,6 +21,8 @@
#ifndef QCRYPTO_INIT_H
#define QCRYPTO_INIT_H

#include "qapi/error.h"

int qcrypto_init(Error **errp);

#endif /* QCRYPTO_INIT_H */
3 changes: 2 additions & 1 deletion tests/crypto-tls-x509-helpers.c
Expand Up @@ -21,6 +21,7 @@
#include "qemu/osdep.h"

#include "crypto-tls-x509-helpers.h"
#include "crypto/init.h"
#include "qemu/sockets.h"

#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
Expand Down Expand Up @@ -95,7 +96,7 @@ static gnutls_x509_privkey_t test_tls_load_key(void)

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();
Expand Down

0 comments on commit dbddad7

Please sign in to comment.