]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Skip tests/tls13/prf.c if visibility 'protected' doesn't work
authorTim Rühsen <tim.ruehsen@gmx.de>
Mon, 8 Oct 2018 09:25:23 +0000 (11:25 +0200)
committerTim Rühsen <tim.ruehsen@gmx.de>
Mon, 8 Oct 2018 13:15:47 +0000 (15:15 +0200)
Overriding gnutls_rnd() with visibility 'protected' doesn't always work.
E.g. LDFLAGS="-Wl,-Bsymbolic-functions" seems to have priority on
Debian derived systems.

Fixes #584

Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
.gitlab-ci.yml
tests/tls13/prf.c
tests/utils.h

index 4c7d593cf774431b95dc36622875b57df4f929ae..06742b2069bd74a1a3960def3150b354c90013f2 100644 (file)
@@ -464,7 +464,7 @@ Debian.x86_64:
   script:
   - ./bootstrap
   - mkdir -p build && cd build &&
-    dash ../configure --disable-gcc-warnings --cache-file ../cache/config.cache --disable-doc --disable-guile --disable-full-test-suite &&
+    dash ../configure --disable-gcc-warnings --cache-file ../cache/config.cache --disable-doc --disable-guile --disable-full-test-suite LDFLAGS='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' &&
     make -j$(nproc) && make check -j$(nproc)
   - cd ..
   tags:
index eb2d0e60964d2458ef8f3946d0e33627a30b8521..75daff59d4619d26a9452715f9d33122c5f474ab 100644 (file)
@@ -70,9 +70,13 @@ gnutls_datum_t hrnd = {(void*)"\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
 static const
 gnutls_datum_t hsrnd = {(void*)"\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 32};
 
+static int gnutls_rnd_works;
+
 int __attribute__ ((visibility ("protected")))
 gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len)
 {
+       gnutls_rnd_works = 1;
+
        memset(data, 0xff, len);
 
        /* Flip the first byte to avoid infinite loop in the RSA
@@ -135,6 +139,11 @@ static void check_prfs(gnutls_session_t session)
        unsigned char key_material[512];
        int ret;
 
+       if (!gnutls_rnd_works) {
+               fprintf(stderr, "gnutls_rnd() could not be overridden, see #584\n");
+               exit(77);
+       }
+
        TRY_OLD(13, "key expansion", 34, (uint8_t*)KEY_EXP_VALUE);
        TRY_OLD(6, "hello", 31, (uint8_t*)HELLO_VALUE);
 
index d5409d661dac42c2c95bb50ec85953e6298e2b07..b905065c529e36d22f8e3182238e936e3b9efcad 100644 (file)
@@ -152,9 +152,12 @@ inline static void _check_wait_status(int status, unsigned sigonly)
                if (WIFSIGNALED(status)) {
                        fail("Child died with signal %d\n", WTERMSIG(status));
                } else {
-                       if (!sigonly)
+                       if (!sigonly) {
+                               if (WEXITSTATUS(status) == 77)
+                                       exit(77);
                                fail("Child died with status %d\n",
                                     WEXITSTATUS(status));
+                       }
                }
        }
 #endif