summaryrefslogtreecommitdiff
path: root/tests/pubkey.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/pubkey.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/pubkey.c')
-rw-r--r--tests/pubkey.c61
1 files changed, 2 insertions, 59 deletions
diff --git a/tests/pubkey.c b/tests/pubkey.c
index 1271e437..4d3b9048 100644
--- a/tests/pubkey.c
+++ b/tests/pubkey.c
@@ -26,18 +26,8 @@
#include <string.h>
-#include "../src/gcrypt-int.h"
-
-#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)
+#define PGM "pubkey"
+#include "t-common.h"
/* Sample RSA keys, taken from basic.c. */
@@ -112,52 +102,6 @@ static const char sample_public_key_1[] =
")\n";
-static int verbose;
-static int error_count;
-
-
-/* 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);
-static void fail (const char *format, ...) GPGRT_ATTR_PRINTF(1,2);
-static void info (const char *format, ...) GPGRT_ATTR_PRINTF(1,2);
-#endif /*GPGRT_ATTR_NORETURN*/
-
-
-static void
-die (const char *format, ...)
-{
- va_list arg_ptr ;
-
- 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;
-
- va_start (arg_ptr, format);
- vfprintf (stderr, format, arg_ptr);
- va_end (arg_ptr);
- error_count++;
-}
-
-static void
-info (const char *format, ...)
-{
- va_list arg_ptr;
-
- va_start (arg_ptr, format);
- vfprintf (stderr, format, arg_ptr);
- va_end (arg_ptr);
-}
-
static void
show_sexp (const char *prefix, gcry_sexp_t a)
{
@@ -1225,7 +1169,6 @@ check_ed25519ecdsa_sample_key (void)
int
main (int argc, char **argv)
{
- int debug = 0;
int i;
if (argc > 1 && !strcmp (argv[1], "--verbose"))