Adding CS-Cipher

This commit is contained in:
bg 2011-02-04 23:29:42 +01:00
parent 61b5214b9a
commit 85b852d666
11 changed files with 6928 additions and 0 deletions

52
bcal/bcal_cscipher.c Normal file
View File

@ -0,0 +1,52 @@
/* bcal_cscipher.c */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2010 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/>.
*/
/**
* \file bcal_cscipher.c
* \email daniel.otte@rub.de
* \author Daniel Otte
* \date 2010-12-17
* \license GPLv3 or later
*
*/
#include <stdlib.h>
#include "blockcipher_descriptor.h"
#include "cscipher.h"
#include "keysize_descriptor.h"
const char cscipher_str[] = "CS-Cipher";
const uint8_t cscipher_keysize_desc[] = { KS_TYPE_LIST, 1, KS_INT(128),
KS_TYPE_TERMINATOR };
const bcdesc_t cscipher_desc = {
BCDESC_TYPE_BLOCKCIPHER,
BC_INIT_TYPE_1,
cscipher_str,
sizeof(cscipher_ctx_t),
64,
{(void_fpt)cscipher_init},
{(void_fpt)cscipher_enc},
{(void_fpt)cscipher_dec},
(bc_free_fpt)NULL,
cscipher_keysize_desc
};

32
bcal/bcal_cscipher.h Normal file
View File

@ -0,0 +1,32 @@
/* bcal_cscipher.h */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2010 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/>.
*/
/**
* \file bcal_cscipher.h
* \email daniel.otte@rub.de
* \author Daniel Otte
* \date 2010-12-17
* \license GPLv3 or later
*
*/
#include "blockcipher_descriptor.h"
#include "cscipher.h"
#include "keysize_descriptor.h"
extern const bcdesc_t cscipher_desc;

32
cscipher/cscipher.h Normal file
View File

@ -0,0 +1,32 @@
/* cscipher.h */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2010 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 CSCIPHER_H_
#define CSCIPHER_H_
typedef struct {
uint8_t keys[9][8];
} cscipher_ctx_t;
void cscipher_enc(void* buffer, const cscipher_ctx_t* ctx);
void cscipher_dec(void* buffer, const cscipher_ctx_t* ctx);
void cscipher_init(const void* key, cscipher_ctx_t* ctx);
#endif /* CSCIPHER_H_ */

39
cscipher/cscipher_sbox.c Normal file
View File

