summaryrefslogtreecommitdiff
path: root/tests/fipsdrv.c
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-12-13 13:24:51 +0100
committerJustus Winter <justus@g10code.com>2016-12-13 13:52:19 +0100
commit4fae5c0b62f5a507a74db654c50ad1c8b182c6d5 (patch)
treeee1a255d0bbd4bc02b02677cc7982ec352cfce3d /tests/fipsdrv.c
parent1b15ff58f9c17c16ce44acc110e2865e7d4d2321 (diff)
downloadlibgcrypt-4fae5c0b62f5a507a74db654c50ad1c8b182c6d5.tar.gz
tests: Use common code for all tests.
-- Also fix minor fallout from the format string warnings. Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'tests/fipsdrv.c')
-rw-r--r--tests/fipsdrv.c40
1 files changed, 2 insertions, 38 deletions
diff --git a/tests/fipsdrv.c b/tests/fipsdrv.c
index 63c51768..dd0fd3ae 100644
--- a/tests/fipsdrv.c
+++ b/tests/fipsdrv.c
@@ -34,9 +34,7 @@
#include <assert.h>
#include <unistd.h>
-#ifdef _GCRYPT_IN_LIBGCRYPT
-# include "../src/gcrypt-int.h"
-#else
+#ifndef _GCRYPT_IN_LIBGCRYPT
# include <gcrypt.h>
# define PACKAGE_BUGREPORT "devnull@example.org"
# define PACKAGE_VERSION "[build on " __DATE__ " " __TIME__ "]"
@@ -44,23 +42,9 @@
#include "../src/gcrypt-testapi.h"
#define PGM "fipsdrv"
-
-#define my_isascii(c) (!((c) & 0x80))
-#define digitp(p) (*(p) >= '0' && *(p) <= '9')
-#define hexdigitp(a) (digitp (a) \
- || (*(a) >= 'A' && *(a) <= 'F') \
- || (*(a) >= 'a' && *(a) <= 'f'))
-#define xtoi_1(p) (*(p) <= '9'? (*(p)- '0'): \
- *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
-#define xtoi_2(p) ((xtoi_1(p) * 16) + xtoi_1((p)+1))
-#define DIM(v) (sizeof(v)/sizeof((v)[0]))
-#define DIMof(type,member) DIM(((type *)0)->member)
-
+#include "t-common.h"
-/* Verbose mode flag. */
-static int verbose;
-
/* Binary input flag. */
static int binary_input;
@@ -134,26 +118,6 @@ struct tag_info
};
-/* If we have a decent libgpg-error we can use some gcc attributes. */
-#ifdef GPGRT_ATTR_NORETURN
-static void die (const char *format, ...) GPGRT_ATTR_NR_PRINTF(1,2);
-#endif /*GPGRT_ATTR_NORETURN*/
-
-
-/* Print a error message and exit the process with an error code. */
-static void
-die (const char *format, ...)
-{
- va_list arg_ptr;
-
- va_start (arg_ptr, format);
- fputs (PGM ": ", stderr);
- vfprintf (stderr, format, arg_ptr);
- va_end (arg_ptr);
- exit (1);
-}
-
-
static void
showhex (const char *prefix, const void *buffer, size_t length)
{