]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
tests: cipher-alignment: ensure cipher registration
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 23 Sep 2019 19:42:14 +0000 (21:42 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 23 Sep 2019 19:42:17 +0000 (21:42 +0200)
That is, ensure that the registered cipher is called at least
once in the program. That is, to make this test fail if the registration
API ever become deprecated/no-op.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
tests/cipher-alignment.c

index bc5239281ad4f12c4a3fd9e49097a6eb553134dc..0537c58186bafd486904c8685fbef202fe3d037f 100644 (file)
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
 #include "ex-session-info.c"
 #include "ex-x509-info.c"
 
-pid_t child;
+static pid_t child;
 
 static void tls_log_func(int level, const char *str)
 {
@@ -126,6 +126,8 @@ struct myaes_ctx {
        int enc;
 };
 
+static unsigned aes_init = 0;
+
 static int
 myaes_init(gnutls_cipher_algorithm_t algorithm, void **_ctx, int enc)
 {
@@ -138,6 +140,7 @@ myaes_init(gnutls_cipher_algorithm_t algorithm, void **_ctx, int enc)
        }
 
        ((struct myaes_ctx *) (*_ctx))->enc = enc;
+       aes_init = 1;
 
        return 0;
 }
@@ -511,6 +514,8 @@ void doit(void)
        start("NORMAL:-CIPHER-ALL:+AES-128-CBC:-VERS-ALL:+VERS-TLS1.1");
        start("NORMAL:-CIPHER-ALL:+AES-128-CBC:-VERS-ALL:+VERS-TLS1.2");
 
+       assert(aes_init != 0);
+
        gnutls_global_deinit();
 }