# HG changeset patch # User Matt Johnston # Date 1370438942 -28800 # Node ID 87c8d0a11906eec7515278ad1e7570e064480f9d # Parent fd28c7358ce8fe79447b3b4a05d1e209d6a6e042 make it work diff -r fd28c7358ce8 -r 87c8d0a11906 Makefile --- a/Makefile Tue Jun 04 22:12:01 2013 +0800 +++ b/Makefile Wed Jun 05 21:29:02 2013 +0800 @@ -23,7 +23,7 @@ PROGRAMMER = #-c stk500v2 -P avrdoper PROGRAMMER = -c stk500 -P ~/dev/stk500 -p $(PROGDEVICE) -B 2 SOURCE_1WIRE = onewire.c simple_ds18b20.c crc8.c -SOURCE_CRYPTO = hmac-sha1.c sha1-asm.S +SOURCE_CRYPTO = hmac-sha1.c sha1-asm.S aes.c SOURCE = main.c SOURCE += $(SOURCE_CRYPTO) LIBS = -lm diff -r fd28c7358ce8 -r 87c8d0a11906 aes.c --- a/aes.c Tue Jun 04 22:12:01 2013 +0800 +++ b/aes.c Wed Jun 05 21:29:02 2013 +0800 @@ -413,6 +413,8 @@ } +#if 0 + /*avr specific routines*/ #include "backward.h" #include @@ -533,3 +535,5 @@ printP(PSTR("\n")); } + +#endif \ No newline at end of file diff -r fd28c7358ce8 -r 87c8d0a11906 main.c --- a/main.c Tue Jun 04 22:12:01 2013 +0800 +++ b/main.c Wed Jun 05 21:29:02 2013 +0800 @@ -14,10 +14,13 @@ #include #include "hmac-sha1.h" +#include "aes.h" //#include "simple_ds18b20.h" //#include "onewire.h" +LOCKBITS = (LB_MODE_3 & BLB0_MODE_4 & BLB1_MODE_4); + #define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) #define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) @@ -26,23 +29,22 @@ #define TICK 1 #define SLEEP_COMPARE (2000000/64) // == 31250 exactly -#define NKEYS 6 -#define KEYLEN 20 +#define NKEYS 10 +#define HMACLEN 20 +#define AESLEN 16 +#define KEYLEN HMACLEN #define BAUD 19200 #define UBRR ((F_CPU)/8/(BAUD)-1) -// XXX #define PORT_PI_BOOT PORTD #define DDR_PI_BOOT DDRD #define PIN_PI_BOOT PD5 -// XXX #define PORT_PI_RESET PORTD #define DDR_PI_RESET DDRD #define PIN_PI_RESET PD6 - #define PORT_LED PORTD #define DDR_LED DDRD #define PIN_LED PD7 @@ -138,18 +140,20 @@ // enable pullups // XXX matt pihelp - PORTB = 0xff; // XXX change when using SPI - PORTD = 0xff; - PORTC = 0xff; + //PORTB = 0xff; // XXX change when using SPI + //PORTD = 0xff; + //PORTC = 0xff; // 3.3v power for bluetooth and SD DDR_LED |= _BV(PIN_LED); +#if 0 // set pullup PORTD |= _BV(PD2); // INT0 setup EICRA = (1<