changeset 30:320c8cc7df5a

merge
author Matt Johnston <matt@ucc.asn.au>
date Thu, 27 Jun 2013 00:12:01 +0800
parents 22badb6239e0 (diff) ce5097eacf2f (current diff)
children 5d6a841eef82
files Makefile
diffstat 2 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Jun 26 23:12:37 2013 +0800
+++ b/Makefile	Thu Jun 27 00:12:01 2013 +0800
@@ -19,12 +19,11 @@
 
 DEVICE     = atmega328p
 PROGDEVICE     = atmega328p
-CLOCK      = 11059200
+CLOCK      = 11059200L
 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 aes.c
-SOURCE_SD = byteordering.c fat.c  partition.c sd_raw.c 
 SOURCE    = main.c
 SOURCE += $(SOURCE_CRYPTO) $(SOURCE_SD)
 LIBS       = 
@@ -80,7 +79,7 @@
 
 AVRDUDE = avrdude $(PROGRAMMER) 
 #COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -g -std=c99 -mcall-prologues -fdata-sections -ffunction-sections  -Wl,--gc-sections -Wl,--relax -fwhole-program  -Wl,-u,vfprintf -lprintf_flt -lm
-COMPILE = /usr/local/CrossPack-AVR/bin/avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -g -std=c99  -mcall-prologues -fdata-sections -ffunction-sections  -Wl,--gc-sections -Wl,--relax -fwhole-program -flto
+COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -g -std=c99 -Wl,-u,vfprintf -lprintf_flt -lm
 
 # symbolic targets:
 all:	main.hex
@@ -99,7 +98,7 @@
 	$(COMPILE) -S $< -o $@
 
 flash:	all
-	$(AVRDUDE) -D -U flash:w:main.hex:i
+	$(AVRDUDE) -U flash:w:main.hex:i
 
 checkprog:	
 	$(AVRDUDE) -v 
--- a/test.py	Wed Jun 26 23:12:37 2013 +0800
+++ b/test.py	Thu Jun 27 00:12:01 2013 +0800
@@ -1,4 +1,4 @@
-#!/Users/matt/tmp/crypto/bin/python
+#!/usr/bin/env python
 
 from Crypto.Cipher import AES
 import hashlib
@@ -20,6 +20,11 @@
 enc_key = 'aabbccddeeffgghh\0\0\0\0'
 indata =  '1234567890123456'
 
+a_key = unhexlify('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
+bs = unhexlify('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb')
+threes = '33333333333333333333'
+print len(threes)
+
 print "cli_key %s, hex %s" % (cli_key, hexlify(cli_key))
 print "enc_key %s, hex %s" % (enc_key, hexlify(enc_key))
 print "data    %s, hex %s" % (indata, hexlify(indata))
@@ -34,7 +39,10 @@
 h = hmac.new(enc_key, 'D:' + enc, hashlib.sha1).digest()
 print "enc hmac hex %s" % hexlify(h)
 
-h = hmac.new(cli_key, 'H:' + cli_key, hashlib.sha1).digest()
-print "hmac test hex %s" % hexlify(h)
+h = hmac.new(a_key, 'H:' + bs, hashlib.sha1).digest()
+print "hmac test aaaa bbbbhex %s" % hexlify(h)
+
+h = hmac.new(threes, 'H:' + threes, hashlib.sha1).digest()
+print "hmac test aaaa bbbbhex %s" % hexlify(h)