From 04dedb18c80bbcc635499d6f2c8ca7ed82620c89 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Sun, 28 Dec 2008 20:51:12 +0100 Subject: [PATCH] Fix up build --- configure.ac | 2 ++ src/Makefile.am | 2 ++ src/crc13239.c | 19 ++++++++++--------- src/crc13239.h | 5 ++++- src/yubiyubo.c | 3 --- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 64bc08b..5aaae7b 100644 --- a/configure.ac +++ b/configure.ac @@ -7,4 +7,6 @@ AM_CONFIG_HEADER(config.h) AC_PROG_CC +PKG_CHECK_MODULES([YUBIYUBO],[libhid]) + AC_OUTPUT([Makefile src/Makefile]) diff --git a/src/Makefile.am b/src/Makefile.am index de04696..c43ff09 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,3 +7,5 @@ yubiyubo_SOURCES = \ crc13239.c \ yubiyubo.c +yubiyubo_LDADD = @YUBIYUBO_LIBS@ +AM_CFLAGS = @YUBIYUBO_CFLAGS@ diff --git a/src/crc13239.c b/src/crc13239.c index cd65441..eef65d4 100644 --- a/src/crc13239.c +++ b/src/crc13239.c @@ -22,13 +22,14 @@ void crc_init(unsigned short *c) { *c = 0xffff; } -void crc_update(unsigned short *c, unsigned char val) { +void crc_update(unsigned short *m_crc, unsigned char val) { int i, j; - m_crc ^= val; + *m_crc ^= val; for (i = 0; i < 8; i++) { - j = m_crc & 1; - m_crc >>= 1; - if (j) m_crc ^= 0x8408; + j = *m_crc & 1; + *m_crc >>= 1; + if (j) + *m_crc ^= 0x8408; } } @@ -36,12 +37,12 @@ void crc_update(unsigned short *c, unsigned char val) { unsigned short crc_get_full(unsigned char *data, size_t len, bool onecomp) { unsigned short c; crc_init(&c); - while (bcnt--) - crc_update(&c, *bp++); + while (len--) + crc_update(&c, *(data++)); return onecomp ? ~c : c; } bool crc_check(unsigned short *c, char *crc) { - return (((c & 0xff) == crc[0]) && - ((c >> 8) == crc[1])); + return (((*c & 0xff) == crc[0]) && + ((*c >> 8) == crc[1])); } diff --git a/src/crc13239.h b/src/crc13239.h index 266a8e0..d420f56 100644 --- a/src/crc13239.h +++ b/src/crc13239.h @@ -15,12 +15,15 @@ * */ +#include +#include + #ifndef _CRC13239_H #define _CRC13239_H #define CRC_OK_RESIDUE 0xf0b8 void crc_init(unsigned short *c); -void crc_update(unsigned short *c, unsigned char *val); +void crc_update(unsigned short *c, unsigned char val); unsigned short crc_get_full(unsigned char *data, size_t len, bool onecomp); bool crc_check(unsigned short *c, char *crc); diff --git a/src/yubiyubo.c b/src/yubiyubo.c index e01e492..d2cb63f 100644 --- a/src/yubiyubo.c +++ b/src/yubiyubo.c @@ -67,6 +67,3 @@ int main(int argc, char **argv) return 0; } - - -} -- 2.39.5