diff mbox series

[for,3.0,1/4] tests: call qcrypto_init instead of gnutls_global_init

Message ID 20180718093815.8104-2-berrange@redhat.com
State New
Headers show
Series [for,3.0,1/4] tests: call qcrypto_init instead of gnutls_global_init | expand

Commit Message

Daniel P. Berrangé July 18, 2018, 9:38 a.m. UTC
Calling qcrypto_init ensures that all relevant initialization is
done. In particular this honours the debugging settings and thread
settings.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/crypto-tls-x509-helpers.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé July 18, 2018, 1:41 p.m. UTC | #1
Hi Daniel,

On 07/18/2018 06:38 AM, Daniel P. Berrangé wrote:
> Calling qcrypto_init ensures that all relevant initialization is
> done. In particular this honours the debugging settings and thread
> settings.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  tests/crypto-tls-x509-helpers.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/crypto-tls-x509-helpers.c b/tests/crypto-tls-x509-helpers.c
> index 173d4e28fb..70df68f5df 100644
> --- a/tests/crypto-tls-x509-helpers.c
> +++ b/tests/crypto-tls-x509-helpers.c
> @@ -21,6 +21,8 @@
>  #include "qemu/osdep.h"
>  
>  #include "crypto-tls-x509-helpers.h"
> +#include "crypto/init.h"
> +#include "qapi/error.h"

This include belongs to "crypto/init.h".

>  #include "qemu/sockets.h"
>  
>  #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
> @@ -95,7 +97,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();
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/tests/crypto-tls-x509-helpers.c b/tests/crypto-tls-x509-helpers.c
index 173d4e28fb..70df68f5df 100644
--- a/tests/crypto-tls-x509-helpers.c
+++ b/tests/crypto-tls-x509-helpers.c
@@ -21,6 +21,8 @@ 
 #include "qemu/osdep.h"
 
 #include "crypto-tls-x509-helpers.h"
+#include "crypto/init.h"
+#include "qapi/error.h"
 #include "qemu/sockets.h"
 
 #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
@@ -95,7 +97,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();