small update (integrating NOEKEON_OMAC and SEED_C)
This commit is contained in:
parent
a1518b457d
commit
86af172844
38
Makefile
38
Makefile
|
@ -80,6 +80,26 @@ info:
|
||||||
# @echo " $(ALGORITHMS_TEST_BIN)"
|
# @echo " $(ALGORITHMS_TEST_BIN)"
|
||||||
# @echo " ALGORITHMS_TEST_TARGET_ELF:"
|
# @echo " ALGORITHMS_TEST_TARGET_ELF:"
|
||||||
# @echo " $(ALGORITHMS_TEST_TARGET_ELF)"
|
# @echo " $(ALGORITHMS_TEST_TARGET_ELF)"
|
||||||
|
@echo " targets:"
|
||||||
|
@echo " all - all algorithm cores"
|
||||||
|
@echo " cores - all algorithm cores"
|
||||||
|
@echo " listings - all algorithm core listings"
|
||||||
|
@echo " tests - all algorithm test programs"
|
||||||
|
@echo " stats - all algorithm size statistics"
|
||||||
|
@echo " blockciphers - all blockcipher cores"
|
||||||
|
@echo " streamciphers - all streamcipher cores"
|
||||||
|
@echo " hashes - all hash cores"
|
||||||
|
@echo " macs - all MAC cores"
|
||||||
|
@echo " prngs - all PRNG cores"
|
||||||
|
@echo " all_testrun - testrun all algorithms"
|
||||||
|
@echo " docu - build doxygen documentation"
|
||||||
|
@echo " clean - remove a lot of builded files"
|
||||||
|
@echo " xclean - also remove dependency files"
|
||||||
|
@echo " *_TEST_BIN - build test program"
|
||||||
|
@echo " *_TESTRUN - run nessie test"
|
||||||
|
@echo " *_OBJ - build algorithm core"
|
||||||
|
@echo " *_FLASH - flash test program"
|
||||||
|
@echo " *_LIST - build assembler listing"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -161,12 +181,12 @@ $(foreach algo, $(ALGORITHMS),$(eval $(call FLASH_TEMPLATE, $(algo), $(TESTBIN_D
|
||||||
define TESTRUN_TEMPLATE
|
define TESTRUN_TEMPLATE
|
||||||
$(1)_TESTRUN: $(1)_FLASH
|
$(1)_TESTRUN: $(1)_FLASH
|
||||||
@echo "[test]: $(1)"
|
@echo "[test]: $(1)"
|
||||||
$(RUBY) get_test.rb $(TESTPORT) $(TESTPORTBAUDR) 8 1 nessie $(TESTLOG_DIR)$(TESTPREFIX) $(2)
|
$(RUBY) $(GET_TEST) $(TESTPORT) $(TESTPORTBAUDR) 8 1 nessie $(TESTLOG_DIR)$(TESTPREFIX) $(2)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(foreach algo, $(ALGORITHMS),$(eval $(call TESTRUN_TEMPLATE, $(algo), $(call lc,$(algo)) )))
|
$(foreach algo, $(ALGORITHMS),$(eval $(call TESTRUN_TEMPLATE, $(algo), $(call lc,$(algo)) )))
|
||||||
|
|
||||||
ALL_TESTRUN: $(foreach algo, $(ALGORITHMS), $(algo)_TESTRUN)
|
all_testrun: $(foreach algo, $(ALGORITHMS), $(algo)_TESTRUN)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -236,6 +256,20 @@ xclean: clean
|
||||||
docu:
|
docu:
|
||||||
doxygen
|
doxygen
|
||||||
|
|
||||||
|
make.dump: Makefile
|
||||||
|
$(MAKE) -p -B -n -f $^ > $@
|
||||||
|
|
||||||
|
make.dot: make.dump
|
||||||
|
$(MAKE2GRAPH) $^ > $@
|
||||||
|
|
||||||
|
make.png: make.dot
|
||||||
|
$(TWOPI) -Tpng -o $@ $^
|
||||||
|
|
||||||
|
make.svg: make.dot
|
||||||
|
$(TWOPI) -Tsvg -o $@ $^
|
||||||
|
|
||||||
|
.PHONY: make-info
|
||||||
|
make-info: make.png make.svg
|
||||||
|
|
||||||
|
|
||||||
# Rules for building the .text rom images
|
# Rules for building the .text rom images
|
||||||
|
|
|
@ -11,7 +11,7 @@ TESTSRC_DIR = test_src/
|
||||||
#uisp -dprog=bsd -dlpt=/dev/parport1 --upload if=$(PRG).hex
|
#uisp -dprog=bsd -dlpt=/dev/parport1 --upload if=$(PRG).hex
|
||||||
ERASECMD =
|
ERASECMD =
|
||||||
TESTPORT = /dev/ttyUSB1
|
TESTPORT = /dev/ttyUSB1
|
||||||
TESTPORTBAUDR = 9600
|
TESTPORTBAUDR = 38400
|
||||||
TESTLOG_DIR = testlog/
|
TESTLOG_DIR = testlog/
|
||||||
TESTPREFIX = nessie-
|
TESTPREFIX = nessie-
|
||||||
LIST_DIR = listings/
|
LIST_DIR = listings/
|
||||||
|
@ -29,3 +29,7 @@ OBJCOPY = avr-objcopy
|
||||||
OBJDUMP = avr-objdump
|
OBJDUMP = avr-objdump
|
||||||
SIZE = avr-size
|
SIZE = avr-size
|
||||||
RUBY = ruby
|
RUBY = ruby
|
||||||
|
GET_TEST = host/get_test.rb
|
||||||
|
MAKE = make
|
||||||
|
MAKE2GRAPH = ~/bin/make2graph.rb
|
||||||
|
TWOPI = twopi
|
||||||
|
|
18
cast5.c
18
cast5.c
|
@ -108,7 +108,7 @@ void cast5_init_rM(uint8_t *klo, uint8_t *khi, uint8_t offset, uint8_t *src, boo
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cast5_init(void* key, uint8_t keylength_b, cast5_ctx_t* s){
|
void cast5_init(const void* key, uint8_t keylength_b, cast5_ctx_t* s){
|
||||||
/* we migth return if the key is valid and if setup was sucessfull */
|
/* we migth return if the key is valid and if setup was sucessfull */
|
||||||
uint32_t x[4], z[4];
|
uint32_t x[4], z[4];
|
||||||
#define BPX ((uint8_t*)&(x[0]))
|
#define BPX ((uint8_t*)&(x[0]))
|
||||||
|
@ -198,8 +198,10 @@ uint32_t cast5_f1(uint32_t d, uint32_t m, uint8_t r){
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
return (((pgm_read_dword(&s1[((uint8_t*)&t)[IA]] ) ^ pgm_read_dword(&s2[((uint8_t*)&t)[IB]] ))
|
return ((( pgm_read_dword(&s1[((uint8_t*)&t)[IA]])
|
||||||
- pgm_read_dword(&s3[((uint8_t*)&t)[IC]] )) + pgm_read_dword(&s4[((uint8_t*)&t)[ID]]));
|
^ pgm_read_dword(&s2[((uint8_t*)&t)[IB]]) )
|
||||||
|
- pgm_read_dword(&s3[((uint8_t*)&t)[IC]]) )
|
||||||
|
+ pgm_read_dword(&s4[((uint8_t*)&t)[ID]]) );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -227,8 +229,8 @@ uint32_t cast5_f2(uint32_t d, uint32_t m, uint8_t r){
|
||||||
return (((ia - ib) + ic) ^ id);
|
return (((ia - ib) + ic) ^ id);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
return (((pgm_read_dword(&s1[((uint8_t*)&t)[IA]])
|
return ((( pgm_read_dword(&s1[((uint8_t*)&t)[IA]])
|
||||||
- pgm_read_dword(&s2[((uint8_t*)&t)[IB]]) )
|
- pgm_read_dword(&s2[((uint8_t*)&t)[IB]]) )
|
||||||
+ pgm_read_dword(&s3[((uint8_t*)&t)[IC]]) )
|
+ pgm_read_dword(&s3[((uint8_t*)&t)[IC]]) )
|
||||||
^ pgm_read_dword(&s4[((uint8_t*)&t)[ID]]) );
|
^ pgm_read_dword(&s4[((uint8_t*)&t)[ID]]) );
|
||||||
|
|
||||||
|
@ -257,8 +259,10 @@ uint32_t cast5_f3(uint32_t d, uint32_t m, uint8_t r){
|
||||||
uart_putstr("\r\n\tID="); uart_hexdump(&id, 4);
|
uart_putstr("\r\n\tID="); uart_hexdump(&id, 4);
|
||||||
return (((ia + ib) ^ ic) - id);
|
return (((ia + ib) ^ ic) - id);
|
||||||
#else
|
#else
|
||||||
return ((pgm_read_dword(&s1[((uint8_t*)&t)[IA]] ) + pgm_read_dword(&s2[((uint8_t*)&t)[IB]] ))
|
return (( pgm_read_dword(&s1[((uint8_t*)&t)[IA]] )
|
||||||
^ pgm_read_dword(&s3[((uint8_t*)&t)[IC]] )) - pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
|
+ pgm_read_dword(&s2[((uint8_t*)&t)[IB]] ))
|
||||||
|
^ pgm_read_dword(&s3[((uint8_t*)&t)[IC]] ))
|
||||||
|
- pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
4
cast5.h
4
cast5.h
|
@ -55,7 +55,7 @@
|
||||||
*
|
*
|
||||||
* A variable of this type may hold a keyschedule for the CAST-5 cipher.
|
* A variable of this type may hold a keyschedule for the CAST-5 cipher.
|
||||||
* This context is regulary generated by the
|
* This context is regulary generated by the
|
||||||
* cast5_init(uint8_t* key, uint8_t keylength_b, cast5_ctx_t* s) funtion.
|
* cast5_init(uint8_t* key, uint8_t keylength_b, cast5_ctx_t* s) function.
|
||||||
*/
|
*/
|
||||||
typedef struct cast5_ctx_st{
|
typedef struct cast5_ctx_st{
|
||||||
uint32_t mask[16];
|
uint32_t mask[16];
|
||||||
|
@ -74,7 +74,7 @@ typedef struct cast5_ctx_st{
|
||||||
* \param keylength_b length of the key in bits (maximum 128 bits)
|
* \param keylength_b length of the key in bits (maximum 128 bits)
|
||||||
* \param s pointer to the context
|
* \param s pointer to the context
|
||||||
*/
|
*/
|
||||||
void cast5_init(void* key, uint8_t keylength_b, cast5_ctx_t* s);
|
void cast5_init(const void* key, uint8_t keylength_b, cast5_ctx_t* s);
|
||||||
|
|
||||||
/** \fn void cast5_enc(void* block, const cast5_ctx_t *s);
|
/** \fn void cast5_enc(void* block, const cast5_ctx_t *s);
|
||||||
* \brief encrypt a block with the CAST-5 algorithm
|
* \brief encrypt a block with the CAST-5 algorithm
|
||||||
|
|
2
config.h
2
config.h
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
/* uart.[ch] defines */
|
/* uart.[ch] defines */
|
||||||
#define UART_INTERRUPT 1
|
#define UART_INTERRUPT 1
|
||||||
#define UART_BAUD_RATE 9600
|
#define UART_BAUD_RATE 38400
|
||||||
#define UART_RXBUFSIZE 16
|
#define UART_RXBUFSIZE 16
|
||||||
#define UART_TXBUFSIZE 16
|
#define UART_TXBUFSIZE 16
|
||||||
#define UART_LINE_BUFFER_SIZE 40
|
#define UART_LINE_BUFFER_SIZE 40
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Makefile for noekeon
|
||||||
|
ALGO_NAME := OMAC_NOEKEON
|
||||||
|
|
||||||
|
# comment out the following line for removement of noekeon from the build process
|
||||||
|
MACS += $(ALGO_NAME)
|
||||||
|
|
||||||
|
|
||||||
|
$(ALGO_NAME)_OBJ := noekeon_asm.o omac_noekeon.o memxor.o
|
||||||
|
$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o serial-tools.o \
|
||||||
|
nessie_mac_test.o nessie_common.o cli.o performance_test.o
|
||||||
|
$(ALGO_NAME)_NESSIE_TEST := test nessie
|
||||||
|
$(ALGO_NAME)_PERFORMANCE_TEST := performance
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Makefile for noekeon
|
||||||
|
ALGO_NAME := OMAC_NOEKEON_C
|
||||||
|
|
||||||
|
# comment out the following line for removement of noekeon from the build process
|
||||||
|
MACS += $(ALGO_NAME)
|
||||||
|
|
||||||
|
|
||||||
|
$(ALGO_NAME)_OBJ := noekeon_asm.o omac_noekeon_C.o memxor.o
|
||||||
|
$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o serial-tools.o \
|
||||||
|
nessie_mac_test.o nessie_common.o cli.o performance_test.o
|
||||||
|
$(ALGO_NAME)_NESSIE_TEST := test nessie
|
||||||
|
$(ALGO_NAME)_PERFORMANCE_TEST := performance
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Makefile for SEED
|
||||||
|
ALGO_NAME := SEED_C
|
||||||
|
|
||||||
|
# comment out the following line for removement of SEED from the build process
|
||||||
|
BLOCK_CIPHERS += $(ALGO_NAME)
|
||||||
|
|
||||||
|
$(ALGO_NAME)_OBJ := seed_C.o
|
||||||
|
$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o serial-tools.o \
|
||||||
|
nessie_bc_test.o nessie_common.o \
|
||||||
|
cli.o performance_test.o
|
||||||
|
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||||
|
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
#include "noekeon.h"
|
||||||
|
#include "omac_noekeon.h"
|
||||||
|
#include "memxor.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
void omac_noekeon_init(omac_noekeon_ctx_t* ctx){
|
||||||
|
memset(ctx, 0, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void omac_noekeon_tweak(uint8_t t, const void* key, omac_noekeon_ctx_t* ctx){
|
||||||
|
*ctx[15] = t;
|
||||||
|
noekeon_enc(ctx, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
void omac_noekeon_next(const void* buffer, const void* key, omac_noekeon_ctx_t* ctx){
|
||||||
|
memxor(ctx, buffer, 16);
|
||||||
|
noekeon_enc(ctx, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void omac_noekeon_comppad(uint8_t* pad, const void* key, uint8_t length_b){
|
||||||
|
uint8_t c1,c2,r,j;
|
||||||
|
memset(pad, 0, 16);
|
||||||
|
noekeon_enc(pad, key);
|
||||||
|
r=(length_b==128)?1:2;
|
||||||
|
for(;r!=0;--r){
|
||||||
|
c1=0;
|
||||||
|
for(j=0;j<16;++j){
|
||||||
|
c2 = c1;
|
||||||
|
c1 = (pad[15-j])>>7;
|
||||||
|
pad[15-j] = ((pad[15-j])<<1) | c2;
|
||||||
|
}
|
||||||
|
if(c1){
|
||||||
|
pad[15] ^= 0x87;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(length_b<128){
|
||||||
|
pad[(length_b)/8] ^= 0x80 >> (length_b%8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void omac_noekeon_last(const void* buffer, uint8_t length_b, const void* key, omac_noekeon_ctx_t* ctx){
|
||||||
|
while(length_b>128){
|
||||||
|
omac_noekeon_next(buffer, key, ctx);
|
||||||
|
buffer = (uint8_t*)buffer +16;
|
||||||
|
length_b -= 128;
|
||||||
|
}
|
||||||
|
uint8_t pad[16];
|
||||||
|
omac_noekeon_comppad(pad, key, length_b);
|
||||||
|
memxor(pad, buffer, (length_b+7)/8);
|
||||||
|
omac_noekeon_next(pad, key, ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void omac_noekeon(void* dest, const void* msg, uint16_t msglength_b,
|
||||||
|
const void* key, uint8_t t){
|
||||||
|
omac_noekeon_init(dest);
|
||||||
|
if(t!=0xff)
|
||||||
|
omac_noekeon_tweak(t,key,dest);
|
||||||
|
while(msglength_b>128){
|
||||||
|
omac_noekeon_next(msg, key, dest);
|
||||||
|
msg = (uint8_t*)msg +16;
|
||||||
|
msglength_b -= 128;
|
||||||
|
}
|
||||||
|
omac_noekeon_last(msg, msglength_b, key, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
46
seed.h
46
seed.h
|
@ -29,15 +29,53 @@
|
||||||
#define SEED_H_
|
#define SEED_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
/** \typedef seed_ctx_t
|
||||||
|
* \brief SEED context
|
||||||
|
*
|
||||||
|
* A variable of this type may hold the key material for the SEED cipher.
|
||||||
|
* This context is regulary generated by the
|
||||||
|
* void seed_init(const void * key, seed_ctx_t * ctx) function.
|
||||||
|
*/
|
||||||
typedef struct{
|
typedef struct{
|
||||||
uint32_t k[4];
|
uint32_t k[4];
|
||||||
} seed_ctx_t;
|
} seed_ctx_t;
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
void seed_init(uint8_t * key, seed_ctx_t * ctx);
|
/** \fn void seed_init(void * key, seed_ctx_t * ctx)
|
||||||
void seed_enc(void * buffer, seed_ctx_t * ctx);
|
* \brief initializes context for SEED operation
|
||||||
void seed_dec(void * buffer, seed_ctx_t * ctx);
|
*
|
||||||
|
* This function copys the key material into a context variable.
|
||||||
|
*
|
||||||
|
* \param key pointer to the key material (128 bit = 16 bytes)
|
||||||
|
* \param ctx pointer to the context (seed_ctx_t)
|
||||||
|
*/
|
||||||
|
void seed_init(const void * key, seed_ctx_t * ctx);
|
||||||
|
|
||||||
|
/** \fn void seed_enc(void * buffer, seed_ctx_t * ctx)
|
||||||
|
* \brief encrypt a block with SEED
|
||||||
|
*
|
||||||
|
* This function encrypts a block of 64 bits (8 bytes) with the SEED algorithm.
|
||||||
|
* The round keys are computed on demand, so the context is modifyed while
|
||||||
|
* encrypting but the original stated is restored when the function exits.
|
||||||
|
*
|
||||||
|
* \param buffer pointer to the block (64 bit = 8 byte) which will be encrypted
|
||||||
|
* \param ctx pointer to the key material (seed_ctx_t)
|
||||||
|
*/
|
||||||
|
void seed_enc(void * buffer, const seed_ctx_t * ctx);
|
||||||
|
|
||||||
|
|
||||||
|
/** \fn void seed_dec(void * buffer, seed_ctx_t * ctx)
|
||||||
|
* \brief decrypt a block with SEED
|
||||||
|
*
|
||||||
|
* This function decrypts a block of 64 bits (8 bytes) with the SEED algorithm.
|
||||||
|
* The round keys are computed on demand, so the context is modifyed while
|
||||||
|
* decrypting but the original stated is restored when the function exits.
|
||||||
|
*
|
||||||
|
* \param buffer pointer to the block (64 bit = 8 byte) which will be decrypted
|
||||||
|
* \param ctx pointer to the key material (seed_ctx_t)
|
||||||
|
*/
|
||||||
|
void seed_dec(void * buffer, const seed_ctx_t * ctx);
|
||||||
|
|
||||||
|
|
||||||
#endif /*SEED_H_*/
|
#endif /*SEED_H_*/
|
||||||
|
|
12
seed_C.c
12
seed_C.c
|
@ -206,7 +206,7 @@ typedef struct{
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
void seed_init(uint8_t * key, seed_ctx_t * ctx){
|
void seed_init(const void * key, seed_ctx_t * ctx){
|
||||||
memcpy(ctx->k, key, 128/8);
|
memcpy(ctx->k, key, 128/8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,11 +215,11 @@ void seed_init(uint8_t * key, seed_ctx_t * ctx){
|
||||||
#define L (((uint64_t*)buffer)[0])
|
#define L (((uint64_t*)buffer)[0])
|
||||||
#define R (((uint64_t*)buffer)[1])
|
#define R (((uint64_t*)buffer)[1])
|
||||||
|
|
||||||
void seed_enc(void * buffer, seed_ctx_t * ctx){
|
void seed_enc(void * buffer, const seed_ctx_t * ctx){
|
||||||
uint8_t r;
|
uint8_t r;
|
||||||
keypair_t k;
|
keypair_t k;
|
||||||
for(r=0; r<8; ++r){
|
for(r=0; r<8; ++r){
|
||||||
k = getnextkeys(ctx->k, 2*r);
|
k = getnextkeys(((seed_ctx_t*)ctx)->k, 2*r);
|
||||||
/*
|
/*
|
||||||
DEBUG_S("\r\n\tDBG ka,0: "); uart_hexdump(&k.k0, 4);
|
DEBUG_S("\r\n\tDBG ka,0: "); uart_hexdump(&k.k0, 4);
|
||||||
DEBUG_S("\r\n\tDBG ka,1: "); uart_hexdump(&k.k1, 4);
|
DEBUG_S("\r\n\tDBG ka,1: "); uart_hexdump(&k.k1, 4);
|
||||||
|
@ -228,7 +228,7 @@ void seed_enc(void * buffer, seed_ctx_t * ctx){
|
||||||
*/
|
*/
|
||||||
L ^= f_function(&R,k.k0,k.k1);
|
L ^= f_function(&R,k.k0,k.k1);
|
||||||
|
|
||||||
k = getnextkeys(ctx->k, 2*r+1);
|
k = getnextkeys(((seed_ctx_t*)ctx)->k, 2*r+1);
|
||||||
/*
|
/*
|
||||||
DEBUG_S("\r\n\tDBG kb,0: "); uart_hexdump(&k.k0, 4);
|
DEBUG_S("\r\n\tDBG kb,0: "); uart_hexdump(&k.k0, 4);
|
||||||
DEBUG_S("\r\n\tDBG kb,1: "); uart_hexdump(&k.k1, 4);
|
DEBUG_S("\r\n\tDBG kb,1: "); uart_hexdump(&k.k1, 4);
|
||||||
|
@ -252,7 +252,7 @@ void seed_dec(void * buffer, seed_ctx_t * ctx){
|
||||||
int8_t r;
|
int8_t r;
|
||||||
keypair_t k;
|
keypair_t k;
|
||||||
for(r=7; r>=0; --r){
|
for(r=7; r>=0; --r){
|
||||||
k = getprevkeys(ctx->k, 2*r+1);
|
k = getprevkeys(((seed_ctx_t*)ctx)->k, 2*r+1);
|
||||||
/*
|
/*
|
||||||
DEBUG_S("\r\n\tDBG ka,0: "); uart_hexdump(&k.k0, 4);
|
DEBUG_S("\r\n\tDBG ka,0: "); uart_hexdump(&k.k0, 4);
|
||||||
DEBUG_S("\r\n\tDBG ka,1: "); uart_hexdump(&k.k1, 4);
|
DEBUG_S("\r\n\tDBG ka,1: "); uart_hexdump(&k.k1, 4);
|
||||||
|
@ -261,7 +261,7 @@ void seed_dec(void * buffer, seed_ctx_t * ctx){
|
||||||
*/
|
*/
|
||||||
L ^= f_function(&R,k.k0,k.k1);
|
L ^= f_function(&R,k.k0,k.k1);
|
||||||
|
|
||||||
k = getprevkeys(ctx->k, 2*r+0);
|
k = getprevkeys(((seed_ctx_t*)ctx)->k, 2*r+0);
|
||||||
/*
|
/*
|
||||||
DEBUG_S("\r\n\tDBG kb,0: "); uart_hexdump(&k.k0, 4);
|
DEBUG_S("\r\n\tDBG kb,0: "); uart_hexdump(&k.k0, 4);
|
||||||
DEBUG_S("\r\n\tDBG kb,1: "); uart_hexdump(&k.k1, 4);
|
DEBUG_S("\r\n\tDBG kb,1: "); uart_hexdump(&k.k1, 4);
|
||||||
|
|
Loading…
Reference in New Issue