@ -0,0 +1,39 @@
/* cscipher_sbox.c */
/*
This file is part of the AVM-Crypto-Lib.
Copyright (C) 2006-2010 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>
const uint8_t cscipher_sbox[] = {
0x29, 0x0d, 0x61, 0x40, 0x9c, 0xeb, 0x9e, 0x8f, 0x1f, 0x85, 0x5f, 0x58, 0x5b, 0x01, 0x39, 0x86,
0x97, 0x2e, 0xd7, 0xd6, 0x35, 0xae, 0x17, 0x16, 0x21, 0xb6, 0x69, 0x4e, 0xa5, 0x72, 0x87, 0x08,
0x3c, 0x18, 0xe6, 0xe7, 0xfa, 0xad, 0xb8, 0x89, 0xb7, 0x00, 0xf7, 0x6f, 0x73, 0x84, 0x11, 0x63,
0x3f, 0x96, 0x7f, 0x6e, 0xbf, 0x14, 0x9d, 0xac, 0xa4, 0x0e, 0x7e, 0xf6, 0x20, 0x4a, 0x62, 0x30,
0x03, 0xc5, 0x4b, 0x5a, 0x46, 0xa3, 0x44, 0x65, 0x7d, 0x4d, 0x3d, 0x42, 0x79, 0x49, 0x1b, 0x5c,
0xf5, 0x6c, 0xb5, 0x94, 0x54, 0xff, 0x56, 0x57, 0x0b, 0xf4, 0x43, 0x0c, 0x4f, 0x70, 0x6d, 0x0a,
0xe4, 0x02, 0x3e, 0x2f, 0xa2, 0x47, 0xe0, 0xc1, 0xd5, 0x1a, 0x95, 0xa7, 0x51, 0x5e, 0x33, 0x2b,
0x5d, 0xd4, 0x1d, 0x2c, 0xee, 0x75, 0xec, 0xdd, 0x7c, 0x4c, 0xa6, 0xb4, 0x78, 0x48, 0x3a, 0x32,
0x98, 0xaf, 0xc0, 0xe1, 0x2d, 0x09, 0x0f, 0x1e, 0xb9, 0x27, 0x8a, 0xe9, 0xbd, 0xe3, 0x9f, 0x07,
0xb1, 0xea, 0x92, 0x93, 0x53, 0x6a, 0x31, 0x10, 0x80, 0xf2, 0xd8, 0x9b, 0x04, 0x36, 0x06, 0x8e,
0xbe, 0xa9, 0x64, 0x45, 0x38, 0x1c, 0x7a, 0x6b, 0xf3, 0xa1, 0xf0, 0xcd, 0x37, 0x25, 0x15, 0x81,
0xfb, 0x90, 0xe8, 0xd9, 0x7b, 0x52, 0x19, 0x28, 0x26, 0x88, 0xfc, 0xd1, 0xe2, 0x8c, 0xa0, 0x34,
0x82, 0x67, 0xda, 0xcb, 0xc7, 0x41, 0xe5, 0xc4, 0xc8, 0xef, 0xdb, 0xc3, 0xcc, 0xab, 0xce, 0xed,
0xd0, 0xbb, 0xd3, 0xd2, 0x71, 0x68, 0x13, 0x12, 0x9a, 0xb3, 0xc2, 0xca, 0xde, 0x77, 0xdc, 0xdf,
0x66, 0x83, 0xbc, 0x8d, 0x60, 0xc6, 0x22, 0x23, 0xb2, 0x8b, 0x91, 0x05, 0x76, 0xcf, 0x74, 0xc9,
0xaa, 0xf1, 0x99, 0xa8, 0x59, 0x50, 0x3b, 0x2a, 0xfe, 0xf9, 0x24, 0xb0, 0xba, 0xfd, 0xf8, 0x55
};

28
cscipher/cscipher_sbox.h Normal file
View File

@ -0,0 +1,28 @@
/* cscipher_sbox.h */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2010 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 CSCIPHER_SBOX_H_
#define CSCIPHER_SBOX_H_
#include <stdint.h>
extern uint8_t cscipher_sbox[];
#endif /* CSCIPHER_SBOX_H_ */

174
cscipher/cscipher_small.c Normal file
View File

