adding mickey128
This commit is contained in:
parent
6284b04026
commit
c88d997521
|
@ -112,7 +112,7 @@ param=(ARGV.size>=7)?ARGV[6]:"";
|
|||
puts("\nPort: "+ARGV[0]+ "@"+ARGV[1]+" "+ARGV[2]+"N"+ARGV[3]+"\n");
|
||||
$linewidth = 16
|
||||
$sp = SerialPort.new(ARGV[0], ARGV[1].to_i, ARGV[2].to_i, ARGV[3].to_i, SerialPort::NONE);
|
||||
$sp.read_timeout=1000; # 1 secound
|
||||
$sp.read_timeout=10000; # 1 secound
|
||||
$extended_wait=100;
|
||||
$sp.write(command);
|
||||
|
||||
|
|
|
@ -0,0 +1,278 @@
|
|||
/* mickey128.c */
|
||||
/*
|
||||
This file is part of the ARM-Crypto-Lib.
|
||||
Copyright (C) 2006-2011 Daniel Otte (daniel.otte@rub.de)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "memxor.h"
|
||||
#include "mickey128.h"
|
||||
|
||||
/*
|
||||
RTAPS = { 0,4,5, 8,10,11,14 ,16,20, 25,30, 32,35,36,38,
|
||||
42,43,46, 50,51,53,54,55, 56,57,60,61,62,63,
|
||||
65,66,69, 73,74,76,79, 80,81,82,85,86, 90,91,92,95,
|
||||
97,100,101, 105,106,107,108,109,111, 112,113,115,116,117,
|
||||
127, 128,129,130,131,133,135, 136,137,140,142, 145,148,150,
|
||||
152,153,154,156,157 }
|
||||
|
||||
0011.0001 0100.1101 0001.0001 0100.0010 0101.1001
|
||||
0100.1100 1110.1100 1111.0011
|
||||
0010.0110 1001.0110 0110.0111 1001.1100
|
||||
0011.0010 1011.1110 0011.1011
|
||||
1000.0000 1010.1111 0101.0011 0101.0010
|
||||
0011.0111
|
||||
|
||||
1000110010110010100010000100001010011010001100100011011111001111011001
|
||||
0001101001111001100011100101001100011111011101110000000001111101011100
|
||||
101001001010111011
|
||||
|
||||
1000.1100 1011.0010 1000.1000 0100.0010 1001.1010 0011.0010
|
||||
0011.0111 1100.1111 0110.0100 0110.1001 1110.0110 0011.1001
|
||||
0100.1100 0111.1101 1101.1100 0000.0001 1111.0101 1100.1010
|
||||
0100.1010 1110.11
|
||||
*/
|
||||
|
||||
uint8_t rtaps[] = {
|
||||
0x31, 0x4D, 0x11, 0x42,
|
||||
0x59, 0x4C, 0xEC, 0xF3,
|
||||
0x26, 0x96, 0x67, 0x9C,
|
||||
0x32, 0xBE, 0x3B, 0x80,
|
||||
0xAF, 0x53, 0x52, 0x37
|
||||
};
|
||||
|
||||
#define SHL0(a) c1=((a)>>7); (a)=(((a)<<1)|c0)
|
||||
#define SHL1(a) c0=((a)>>7); (a)=(((a)<<1)|c1)
|
||||
|
||||
#define SHLX0(a) c1=((a)>>7); (a)^=(((a)<<1)|c0)
|
||||
#define SHLX1(a) c0=((a)>>7); (a)^=(((a)<<1)|c1)
|
||||
|
||||
static
|
||||
void clock_r(uint8_t* r, uint8_t ibit, uint8_t cbit){
|
||||
uint8_t i,c0=0,c1=0; /* carry */
|
||||
ibit ^= ((r[159/8])>>(159%8))&1; /* ibit is now the same as feedback_bit */
|
||||
if(cbit){
|
||||
for(i=0; i<10; ++i){
|
||||
SHLX0(r[2*i+0]);
|
||||
SHLX1(r[2*i+1]);
|
||||
}
|
||||
} else {
|
||||
for(i=0; i<10; ++i){
|
||||
SHL0(r[2*i+0]);
|
||||
SHL1(r[2*i+1]);
|
||||
}
|
||||
}
|
||||
if(ibit){
|
||||
memxor(r, rtaps, 20);
|
||||
}
|
||||
}
|
||||
|
||||
/* comp0 (filling spaces with zero) (one at each side)
|
||||
* 0101.1110 1111.0010 1101.0110 0101.1101
|
||||
* 0101.0101 0000.1001 0010.0110 0111.1001
|
||||
* 0110.0010 0111.0000 0000.0000 0111.1001
|
||||
* 0011.0001 1101.1001 1010.1111 0011.0111
|
||||
* 1011.1110 0000.0110 1011.1110 0000.1111
|
||||
* --
|
||||
* 5E F2 D6 5D
|
||||
* 55 09 26 79
|
||||
* 62 70 00 79
|
||||
* 31 D9 AF 37
|
||||
* BE 06 BE 0F
|
||||
*/
|
||||
uint8_t comp0[] = {
|
||||
0x5E, 0xF2, 0xD6, 0x5D,
|
||||
0x55, 0x09, 0x26, 0x79,
|
||||
0x62, 0x70, 0x00, 0x79,
|
||||
0x31, 0xD9, 0xAF, 0x37,
|
||||
0xBE, 0x06, 0xBE, 0x0F
|
||||
};
|
||||
|
||||
|
||||
/* comp1 (shifting one bit right to make calculation easier, so inserting two zeros)
|
||||
* 0110.0000 0011.1110 0011.0010 1111.1010
|
||||
* 0011.0000 0111.1001 0110.1100 1111.1101
|
||||
* 1100.0001 1000.0111 0000.0001 1111.1000
|
||||
* 1000.1010 1100.0110 1100.0001 1100.1100
|
||||
* 0110.1010 1011.0111 1110.1000 1111.1111
|
||||
* --
|
||||
* 60 3E 32 FA
|
||||
* 30 79 6C FD
|
||||
* C1 87 01 F8
|
||||
* 8A C6 C1 CC
|
||||
* 6A B7 E8 FF
|
||||
*/
|
||||
/*
|
||||
uint8_t comp1[] PROGMEM = {
|
||||
0x60, 0x3E, 0x32, 0xFA, 0x30, 0x79, 0x6C, 0xFD, 0xC1, 0x87,
|
||||
0x01, 0xF8, 0x8A, 0xC6, 0xC1, 0xCC, 0x6A, 0xB7, 0xE8, 0xFF
|
||||
};
|
||||
*/
|
||||
/* comp1
|
||||
* 0000.1100 1111.1000 1001.1000 1011.1110
|
||||
* 0001.1001 0011.1100 0110.1101 0111.1111
|
||||
* 0000.0111 1100.0011 0000.0000 0011.1110
|
||||
* 1010.0010 1100.0111 0000.0110 0110.0110
|
||||
* 1010.1101 1101.1010 0010.1111 1111.1110
|
||||
* --
|
||||
* 0C F8 98 BE
|
||||
* 19 3C 6D 7F
|
||||
* 07 C3 00 3E
|
||||
* A2 C7 06 66
|
||||
* AD DA 2F FE
|
||||
*/
|
||||
/*
|
||||
uint8_t comp1[] PROGMEM = {
|
||||
0x0C, 0xF8, 0x98, 0xBE, 0x19, 0x3C, 0x6D, 0x7F, 0x07, 0xC3,
|
||||
0x00, 0x3E, 0xA2, 0xC7, 0x06, 0x66, 0xAD, 0xDA, 0x2F, 0xFE
|
||||
};
|
||||
*/
|
||||
/* comp1
|
||||
* 0011.0000 0001.1111 0001.1001 0111.1101
|
||||
* 1001.1000 0011.1100 1011.0110 1111.1110
|
||||
* 1110.0000 1100.0011 0000.0000 0111.1100
|
||||
* 0100.0101 1110.0011 0110.0000 0110.0110
|
||||
* 1011.0101 0101.1011 1111.0100 0111.1111
|
||||
* --
|
||||
* 30 1F 19 7D
|
||||
* 98 3C B6 FE
|
||||
* E0 C3 00 7C
|
||||
* 45 E3 60 66
|
||||
* B5 5B F4 7F
|
||||
*/
|
||||
|
||||
uint8_t comp1[] = {
|
||||
0x30, 0x1F, 0x19, 0x7D,
|
||||
0x98, 0x3C, 0xB6, 0xFE,
|
||||
0xE0, 0xC3, 0x00, 0x7C,
|
||||
0x45, 0xE3, 0x60, 0x66,
|
||||
0xB5, 0x5B, 0xF4, 0x7F
|
||||
};
|
||||
|
||||
/* fb0
|
||||
* 1010.1111 0001.1111 0011.1100 1100.0100
|
||||
* 0010.0010 1010.0011 0010.1111 0000.1110
|
||||
* 1000.0001 0100.1101 1110.0101 0110.0110
|
||||
* 1001.0001 0100.1011 0101.0100 1101.0100
|
||||
* 1100.0001 0000.1011 0110.0011 1000.0011
|
||||
* --
|
||||
* AF 1F 3C C4
|
||||
* 22 A3 2F 0E
|
||||
* 81 4D E5 66
|
||||
* 91 4B 54 D4
|
||||
* C1 0B 63 83
|
||||
*/
|
||||
uint8_t fb0[] = {
|
||||
0xAF, 0x1F, 0x3C, 0xC4,
|
||||
0x22, 0xA3, 0x2F, 0x0E,
|
||||
0x81, 0x4D, 0xE5, 0x66,
|
||||
0x91, 0x4B, 0x54, 0xD4,
|
||||
0xC1, 0x0B, 0x63, 0x83
|
||||
};
|
||||
|
||||
/* fb1
|
||||
* 1010.1011 0111.0111 1111.0100 1001.1011
|
||||
* 1001.0000 1000.1100 0111.1001 0111.0000
|
||||
* 1011.0110 0001.1000 1001.1010 0110.1111
|
||||
* 1110.0111 0111.1110 0100.1011 0110.1100
|
||||
* 1110.1111 1000.0000 1010.0111 0001.0001
|
||||
* --
|
||||
* AB 77 F4 9B
|
||||
* 90 8C 79 70
|
||||
* B6 18 9A 6F
|
||||
* E7 7E 4B 6C
|
||||
* EF 80 A7 11
|
||||
*/
|
||||
uint8_t fb1[] = {
|
||||
0xAB, 0x77, 0xF4, 0x9B,
|
||||
0x90, 0x8C, 0x79, 0x70,
|
||||
0xB6, 0x18, 0x9A, 0x6F,
|
||||
0xE7, 0x7E, 0x4B, 0x6C,
|
||||
0xEF, 0x80, 0xA7, 0x11
|
||||
};
|
||||
|
||||
static
|
||||
void clock_s(uint8_t* s, uint8_t ibit, uint8_t cbit){
|
||||
uint8_t s0[20], s1[20];
|
||||
uint8_t i,c=0, c2=0;
|
||||
ibit ^= (s[19])>>7;
|
||||
memcpy(s0,s,20);
|
||||
memxor(s0, comp0, 20);
|
||||
for(i=0; i<20; ++i){
|
||||
s1[19-i]= c|((s[19-i])>>1);
|
||||
c = (s[19-i])<<7;
|
||||
}
|
||||
memxor(s1, comp1, 20);
|
||||
c=0;
|
||||
for(i=0; i<20; ++i){
|
||||
c2=(s[i])>>7;
|
||||
s[i]=((s[i])<<1) ^ ((s0[i])&(s1[i])) ^ c;
|
||||
c=c2;
|
||||
}
|
||||
s[0] &= 0xFE;
|
||||
if(ibit){
|
||||
memxor(s, cbit?fb1:fb0, 20);
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void clock_kg(uint8_t* r, uint8_t* s, uint8_t mixing, uint8_t input){
|
||||
uint8_t rb, sb;
|
||||
rb = ((s[ 54/8])>>(( 54%8))) ^ ((r[106/8])>>(((106%8))));
|
||||
sb = ((s[106/8])>>((106%8))) ^ ((r[ 53/8])>>((( 53%8))));
|
||||
rb &= 1;
|
||||
sb &= 1;
|
||||
mixing = input ^ (mixing & ((s[80/8]>>((80%8))) & 1));
|
||||
clock_r(r, mixing, rb);
|
||||
clock_s(s, input, sb);
|
||||
}
|
||||
|
||||
void mickey128_init(void* key, uint16_t keysize_b,
|
||||
void* iv, uint16_t ivsize_b,
|
||||
mickey128_ctx_t* ctx){
|
||||
uint16_t i;
|
||||
memset(ctx->r, 0, 20);
|
||||
memset(ctx->s, 0, 20);
|
||||
for(i=0; i<ivsize_b; ++i){
|
||||
clock_kg(ctx->r, ctx->s, 1, 1&((((uint8_t*)iv)[i/8])>>(7-(i%8))));
|
||||
}
|
||||
for(i=0; i<keysize_b; ++i){
|
||||
clock_kg(ctx->r, ctx->s, 1, 1&((((uint8_t*)key)[i/8])>>(7-(i%8))));
|
||||
}
|
||||
for(i=0; i<160; ++i){
|
||||
clock_kg(ctx->r, ctx->s, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t mickey128_getbit(mickey128_ctx_t* ctx){
|
||||
uint8_t ret;
|
||||
ret = 1&(*(ctx->r) ^ *(ctx->s));
|
||||
clock_kg(ctx->r, ctx->s, 0, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint8_t mickey128_getbyte(mickey128_ctx_t* ctx){
|
||||
uint8_t i,ret=0;
|
||||
for(i=0; i<8; ++i){
|
||||
ret<<=1;
|
||||
ret |= 1&(((ctx->r)[0]) ^ ((ctx->s)[0]));
|
||||
clock_kg(ctx->r, ctx->s, 0, 0);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef MICKEY128_H_
|
||||
#define MICKEY128_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct mickey128_ctx_st{
|
||||
uint8_t r[20];
|
||||
uint8_t s[20];
|
||||
} mickey128_ctx_t;
|
||||
|
||||
void debug_clock_r(void);
|
||||
void debug_clock_s(void);
|
||||
void mickey128_init(void* key, uint16_t keysize_b,
|
||||
void* iv, uint16_t ivsize_b,
|
||||
mickey128_ctx_t* ctx);
|
||||
uint8_t mickey128_getbit(mickey128_ctx_t* ctx);
|
||||
uint8_t mickey128_getbyte(mickey128_ctx_t* ctx);
|
||||
|
||||
#endif /*MICKEY128_H_*/
|
|
@ -0,0 +1,13 @@
|
|||
# Makefile for Mickey128
|
||||
ALGO_NAME := MICKEY128
|
||||
|
||||
# comment out the following line for removement of Mickey128 from the build process
|
||||
STREAM_CIPHERS += $(ALGO_NAME)
|
||||
|
||||
$(ALGO_NAME)_DIR := mickey128/
|
||||
$(ALGO_NAME)_OBJ := mickey128.o
|
||||
$(ALGO_NAME)_INCDIR := memxor/ scal/
|
||||
$(ALGO_NAME)_TEST_BIN := main-mickey128-test.o $(CLI_STD) $(SCAL_STD) scal_mickey128.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
|
||||
$(ALGO_NAME)_DEF := NESSIE_ESTREAM=1
|
|
@ -3,5 +3,5 @@ source [find /usr/share/openocd/scripts/target/lm3s9b9x.cfg]
|
|||
# GDB can also flash my flash!
|
||||
#gdb_memory_map enable
|
||||
#gdb_flash_program enable
|
||||
#jtag_khz 5500
|
||||
jtag_khz 5500
|
||||
#source [find /usr/share/openocd/scripts/target/lm3s9b9x.cfg]
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/* scal_mickey128.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "streamcipher_descriptor.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
#include "mickey128.h"
|
||||
|
||||
const char mickey128_str[] = "Mickey128";
|
||||
|
||||
const uint8_t mickey128_keysize_desc[] = {
|
||||
KS_TYPE_LIST, 1, KS_INT(128),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const uint8_t mickey128_ivsize_desc[] = {
|
||||
KS_TYPE_LIST, 4, KS_INT(0), KS_INT(32), KS_INT(64), KS_INT(80),
|
||||
KS_TYPE_RANGE, KS_INT(0), KS_INT(128),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const scdesc_t mickey128_desc = {
|
||||
SCDESC_TYPE_STREAMCIPHER, /* abstraction layer type designator */
|
||||
SC_INIT_TYPE_5|SC_GEN_TYPE_1, /* flags*/
|
||||
mickey128_str, /* name string pointer */
|
||||
sizeof(mickey128_ctx_t), /* size of context */
|
||||
8, /* blocksize */
|
||||
{(void_fpt)mickey128_init}, /* init function pointer */
|
||||
{(void_fpt)mickey128_getbyte}, /* key stream generator function pointer */
|
||||
{(void_fpt)NULL}, /* key stream generator for random access function pointer */
|
||||
(sc_free_fpt)NULL, /* free function pointer */
|
||||
mickey128_keysize_desc, /* key size descriptor pointer */
|
||||
mickey128_ivsize_desc /* iv size descriptor pointer */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
/* scal_mickey128.h */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SCAL_MICKEY128_H_
|
||||
#define SCAL_MICKEY128_H_
|
||||
|
||||
#include "streamcipher_descriptor.h"
|
||||
|
||||
extern const scdesc_t mickey128_desc;
|
||||
|
||||
#endif /* SCAL_MICKEY128_H_ */
|
|
@ -1,7 +1,7 @@
|
|||
/* main-arcfour-test.c */
|
||||
/*
|
||||
This file is part of the ARM-Crypto-Lib.
|
||||
Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de)
|
||||
Copyright (C) 2006-2011 Daniel Otte (daniel.otte@rub.de)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Mickey128 test-suit
|
||||
*
|
||||
*/
|
||||
#include "main-test-common.h"
|
||||
|
||||
#include "performance_test.h"
|
||||
#include "mickey128.h"
|
||||
#include "scal_mickey128.h"
|
||||
#include "scal-basic.h"
|
||||
#include "scal-nessie.h"
|
||||
|
||||
char* algo_name = "Mickey128";
|
||||
|
||||
/*****************************************************************************
|
||||
* additional validation-functions *
|
||||
*****************************************************************************/
|
||||
|
||||
void testrun_nessie_mickey128(void){
|
||||
scal_nessie_set_estream(1);
|
||||
scal_nessie_run(&mickey128_desc);
|
||||
}
|
||||
|
||||
void testrun_ref_mickey128(void){
|
||||
uint8_t key[4][16] ={
|
||||
{ 0x12, 0x34, 0x56, 0x78,
|
||||
0x9a, 0xbc, 0xde, 0xf0,
|
||||
0x01, 0x23, 0x45, 0x67,
|
||||
0x89, 0xab, 0xcd, 0xef},
|
||||
{ 0xf1, 0x1a, 0x56, 0x27,
|
||||
0xce, 0x43, 0xb6, 0x1f,
|
||||
0x89, 0x12, 0x29, 0x94,
|
||||
0x86, 0x09, 0x44, 0x86},
|
||||
{ 0x3b, 0x80, 0xfc, 0x8c,
|
||||
0x47, 0x5f, 0xc2, 0x70,
|
||||
0xfa, 0x26, 0xb4, 0x70,
|
||||
0x64, 0xb3, 0x2d, 0x33},
|
||||
{ 0x82, 0xac, 0xb3, 0x8c,
|
||||
0x5d, 0x7a, 0x3c, 0x78,
|
||||
0xd9, 0x8f, 0x15, 0x3c,
|
||||
0xa3, 0xf9, 0xde, 0x7c} };
|
||||
uint8_t iv_1[] = {0x21, 0x43, 0x65, 0x87};
|
||||
uint8_t iv_2[] = {0x9c, 0x53, 0x2f, 0x8a,
|
||||
0xc3, 0xea, 0x4b, 0x2e,
|
||||
0xa0, 0xf5, 0x96, 0x40,
|
||||
0x30, 0x83, 0x77, 0xcc};
|
||||
uint8_t data[16];
|
||||
uint8_t i;
|
||||
mickey128_ctx_t ctx;
|
||||
cli_putstr("\r\n-=Reference test=-\r\n");
|
||||
|
||||
cli_putstr("Test 1:\r\n key: ");
|
||||
cli_hexdump(key[0], 16);
|
||||
cli_putstr("\r\n iv: ");
|
||||
cli_hexdump(iv_1, 4);
|
||||
mickey128_init(&(key[0][0]), 128, iv_1, 4*8, &ctx);
|
||||
for(i=0; i<16; ++i){
|
||||
data[i] = mickey128_getbyte(&ctx);
|
||||
}
|
||||
cli_putstr("\r\n stream: ");
|
||||
cli_hexdump(data, 16);
|
||||
|
||||
cli_putstr("\r\n\r\nTest 2:\r\n key: ");
|
||||
cli_hexdump(key[1], 16);
|
||||
cli_putstr("\r\n iv: ");
|
||||
cli_hexdump(iv_2, 16);
|
||||
mickey128_init(key[1], 128, iv_2, 16*8, &ctx);
|
||||
for(i=0; i<16; ++i){
|
||||
data[i] = mickey128_getbyte(&ctx);
|
||||
}
|
||||
cli_putstr("\r\n stream: ");
|
||||
cli_hexdump(data, 16);
|
||||
|
||||
cli_putstr("\r\n\r\nTest 3:\r\n key: ");
|
||||
cli_hexdump(key[2], 16);
|
||||
cli_putstr("\r\n iv: ");
|
||||
mickey128_init(key[2], 128, NULL, 0, &ctx);
|
||||
for(i=0; i<16; ++i){
|
||||
data[i] = mickey128_getbyte(&ctx);
|
||||
}
|
||||
cli_putstr("\r\n stream: ");
|
||||
cli_hexdump(data, 16);
|
||||
|
||||
cli_putstr("\r\n\r\nIteration test:\r\n key: ");
|
||||
cli_hexdump(key[3], 16);
|
||||
mickey128_init(key[3], 128, NULL, 0, &ctx);
|
||||
uint16_t j;
|
||||
for(j=0; j<1000; ++j){
|
||||
for(i=0; i<16; ++i)
|
||||
key[0][i] = mickey128_getbyte(&ctx);
|
||||
for(i=0; i<4; ++i)
|
||||
iv_1[i] = mickey128_getbyte(&ctx);
|
||||
mickey128_init(key[0], 128, iv_1, 32, &ctx);
|
||||
}
|
||||
for(i=0; i<16; ++i){
|
||||
data[i] = mickey128_getbyte(&ctx);
|
||||
}
|
||||
cli_putstr("\r\n stream: ");
|
||||
cli_hexdump(data, 16);
|
||||
cli_putstr("\r\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* main *
|
||||
*****************************************************************************/
|
||||
|
||||
const char nessie_str[] = "nessie";
|
||||
const char test_str[] = "test";
|
||||
const char performance_str[] = "performance";
|
||||
const char echo_str[] = "echo";
|
||||
|
||||
cmdlist_entry_t cmdlist[] = {
|
||||
{ nessie_str, NULL, testrun_nessie_mickey128},
|
||||
{ test_str, NULL, testrun_ref_mickey128},
|
||||
{ echo_str, (void*)1, (void_fpt)echo_ctrl},
|
||||
{ NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
int main (void){
|
||||
main_setup();
|
||||
|
||||
for(;;){
|
||||
welcome_msg(algo_name);
|
||||
cmd_interface(cmdlist);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue