fixing lot of typos, camellia_C now seems to work

This commit is contained in:
bg 2008-12-10 15:18:23 +00:00
parent 12883cff6e
commit 9b567bc05f
38 changed files with 155 additions and 223 deletions

View File

@ -29,7 +29,7 @@ typedef struct camellia128_ctx_s{
}camellia128_ctx_t;
void camellia128_init(const uint8_t* key, camellia128_ctx_t* s);
void camellia128_init(const void* key, camellia128_ctx_t* s);
void camellia128_enc(void* block, const camellia128_ctx_t* s);
void camellia128_dec(void* block, const camellia128_ctx_t* s);

View File

@ -1,4 +1,4 @@
/* camellia.c */
/* camellia128-stub.c */
/*
This file is part of the Crypto-avr-lib/microcrypt-lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
@ -27,10 +27,11 @@
#include <avr/io.h>
#include <avr/pgmspace.h>
#include "camellia.h"
#include "uart.h"
#include "debug.h"
#include <util/delay.h>
#if 0
#include "uart.h"
#include "debug.h"
#include <util/delay.h>
#endif
/*****************************************************************************/
uint64_t camellia_f(uint64_t x, uint64_t k);
/*****************************************************************************/
@ -69,7 +70,7 @@ uint32_t PROGMEM camellia_sigma[12]={ /* 48 byte table */
/*****************************************************************************/
/*
void camellia128_ctx_dump(camellia128_ctx_t *s){
uart_putstr_P(PSTR("\r\n==State Dump=="));
uart_putstr_P(PSTR("\n\rKAl: ")); uart_hexdump(&(s->kal), 8);
@ -78,22 +79,24 @@ void camellia128_ctx_dump(camellia128_ctx_t *s){
uart_putstr_P(PSTR("\n\rKLr: ")); uart_hexdump(&(s->klr), 8);
return;
}
*/
/*****************************************************************************/
/* extern prog_uint64_t camellia_sigma[6]; */
void camellia128_init(const uint8_t* key, camellia128_ctx_t* s){
void camellia128_init(const void* key, camellia128_ctx_t* s){
uint8_t i;
s->kll = 0; /* ((uint64_t*)key)[0]; */
/* load the key, endian-adjusted, to kll,klr */
for(i=0; i<8; ++i){
s->kll <<= 8;
s->kll |= *key++;
s->kll |= *((uint8_t*)key);
key = (uint8_t*)key+1;
}
for(i=0; i<8; ++i){
s->klr <<= 8;
s->klr |= *key++;
s->klr |= *((uint8_t*)key);
key = (uint8_t*)key+1;
}
s->kal = s->kll;

View File

@ -27,10 +27,11 @@
#include <avr/io.h>
#include <avr/pgmspace.h>
#include "camellia.h"
#include "uart.h"
#include "debug.h"
#include <util/delay.h>
#if 0
#include "uart.h"
#include "debug.h"
#include <util/delay.h>
#endif
/*****************************************************************************/
uint8_t rol(uint8_t a, uint8_t n){return ((a<<n) | (a>>(8-n)));}
@ -155,29 +156,24 @@ uint64_t camellia_p(uint64_t d){
uint64_t camellia_f(uint64_t x, uint64_t k){
uint64_t y;
y = camellia_p(camellia_s(x ^ k));
/*
uart_putstr("\r\nEfunc X=");
uart_hexdump(&(x), 8);
uart_putstr(" K=");
uart_hexdump(&(k), 8);
uart_putstr(" Y=");
uart_hexdump(&(y), 8);
*/
return y;
}
/*****************************************************************************/
uint64_t camellia_fl(uint64_t x, uint64_t k){
uint64_t lx[1], lk[1], y[1];
lx[0]=x; lk[0] = k;
// uint64_t lx, lk, y;
uint32_t lx[2], lk[2], yr, yl;
lx[0]=(uint32_t)x;
lx[1]=(uint32_t)(x>>32);
lk[0]=(uint32_t)k;
lk[1]=(uint32_t)(k>>32);
#define Y ((uint32_t*)y)
#define X ((uint32_t*)lx)
#define K ((uint32_t*)lk)
Y[0] = rol32((X[1]) & K[1] ,1) ^ (X[0]); /* Yr */
Y[1] = (Y[0] | K[0]) ^ (X[1]); /* Yl */
yr = rol32((X[1]) & (K[1]) ,1) ^ (X[0]); /* Yr */
yl = (yr | K[0]) ^ (X[1]); /* Yl */
/*
uart_putstr("\r\nFL(");
@ -190,15 +186,18 @@ uint64_t camellia_fl(uint64_t x, uint64_t k){
#undef K
#undef X
#undef Y
return y[0];
return (((uint64_t)yl)<<32 | yr);
}
/*****************************************************************************/
uint64_t camellia_fl_inv(uint64_t y, uint64_t k){
//volatile uint32_t xl, xr;
volatile uint64_t ly[1], lk[1], x[1];
ly[0]=y; lk[0] = k;
uint32_t ly[2], lk[2], x[2];
ly[0]=(uint32_t)y;
ly[1]=(uint32_t)(y>>32);
lk[0]=(uint32_t)k;
lk[1]=(uint32_t)(k>>32);
#define Y ((uint32_t*)ly)
#define X ((uint32_t*)x)
#define K ((uint32_t*)lk)
@ -216,7 +215,7 @@ uint64_t camellia_fl_inv(uint64_t y, uint64_t k){
#undef K
#undef X
#undef Y
return x[0];
return ((uint64_t)(x[1]))<<32 | x[0];
}
/*****************************************************************************/
@ -231,7 +230,7 @@ uint64_t camellia_sigma[6]={
};
/*****************************************************************************/
#if 0
void camellia128_ctx_dump(camellia128_ctx_t *s){
uart_putstr("\r\n==State Dump==");
uart_putstr("\n\rKAl: "); uart_hexdump(&(s->kal), 8);
@ -240,21 +239,23 @@ void camellia128_ctx_dump(camellia128_ctx_t *s){
uart_putstr("\n\rKLr: "); uart_hexdump(&(s->klr), 8);
return;
}
#endif
/*****************************************************************************/
void camellia128_init(const uint8_t* key, camellia128_ctx_t* s){
void camellia128_init(const void* key, camellia128_ctx_t* s){
uint8_t i;
s->kll = 0; //((uint64_t*)key)[0];
/* load the key, endian-adjusted, to kll,klr */
for(i=0; i<8; ++i){
s->kll <<= 8;
s->kll |= *key++;
s->kll |= *((uint8_t*)key);
key = (uint8_t*)key+1;
}
for(i=0; i<8; ++i){
s->klr <<= 8;
s->klr |= *key++;
s->klr |= *((uint8_t*)key);
key = (uint8_t*)key+1;
}
s->kal = s->kll;
@ -324,16 +325,16 @@ void camellia128_keyop_inv(camellia128_ctx_t* s, int8_t q){
void camellia_6rounds(const camellia128_ctx_t* s, uint64_t* bl, uint64_t* br, uint8_t roundop, uint8_t keychoice){
uint8_t i;
uint64_t* k[4];
k[0] = &(s->kll);
k[1] = &(s->klr);
k[2] = &(s->kal);
k[3] = &(s->kar);
k[0] = &(((camellia128_ctx_t*)s)->kll);
k[1] = &(((camellia128_ctx_t*)s)->klr);
k[2] = &(((camellia128_ctx_t*)s)->kal);
k[3] = &(((camellia128_ctx_t*)s)->kar);
for(i=0; i<3; ++i){ /* each cycle */
br[0] ^= camellia_f(bl[0],*(k[(keychoice&1)*2+((roundop&KEY_DIR)?1:0)]));
keychoice >>= 1;
if((i == 1) && (roundop&KEY_INC2)){
((roundop&KEY_DIR)?camellia128_keyop_inv:camellia128_keyop)(s,(roundop&KEY_AMMOUNT)?1:-1);
((roundop&KEY_DIR)?camellia128_keyop_inv:camellia128_keyop)(((camellia128_ctx_t*)s),(roundop&KEY_AMMOUNT)?1:-1);
}
bl[0] ^= camellia_f(br[0],*(k[(keychoice&1)*2+((roundop&KEY_DIR)?0:1)]));
@ -341,7 +342,7 @@ void camellia_6rounds(const camellia128_ctx_t* s, uint64_t* bl, uint64_t* br, ui
/* check if we should do some keyop */
if((i == (roundop&1)) && (!(roundop&KEY_INC2)) ){
((roundop&KEY_DIR)?camellia128_keyop_inv:camellia128_keyop)(s,(roundop&KEY_AMMOUNT)?1:-1);
((roundop&KEY_DIR)?camellia128_keyop_inv:camellia128_keyop)(((camellia128_ctx_t*)s),(roundop&KEY_AMMOUNT)?1:-1);
/* isn't it fuckin nice what we can do in C?! */
}
}
@ -349,6 +350,16 @@ void camellia_6rounds(const camellia128_ctx_t* s, uint64_t* bl, uint64_t* br, ui
/*****************************************************************************/
void change_endian(void* data, uint8_t length){
uint8_t i,a;
for(i=0; i<length/2; ++i){
a = ((uint8_t*)data)[i];
((uint8_t*)data)[i] = ((uint8_t*)data)[length-i-1];
((uint8_t*)data)[length-i-1] = a;
}
}
/*****************************************************************************/
void camellia128_enc(void* block, const camellia128_ctx_t* s){
@ -362,31 +373,14 @@ void camellia128_enc(void* block, const camellia128_ctx_t* s){
uint64_t temp64;
temp64 = BL;
BL = temp64 >> 56 | temp64 << 56 /* swap the most out bytes (1 & 8) */
| (temp64 & (0xffLL<<48))>>(5*8) | (temp64 & (0xffLL<< 8))<<(5*8) /* 2 & 7 */
| (temp64 & (0xffLL<<40))>>(3*8) | (temp64 & (0xffLL<<16))<<(3*8) /* 3 & 6 */
| (temp64 & (0xffLL<<32))>>(1*8) | (temp64 & (0xffLL<<24))<<(1*8); /* 4 & 5 */
temp64 = BR;
BR = temp64 >> 56 | temp64 << 56 /* swap the most out bytes (1 & 8) */
| (temp64 & (0xffLL<<48))>>(5*8) | (temp64 & (0xffLL<< 8))<<(5*8) /* 2 & 7 */
| (temp64 & (0xffLL<<40))>>(3*8) | (temp64 & (0xffLL<<16))<<(3*8) /* 3 & 6 */
| (temp64 & (0xffLL<<32))>>(1*8) | (temp64 & (0xffLL<<24))<<(1*8); /* 4 & 5 */
change_endian(&BL, 64/8);
change_endian(&BR, 64/8);
/* Prewhitening */
BL ^= s->kll;
BR ^= s->klr;
/* the first 6 */
/*
BR ^= camellia_f(BL, s->kal);
BL ^= camellia_f(BR, s->kar);
camellia128_keyop(s, -1);
BR ^= camellia_f(BL, s->kll);
BL ^= camellia_f(BR, s->klr);
BR ^= camellia_f(BL, s->kal);
BL ^= camellia_f(BR, s->kar);
*/
camellia_6rounds(s, &BL, &BR, KEY_ROL15 | KEY_DIR_NORM | KEY_POSTC1 , 0x33);
/* FL injection */
camellia128_keyop((camellia128_ctx_t*)s, -1);
@ -394,14 +388,6 @@ void camellia128_enc(void* block, const camellia128_ctx_t* s){
BR = camellia_fl_inv(BR, s->kar);
camellia128_keyop((camellia128_ctx_t*)s, -1);
/* middle 6 */
/* BR ^= camellia_f(BL, s->kll);
BL ^= camellia_f(BR, s->klr);
BR ^= camellia_f(BL, s->kal);
camellia128_keyop(s, -1);
BL ^= camellia_f(BR, s->klr);
BR ^= camellia_f(BL, s->kal);
BL ^= camellia_f(BR, s->kar);
/*/
camellia_6rounds(s, &BL, &BR, KEY_ROL15 | KEY_DIR_NORM | KEY_INC2 , 0x34);
/* FL injection */
camellia128_keyop((camellia128_ctx_t*)s, 1);
@ -409,15 +395,6 @@ void camellia128_enc(void* block, const camellia128_ctx_t* s){
BR = camellia_fl_inv(BR, s->klr);
camellia128_keyop((camellia128_ctx_t*)s, 1);
/* last 6 */
/* BR ^= camellia_f(BL, s->kll);
BL ^= camellia_f(BR, s->klr);
BR ^= camellia_f(BL, s->kal);
BL ^= camellia_f(BR, s->kar);
camellia128_keyop(s, 1);
BR ^= camellia_f(BL, s->kll);
BL ^= camellia_f(BR, s->klr);
*/
camellia_6rounds(s, &BL, &BR, KEY_ROL17 | KEY_DIR_NORM | KEY_POSTC2 , 0x0C);
/* Postwhitening */
BR ^= s->kal;
@ -427,16 +404,10 @@ void camellia128_enc(void* block, const camellia128_ctx_t* s){
BR = BL;
BL = temp64;
camellia128_keyop((camellia128_ctx_t*)s,1);
BL = temp64 >> 56 | temp64 << 56 /* swap the most out bytes (1 & 8) */
| (temp64 & (0xffLL<<48))>>(5*8) | (temp64 & (0xffLL<< 8))<<(5*8) /* 2 & 7 */
| (temp64 & (0xffLL<<40))>>(3*8) | (temp64 & (0xffLL<<16))<<(3*8) /* 3 & 6 */
| (temp64 & (0xffLL<<32))>>(1*8) | (temp64 & (0xffLL<<24))<<(1*8); /* 4 & 5 */
temp64 = BR;
BR = temp64 >> 56 | temp64 << 56 /* swap the most out bytes (1 & 8) */
| (temp64 & (0xffLL<<48))>>(5*8) | (temp64 & (0xffLL<< 8))<<(5*8) /* 2 & 7 */
| (temp64 & (0xffLL<<40))>>(3*8) | (temp64 & (0xffLL<<16))<<(3*8) /* 3 & 6 */
| (temp64 & (0xffLL<<32))>>(1*8) | (temp64 & (0xffLL<<24))<<(1*8); /* 4 & 5 */
change_endian(&BL, 64/8);
change_endian(&BR, 64/8);
#undef BL
#undef BR
@ -455,67 +426,28 @@ void camellia128_dec(void* block, const camellia128_ctx_t* s){
*/
uint64_t temp64;
temp64 = BL;
BL = temp64 >> 56 | temp64 << 56 /* swap the most out bytes (1 & 8) */
| (temp64 & (0xffLL<<48))>>(5*8) | (temp64 & (0xffLL<< 8))<<(5*8) /* 2 & 7 */
| (temp64 & (0xffLL<<40))>>(3*8) | (temp64 & (0xffLL<<16))<<(3*8) /* 3 & 6 */
| (temp64 & (0xffLL<<32))>>(1*8) | (temp64 & (0xffLL<<24))<<(1*8); /* 4 & 5 */
temp64 = BR;
BR = temp64 >> 56 | temp64 << 56 /* swap the most out bytes (1 & 8) */
| (temp64 & (0xffLL<<48))>>(5*8) | (temp64 & (0xffLL<< 8))<<(5*8) /* 2 & 7 */
| (temp64 & (0xffLL<<40))>>(3*8) | (temp64 & (0xffLL<<16))<<(3*8) /* 3 & 6 */
| (temp64 & (0xffLL<<32))>>(1*8) | (temp64 & (0xffLL<<24))<<(1*8); /* 4 & 5 */
change_endian(&BL, 64/8);
change_endian(&BR, 64/8);
camellia128_keyop_inv((camellia128_ctx_t*)s, 1);
/* Prewhitening */
BR ^= s->kal; /* kw3 */
BL ^= s->kar; /* kw4 */
/* the first 6 */
/*
BL ^= camellia_f(BR, s->klr); /* k18 * /
BR ^= camellia_f(BL, s->kll); /* k17 * /
camellia128_keyop_inv(s, 1);
BL ^= camellia_f(BR, s->kar);
BR ^= camellia_f(BL, s->kal);
BL ^= camellia_f(BR, s->klr);
BR ^= camellia_f(BL, s->kll);
*/
camellia_6rounds(s, &BR, &BL, KEY_ROL17 | KEY_DIR_INV | KEY_POSTC1 , 0x0C);
/* FL injection */
camellia128_keyop_inv((camellia128_ctx_t*)s, 1);
BR = camellia_fl(BR, s->klr);
BL = camellia_fl_inv(BL, s->kll);
camellia128_keyop_inv((camellia128_ctx_t*)s, 1);
/* middle 6 */
/* BL ^= camellia_f(BR, s->kar);
BR ^= camellia_f(BL, s->kal);
BL ^= camellia_f(BR, s->klr);
camellia128_keyop_inv(s, -1);
BR ^= camellia_f(BL, s->kal);
BL ^= camellia_f(BR, s->klr);
BR ^= camellia_f(BL, s->kll);
*/
camellia_6rounds(s, &BR, &BL, KEY_ROL15 | KEY_DIR_INV | KEY_INC2 , 0x0B);
/* FL injection */
camellia128_keyop_inv(s, -1);
camellia128_keyop_inv((camellia128_ctx_t*)s, -1);
BR = camellia_fl(BR, s->kar);
BL = camellia_fl_inv(BL, s->kal);
camellia128_keyop_inv((camellia128_ctx_t*)s, -1);
/* last 6 */
/*
BL ^= camellia_f(BR, s->kar);
BR ^= camellia_f(BL, s->kal);
BL ^= camellia_f(BR, s->klr);
BR ^= camellia_f(BL, s->kll);
camellia128_keyop_inv(s, -1);
BL ^= camellia_f(BR, s->kar);
BR ^= camellia_f(BL, s->kal);
/*/
camellia_6rounds(s, &BR, &BL, KEY_ROL15 | KEY_DIR_INV | KEY_POSTC2 , 0x33);
/* Postwhitening */
@ -526,19 +458,13 @@ void camellia128_dec(void* block, const camellia128_ctx_t* s){
BR = BL;
BL = temp64;
BL = temp64 >> 56 | temp64 << 56 /* swap the most out bytes (1 & 8) */
| (temp64 & (0xffLL<<48))>>(5*8) | (temp64 & (0xffLL<< 8))<<(5*8) /* 2 & 7 */
| (temp64 & (0xffLL<<40))>>(3*8) | (temp64 & (0xffLL<<16))<<(3*8) /* 3 & 6 */
| (temp64 & (0xffLL<<32))>>(1*8) | (temp64 & (0xffLL<<24))<<(1*8); /* 4 & 5 */
temp64 = BR;
BR = temp64 >> 56 | temp64 << 56 /* swap the most out bytes (1 & 8) */
| (temp64 & (0xffLL<<48))>>(5*8) | (temp64 & (0xffLL<< 8))<<(5*8) /* 2 & 7 */
| (temp64 & (0xffLL<<40))>>(3*8) | (temp64 & (0xffLL<<16))<<(3*8) /* 3 & 6 */
| (temp64 & (0xffLL<<32))>>(1*8) | (temp64 & (0xffLL<<24))<<(1*8); /* 4 & 5 */
change_endian(&BL, 64/8);
change_endian(&BR, 64/8);
}
/*****************************************************************************/
/*****************************************************************************/

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := A5_1.o
$(ALGO_NAME)_TEST_BIN := main-a5_1-test.o debug.o uart.o serial-tools.o \
nessie_stream_test.o nessie_common.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o serial-tools.o \
nessie_stream_test.o nessie_common.o cli.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o serial-tools.o \
nessie_stream_test.o nessie_common.o cli.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -4,10 +4,10 @@ ALGO_NAME := CAMELLIA
# comment out the following line for removement of Camellia from the build process
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := camellia.o camellia-asm.o
$(ALGO_NAME)_OBJ := camellia128-stub.o camellia-asm.o
$(ALGO_NAME)_TEST_BIN := main-camellia-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := cast5.o
$(ALGO_NAME)_TEST_BIN := main-cast5-test.o debug.o uart.o serial-tools.o cli.o\
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := des.o
$(ALGO_NAME)_TEST_BIN := main-des-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_TEST_BIN := main-entropium-test.o debug.o uart.o serial-tools.o \
cli.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_TEST_BIN := main-grain-test.o debug.o uart.o serial-tools.o \
nessie_stream_test.o nessie_common.o cli.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := hmac-sha1.o sha1-asm.o
$(ALGO_NAME)_TEST_BIN := main-hmac-sha1-test.o debug.o uart.o serial-tools.o cli.o \
nessie_mac_test.o nessie_common.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := hmac-sha256.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-hmac-sha256-test.o debug.o uart.o serial-tools.o \
nessie_mac_test.o nessie_common.o cli.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := md5.o
$(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o serial-tools.o \
nessie_hash_test.o nessie_common.o cli.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_OBJ := noekeon_asm.o
$(ALGO_NAME)_TEST_BIN := main-noekeon-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 := test nessie
$(ALGO_NAME)_PEROFRMANCE_TEST := performance
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_OBJ := noekeon.o
$(ALGO_NAME)_TEST_BIN := main-noekeon-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 := test nessie
$(ALGO_NAME)_PEROFRMANCE_TEST := performance
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_OBJ := present.o
$(ALGO_NAME)_TEST_BIN := main-present-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -10,5 +10,5 @@ $(ALGO_NAME)_TEST_BIN := main-rc5-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 := test nessie
$(ALGO_NAME)_PEROFRMANCE_TEST := performance
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_OBJ := rc6.o
$(ALGO_NAME)_TEST_BIN := main-rc6-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 := test nessie
$(ALGO_NAME)_PEROFRMANCE_TEST := performance
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -9,5 +9,5 @@ $(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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-bitslice.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-fast.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-small.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_OBJ := serpent.o serpent-sboxes_c.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := sha1-asm.o
$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o serial-tools.o \
nessie_hash_test.o nessie_common.o cli.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o serial-tools.o \
nessie_hash_test.o nessie_common.o cli.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o serial-tools.o \
nessie_hash_test.o nessie_common.o cli.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := sha256.o
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o serial-tools.o \
nessie_hash_test.o nessie_common.o cli.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := shabea.o sha256-asm.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-shabea-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_OBJ := shacal1_enc.o sha1-asm.o
$(ALGO_NAME)_TEST_BIN := main-shacal1_enc-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_OBJ := shacal2_enc.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-shacal2_enc-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_TEST_BIN := main-skipjack-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := des.o
$(ALGO_NAME)_TEST_BIN := main-tdes-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -9,5 +9,5 @@ $(ALGO_NAME)_TEST_BIN := main-trivium-test.o debug.o uart.o serial-tools.o \
nessie_stream_test.o nessie_common.o cli.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := xtea-asm.o
$(ALGO_NAME)_TEST_BIN := main-xtea-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,5 +8,5 @@ $(ALGO_NAME)_OBJ := xtea.o
$(ALGO_NAME)_TEST_BIN := main-xtea-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)_PEROFRMANCE_TEST := "performance"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -115,15 +115,15 @@ void testrun_camellia(void){
0x89, 0xab, 0xcd, 0xef,
0xfe, 0xdc, 0xba, 0x98,
0x76, 0x54, 0x32, 0x10 };
/*
uint8_t data[16] = {
0x10, 0x32, 0x54, 0x76,
0x98, 0xba, 0xdc, 0xfe,
0xfe, 0xcd, 0xab, 0x89
0x67, 0x89, 0x67, 0x01};
*/
uint8_t key[16] = { 0x01, 0x23, 0x45, 0x67,
0x89, 0xab, 0xcd, 0xef,
0xfe, 0xdc, 0xba, 0x98,
0x76, 0x54, 0x32, 0x10 };
camellia128_ctx_t ctx;
camellia128_init(data, &ctx);
camellia128_init(key, &ctx);
uart_putstr_P(PSTR("\r\n key: "));
uart_hexdump(data, 16);
uart_putstr_P(PSTR("\r\n plaintext: "));
@ -131,6 +131,9 @@ void testrun_camellia(void){
camellia128_enc(data, &ctx);
uart_putstr_P(PSTR("\r\n ciphertext: "));
uart_hexdump(data, 16);
camellia128_dec(data, &ctx);
uart_putstr_P(PSTR("\r\n decrypted: "));
uart_hexdump(data, 16);
}