@ -0,0 +1,174 @@
/* cscipher_small_core.c */
/*
This file is part of the ARM-Crypto-Lib.
Copyright (C) 2006-2010 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 <stdlib.h>
#include <string.h>
#include "memxor.h"
#include "cscipher.h"
#define DEBUG 0
#if DEBUG
#include "cli.h"
#endif
#define ROTL(a) (((a)<<1)|((a)>>7))
#ifndef SBOX_PROG
#define SBOX_PROG 0
#endif
#if SBOX_PROG
static const uint8_t fg_table[] = {
0xfa, 0xd6, 0xb0, 0xb2, 0x7b, 0x5e, 0x71, 0x78,
0xed, 0xd4, 0xa5, 0xb3, 0xef, 0xdc, 0xe7, 0xf9
};
static
uint8_t p(uint8_t a){
a ^= fg_table[a&0xf]&0xf0;
a ^= fg_table[a>>4] &0x0f;
a ^= fg_table[a&0xf]&0xf0;
return a;
}
#define P(a) p(a)
#else
#include "cscipher_sbox.h"
#define P(a) (cscipher_sbox[(a)])
#endif
static const uint8_t round_const[] = {
0xb7, 0xe1, 0x51, 0x62, 0x8a, 0xed, 0x2a, 0x6a,
0xbf, 0x71, 0x58, 0x80, 0x9c, 0xf4, 0xf3, 0xc7 };
static const uint8_t ks_const[] = {
0x29,0x0d,0x61,0x40,0x9c,0xeb,0x9e,0x8f,
0x1f,0x85,0x5f,0x58,0x5b,0x01,0x39,0x86,
0x97,0x2e,0xd7,0xd6,0x35,0xae,0x17,0x16,
0x21,0xb6,0x69,0x4e,0xa5,0x72,0x87,0x08,
0x3c,0x18,0xe6,0xe7,0xfa,0xad,0xb8,0x89,
0xb7,0x00,0xf7,0x6f,0x73,0x84,0x11,0x63,
0x3f,0x96,0x7f,0x6e,0xbf,0x14,0x9d,0xac,
0xa4,0x0e,0x7e,0xf6,0x20,0x4a,0x62,0x30,
0x03,0xc5,0x4b,0x5a,0x46,0xa3,0x44,0x65
};
static uint16_t m(uint16_t a){
uint8_t xl, xr, yl, yr;
uint16_t ret;
xr = a>>8;
xl = a&0xff;
yl = (ROTL(xl)&0x55)^xl^xr;
yr = ROTL(xl)^xr;
ret = (P(yr)<<8)|P(yl);
return ret;
}
static uint16_t m_inv(uint16_t a){
uint8_t xl, xr;
xr = P(a>>8);
xl = P(a&0xff);
xl ^= xr;
xl ^= (ROTL(xl)&0xaa);
xr ^= ROTL(xl);
return (xr<<8)|xl;
}
void cscipher_enc(void* buffer, const cscipher_ctx_t* ctx){
uint8_t i,j,k;
uint8_t tmp[8];
for(i=0; i<8; ++i){
#if DEBUG
cli_putstr("\r\nDBG: round ");
cli_hexdump(&i, 1);
cli_putstr(" buffer:");
cli_hexdump(buffer, 8);
#endif
for(j=0; j<3; ++j){
if(j==0){
memxor(buffer, ctx->keys[i], 8);
}else{
memxor(buffer, round_const+((j==1)?0:8), 8);
}
for(k=0; k<4; ++k){
((uint16_t*)tmp)[k] = m(((uint16_t*)buffer)[k]);
}
for(k=0; k<4; ++k){
((uint8_t*)buffer)[k] = tmp[2*k];
((uint8_t*)buffer)[k+4] = tmp[2*k+1];
}
}
}
memxor(buffer, ctx->keys[8], 8);
}
void cscipher_dec(void* buffer, const cscipher_ctx_t* ctx){
uint8_t i=7,j,k;
uint8_t tmp[8];
memxor(buffer, ctx->keys[8], 8);
do{
for(j=0; j<3; ++j){
for(k=0; k<4; ++k){
tmp[2*k] = ((uint8_t*)buffer)[k];
tmp[2*k+1] = ((uint8_t*)buffer)[4+k];
}
for(k=0; k<4; ++k){
((uint16_t*)buffer)[k] = m_inv(((uint16_t*)tmp)[k]);
}
if(j==2){
memxor(buffer, ctx->keys[i], 8);
}else{
memxor(buffer, round_const+((j==1)?0:8), 8);
}
}
}while(i--);
}
void cscipher_init(const void* key, cscipher_ctx_t* ctx){
uint8_t tmp_key[16], tmp[8];
uint8_t i,j,k,t=0;
memcpy(tmp_key, key, 16);
for(i=0; i<9; ++i){
#if DEBUG
cli_putstr("\r\nDBG: round ");
cli_hexdump(&i, 1);
cli_putstr(" key state:");
cli_hexdump(tmp_key, 16);
#endif
memcpy(tmp, tmp_key+(((i&1)==0)?0:8), 8);
memxor(tmp, ks_const+8*i, 8);
for(j=0; j<8; ++j){
tmp[j] = P(tmp[j]);
}
for(j=0; j<8; ++j){
for(k=0; k<8; ++k){
t<<=1;
t |= tmp[k]>>7;
tmp[k]<<=1;
}
tmp_key[j+(((i&1)==0)?8:0)] ^= t;
}
memcpy(ctx->keys[i], tmp_key+(((i&1)==0)?8:0), 8);
}
}

35
cscipher/sbox_check.rb Normal file
View File

@ -0,0 +1,35 @@
$sbox = [
0x29, 0x0d, 0x61, 0x40, 0x9c, 0xeb, 0x9e, 0x8f, 0x1f, 0x85, 0x5f, 0x58, 0x5b, 0x01, 0x39, 0x86,
0x97, 0x2e, 0xd7, 0xd6, 0x35, 0xae, 0x17, 0x16, 0x21, 0xb6, 0x69, 0x4e, 0xa5, 0x72, 0x87, 0x08,
0x3c, 0x18, 0xe6, 0xe7, 0xfa, 0xad, 0xb8, 0x89, 0xb7, 0x00, 0xf7, 0x6f, 0x73, 0x84, 0x11, 0x63,
0x3f, 0x96, 0x7f, 0x6e, 0xbf, 0x14, 0x9d, 0xac, 0xa4, 0x0e, 0x7e, 0xf6, 0x20, 0x4a, 0x62, 0x30,
0x03, 0xc5, 0x4b, 0x5a, 0x46, 0xa3, 0x44, 0x65, 0x7d, 0x4d, 0x3d, 0x42, 0x79, 0x49, 0x1b, 0x5c,
0xf5, 0x6c, 0xb5, 0x94, 0x54, 0xff, 0x56, 0x57, 0x0b, 0xf4, 0x43, 0x0c, 0x4f, 0x70, 0x6d, 0x0a,
0xe4, 0x02, 0x3e, 0x2f, 0xa2, 0x47, 0xe0, 0xc1, 0xd5, 0x1a, 0x95, 0xa7, 0x51, 0x5e, 0x33, 0x2b,
0x5d, 0xd4, 0x1d, 0x2c, 0xee, 0x75, 0xec, 0xdd, 0x7c, 0x4c, 0xa6, 0xb4, 0x78, 0x48, 0x3a, 0x32,
0x98, 0xaf, 0xc0, 0xe1, 0x2d, 0x09, 0x0f, 0x1e, 0xb9, 0x27, 0x8a, 0xe9, 0xbd, 0xe3, 0x9f, 0x07,
0xb1, 0xea, 0x92, 0x93, 0x53, 0x6a, 0x31, 0x10, 0x80, 0xf2, 0xd8, 0x9b, 0x04, 0x36, 0x06, 0x8e,
0xbe, 0xa9, 0x64, 0x45, 0x38, 0x1c, 0x7a, 0x6b, 0xf3, 0xa1, 0xf0, 0xcd, 0x37, 0x25, 0x15, 0x81,
0xfb, 0x90, 0xe8, 0xd9, 0x7b, 0x52, 0x19, 0x28, 0x26, 0x88, 0xfc, 0xd1, 0xe2, 0x8c, 0xa0, 0x34,
0x82, 0x67, 0xda, 0xcb, 0xc7, 0x41, 0xe5, 0xc4, 0xc8, 0xef, 0xdb, 0xc3, 0xcc, 0xab, 0xce, 0xed,
0xd0, 0xbb, 0xd3, 0xd2, 0x71, 0x68, 0x13, 0x12, 0x9a, 0xb3, 0xc2, 0xca, 0xde, 0x77, 0xdc, 0xdf,
0x66, 0x83, 0xbc, 0x8d, 0x60, 0xc6, 0x22, 0x23, 0xb2, 0x8b, 0x91, 0x05, 0x76, 0xcf, 0x74, 0xc9,
0xaa, 0xf1, 0x99, 0xa8, 0x59, 0x50, 0x3b, 0x2a, 0xfe, 0xf9, 0x24, 0xb0, 0xba, 0xfd, 0xf8, 0x55
]
$error_list = Array.new
256.times do |i|
if $sbox[$sbox[i]]==i
putc('*')
else
putc('!')
$error_list << i;
end
puts("") if(i%16==15)
end
if $error_list.length!=0
print "Errors: "
$error_list.each {|x| printf("%02X ", x)}
puts("")
end

View File

@ -0,0 +1,13 @@
# Makefile for CS-Cipher
ALGO_NAME := CSCIPHER_SMALL_C
# comment out the following line for removement of CS-Cipher from the build process
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_DIR := cscipher/
$(ALGO_NAME)_INCDIR := bcal/ memxor/
$(ALGO_NAME)_OBJ := cscipher_small.o cscipher_sbox.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-cscipher-test.o bcal_cscipher.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_DEF := SBOX_PROG=0

View File

@ -0,0 +1,14 @@
# Makefile for CS-Cipher
ALGO_NAME := CSCIPHER_TINY_C
# comment out the following line for removement of CS-Cipher from the build process
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_DIR := cscipher/
$(ALGO_NAME)_INCDIR := bcal/ memxor/
$(ALGO_NAME)_OBJ := cscipher_small.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-cscipher-test.o bcal_cscipher.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_DEF := SBOX_PROG=1

View File

@ -0,0 +1,173 @@
/* main-cscipher-test.c */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 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/>.
*/
/*
* cscipher test-suit
*
*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "config.h"
#include "cli.h"
#include "dump.h"
#include "uart_lowlevel.h"
#include "sysclock.h"
#include "hw_gptm.h"
#include "cscipher.h"
#include "bcal-nessie.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal_cscipher.h"
char* algo_name = "CS-Cipher";
void uart0_putc(char byte){
uart_putc(UART_0, byte);
}
char uart0_getc(void){
return uart_getc(UART_0);
}
const bcdesc_t* algolist[] = {
(bcdesc_t*)&cscipher_desc,
NULL
};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
void testrun_nessie_cscipher(void){
bcal_nessie(&cscipher_desc);
}
void testrun_cscipher(void){
uint8_t data[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
uint8_t key[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 };
cscipher_ctx_t ctx;
cli_putstr("\r\n== CS-Cipher test==\r\nkey: ");
cli_hexdump(key, 16);
memset(&ctx, 0, 8*9);
cscipher_init(key, &ctx);
cli_putstr("\r\nround keys:\r\n");
cli_hexdump_block(&ctx, 8*9, 4, 8);
cli_putstr("\r\nplain: ");
cli_hexdump(data, 8);
cscipher_enc(data, &ctx);
cli_putstr("\r\ncipher: ");
cli_hexdump(data, 8);
cscipher_dec(data, &ctx);
cli_putstr("\r\nplain: ");
cli_hexdump(data, 8);
}
void testrun_long_cscipher(void){
uint8_t data[8];
char str[10];
uint16_t i;
uint8_t j;
uint8_t key[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 };
cscipher_ctx_t ctx;
cli_putstr("\r\n== CS-Cipher test==\r\nkey: ");
cli_hexdump(key, 16);
cscipher_init(key, &ctx);
memset(data, 0, 8);
cli_putstr("\r\nplain: ");
cli_hexdump(data, 8);
cli_putstr("\r\nencrypting 1,000,000 times:\r\n");
for(i=0; i<10000;++i){
for(j=0;j<100;++j){
cscipher_enc(data, &ctx);
}
if(i%128==0){
sprintf(str, "%d", i);
cli_putstr("\r\n");
cli_putstr(str);
cli_putstr(": ");
}
cli_putc('*');
}
cli_putstr("\r\ncipher: ");
cli_hexdump(data, 8);
cli_putstr("\r\ndecrypting 1,000,000 times:");
for(i=0; i<10000;++i){
for(j=0;j<100;++j){
cscipher_dec(data, &ctx);
}
if(i%128==0){
sprintf(str, "%d", i);
cli_putstr("\r\n");
cli_putstr(str);
cli_putstr(": ");
}
cli_putc('*');
}
cli_putstr("\r\nplain: ");
cli_hexdump(data, 8);
}
void testrun_performance_cscipher(void){
bcal_performance_multiple(algolist);
}
/*****************************************************************************
* main *
*****************************************************************************/
const char nessie_str[] = "nessie";
const char test_str[] = "test";
const char longtest_str[] = "longtest";
const char performance_str[] = "performance";
const char echo_str[] = "echo";
const cmdlist_entry_t cmdlist[] = {
{ nessie_str, NULL, testrun_nessie_cscipher },
{ test_str, NULL, testrun_cscipher},
{ longtest_str, NULL, testrun_long_cscipher},
{ performance_str, NULL, testrun_performance_cscipher},
{ echo_str, (void*)1, (void_fpt)echo_ctrl},
{ NULL, NULL, NULL}
};
int main (void){
sysclk_set_freq(SYS_FREQ);
sysclk_mosc_verify_enable();
uart_init(UART_0, 115200, 8, UART_PARATY_NONE, UART_STOPBITS_ONE);
gptm_set_timer_32periodic(TIMER0);
cli_rx = uart0_getc;
cli_tx = uart0_putc;
for(;;){
cli_putstr("\r\n\r\nARM-Crypto-Lib VS (");
cli_putstr(algo_name);
cli_putstr("; ");
cli_putstr(__DATE__);
cli_putc(' ');
cli_putstr(__TIME__);
cli_putstr(")\r\nloaded and running\r\n");
cmd_interface(cmdlist);
}
}

File diff suppressed because it is too large Load Diff