summaryrefslogtreecommitdiff
path: root/tests/t-ed25519.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/t-ed25519.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/t-ed25519.c')
-rw-r--r--tests/t-ed25519.c69
1 files changed, 1 insertions, 68 deletions
diff --git a/tests/t-ed25519.c b/tests/t-ed25519.c
index f0c44cc6..9922efca 100644
--- a/tests/t-ed25519.c
+++ b/tests/t-ed25519.c
@@ -27,83 +27,16 @@
#include <string.h>
#include <errno.h>
-#include "../src/gcrypt-int.h"
-
#include "stopwatch.h"
#define PGM "t-ed25519"
+#include "t-common.h"
#define N_TESTS 1026
-#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 xmalloc(a) gcry_xmalloc ((a))
-#define xcalloc(a,b) gcry_xcalloc ((a),(b))
-#define xstrdup(a) gcry_xstrdup ((a))
-#define xfree(a) gcry_free ((a))
-#define pass() do { ; } while (0)
-
-static int verbose;
-static int debug;
-static int error_count;
static int sign_with_pk;
static int no_verify;
static int custom_data_file;
-static void
-die (const char *format, ...)
-{
- va_list arg_ptr ;
-
- fflush (stdout);
- fprintf (stderr, "%s: ", PGM);
- va_start( arg_ptr, format ) ;
- vfprintf (stderr, format, arg_ptr );
- va_end(arg_ptr);
- if (*format && format[strlen(format)-1] != '\n')
- putc ('\n', stderr);
- exit (1);
-}
-
-static void
-fail (const char *format, ...)
-{
- va_list arg_ptr;
-
- fflush (stdout);
- fprintf (stderr, "%s: ", PGM);
- /* if (wherestr) */
- /* fprintf (stderr, "%s: ", wherestr); */
- va_start (arg_ptr, format);
- vfprintf (stderr, format, arg_ptr);
- va_end (arg_ptr);
- if (*format && format[strlen(format)-1] != '\n')
- putc ('\n', stderr);
- error_count++;
- if (error_count >= 50)
- die ("stopped after 50 errors.");
-}
-
-static void
-info (const char *format, ...)
-{
- va_list arg_ptr;
-
- if (!verbose)
- return;
- fprintf (stderr, "%s: ", PGM);
- va_start (arg_ptr, format);
- vfprintf (stderr, format, arg_ptr);
- if (*format && format[strlen(format)-1] != '\n')
- putc ('\n', stderr);
- va_end (arg_ptr);
-}
-
static void
show_note (const char *format, ...)