some adjustments for debugging
This commit is contained in:
parent
aa060d30f8
commit
45ad29acaf
7
debug.h
7
debug.h
|
@ -21,18 +21,21 @@
|
|||
|
||||
#ifdef DEBUG_METHOD
|
||||
#define DEBUG_INIT() debug_init()
|
||||
#else
|
||||
#define DEBUG_INIT()
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
#define DEBUG_C(_c) debug_char(_c)
|
||||
#define DEBUG_S(_s) debug_str(_s)
|
||||
#define DEBUG_B(_b) debug_byte(_b)
|
||||
#include "cli.h"
|
||||
#else
|
||||
#define DEBUG_INIT()
|
||||
#define DEBUG_C(_c)
|
||||
#define DEBUG_S(_s)
|
||||
#define DEBUG_B(_b)
|
||||
#endif
|
||||
|
||||
|
||||
void debug_init(void);
|
||||
void debug_char(char);
|
||||
void debug_str(char*);
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
rcall noekeon_enc
|
||||
1:
|
||||
pop_ r27, r26, r23, r22
|
||||
pop r16 /* bloc counter */
|
||||
pop r16 /* block counter */
|
||||
dec r16
|
||||
breq 9f
|
||||
push r16
|
||||
|
|
|
@ -542,7 +542,7 @@ sha1_nextBlock_mainloop:
|
|||
ld T3, X+
|
||||
ld T4, X+
|
||||
|
||||
/**/
|
||||
/*
|
||||
push r26
|
||||
push r27
|
||||
push T4
|
||||
|
@ -559,7 +559,7 @@ sha1_nextBlock_mainloop:
|
|||
pop T4
|
||||
pop r27
|
||||
pop r26
|
||||
/**/
|
||||
*/
|
||||
|
||||
cpi LoopC, 16
|
||||
brlt sha1_nextBlock_mainloop_core
|
||||
|
@ -723,7 +723,7 @@ sha1_nextBlock_update_a:
|
|||
std Y+1*4+1, T2
|
||||
std Y+1*4+2, T3
|
||||
std Y+1*4+3, T4
|
||||
|
||||
/*
|
||||
push r27
|
||||
push r26
|
||||
movw r26, W1
|
||||
|
@ -731,7 +731,7 @@ sha1_nextBlock_update_a:
|
|||
dbg_hexdump 4*5
|
||||
pop r26
|
||||
pop r27
|
||||
|
||||
*/
|
||||
inc LoopC
|
||||
cpi LoopC, 80
|
||||
brge 1f
|
||||
|
|
|
@ -28,11 +28,14 @@
|
|||
#include <string.h> /* memcpy & co */
|
||||
#include <stdint.h>
|
||||
#include "config.h"
|
||||
#undef DEBUG
|
||||
//#define DEBUG UART
|
||||
#include "debug.h"
|
||||
#include "sha1.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
# undef DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
#define LITTLE_ENDIAN
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
|
|
@ -41,10 +41,10 @@
|
|||
|
||||
|
||||
|
||||
uint32_t ovfcounter;
|
||||
static volatile uint32_t ovfcounter;
|
||||
|
||||
uint16_t const_overhead=0;
|
||||
uint16_t int_overhead=0;
|
||||
static uint16_t const_overhead=0;
|
||||
static uint16_t int_overhead=0;
|
||||
|
||||
ISR(TIMER1_OVF_vect){
|
||||
ovfcounter++;
|
||||
|
@ -75,7 +75,7 @@ void startTimer(uint8_t granularity){
|
|||
uint64_t stopTimer(void){
|
||||
TCCR1B = 0; /* stop timer */
|
||||
uint64_t ret;
|
||||
ret = (ovfcounter<<16) | TCNT1;
|
||||
ret = (((uint64_t)ovfcounter)<<16) | TCNT1;
|
||||
ret -= const_overhead;
|
||||
ret -= ovfcounter * int_overhead;
|
||||
return ret;
|
||||
|
|
|
@ -291,10 +291,23 @@ void shavs_test1(void){
|
|||
_delay_ms(500);
|
||||
|
||||
cli_putstr_P(PSTR("\r\n starting last block"));
|
||||
cli_putstr_P(PSTR("\r\n\tlength == "));
|
||||
cli_hexdump_rev(&length,4);
|
||||
cli_putstr_P(PSTR("\r\n\tbuffersize_B == "));
|
||||
cli_hexdump_rev(&(shavs_ctx.buffersize_B),2);
|
||||
uint16_t temp=length-(shavs_ctx.blocks)*((shavs_ctx.buffersize_B)*8);
|
||||
cli_putstr_P(PSTR("\r\n\t (temp) == "));
|
||||
cli_hexdump_rev(&temp,2);
|
||||
_delay_ms(500);
|
||||
#endif
|
||||
hfal_hash_lastBlock( &(shavs_ctx.ctx),
|
||||
shavs_ctx.buffer,
|
||||
length-(shavs_ctx.blocks)*((shavs_ctx.buffersize_B)*8));
|
||||
#if !DEBUG
|
||||
uint16_t temp=length-(shavs_ctx.blocks)*((shavs_ctx.buffersize_B)*8);
|
||||
// cli_putstr_P(PSTR("\r\n\t (temp) == "));
|
||||
cli_hexdump_rev(&temp,2);
|
||||
#endif
|
||||
hfal_hash_lastBlock( &(shavs_ctx.ctx), buffer, /* be aware of freaking compilers!!! */
|
||||
// length-(shavs_ctx.blocks)*((shavs_ctx.buffersize_B)*8));
|
||||
temp );
|
||||
#if DEBUG
|
||||
cli_putstr_P(PSTR("\r\n starting ctx2hash"));
|
||||
_delay_ms(500);
|
||||
|
|
Loading…
Reference in New Issue