From 3d841899fe8859b2ce6af8fdfd8fa961c7651425 Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Thu, 31 Oct 2013 00:46:36 +0400 Subject: [PATCH] create test for crypto --- Makefile.am | 5 +++-- configure.ac | 2 +- test_crypto.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 test_crypto.c diff --git a/Makefile.am b/Makefile.am index 23711ac..c2b8529 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,9 +15,10 @@ lib_LTLIBRARIES = pam_pcsc_cr.la pam_pcsc_cr_la_LDFLAGS = -module -avoid-version pam_pcsc_cr_la_LIBADD = libpcsc_cr.la -check_PROGRAMS = test_cr +check_PROGRAMS = test_crypto test_cr +test_crypto_LDADD = libpcsc_cr.la test_cr_LDADD = libpcsc_cr.la EXTRA_DIST = autogen.sh -TESTS = test_cr +TESTS = test_crypto test_cr diff --git a/configure.ac b/configure.ac index 1e6cdfa..4a9453d 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ AC_LANG_C AC_PROG_CC if test "X$CC" = "Xgcc"; then - CFLAGS="$CFLAGS -Wall -g" + CFLAGS="$CFLAGS -Wall" fi AC_PROG_MAKE_SET diff --git a/test_crypto.c b/test_crypto.c new file mode 100644 index 0000000..695c4fe --- /dev/null +++ b/test_crypto.c @@ -0,0 +1,45 @@ +#include +#include +#include +#include +#include "crypto.h" + +unsigned char pt[48] = "the quick brown fox jumps over a lazy dog"; +unsigned char key[16] = { +0x0f,0x65,0xd1,0x3a,0xfe,0xcb,0xc4,0xb9,0x52,0xb1,0x60,0xcf,0xe8,0x55,0x6a,0xdd +}; + +static void usage(const char const *cmd) +{ + fprintf(stderr, "usage: %s\n", cmd); +} + +#define printh(p,x) printh_f(p, x, sizeof(x)) +void printh_f(char *p, unsigned char *x, size_t l) +{ + int i; + printf("%s:", p); + for (i=0; i