diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2024-05-02 11:56:41 +0200 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2024-07-24 10:39:10 +0100 |
commit | 0e9bb8ad4d907d28aea8336d43ae990d87b1c834 (patch) | |
tree | 9d7c0142bd5ff751bb9e8c660abd1eee1aae3d42 /tests/unit | |
parent | e8ad8b9987efdbac4116567e685e6fd8ec28ef48 (diff) | |
download | qemu-0e9bb8ad4d907d28aea8336d43ae990d87b1c834.zip qemu-0e9bb8ad4d907d28aea8336d43ae990d87b1c834.tar.gz qemu-0e9bb8ad4d907d28aea8336d43ae990d87b1c834.tar.bz2 |
crypto: Restrict pkix_asn1_tab[] to crypto-tls-x509-helpers.c
pkix_asn1_tab[] is only accessed by crypto-tls-x509-helpers.c,
rename pkix_asn1_tab.c as pkix_asn1_tab.c.inc and include it once.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
[berrange: updated MAINTAINERS for changed filename]
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/crypto-tls-x509-helpers.c | 6 | ||||
-rw-r--r-- | tests/unit/crypto-tls-x509-helpers.h | 3 | ||||
-rw-r--r-- | tests/unit/meson.build | 6 | ||||
-rw-r--r-- | tests/unit/pkix_asn1_tab.c.inc (renamed from tests/unit/pkix_asn1_tab.c) | 5 |
4 files changed, 9 insertions, 11 deletions
diff --git a/tests/unit/crypto-tls-x509-helpers.c b/tests/unit/crypto-tls-x509-helpers.c index e9937f6..3e74ec5 100644 --- a/tests/unit/crypto-tls-x509-helpers.c +++ b/tests/unit/crypto-tls-x509-helpers.c @@ -20,15 +20,19 @@ #include "qemu/osdep.h" +#include <libtasn1.h> + #include "crypto-tls-x509-helpers.h" #include "crypto/init.h" #include "qemu/sockets.h" +#include "pkix_asn1_tab.c.inc" + /* * This stores some static data that is needed when * encoding extensions in the x509 certs */ -asn1_node pkix_asn1; +static asn1_node pkix_asn1; /* * To avoid consuming random entropy to generate keys, diff --git a/tests/unit/crypto-tls-x509-helpers.h b/tests/unit/crypto-tls-x509-helpers.h index 247e716..562c160 100644 --- a/tests/unit/crypto-tls-x509-helpers.h +++ b/tests/unit/crypto-tls-x509-helpers.h @@ -23,7 +23,6 @@ #include <gnutls/gnutls.h> #include <gnutls/x509.h> -#include <libtasn1.h> #define QCRYPTO_TLS_TEST_CLIENT_NAME "ACME QEMU Client" @@ -171,6 +170,4 @@ void test_tls_cleanup(const char *keyfile); }; \ test_tls_generate_cert(&varname, cavarname.crt) -extern const asn1_static_node pkix_asn1_tab[]; - #endif diff --git a/tests/unit/meson.build b/tests/unit/meson.build index 26c109c..490ab81 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -99,11 +99,11 @@ if have_block tasn1.found() and \ host_os != 'windows' tests += { - 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', + 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', tasn1, crypto, gnutls], - 'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c', + 'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'crypto-tls-psk-helpers.c', tasn1, crypto, gnutls], - 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', + 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', tasn1, io, crypto, gnutls]} endif if pam.found() diff --git a/tests/unit/pkix_asn1_tab.c b/tests/unit/pkix_asn1_tab.c.inc index 8952140..fe29c41 100644 --- a/tests/unit/pkix_asn1_tab.c +++ b/tests/unit/pkix_asn1_tab.c.inc @@ -3,10 +3,7 @@ * and is under copyright of various GNUTLS contributors. */ -#include "qemu/osdep.h" -#include "crypto-tls-x509-helpers.h" - -const asn1_static_node pkix_asn1_tab[] = { +static const asn1_static_node pkix_asn1_tab[] = { {"PKIX1", 536875024, 0}, {0, 1073741836, 0}, {"id-ce", 1879048204, 0}, |