forgotten directories
This commit is contained in:
parent
fb4cf7b5c6
commit
924aa320be
|
@ -0,0 +1,94 @@
|
|||
/* bcal-basic.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 <string.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
uint8_t bcal_cipher_init(const bcdesc_t* cipher_descriptor,
|
||||
const void* key, uint16_t keysize_b, bcgen_ctx_t* ctx){
|
||||
if(!is_valid_keysize_P((PGM_VOID_P)pgm_read_word(&(cipher_descriptor->valid_keysize_desc)),
|
||||
keysize_b)){
|
||||
return 1;
|
||||
}
|
||||
uint8_t flags;
|
||||
bc_init_fpt init_fpt;
|
||||
ctx->desc_ptr = (bcdesc_t*)cipher_descriptor;
|
||||
ctx->keysize = keysize_b;
|
||||
flags = pgm_read_byte(cipher_descriptor->flags);
|
||||
init_fpt.initvoid = (void_fpt)(pgm_read_word(&(cipher_descriptor->init.initvoid)));
|
||||
if(init_fpt.initvoid == NULL){
|
||||
if(!(ctx->ctx = malloc((keysize_b+7)/8)))
|
||||
return 2;
|
||||
memcpy(ctx->ctx, key, (keysize_b+7)/8);
|
||||
return 0;
|
||||
}
|
||||
if(!(ctx->ctx = malloc(pgm_read_word(&(cipher_descriptor->ctxsize_B)))))
|
||||
return 3;
|
||||
if((flags&BC_INIT_TYPE)==BC_INIT_TYPE_1){
|
||||
init_fpt.init1((void*)key, (ctx->ctx));
|
||||
}else{
|
||||
init_fpt.init2((void*)key, keysize_b, (ctx->ctx));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bcal_cipher_free(bcgen_ctx_t* ctx){
|
||||
if(!ctx)
|
||||
return;
|
||||
bc_free_fpt free_fpt;
|
||||
free_fpt = (bc_free_fpt)(pgm_read_word(&(ctx->desc_ptr->free)));
|
||||
if(free_fpt)
|
||||
free_fpt((ctx->ctx));
|
||||
free(ctx->ctx);
|
||||
}
|
||||
|
||||
void bcal_cipher_enc(void* block, const bcgen_ctx_t* ctx){
|
||||
bc_enc_fpt enc_fpt;
|
||||
enc_fpt.encvoid = (void_fpt)pgm_read_word(&(ctx->desc_ptr->enc.encvoid));
|
||||
if(!enc_fpt.encvoid){
|
||||
/* very bad error, no enciphering function specified */
|
||||
return;
|
||||
}
|
||||
enc_fpt.enc1(block, (ctx->ctx));
|
||||
|
||||
}
|
||||
|
||||
void bcal_cipher_dec(void* block, const bcgen_ctx_t* ctx){
|
||||
bc_dec_fpt dec_fpt;
|
||||
dec_fpt.decvoid = (void_fpt)pgm_read_word(&(ctx->desc_ptr->dec.decvoid));
|
||||
if(!dec_fpt.decvoid){
|
||||
/* very bad error, no deciphering function specified */
|
||||
return;
|
||||
}
|
||||
dec_fpt.dec1(block, (ctx->ctx));
|
||||
}
|
||||
|
||||
uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t* desc){
|
||||
return pgm_read_word(&(desc->blocksize_b));
|
||||
}
|
||||
|
||||
PGM_VOID_P bcal_cipher_getKeysizeDesc(const bcdesc_t* desc){
|
||||
return (PGM_VOID_P)pgm_read_word(&(desc->valid_keysize_desc));
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/* bcal-basic.h */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 BCAL_BASIC_H_
|
||||
#define BCAL_BASIC_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "keysize_descriptor.h"
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
uint8_t bcal_cipher_init(const bcdesc_t* cipher_descriptor,
|
||||
const void* key, uint16_t keysize_b, bcgen_ctx_t* ctx);
|
||||
void bcal_cipher_free(bcgen_ctx_t* ctx);
|
||||
void bcal_cipher_enc(void* block, const bcgen_ctx_t* ctx);
|
||||
void bcal_cipher_dec(void* block, const bcgen_ctx_t* ctx);
|
||||
uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t* desc);
|
||||
PGM_VOID_P bcal_cipher_getKeysizeDesc(const bcdesc_t* desc);
|
||||
#endif /* BCAL_BASIC_H_ */
|
|
@ -0,0 +1,84 @@
|
|||
/* bcal-cbc.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/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "bcal-cbc.h"
|
||||
#include "bcal-basic.h"
|
||||
#include "memxor/memxor.h"
|
||||
|
||||
uint8_t bcal_cbc_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cbc_ctx_t* ctx){
|
||||
ctx->desc = (bcdesc_t*)desc;
|
||||
ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
|
||||
ctx->prev_block = malloc(ctx->blocksize_B);
|
||||
|
||||
if(ctx->prev_block==NULL){
|
||||
return 0x11;
|
||||
}
|
||||
return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
|
||||
}
|
||||
|
||||
void bcal_cbc_free(bcal_cbc_ctx_t* ctx){
|
||||
bcal_cipher_free(&(ctx->cctx));
|
||||
free(ctx->prev_block);
|
||||
}
|
||||
|
||||
|
||||
void bcal_cbc_loadIV(const void* iv, bcal_cbc_ctx_t* ctx){
|
||||
if(iv){
|
||||
memcpy(ctx->prev_block, iv, ctx->blocksize_B);
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_cbc_encNext(void* block, bcal_cbc_ctx_t* ctx){
|
||||
memxor(block, ctx->prev_block, ctx->blocksize_B);
|
||||
bcal_cipher_enc(block, &(ctx->cctx));
|
||||
memcpy(ctx->prev_block, block, ctx->blocksize_B);
|
||||
}
|
||||
|
||||
void bcal_cbc_decNext(void* block, bcal_cbc_ctx_t* ctx){
|
||||
uint8_t tmp[ctx->blocksize_B];
|
||||
memcpy(tmp, block, ctx->blocksize_B);
|
||||
bcal_cipher_dec(block, &(ctx->cctx));
|
||||
memxor(block, ctx->prev_block, ctx->blocksize_B);
|
||||
memcpy(ctx->prev_block, tmp, ctx->blocksize_B);
|
||||
}
|
||||
void bcal_cbc_decRand(void* block, const void* prev_block, bcal_cbc_ctx_t* ctx){
|
||||
bcal_cipher_dec(block, &(ctx->cctx));
|
||||
memxor(block, prev_block, ctx->blocksize_B);
|
||||
}
|
||||
|
||||
void bcal_cbc_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx){
|
||||
bcal_cbc_loadIV(iv, ctx);
|
||||
while(msg_blocks--){
|
||||
bcal_cbc_encNext(msg, ctx);
|
||||
msg = (uint8_t*)msg + ctx->blocksize_B;
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_cbc_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx){
|
||||
msg=(uint8_t*)msg + (msg_blocks-1)*ctx->blocksize_B;
|
||||
while(msg_blocks > 1){
|
||||
bcal_cbc_decRand(msg, (uint8_t*)msg-ctx->blocksize_B, ctx);
|
||||
msg_blocks -= 1;
|
||||
msg=(uint8_t*)msg-ctx->blocksize_B;
|
||||
}
|
||||
bcal_cbc_decRand(msg, iv, ctx);
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/* bcal-cbc.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 BCALCBC_H_
|
||||
#define BCALCBC_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "bcal-basic.h"
|
||||
|
||||
typedef struct{
|
||||
bcdesc_t* desc;
|
||||
bcgen_ctx_t cctx;
|
||||
uint8_t* prev_block;
|
||||
uint8_t blocksize_B;
|
||||
} bcal_cbc_ctx_t;
|
||||
|
||||
uint8_t bcal_cbc_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cbc_ctx_t* ctx);
|
||||
void bcal_cbc_free(bcal_cbc_ctx_t* ctx);
|
||||
void bcal_cbc_loadIV(const void* iv, bcal_cbc_ctx_t* ctx);
|
||||
void bcal_cbc_encNext(void* block, bcal_cbc_ctx_t* ctx);
|
||||
void bcal_cbc_decNext(void* block, bcal_cbc_ctx_t* ctx);
|
||||
void bcal_cbc_decRand(void* block, const void* prev_block, bcal_cbc_ctx_t* ctx);
|
||||
void bcal_cbc_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx);
|
||||
void bcal_cbc_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx);
|
||||
|
||||
|
||||
#endif /* BCALCBC_H_ */
|
|
@ -0,0 +1,128 @@
|
|||
/* bcal-cfb_bit.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/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "bcal-cfb_bit.h"
|
||||
#include "bcal-basic.h"
|
||||
|
||||
static uint8_t read_bit(void* block, uint32_t index){
|
||||
uint8_t r;
|
||||
r=((uint8_t*)block)[index/8];
|
||||
r=(r&(0x80>>(index&7)))?0xff:0x00;
|
||||
return r;
|
||||
}
|
||||
|
||||
static void write_bit(void* block, uint32_t index, uint8_t value){
|
||||
if(value){
|
||||
/* set bit */
|
||||
((uint8_t*)block)[index/8] |= 0x80>>(index&7);
|
||||
}else{
|
||||
/* clear bit */
|
||||
((uint8_t*)block)[index/8] &= ~(0x80>>(index&7));
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t bcal_cfb_b_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t* ctx){
|
||||
ctx->desc = (bcdesc_t*)desc;
|
||||
ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
|
||||
ctx->in_block=malloc(ctx->blocksize_B);
|
||||
if(ctx->in_block==NULL){
|
||||
return 0x11;
|
||||
}
|
||||
if(size_b>bcal_cipher_getBlocksize_b(desc)){
|
||||
return 0x12;
|
||||
}
|
||||
ctx->size_b = size_b;
|
||||
return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
|
||||
}
|
||||
|
||||
void bcal_cfb_b_free(bcal_cfb_b_ctx_t* ctx){
|
||||
free(ctx->in_block);
|
||||
bcal_cipher_free(&(ctx->cctx));
|
||||
}
|
||||
|
||||
void bcal_cfb_b_loadIV(const void* iv, bcal_cfb_b_ctx_t* ctx){
|
||||
if(iv){
|
||||
memcpy(ctx->in_block, iv, ctx->blocksize_B);
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_cfb_b_encNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx){
|
||||
uint8_t tmp[ctx->blocksize_B];
|
||||
offset &= 7;
|
||||
memcpy(tmp, ctx->in_block, ctx->blocksize_B);
|
||||
bcal_cipher_enc(tmp, &(ctx->cctx));
|
||||
uint16_t i,j;
|
||||
uint8_t a;
|
||||
for(i=0; i<ctx->blocksize_B*8-ctx->size_b; ++i){
|
||||
a = read_bit(ctx->in_block, i+ctx->size_b);
|
||||
write_bit(ctx->in_block, i, a);
|
||||
}
|
||||
for(j=offset,i=0; i<ctx->size_b; ++i, ++j){
|
||||
a = read_bit(tmp, i) ^ read_bit(block, j);
|
||||
write_bit(ctx->in_block, ctx->blocksize_B*8-ctx->size_b+i, a);
|
||||
write_bit(block, j, a);
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_cfb_b_decNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx){
|
||||
uint8_t tmp[ctx->blocksize_B];
|
||||
offset &= 7;
|
||||
memcpy(tmp, ctx->in_block, ctx->blocksize_B);
|
||||
bcal_cipher_enc(tmp, &(ctx->cctx));
|
||||
uint16_t i,j;
|
||||
uint8_t a,b;
|
||||
for(i=0; i<ctx->blocksize_B*8-ctx->size_b; ++i){
|
||||
a = read_bit(ctx->in_block, i+ctx->size_b);
|
||||
write_bit(ctx->in_block, i, a);
|
||||
}
|
||||
for(j=offset,i=0; i<ctx->size_b; ++i, ++j){
|
||||
a = read_bit(tmp, i);
|
||||
b = read_bit(block, j);
|
||||
a ^= b;
|
||||
write_bit(ctx->in_block, ctx->blocksize_B*8-ctx->size_b+i, b);
|
||||
write_bit(block, j, a);
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_cfb_b_encMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx){
|
||||
bcal_cfb_b_loadIV(iv, ctx);
|
||||
uint32_t addr;
|
||||
addr = ((uint16_t)msg)*8+offset;
|
||||
while(msg_blocks--){
|
||||
msg = (void*)((uint16_t)(addr/8));
|
||||
offset = addr&7;
|
||||
bcal_cfb_b_encNext(msg, offset, ctx);
|
||||
addr += ctx->size_b;
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_cfb_b_decMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx){
|
||||
bcal_cfb_b_loadIV(iv, ctx);
|
||||
uint32_t addr;
|
||||
addr = ((uint16_t)msg)*8+offset;
|
||||
while(msg_blocks--){
|
||||
msg = (void*)((uint16_t)(addr/8));
|
||||
offset = addr&7;
|
||||
bcal_cfb_b_decNext(msg, offset, ctx);
|
||||
addr += ctx->size_b;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/* bcal-cfb_bit.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 BCALCFB_BIT_H_
|
||||
#define BCALCFB_BIT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "bcal-basic.h"
|
||||
#include "blockcipher_descriptor.h"
|
||||
|
||||
|
||||
typedef struct{
|
||||
bcdesc_t* desc;
|
||||
bcgen_ctx_t cctx;
|
||||
uint8_t* in_block;
|
||||
uint8_t blocksize_B;
|
||||
uint16_t size_b;
|
||||
} bcal_cfb_b_ctx_t;
|
||||
|
||||
|
||||
uint8_t bcal_cfb_b_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t* ctx);
|
||||
void bcal_cfb_b_free(bcal_cfb_b_ctx_t* ctx);
|
||||
void bcal_cfb_b_loadIV(const void* iv, bcal_cfb_b_ctx_t* ctx);
|
||||
void bcal_cfb_b_encNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx);
|
||||
void bcal_cfb_b_decNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx);
|
||||
void bcal_cfb_b_encMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx);
|
||||
void bcal_cfb_b_decMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx);
|
||||
|
||||
|
||||
#endif /* BCALCFB_BIT_H_ */
|
|
@ -0,0 +1,88 @@
|
|||
/* bcal-cfb_byte.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/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "bcal-cfb_byte.h"
|
||||
#include "bcal-basic.h"
|
||||
#include "memxor/memxor.h"
|
||||
|
||||
|
||||
uint8_t bcal_cfb_B_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t* ctx){
|
||||
ctx->desc = (bcdesc_t*)desc;
|
||||
ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
|
||||
ctx->in_block=malloc(ctx->blocksize_B);
|
||||
if(ctx->in_block==NULL){
|
||||
return 0x11;
|
||||
}
|
||||
if(size_b&7){
|
||||
return 0x12;
|
||||
}
|
||||
ctx->size_B = size_b/8;
|
||||
return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
|
||||
}
|
||||
|
||||
void bcal_cfb_B_free(bcal_cfb_B_ctx_t* ctx){
|
||||
free(ctx->in_block);
|
||||
bcal_cipher_free(&(ctx->cctx));
|
||||
}
|
||||
|
||||
void bcal_cfb_B_loadIV(const void* iv, bcal_cfb_B_ctx_t* ctx){
|
||||
if(iv){
|
||||
memcpy(ctx->in_block, iv, ctx->blocksize_B);
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_cfb_B_encNext(void* block, bcal_cfb_B_ctx_t* ctx){
|
||||
uint8_t tmp[ctx->blocksize_B];
|
||||
memcpy(tmp, ctx->in_block, ctx->blocksize_B);
|
||||
bcal_cipher_enc(tmp, &(ctx->cctx));
|
||||
memxor(block, tmp, ctx->size_B);
|
||||
memmove(ctx->in_block, ctx->in_block+ctx->size_B, ctx->blocksize_B - ctx->size_B);
|
||||
memcpy(ctx->in_block+ctx->blocksize_B-ctx->size_B, block, ctx->size_B);
|
||||
}
|
||||
|
||||
void bcal_cfb_B_decNext(void* block, bcal_cfb_B_ctx_t* ctx){
|
||||
uint8_t tmp[ctx->blocksize_B];
|
||||
uint8_t xblock[ctx->size_B];
|
||||
memcpy(xblock, block, ctx->size_B);
|
||||
memcpy(tmp, ctx->in_block, ctx->blocksize_B);
|
||||
bcal_cipher_enc(tmp, &(ctx->cctx));
|
||||
memxor(block, tmp, ctx->size_B);
|
||||
memmove(ctx->in_block, ctx->in_block+ctx->size_B, ctx->blocksize_B - ctx->size_B);
|
||||
memcpy(ctx->in_block+ctx->blocksize_B-ctx->size_B, xblock, ctx->size_B);
|
||||
}
|
||||
|
||||
void bcal_cfb_B_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx){
|
||||
bcal_cfb_B_loadIV(iv, ctx);
|
||||
while(msg_blocks--){
|
||||
bcal_cfb_B_encNext(msg, ctx);
|
||||
msg = (uint8_t*)msg+ctx->size_B;
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_cfb_B_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx){
|
||||
bcal_cfb_B_loadIV(iv, ctx);
|
||||
while(msg_blocks--){
|
||||
bcal_cfb_B_decNext(msg, ctx);
|
||||
msg = (uint8_t*)msg+ctx->size_B;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/* bcal-cbc.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 BCALCFB_BYTE_H_
|
||||
#define BCALCFB_BYTE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "bcal-basic.h"
|
||||
#include "blockcipher_descriptor.h"
|
||||
|
||||
|
||||
typedef struct{
|
||||
bcdesc_t* desc;
|
||||
bcgen_ctx_t cctx;
|
||||
uint8_t* in_block;
|
||||
uint8_t blocksize_B;
|
||||
uint8_t size_B;
|
||||
} bcal_cfb_B_ctx_t;
|
||||
|
||||
|
||||
uint8_t bcal_cfb_B_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t* ctx);
|
||||
void bcal_cfb_B_free(bcal_cfb_B_ctx_t* ctx);
|
||||
void bcal_cfb_B_loadIV(const void* iv, bcal_cfb_B_ctx_t* ctx);
|
||||
void bcal_cfb_B_encNext(void* block, bcal_cfb_B_ctx_t* ctx);
|
||||
void bcal_cfb_B_decNext(void* block, bcal_cfb_B_ctx_t* ctx);
|
||||
void bcal_cfb_B_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx);
|
||||
void bcal_cfb_B_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx);
|
||||
|
||||
|
||||
#endif /* BCALCFB_BYTE_H_ */
|
|
@ -0,0 +1,152 @@
|
|||
/* bcal-omac.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/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "bcal-basic.h"
|
||||
#include "bcal-cmac.h"
|
||||
#include "memxor/memxor.h"
|
||||
|
||||
|
||||
static uint8_t left_shift_be_block(void* block, uint8_t blocksize_B){
|
||||
uint8_t c1=0, c2;
|
||||
do{
|
||||
--blocksize_B;
|
||||
c2 = (((uint8_t*)block)[blocksize_B])>>7;
|
||||
(((uint8_t*)block)[blocksize_B]) <<= 1;
|
||||
(((uint8_t*)block)[blocksize_B]) |= c1;
|
||||
c1 = c2;
|
||||
}while(blocksize_B);
|
||||
return c1;
|
||||
}
|
||||
|
||||
static const uint8_t const_128 = 0x87;
|
||||
static const uint8_t const_64 = 0x1b;
|
||||
|
||||
uint8_t bcal_cmac_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cmac_ctx_t* ctx){
|
||||
uint8_t r;
|
||||
ctx->desc = (bcdesc_t*)desc;
|
||||
ctx->blocksize_B = bcal_cipher_getBlocksize_b(desc)/8;
|
||||
if (ctx->blocksize_B!=128/8 && ctx->blocksize_B!=64/8){
|
||||
return 0x13;
|
||||
}
|
||||
ctx->accu = malloc(ctx->blocksize_B);
|
||||
if(ctx->accu==NULL){
|
||||
return 0x14;
|
||||
}
|
||||
ctx->k1 = malloc(ctx->blocksize_B);
|
||||
if(ctx->k1==NULL){
|
||||
return 0x15;
|
||||
}
|
||||
ctx->k2 = malloc(ctx->blocksize_B);
|
||||
if(ctx->k2==NULL){
|
||||
return 0x16;
|
||||
}
|
||||
ctx->lastblock = malloc(ctx->blocksize_B);
|
||||
if(ctx->lastblock==NULL){
|
||||
return 0x17;
|
||||
}
|
||||
r = bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
|
||||
if(r){
|
||||
return r;
|
||||
}
|
||||
if(ctx->blocksize_B==128/8){
|
||||
r = const_128;
|
||||
}else{
|
||||
r = const_64;
|
||||
}
|
||||
/* subkey computation */
|
||||
memset(ctx->accu, 0x00, ctx->blocksize_B);
|
||||
memset(ctx->k1, 0x00, ctx->blocksize_B);
|
||||
bcal_cipher_enc(ctx->k1, &(ctx->cctx));
|
||||
if(left_shift_be_block(ctx->k1, ctx->blocksize_B)){
|
||||
ctx->k1[ctx->blocksize_B-1] ^= r;
|
||||
}
|
||||
memcpy(ctx->k2, ctx->k1, ctx->blocksize_B);
|
||||
if(left_shift_be_block(ctx->k2, ctx->blocksize_B)){
|
||||
ctx->k2[ctx->blocksize_B-1] ^= r;
|
||||
}
|
||||
ctx->last_set=0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bcal_cmac_free(bcal_cmac_ctx_t* ctx){
|
||||
free(ctx->accu);
|
||||
free(ctx->k1);
|
||||
free(ctx->k2);
|
||||
bcal_cipher_free(&(ctx->cctx));
|
||||
}
|
||||
|
||||
void bcal_cmac_nextBlock (bcal_cmac_ctx_t* ctx, const void* block){
|
||||
if(ctx->last_set){
|
||||
memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
|
||||
bcal_cipher_enc(ctx->accu, &(ctx->cctx));
|
||||
}
|
||||
memcpy(ctx->lastblock, block, ctx->blocksize_B);
|
||||
ctx->last_set=1;
|
||||
}
|
||||
|
||||
|
||||
void bcal_cmac_lastBlock(bcal_cmac_ctx_t* ctx, const void* block, uint16_t length_b){
|
||||
uint16_t blocksize_b;
|
||||
blocksize_b = ctx->blocksize_B*8;
|
||||
while(length_b>=blocksize_b){
|
||||
bcal_cmac_nextBlock(ctx, block);
|
||||
block = (uint8_t*)block + ctx->blocksize_B;
|
||||
length_b -= blocksize_b;
|
||||
}
|
||||
if(ctx->last_set==0){
|
||||
memxor(ctx->accu, block, (length_b+7)/8);
|
||||
memxor(ctx->accu, ctx->k2, ctx->blocksize_B);
|
||||
ctx->accu[length_b/8] ^= 0x80>>(length_b&7);
|
||||
}else{
|
||||
if(length_b==0){
|
||||
memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
|
||||
memxor(ctx->accu, ctx->k1, ctx->blocksize_B);
|
||||
}else{
|
||||
memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
|
||||
bcal_cipher_enc(ctx->accu, &(ctx->cctx));
|
||||
memxor(ctx->accu, block, (length_b+7)/8);
|
||||
memxor(ctx->accu, ctx->k2, ctx->blocksize_B);
|
||||
ctx->accu[length_b/8] ^= 0x80>>(length_b&7);
|
||||
}
|
||||
}
|
||||
bcal_cipher_enc(ctx->accu, &(ctx->cctx));
|
||||
}
|
||||
|
||||
void bcal_cmac_ctx2mac(void* dest, uint16_t length_b, const bcal_cmac_ctx_t* ctx){
|
||||
memcpy(dest, ctx->accu, length_b/8);
|
||||
if(length_b&7){
|
||||
((uint8_t*)dest)[length_b/8] &= 0xff>>(length_b&7);
|
||||
((uint8_t*)dest)[length_b/8] |= (0xff00>>(length_b&7))&(ctx->accu[length_b/8]);
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_cmac(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_cmac_ctx_t* ctx){
|
||||
uint16_t blocksize_b;
|
||||
blocksize_b = ctx->blocksize_B*8;
|
||||
while(length_b>blocksize_b){
|
||||
bcal_cmac_nextBlock(ctx, block);
|
||||
block = (uint8_t*)block + ctx->blocksize_B;
|
||||
length_b -= blocksize_b;
|
||||
}
|
||||
bcal_cmac_lastBlock(ctx, block, length_b);
|
||||
bcal_cmac_ctx2mac(dest, out_length_b, ctx);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/* bcal-cmac.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 BCALCMAC_H_
|
||||
#define BCALCMAC_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "bcal-basic.h"
|
||||
#include "blockcipher_descriptor.h"
|
||||
|
||||
typedef struct{
|
||||
bcdesc_t* desc;
|
||||
bcgen_ctx_t cctx;
|
||||
uint8_t* accu;
|
||||
uint8_t* k1;
|
||||
uint8_t* k2;
|
||||
uint8_t* lastblock;
|
||||
uint8_t last_set;
|
||||
uint8_t blocksize_B;
|
||||
} bcal_cmac_ctx_t;
|
||||
|
||||
uint8_t bcal_cmac_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cmac_ctx_t* ctx);
|
||||
void bcal_cmac_free(bcal_cmac_ctx_t* ctx);
|
||||
void bcal_cmac_nextBlock(bcal_cmac_ctx_t* ctx, const void* block);
|
||||
void bcal_cmac_lastBlock(bcal_cmac_ctx_t* ctx, const void* block, uint16_t length_b);
|
||||
void bcal_cmac_ctx2mac(void* dest, uint16_t length_b, const bcal_cmac_ctx_t* ctx);
|
||||
void bcal_cmac(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_cmac_ctx_t* ctx);
|
||||
|
||||
#endif /* BCALCMAC_H_ */
|
|
@ -0,0 +1,95 @@
|
|||
/* bcal-ctr.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/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "bcal-basic.h"
|
||||
#include "bcal-ctr.h"
|
||||
#include "memxor/memxor.h"
|
||||
|
||||
static void increment_be(void* block, uint8_t size_B){
|
||||
uint16_t c=1;
|
||||
do{
|
||||
--size_B;
|
||||
c += ((uint8_t*)block)[size_B];
|
||||
((uint8_t*)block)[size_B] = (uint8_t)c;
|
||||
c>>=8;
|
||||
}while(size_B);
|
||||
}
|
||||
|
||||
uint8_t bcal_ctr_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t* ctx){
|
||||
ctx->desc = (bcdesc_t*)desc;
|
||||
if(inc_func){
|
||||
ctx->inc_func = inc_func;
|
||||
}else{
|
||||
ctx->inc_func = increment_be;
|
||||
}
|
||||
ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
|
||||
ctx->in_block=malloc(ctx->blocksize_B);
|
||||
if(ctx->in_block==NULL){
|
||||
return 0x11;
|
||||
}
|
||||
return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
|
||||
}
|
||||
|
||||
void bcal_ctr_free(bcal_ctr_ctx_t* ctx){
|
||||
free(ctx->in_block);
|
||||
bcal_cipher_free(&(ctx->cctx));
|
||||
}
|
||||
|
||||
void bcal_ctr_loadIV(const void* iv, bcal_ctr_ctx_t* ctx){
|
||||
if(iv){
|
||||
memcpy(ctx->in_block, iv, ctx->blocksize_B);
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_ctr_encNext(void* block, bcal_ctr_ctx_t* ctx){
|
||||
uint8_t tmp[ctx->blocksize_B];
|
||||
memcpy(tmp, ctx->in_block, ctx->blocksize_B);
|
||||
bcal_cipher_enc(tmp, &(ctx->cctx));
|
||||
memxor(block, tmp, ctx->blocksize_B);
|
||||
ctx->inc_func(ctx->in_block, ctx->blocksize_B);
|
||||
}
|
||||
|
||||
void bcal_ctr_decNext(void* block, bcal_ctr_ctx_t* ctx){
|
||||
bcal_ctr_encNext(block, ctx);
|
||||
}
|
||||
|
||||
void bcal_ctr_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx){
|
||||
bcal_ctr_loadIV(iv, ctx);
|
||||
uint16_t blocksize_b;
|
||||
blocksize_b = ctx->blocksize_B*8;
|
||||
while(msg_len_b>blocksize_b){
|
||||
bcal_ctr_encNext(msg, ctx);
|
||||
msg_len_b -= blocksize_b;
|
||||
msg = (uint8_t*)msg + ctx->blocksize_B;
|
||||
}
|
||||
uint8_t tmp[ctx->blocksize_B];
|
||||
memcpy(tmp, ctx->in_block, ctx->blocksize_B);
|
||||
bcal_cipher_enc(tmp, &(ctx->cctx));
|
||||
ctx->inc_func(ctx->in_block, ctx->blocksize_B);
|
||||
tmp[msg_len_b/8] = 0xff00>>(msg_len_b&7);
|
||||
memxor(msg, tmp, (msg_len_b+7)/8);
|
||||
}
|
||||
|
||||
void bcal_ctr_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx){
|
||||
bcal_ctr_encMsg(iv, msg, msg_len_b, ctx);
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/* bcal-ctr.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 BCALCTR_H_
|
||||
#define BCALCTR_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "bcal-basic.h"
|
||||
#include "blockcipher_descriptor.h"
|
||||
|
||||
typedef void(*inc_fp_t)(void* block, uint8_t size_B);
|
||||
|
||||
typedef struct{
|
||||
bcdesc_t* desc;
|
||||
bcgen_ctx_t cctx;
|
||||
uint8_t* in_block;
|
||||
inc_fp_t inc_func;
|
||||
uint8_t blocksize_B;
|
||||
} bcal_ctr_ctx_t;
|
||||
|
||||
uint8_t bcal_ctr_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t* ctx);
|
||||
void bcal_ctr_free(bcal_ctr_ctx_t* ctx);
|
||||
void bcal_ctr_loadIV(const void* iv, bcal_ctr_ctx_t* ctx);
|
||||
void bcal_ctr_encNext(void* block, bcal_ctr_ctx_t* ctx);
|
||||
void bcal_ctr_decNext(void* block, bcal_ctr_ctx_t* ctx);
|
||||
void bcal_ctr_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx);
|
||||
void bcal_ctr_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx);
|
||||
|
||||
#endif /* BCALCTR_H_ */
|
|
@ -0,0 +1,119 @@
|
|||
/* bca-eax.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/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "bcal-basic.h"
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "bcal-cmac.h"
|
||||
#include "bcal-ctr.h"
|
||||
#include "bcal-eax.h"
|
||||
#include "memxor/memxor.h"
|
||||
|
||||
uint8_t bcal_eax_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_eax_ctx_t* ctx){
|
||||
uint8_t r;
|
||||
ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
|
||||
ctx->nonce = malloc(ctx->blocksize_B);
|
||||
if(ctx->nonce==NULL){
|
||||
return 0x81;
|
||||
}
|
||||
r = bcal_cmac_init(desc, key, keysize_b, &(ctx->ctag));
|
||||
if(r){
|
||||
return r;
|
||||
}
|
||||
r = bcal_cmac_init(desc, key, keysize_b, &(ctx->htag));
|
||||
if(r){
|
||||
return (r|0x10);
|
||||
}
|
||||
r = bcal_cmac_init(desc, key, keysize_b, &(ctx->ntag));
|
||||
if(r){
|
||||
return (r|0x20);
|
||||
}
|
||||
r = bcal_ctr_init(desc, key, keysize_b, NULL, &(ctx->cipher));
|
||||
if(r){
|
||||
return (r|0x30);
|
||||
}
|
||||
ctx->header_set=0;
|
||||
uint8_t tmp[ctx->blocksize_B];
|
||||
memset(tmp, 0, ctx->blocksize_B);
|
||||
bcal_cmac_nextBlock(&(ctx->ntag), tmp);
|
||||
tmp[ctx->blocksize_B-1]=1;
|
||||
bcal_cmac_nextBlock(&(ctx->htag), tmp);
|
||||
tmp[ctx->blocksize_B-1]=2;
|
||||
bcal_cmac_nextBlock(&(ctx->ctag), tmp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bcal_eax_free(bcal_eax_ctx_t* ctx){
|
||||
bcal_ctr_free(&(ctx->cipher));
|
||||
bcal_cmac_free(&(ctx->ctag));
|
||||
bcal_cmac_free(&(ctx->htag));
|
||||
bcal_cmac_free(&(ctx->ntag));
|
||||
free(ctx->nonce);
|
||||
}
|
||||
|
||||
void bcal_eax_loadNonce(const void* nonce, uint16_t length_b, bcal_eax_ctx_t* ctx){
|
||||
bcal_cmac_lastBlock(&(ctx->ntag), nonce, length_b);
|
||||
bcal_cmac_ctx2mac(ctx->nonce, ctx->blocksize_B*8, &(ctx->ntag));
|
||||
bcal_ctr_loadIV(ctx->nonce, &(ctx->cipher));
|
||||
}
|
||||
|
||||
void bcal_eax_addNextHeader(const void* header, bcal_eax_ctx_t* ctx){
|
||||
bcal_cmac_nextBlock(&(ctx->htag), header);
|
||||
}
|
||||
|
||||
void bcal_eax_addLastHeader(const void* header, uint16_t length_b, bcal_eax_ctx_t* ctx){
|
||||
bcal_cmac_lastBlock(&(ctx->htag), header, length_b);
|
||||
ctx->header_set = 1;
|
||||
}
|
||||
|
||||
void bcal_eax_encNextBlock(void* block, bcal_eax_ctx_t* ctx){
|
||||
bcal_ctr_encNext(block, &(ctx->cipher));
|
||||
bcal_cmac_nextBlock(&(ctx->ctag), block);
|
||||
}
|
||||
|
||||
void bcal_eax_encLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx){
|
||||
bcal_ctr_encMsg(NULL, block, length_b, &(ctx->cipher));
|
||||
bcal_cmac_lastBlock(&(ctx->ctag), block, length_b);
|
||||
}
|
||||
|
||||
void bcal_eax_decNextBlock(void* block, bcal_eax_ctx_t* ctx){
|
||||
bcal_cmac_nextBlock(&(ctx->ctag), block);
|
||||
bcal_ctr_decNext(block, &(ctx->cipher));
|
||||
}
|
||||
|
||||
void bcal_eax_decLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx){
|
||||
bcal_cmac_lastBlock(&(ctx->ctag), block, length_b);
|
||||
bcal_ctr_decMsg(NULL, block, length_b, &(ctx->cipher));
|
||||
}
|
||||
|
||||
void bcal_eax_ctx2tag(void* dest, uint16_t length_b, bcal_eax_ctx_t* ctx){
|
||||
uint8_t tmp[ctx->blocksize_B];
|
||||
if(ctx->header_set==0){
|
||||
bcal_cmac_lastBlock(&(ctx->htag), NULL, 0);
|
||||
}
|
||||
|
||||
bcal_cmac_ctx2mac(tmp, ctx->blocksize_B*8, &(ctx->htag));
|
||||
memxor(ctx->nonce, tmp, ctx->blocksize_B);
|
||||
|
||||
bcal_cmac_ctx2mac(tmp, ctx->blocksize_B*8, &(ctx->ctag));
|
||||
memxor(ctx->nonce, tmp, ctx->blocksize_B);
|
||||
memcpy(dest, ctx->nonce, (length_b+7)/8);
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/* bcal-eax.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 BCALEAX_H_
|
||||
#define BCALEAX_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "bcal-basic.h"
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "bcal-cmac.h"
|
||||
#include "bcal-ctr.h"
|
||||
|
||||
typedef struct{
|
||||
uint8_t* nonce;
|
||||
bcal_cmac_ctx_t ntag;
|
||||
bcal_cmac_ctx_t ctag;
|
||||
bcal_cmac_ctx_t htag;
|
||||
bcal_ctr_ctx_t cipher;
|
||||
uint8_t blocksize_B;
|
||||
uint8_t header_set;
|
||||
} bcal_eax_ctx_t;
|
||||
|
||||
uint8_t bcal_eax_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_eax_ctx_t* ctx);
|
||||
void bcal_eax_free(bcal_eax_ctx_t* ctx);
|
||||
void bcal_eax_loadNonce(const void* nonce, uint16_t length_b, bcal_eax_ctx_t* ctx);
|
||||
void bcal_eax_addNextHeader(const void* header, bcal_eax_ctx_t* ctx);
|
||||
void bcal_eax_addLastHeader(const void* header, uint16_t length_b, bcal_eax_ctx_t* ctx);
|
||||
void bcal_eax_encNextBlock(void* block, bcal_eax_ctx_t* ctx);
|
||||
void bcal_eax_encLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx);
|
||||
void bcal_eax_decNextBlock(void* block, bcal_eax_ctx_t* ctx);
|
||||
void bcal_eax_decLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx);
|
||||
void bcal_eax_ctx2tag(void* dest, uint16_t length_b, bcal_eax_ctx_t* ctx);
|
||||
//void bcal_eax(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_eax_ctx_t* ctx);
|
||||
|
||||
#endif /* BCALEAX_H_ */
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
/* bcal-ofb.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/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "bcal-ofb.h"
|
||||
#include "bcal-basic.h"
|
||||
#include "memxor/memxor.h"
|
||||
|
||||
|
||||
uint8_t bcal_ofb_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_ofb_ctx_t* ctx){
|
||||
ctx->desc = (bcdesc_t*)desc;
|
||||
ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
|
||||
ctx->in_block=malloc(ctx->blocksize_B);
|
||||
if(ctx->in_block==NULL){
|
||||
return 0x11;
|
||||
}
|
||||
return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
|
||||
}
|
||||
|
||||
void bcal_ofb_free(bcal_ofb_ctx_t* ctx){
|
||||
free(ctx->in_block);
|
||||
bcal_cipher_free(&(ctx->cctx));
|
||||
}
|
||||
|
||||
void bcal_ofb_loadIV(const void* iv, bcal_ofb_ctx_t* ctx){
|
||||
if(iv){
|
||||
memcpy(ctx->in_block, iv, ctx->blocksize_B);
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_ofb_encNext(void* block, bcal_ofb_ctx_t* ctx){
|
||||
bcal_cipher_enc(ctx->in_block , &(ctx->cctx));
|
||||
memxor(block, ctx->in_block, ctx->blocksize_B);
|
||||
}
|
||||
|
||||
void bcal_ofb_decNext(void* block, bcal_ofb_ctx_t* ctx){
|
||||
bcal_cipher_enc(ctx->in_block , &(ctx->cctx));
|
||||
memxor(block, ctx->in_block, ctx->blocksize_B);
|
||||
}
|
||||
|
||||
|
||||
void bcal_ofb_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx){
|
||||
uint16_t block_len_b;
|
||||
block_len_b = ctx->blocksize_B*8;
|
||||
bcal_ofb_loadIV(iv, ctx);
|
||||
while(msg_len_b>block_len_b){
|
||||
bcal_ofb_encNext(msg, ctx);
|
||||
msg_len_b -= block_len_b;
|
||||
msg = (uint8_t*)msg + ctx->blocksize_B;
|
||||
}
|
||||
bcal_cipher_enc(ctx->in_block, &(ctx->cctx));
|
||||
ctx->in_block[msg_len_b/8] = 0xff00>>(msg_len_b&7);
|
||||
memxor(msg, ctx->in_block, (msg_len_b+7)/8);
|
||||
}
|
||||
|
||||
void bcal_ofb_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx){
|
||||
bcal_ofb_encMsg(iv, msg, msg_len_b, ctx);
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/* bcal-ofb.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 BCALOFB_H_
|
||||
#define BCALOFB_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "bcal-basic.h"
|
||||
#include "blockcipher_descriptor.h"
|
||||
|
||||
|
||||
typedef struct{
|
||||
bcdesc_t* desc;
|
||||
bcgen_ctx_t cctx;
|
||||
uint8_t* in_block;
|
||||
uint8_t blocksize_B;
|
||||
} bcal_ofb_ctx_t;
|
||||
|
||||
|
||||
uint8_t bcal_ofb_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_ofb_ctx_t* ctx);
|
||||
void bcal_ofb_free(bcal_ofb_ctx_t* ctx);
|
||||
void bcal_ofb_loadIV(const void* iv, bcal_ofb_ctx_t* ctx);
|
||||
void bcal_ofb_encNext(void* block, bcal_ofb_ctx_t* ctx);
|
||||
void bcal_ofb_decNext(void* block, bcal_ofb_ctx_t* ctx);
|
||||
void bcal_ofb_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx);
|
||||
void bcal_ofb_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx);
|
||||
|
||||
|
||||
#endif /* BCALOFB_H_ */
|
|
@ -0,0 +1,225 @@
|
|||
/* bcal-performance.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-performance.c
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2010-02-16
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bcal-performance.h"
|
||||
#include "keysize_descriptor.h"
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "performance_test.h"
|
||||
#include "stack_measuring.h"
|
||||
#include "cli.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#define PATTERN_A 0xAA
|
||||
#define PATTERN_B 0x55
|
||||
|
||||
|
||||
static
|
||||
void printvalue(unsigned long v){
|
||||
char str[20];
|
||||
int i;
|
||||
ultoa(v, str, 10);
|
||||
for(i=0; i<10-strlen(str); ++i){
|
||||
cli_putc(' ');
|
||||
}
|
||||
cli_putstr(str);
|
||||
}
|
||||
|
||||
void bcal_performance(const bcdesc_t* bcd){
|
||||
bcdesc_t bc;
|
||||
memcpy_P(&bc, bcd, sizeof(bcdesc_t));
|
||||
uint8_t ctx[bc.ctxsize_B];
|
||||
uint8_t data[(bc.blocksize_b+7)/8];
|
||||
uint16_t keysize = get_keysize(bc.valid_keysize_desc);
|
||||
uint8_t key[(keysize+7)/8];
|
||||
uint64_t t;
|
||||
uint8_t i;
|
||||
|
||||
if(bc.type!=BCDESC_TYPE_BLOCKCIPHER)
|
||||
return;
|
||||
calibrateTimer();
|
||||
print_overhead();
|
||||
cli_putstr_P(PSTR("\r\n\r\n === "));
|
||||
cli_putstr_P(bc.name);
|
||||
cli_putstr_P(PSTR(" performance === "
|
||||
"\r\n type: blockcipher"
|
||||
"\r\n keysize (bits): "));
|
||||
printvalue(keysize);
|
||||
|
||||
cli_putstr_P(PSTR("\r\n ctxsize (bytes): "));
|
||||
printvalue(bc.ctxsize_B);
|
||||
|
||||
cli_putstr_P(PSTR("\r\n blocksize (bits): "));
|
||||
printvalue(bc.blocksize_b);
|
||||
|
||||
|
||||
|
||||
t=0;
|
||||
if(bc.init.init1){
|
||||
if((bc.flags&BC_INIT_TYPE)==BC_INIT_TYPE_1){
|
||||
for(i=0; i<32; ++i){
|
||||
startTimer(0);
|
||||
START_TIMER;
|
||||
(bc.init.init1)(key, &ctx);
|
||||
STOP_TIMER;
|
||||
t += stopTimer();
|
||||
if(i!=31 && bc.free){
|
||||
bc.free(&ctx);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(i=0; i<32; ++i){
|
||||
startTimer(0);
|
||||
START_TIMER;
|
||||
(bc.init.init2)(key, keysize, &ctx);
|
||||
STOP_TIMER;
|
||||
t += stopTimer();
|
||||
if(i!=31 && bc.free){
|
||||
bc.free(&ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
t>>=5;
|
||||
cli_putstr_P(PSTR("\r\n init (cycles): "));
|
||||
printvalue(t);
|
||||
}
|
||||
t=0;
|
||||
for(i=0; i<32; ++i){
|
||||
startTimer(0);
|
||||
START_TIMER;
|
||||
bc.enc.enc1(data, &ctx);
|
||||
STOP_TIMER;
|
||||
t += stopTimer();
|
||||
}
|
||||
t>>=5;
|
||||
cli_putstr_P(PSTR("\r\n encrypt (cycles): "));
|
||||
printvalue(t);
|
||||
|
||||
t=0;
|
||||
for(i=0; i<32; ++i){
|
||||
startTimer(0);
|
||||
START_TIMER;
|
||||
bc.dec.dec1(data, &ctx);
|
||||
STOP_TIMER;
|
||||
t += stopTimer();
|
||||
}
|
||||
t>>=5;
|
||||
cli_putstr_P(PSTR("\r\n decrypt (cycles): "));
|
||||
printvalue(t);
|
||||
|
||||
if(bc.free){
|
||||
bc.free(&ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_stacksize(const bcdesc_t* bcd){
|
||||
bcdesc_t bc;
|
||||
stack_measuring_ctx_t smctx;
|
||||
memcpy_P(&bc, bcd, sizeof(bcdesc_t));
|
||||
uint8_t ctx[bc.ctxsize_B];
|
||||
uint8_t data[(bc.blocksize_b+7)/8];
|
||||
uint16_t keysize = get_keysize(bc.valid_keysize_desc);
|
||||
uint8_t key[(keysize+7)/8];
|
||||
uint16_t t1, t2;
|
||||
|
||||
if(bc.type!=BCDESC_TYPE_BLOCKCIPHER)
|
||||
return;
|
||||
cli_putstr_P(PSTR("\r\n\r\n === "));
|
||||
cli_putstr_P(bc.name);
|
||||
cli_putstr_P(PSTR(" stack-usage === "));
|
||||
|
||||
if(bc.init.init1){
|
||||
if((bc.flags&BC_INIT_TYPE)==BC_INIT_TYPE_1){
|
||||
cli();
|
||||
stack_measure_init(&smctx, PATTERN_A);
|
||||
bc.init.init1(&ctx, key);
|
||||
t1 = stack_measure_final(&smctx);
|
||||
stack_measure_init(&smctx, PATTERN_B);
|
||||
bc.init.init1(&ctx, key);
|
||||
t2 = stack_measure_final(&smctx);
|
||||
sei();
|
||||
} else {
|
||||
cli();
|
||||
stack_measure_init(&smctx, PATTERN_A);
|
||||
bc.init.init2(&ctx, keysize, key);
|
||||
t1 = stack_measure_final(&smctx);
|
||||
stack_measure_init(&smctx, PATTERN_B);
|
||||
bc.init.init2(&ctx, keysize, key);
|
||||
t2 = stack_measure_final(&smctx);
|
||||
sei();
|
||||
}
|
||||
t1 = (t1>t2)?t1:t2;
|
||||
cli_putstr_P(PSTR("\r\n init (bytes): "));
|
||||
printvalue((unsigned long)t1);
|
||||
}
|
||||
cli();
|
||||
stack_measure_init(&smctx, PATTERN_A);
|
||||
bc.enc.enc1(data, &ctx);
|
||||
t1 = stack_measure_final(&smctx);
|
||||
stack_measure_init(&smctx, PATTERN_B);
|
||||
bc.enc.enc1(data, &ctx);
|
||||
t2 = stack_measure_final(&smctx);
|
||||
sei();
|
||||
|
||||
t1 = (t1>t2)?t1:t2;
|
||||
cli_putstr_P(PSTR("\r\n encBlock (bytes): "));
|
||||
printvalue((unsigned long)t1);
|
||||
|
||||
cli();
|
||||
stack_measure_init(&smctx, PATTERN_A);
|
||||
bc.dec.dec1(data, &ctx);
|
||||
t1 = stack_measure_final(&smctx);
|
||||
stack_measure_init(&smctx, PATTERN_B);
|
||||
bc.dec.dec1(data, &ctx);
|
||||
t2 = stack_measure_final(&smctx);
|
||||
sei();
|
||||
|
||||
t1 = (t1>t2)?t1:t2;
|
||||
cli_putstr_P(PSTR("\r\n decBlock (bytes): "));
|
||||
printvalue((unsigned long)t1);
|
||||
|
||||
if(bc.free){
|
||||
bc.free(&ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void bcal_performance_multiple(const bcdesc_t** bcd_list){
|
||||
const bcdesc_t* bcd;
|
||||
for(;;){
|
||||
bcd = (void*)pgm_read_word(bcd_list);
|
||||
if(!bcd){
|
||||
cli_putstr_P(PSTR("\r\n\r\n End of performance figures\r\n"));
|
||||
return;
|
||||
}
|
||||
bcal_performance(bcd);
|
||||
bcal_stacksize(bcd);
|
||||
bcd_list = (void*)((uint8_t*)bcd_list + 2);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/* bcal-performance.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-performance.h
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2010-02-16
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BCAL_PERFORMANCE_H_
|
||||
#define BCAL_PERFORMANCE_H_
|
||||
|
||||
#include "blockcipher_descriptor.h"
|
||||
|
||||
void bcal_performance(const bcdesc_t* hd);
|
||||
void bcal_performance_multiple(const bcdesc_t** hd_list);
|
||||
|
||||
|
||||
#endif /* BCAL_PERFORMANCE_H_ */
|
|
@ -0,0 +1,55 @@
|
|||
/* bcal_aes128.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_aes128.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-08
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "aes.h"
|
||||
#include "aes128_enc.h"
|
||||
#include "aes128_dec.h"
|
||||
#include "aes_keyschedule.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char aes128_str[] PROGMEM = "AES-128";
|
||||
|
||||
const uint8_t aes128_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t aes128_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1,
|
||||
aes128_str,
|
||||
sizeof(aes128_ctx_t),
|
||||
128,
|
||||
{(void_fpt)aes128_init},
|
||||
{(void_fpt)aes128_enc},
|
||||
{(void_fpt)aes128_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
aes128_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/* bcal_aes128.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_aes128.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-08
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "aes.h"
|
||||
#include "aes128_enc.h"
|
||||
#include "aes128_dec.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t aes128_desc;
|
|
@ -0,0 +1,55 @@
|
|||
/* bcal_aes192.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_aes192.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-08
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "aes.h"
|
||||
#include "aes192_enc.h"
|
||||
#include "aes192_dec.h"
|
||||
#include "aes_keyschedule.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char aes192_str[] PROGMEM = "AES-192";
|
||||
|
||||
const uint8_t aes192_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(192),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t aes192_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1,
|
||||
aes192_str,
|
||||
sizeof(aes192_ctx_t),
|
||||
128,
|
||||
{(void_fpt)aes192_init},
|
||||
{(void_fpt)aes192_enc},
|
||||
{(void_fpt)aes192_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
aes192_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/* bcal_aes192.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_aes192.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-08
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "aes.h"
|
||||
#include "aes192_enc.h"
|
||||
#include "aes192_dec.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t aes192_desc;
|
|
@ -0,0 +1,55 @@
|
|||
/* bcal_aes256.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_aes256.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-08
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "aes.h"
|
||||
#include "aes256_enc.h"
|
||||
#include "aes256_dec.h"
|
||||
#include "aes_keyschedule.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char aes256_str[] PROGMEM = "AES-256";
|
||||
|
||||
const uint8_t aes256_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(256),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t aes256_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1,
|
||||
aes256_str,
|
||||
sizeof(aes256_ctx_t),
|
||||
128,
|
||||
{(void_fpt)aes256_init},
|
||||
{(void_fpt)aes256_enc},
|
||||
{(void_fpt)aes256_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
aes256_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/* bcal_aes256.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_aes256.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-08
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "aes.h"
|
||||
#include "aes256_enc.h"
|
||||
#include "aes256_dec.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t aes256_desc;
|
|
@ -0,0 +1,52 @@
|
|||
/* bcal_camellia128.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_camellia128.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "camellia.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char camellia128_str[] PROGMEM = "Camellia-128";
|
||||
|
||||
const uint8_t camellia128_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t camellia128_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_2,
|
||||
camellia128_str,
|
||||
sizeof(camellia128_ctx_t),
|
||||
128,
|
||||
{(void_fpt)camellia128_init},
|
||||
{(void_fpt)camellia128_enc},
|
||||
{(void_fpt)camellia128_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
camellia128_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_camellia128.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_camellia128.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "camellia.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t camellia128_desc;
|
|
@ -0,0 +1,52 @@
|
|||
/* bcal_cast5.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_cast5.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "cast5.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char cast5_str[] PROGMEM = "CAST5";
|
||||
|
||||
const uint8_t cast5_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(0), KS_INT(128),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t cast5_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_2,
|
||||
cast5_str,
|
||||
sizeof(cast5_ctx_t),
|
||||
128,
|
||||
{(void_fpt)cast5_init},
|
||||
{(void_fpt)cast5_enc},
|
||||
{(void_fpt)cast5_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
cast5_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_cast5.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_cast5.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "cast5.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t cast5_desc;
|
|
@ -0,0 +1,52 @@
|
|||
/* bcal_cast6.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_cast6.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-04-03
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "cast6.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char cast6_str[] PROGMEM = "CAST-256";
|
||||
|
||||
const uint8_t cast6_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(0), KS_INT(256),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t cast6_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_2,
|
||||
cast6_str,
|
||||
sizeof(cast6_ctx_t),
|
||||
128,
|
||||
{(void_fpt)cast6_init},
|
||||
{(void_fpt)cast6_enc},
|
||||
{(void_fpt)cast6_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
cast6_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_cast6.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_cast6.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-04-03
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "cast6.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t cast6_desc;
|
|
@ -0,0 +1,61 @@
|
|||
/* bcal_des.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_des.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "des.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char des_str[] PROGMEM = "DES";
|
||||
|
||||
const uint8_t des_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(64),
|
||||
KS_TYPE_TERMINATOR };
|
||||
static
|
||||
void des_dummy_enc(void* block, void* key){
|
||||
des_enc(block, block, key);
|
||||
}
|
||||
|
||||
static
|
||||
void des_dummy_dec(void* block, void* key){
|
||||
des_dec(block, block, key);
|
||||
}
|
||||
|
||||
const bcdesc_t des_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1,
|
||||
des_str,
|
||||
8,
|
||||
128,
|
||||
{(void_fpt)NULL},
|
||||
{(void_fpt)des_dummy_enc},
|
||||
{(void_fpt)des_dummy_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
des_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_des.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_des.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "des.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t des_desc;
|
|
@ -0,0 +1,41 @@
|
|||
/* bcal_noekeon.c */
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "noekeon/noekeon.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char noekeon_direct_str[] PROGMEM = "Noekeon-Direct";
|
||||
const char noekeon_indirect_str[] PROGMEM = "Noekeon-Indirect";
|
||||
|
||||
const uint8_t noekeon_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t noekeon_direct_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_ENC_TYPE_1,
|
||||
noekeon_direct_str,
|
||||
16,
|
||||
128,
|
||||
{(void_fpt)NULL},
|
||||
{(void_fpt)noekeon_enc},
|
||||
{(void_fpt)noekeon_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
noekeon_keysize_desc
|
||||
};
|
||||
|
||||
const bcdesc_t noekeon_indirect_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1 | BC_ENC_TYPE_1,
|
||||
noekeon_indirect_str,
|
||||
16,
|
||||
128,
|
||||
{(void_fpt)noekeon_init},
|
||||
{(void_fpt)noekeon_enc},
|
||||
{(void_fpt)noekeon_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
noekeon_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
/* bcal_noekeon.h */
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "noekeon/noekeon.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t noekeon_direct_desc;
|
||||
extern const bcdesc_t noekeon_indirect_desc;
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/* bcal_present.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_present.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "present.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char present_str[] PROGMEM = "Present";
|
||||
|
||||
const uint8_t present_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(80),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t present_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_2,
|
||||
present_str,
|
||||
sizeof(present_ctx_t),
|
||||
64,
|
||||
{(void_fpt)present_init},
|
||||
{(void_fpt)present_enc},
|
||||
{(void_fpt)present_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
present_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_present.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_present.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "present.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t present_desc;
|
|
@ -0,0 +1,59 @@
|
|||
/* bcal_rc5.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_rc5.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "rc5.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
#define RC5_ROUNDS 12
|
||||
|
||||
const char rc5_str[] PROGMEM = "RC5";
|
||||
|
||||
const uint8_t rc5_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1), KS_INT(2040),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
static
|
||||
void rc5_dummy_init(void* key, uint16_t keysize_b, void* ctx){
|
||||
rc5_init(key, keysize_b, RC5_ROUNDS, ctx);
|
||||
}
|
||||
|
||||
const bcdesc_t rc5_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_2,
|
||||
rc5_str,
|
||||
sizeof(rc5_ctx_t),
|
||||
128,
|
||||
{(void_fpt)rc5_dummy_init},
|
||||
{(void_fpt)rc5_enc},
|
||||
{(void_fpt)rc5_dec},
|
||||
(bc_free_fpt)rc5_free,
|
||||
rc5_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_rc5.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_rc5.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "rc5.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t rc5_desc;
|
|
@ -0,0 +1,52 @@
|
|||
/* bcal_rc6.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_rc6.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "rc6.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char rc6_str[] PROGMEM = "RC6";
|
||||
|
||||
const uint8_t rc6_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1), KS_INT(2040),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t rc6_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_2,
|
||||
rc6_str,
|
||||
sizeof(rc6_ctx_t),
|
||||
128,
|
||||
{(void_fpt)rc6_init},
|
||||
{(void_fpt)rc6_enc},
|
||||
{(void_fpt)rc6_dec},
|
||||
(bc_free_fpt)rc6_free,
|
||||
rc6_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_rc6.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_rc6.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "rc6.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t rc6_desc;
|
|
@ -0,0 +1,52 @@
|
|||
/* bcal_seed.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_seed.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "seed.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char seed_str[] PROGMEM = "SEED";
|
||||
|
||||
const uint8_t seed_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t seed_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1,
|
||||
seed_str,
|
||||
sizeof(seed_ctx_t),
|
||||
128,
|
||||
{(void_fpt)seed_init},
|
||||
{(void_fpt)seed_enc},
|
||||
{(void_fpt)seed_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
seed_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_seed.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_seed.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "seed.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t seed_desc;
|
|
@ -0,0 +1,52 @@
|
|||
/* bcal_serpent.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_serpent.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "serpent.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char serpent_str[] PROGMEM = "serpent";
|
||||
|
||||
const uint8_t serpent_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1), KS_INT(256),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t serpent_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_2,
|
||||
serpent_str,
|
||||
sizeof(serpent_ctx_t),
|
||||
128,
|
||||
{(void_fpt)serpent_init},
|
||||
{(void_fpt)serpent_enc},
|
||||
{(void_fpt)serpent_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
serpent_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_serpent.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_serpent.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "serpent.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t serpent_desc;
|
|
@ -0,0 +1,52 @@
|
|||
/* bcal_skipjack.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_skipjack.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "skipjack.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char skipjack_str[] PROGMEM = "Skipjack";
|
||||
|
||||
const uint8_t skipjack_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(80),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t skipjack_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1,
|
||||
skipjack_str,
|
||||
10,
|
||||
64,
|
||||
{(void_fpt)NULL},
|
||||
{(void_fpt)skipjack_enc},
|
||||
{(void_fpt)skipjack_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
skipjack_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_skipjack.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_skipjack.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "skipjack.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t skipjack_desc;
|
|
@ -0,0 +1,62 @@
|
|||
/* bcal_tdes.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_tdes.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "des.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char tdes_str[] PROGMEM = "TDES";
|
||||
|
||||
const uint8_t tdes_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(192),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
static
|
||||
void tdes_dummy_enc(void* block, void* key){
|
||||
tdes_enc(block, block, key);
|
||||
}
|
||||
|
||||
static
|
||||
void tdes_dummy_dec(void* block, void* key){
|
||||
tdes_dec(block, block, key);
|
||||
}
|
||||
|
||||
const bcdesc_t tdes_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1,
|
||||
tdes_str,
|
||||
24,
|
||||
64,
|
||||
{(void_fpt)NULL},
|
||||
{(void_fpt)tdes_dummy_enc},
|
||||
{(void_fpt)tdes_dummy_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
tdes_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_tdes.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_tdes.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "des.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t tdes_desc;
|
|
@ -0,0 +1,70 @@
|
|||
/* bcal_tdes2.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_tdes.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2010-02-02
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "des.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char tdes2_str[] PROGMEM = "TDES-2";
|
||||
|
||||
const uint8_t tdes2_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
static
|
||||
void tdes_dummy_enc(void* block, void* key){
|
||||
tdes_enc(block, block, key);
|
||||
}
|
||||
|
||||
static
|
||||
void tdes_dummy_dec(void* block, void* key){
|
||||
tdes_dec(block, block, key);
|
||||
}
|
||||
|
||||
static
|
||||
void tdes2_init(void* key, void* ctx){
|
||||
memcpy(ctx, key, 16);
|
||||
memcpy((uint8_t*)ctx+16, key, 8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const bcdesc_t tdes2_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1,
|
||||
tdes2_str,
|
||||
24,
|
||||
64,
|
||||
{(void_fpt)tdes2_init},
|
||||
{(void_fpt)tdes_dummy_enc},
|
||||
{(void_fpt)tdes_dummy_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
tdes2_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/* bcal_tdes2.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_tdes.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BCAL_TDES2_H_
|
||||
#define BCAL_TDES2_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "des.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t tdes2_desc;
|
||||
|
||||
#endif /* BCAL_TDES2_H_ */
|
|
@ -0,0 +1,56 @@
|
|||
/* bcal_threefish1024.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_threefish1024.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2010-02-20
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "threefish.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char threefish1024_str[] PROGMEM = "Threefish-1024";
|
||||
|
||||
const uint8_t threefish1024_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(1024),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
static void threefish1024_dummy_init(void* key, void* ctx){
|
||||
threefish1024_init(key, NULL, ctx);
|
||||
}
|
||||
|
||||
const bcdesc_t threefish1024_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1,
|
||||
threefish1024_str,
|
||||
sizeof(threefish1024_ctx_t),
|
||||
1024,
|
||||
{(void_fpt)threefish1024_dummy_init},
|
||||
{(void_fpt)threefish1024_enc},
|
||||
{(void_fpt)threefish1024_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
threefish1024_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_threefis1024.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_threefish1024.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2010-02-20
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "threefish.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t threefish1024_desc;
|
|
@ -0,0 +1,56 @@
|
|||
/* bcal_threefish256.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_threefish256.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2010-02-20
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "threefish.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char threefish256_str[] PROGMEM = "Threefish-256";
|
||||
|
||||
const uint8_t threefish256_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(256),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
static void threefish256_dummy_init(void* key, void* ctx){
|
||||
threefish256_init(key, NULL, ctx);
|
||||
}
|
||||
|
||||
const bcdesc_t threefish256_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1,
|
||||
threefish256_str,
|
||||
sizeof(threefish256_ctx_t),
|
||||
256,
|
||||
{(void_fpt)threefish256_dummy_init},
|
||||
{(void_fpt)threefish256_enc},
|
||||
{(void_fpt)threefish256_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
threefish256_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_threefis256.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_threefish256.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2010-02-20
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "threefish.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t threefish256_desc;
|
|
@ -0,0 +1,56 @@
|
|||
/* bcal_threefish512.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_threefish512.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2010-02-20
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "threefish.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char threefish512_str[] PROGMEM = "Threefish-512";
|
||||
|
||||
const uint8_t threefish512_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(512),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
static void threefish512_dummy_init(void* key, void* ctx){
|
||||
threefish512_init(key, NULL, ctx);
|
||||
}
|
||||
|
||||
const bcdesc_t threefish512_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_1,
|
||||
threefish512_str,
|
||||
sizeof(threefish512_ctx_t),
|
||||
512,
|
||||
{(void_fpt)threefish512_dummy_init},
|
||||
{(void_fpt)threefish512_enc},
|
||||
{(void_fpt)threefish512_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
threefish512_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_threefis512.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_threefish512.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2010-02-20
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "threefish.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t threefish512_desc;
|
|
@ -0,0 +1,62 @@
|
|||
/* bcal_xtea.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_xtea.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "xtea.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
const char xtea_str[] PROGMEM = "XTEA";
|
||||
|
||||
const uint8_t xtea_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
static
|
||||
void xtea_dummy_enc(void* block, void* key){
|
||||
xtea_enc(block, block, key);
|
||||
}
|
||||
|
||||
static
|
||||
void xtea_dummy_dec(void* block, void* key){
|
||||
xtea_dec(block, block, key);
|
||||
}
|
||||
|
||||
const bcdesc_t xtea_desc PROGMEM = {
|
||||
BCDESC_TYPE_BLOCKCIPHER,
|
||||
BC_INIT_TYPE_2,
|
||||
xtea_str,
|
||||
16,
|
||||
64,
|
||||
{(void_fpt)NULL},
|
||||
{(void_fpt)xtea_dummy_enc},
|
||||
{(void_fpt)xtea_dummy_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
xtea_keysize_desc
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* bcal_xtea.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file bcal_xtea.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-01-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "blockcipher_descriptor.h"
|
||||
#include "xtea.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t xtea_desc;
|
|
@ -0,0 +1,3 @@
|
|||
sx#include\([^"<]*["<]\)noekeonx#include\1noekeon/noekeonx
|
||||
sq#include\([^"<]*["<]\)memxorq#include\1memxor/memxorq
|
||||
sq#include\([^"<]*["<]\)gf256mulq#include\1gf256mul/gf256mulq
|
|
@ -0,0 +1,82 @@
|
|||
/* gf256mul.S */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: gf256mul.S
|
||||
* Author: Daniel Otte
|
||||
* Date: 2008-12-19
|
||||
* License: GPLv3 or later
|
||||
* Description: peasant's algorithm for multiplication in GF(2^8)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/io.h>
|
||||
#define OPTIMIZE_SMALL_A
|
||||
|
||||
/*
|
||||
* param a: r24
|
||||
* param b: r22
|
||||
* param reducer: r20
|
||||
*/
|
||||
A = 23
|
||||
B = 22
|
||||
P = 24
|
||||
.global gf256mul
|
||||
|
||||
#ifdef OPTIMIZE_SMALL_A
|
||||
gf256mul:
|
||||
mov A, r24
|
||||
clr r24
|
||||
1:
|
||||
lsr A
|
||||
breq 4f
|
||||
brcc 2f
|
||||
eor P, B
|
||||
2:
|
||||
lsl B
|
||||
brcc 3f
|
||||
eor B, r20
|
||||
3:
|
||||
rjmp 1b
|
||||
4:
|
||||
brcc 2f
|
||||
eor P, B
|
||||
2:
|
||||
ret
|
||||
|
||||
#else
|
||||
|
||||
gf256mul:
|
||||
mov r21, r24
|
||||
clr r24
|
||||
ldi r25, 8
|
||||
1:
|
||||
lsr A
|
||||
brcc 2f
|
||||
eor P, B
|
||||
2:
|
||||
lsl B
|
||||
brcc 3f
|
||||
eor B, r20
|
||||
3:
|
||||
dec r25
|
||||
brne 1b
|
||||
ret
|
||||
|
||||
#endif
|
|
@ -0,0 +1,37 @@
|
|||
/* gf256mul.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
#ifndef GF256MUL_H_
|
||||
#define GF256MUL_H_
|
||||
|
||||
/**
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2008-12-19
|
||||
* \license GPLv3
|
||||
* \brief
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t gf256mul(uint8_t a, uint8_t b, uint8_t reducer);
|
||||
|
||||
#endif /* GF256MUL_H_ */
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
/* hfal-basic.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "hfal-basic.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
uint8_t hfal_hash_init(const hfdesc_t* hash_descriptor, hfgen_ctx_t* ctx){
|
||||
hf_init_fpt f;
|
||||
uint16_t tmp;
|
||||
ctx->desc_ptr = (hfdesc_t*)hash_descriptor;
|
||||
tmp = pgm_read_word(&(hash_descriptor->ctxsize_B));
|
||||
if(!(ctx->ctx=malloc(tmp)))
|
||||
return 3;
|
||||
f= (hf_init_fpt)pgm_read_word(&(hash_descriptor->init));
|
||||
f(ctx->ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hfal_hash_nextBlock(hfgen_ctx_t* ctx, const void* block){
|
||||
hf_nextBlock_fpt f;
|
||||
hfdesc_t* x=(ctx->desc_ptr);
|
||||
f =(hf_nextBlock_fpt)pgm_read_word(&(x->nextBlock));
|
||||
f(ctx->ctx, block);
|
||||
}
|
||||
|
||||
void hfal_hash_lastBlock(hfgen_ctx_t* ctx, const void* block, uint16_t length_b){
|
||||
hf_lastBlock_fpt f;
|
||||
hfdesc_t* x=ctx->desc_ptr;
|
||||
f =(hf_lastBlock_fpt)pgm_read_word(&(x->lastBlock));
|
||||
f(ctx->ctx, block, length_b);
|
||||
}
|
||||
|
||||
void hfal_hash_ctx2hash(void* dest, hfgen_ctx_t* ctx){
|
||||
hf_ctx2hash_fpt f;
|
||||
hfdesc_t* x=ctx->desc_ptr;
|
||||
f =(hf_ctx2hash_fpt)pgm_read_word(&(x->ctx2hash));
|
||||
f(dest, ctx->ctx);
|
||||
}
|
||||
|
||||
void hfal_hash_free(hfgen_ctx_t* ctx){
|
||||
hf_free_fpt f;
|
||||
hfdesc_t* x=ctx->desc_ptr;
|
||||
f =(hf_free_fpt)pgm_read_word(&(x->free));
|
||||
if(f)
|
||||
f(ctx->ctx);
|
||||
free(ctx->ctx);
|
||||
}
|
||||
|
||||
void hfal_hash_mem(const hfdesc_t* hash_descriptor, void* dest, const void* msg, uint32_t length_b){
|
||||
void_fpt f;
|
||||
f = (void_fpt)pgm_read_word(&(hash_descriptor->mem));
|
||||
if(f){
|
||||
((hf_mem_fpt)f)(dest, msg, length_b);
|
||||
}else{
|
||||
uint16_t bs,bsb;
|
||||
uint8_t ctx[pgm_read_word(&(hash_descriptor->ctxsize_B))];
|
||||
f=(void_fpt)(pgm_read_word(&(hash_descriptor->init)));
|
||||
((hf_init_fpt)f)(ctx);
|
||||
bs=pgm_read_word(&(hash_descriptor->blocksize_b));
|
||||
bsb=bs/8;
|
||||
f=(void_fpt)(pgm_read_word(&(hash_descriptor->nextBlock)));
|
||||
while(length_b>bs){
|
||||
((hf_nextBlock_fpt)f)(ctx, msg);
|
||||
length_b -= bs;
|
||||
msg = (uint8_t*)msg + bsb;
|
||||
}
|
||||
f=(void_fpt)(pgm_read_word(&(hash_descriptor->lastBlock)));
|
||||
((hf_lastBlock_fpt)f)(ctx, msg, length_b);
|
||||
f=(void_fpt)(pgm_read_word(&(hash_descriptor->ctx2hash)));
|
||||
((hf_ctx2hash_fpt)f)(dest, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t hfal_hash_getBlocksize(const hfdesc_t* hash_descriptor){
|
||||
uint16_t ret;
|
||||
ret = pgm_read_word(&(hash_descriptor->blocksize_b));
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint16_t hfal_hash_getHashsize(const hfdesc_t* hash_descriptor){
|
||||
uint16_t ret;
|
||||
ret = pgm_read_word(&(hash_descriptor->hashsize_b));
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/* hfal-basic.h */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 HFAL_BASIC_H_
|
||||
#define HFAL_BASIC_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
uint8_t hfal_hash_init(const hfdesc_t* hash_descriptor, hfgen_ctx_t* ctx);
|
||||
void hfal_hash_nextBlock(hfgen_ctx_t* ctx, const void* block);
|
||||
void hfal_hash_lastBlock(hfgen_ctx_t* ctx, const void* block, uint16_t length_b);
|
||||
void hfal_hash_ctx2hash(void* dest, hfgen_ctx_t* ctx);
|
||||
void hfal_hash_free(hfgen_ctx_t* ctx);
|
||||
void hfal_hash_mem(const hfdesc_t* hash_descriptor, void* dest, const void* msg, uint32_t length_b);
|
||||
uint16_t hfal_hash_getBlocksize(const hfdesc_t* hash_descriptor);
|
||||
uint16_t hfal_hash_getHashsize(const hfdesc_t* hash_descriptor);
|
||||
|
||||
#endif /* HFAL_BASIC_H_ */
|
|
@ -0,0 +1,127 @@
|
|||
/* hfal-hmac.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "hfal-basic.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define IPAD 0x36
|
||||
#define OPAD 0x5C
|
||||
|
||||
uint8_t hfal_hmac_init(const hfdesc_t* hash_descriptor,
|
||||
hfhmacgen_ctx_t* ctx,
|
||||
const void* key, uint16_t keylength_b){
|
||||
uint16_t bs = hfal_hash_getBlocksize();
|
||||
uint8_t buffer[bs/8];
|
||||
uint8_t i;
|
||||
hf_init_fpt init;
|
||||
hf_nextBlock_fpt nextBlock;
|
||||
memset(buffer, 0, bs/8);
|
||||
ctx->desc = hash_descriptor;
|
||||
ctx->ctx = malloc(pgm_read_word(&(hash_descriptor->ctxsize_B)));
|
||||
ctx->finctx = malloc(pgm_read_word(&(hash_descriptor->ctxsize_B)));
|
||||
if(ctx->ctx==NULL && ctx->finctx==NULL)
|
||||
return 3;
|
||||
if(ctx->finctx==NULL){
|
||||
free(ctx->ctx)
|
||||
return 2;
|
||||
}
|
||||
if(ctx->ctx==NULL){
|
||||
free(ctx->finctx)
|
||||
return 1;
|
||||
}
|
||||
if(keylength_b>bs){
|
||||
hfal_hash_mem(hash_descriptor, buffer, key, keylength_b);
|
||||
} else {
|
||||
memcpy(buffer, key, (keylength_b+7)/8);
|
||||
}
|
||||
for(i=0; i<bs/8; ++i){
|
||||
buffer[i] ^= IPAD;
|
||||
}
|
||||
init = pgm_read_word(&(hash_descriptor->init));
|
||||
nextBlock = pgm_read_word(&(hash_descriptor->nextBlock));
|
||||
init(ctx->ctx);
|
||||
init(ctx->finctx);
|
||||
nextBlock(ctx->ctx, buffer);
|
||||
for(i=0; i<bs/8; ++i){
|
||||
buffer[i] ^= IPAD^OPAD;
|
||||
}
|
||||
nextBlock(ctx->finctx, buffer);
|
||||
memset(buffer, 0, bs/8);
|
||||
}
|
||||
|
||||
void hfal_hmac_nextBlock(hfhmacgen_ctx_t* ctx, const void* block){
|
||||
hf_nextBlock_fpt nextBlock;
|
||||
nextBlock = pgm_read_word(&(hash_descriptor->nextBlock));
|
||||
nextBlock(ctx->ctx, block);
|
||||
}
|
||||
|
||||
void hfal_hmac_lastBlock(hfhmacgen_ctx_t* ctx, const void* block, uint16_t length_b){
|
||||
hf_lastBlock_fpt lastBlock;
|
||||
hf_ctx2hash_fpt ctx2hash;
|
||||
uint16_t hs = pgm_read_word(&(hash_descriptor->hashsize_b));
|
||||
uint8_t buffer[(hs+7)/8];
|
||||
lastBlock = pgm_read_word(&(hash_descriptor->lastBlock));
|
||||
ctx2hash = pgm_read_word(&(hash_descriptor->ctx2hash));
|
||||
lastBlock(ctx->ctx, block, length_b);
|
||||
ctx2hash(buffer, ctx->ctx);
|
||||
lastBlock(ctx->finctx, buffer, hs);
|
||||
}
|
||||
|
||||
void hfal_hmac_ctx2mac(void* dest, hfhmacgen_ctx_t* ctx){
|
||||
hf_ctx2hash_fpt ctx2hash;
|
||||
ctx2hash = pgm_read_word(&(hash_descriptor->ctx2hash));
|
||||
ctx2hash(dest, ctx->finctx);
|
||||
}
|
||||
|
||||
void hfal_hmac_free(hfhmacgen_ctx_t* ctx){
|
||||
hf_free_fpt free_fpt;
|
||||
free_fpt = pgm_read_word(&(hash_descriptor->free));
|
||||
if(free_fpt){
|
||||
free_fpt(ctx->ctx);
|
||||
free_fpt(ctx->finctx);
|
||||
}
|
||||
free(ctx->ctx)
|
||||
free(ctx->finctx)
|
||||
}
|
||||
|
||||
void hfal_hmac_mem(const hfdesc_t* hash_descriptor, const void* key, uint16_t keylength_b, void* dest, const void* msg, uint32_t length_b){
|
||||
hfhmacgen_ctx_t ctx;
|
||||
uint16_t bs = hfal_hash_getBlocksize();
|
||||
hfal_hmac_init(hash_descriptor, &ctx, key, keylength_b);
|
||||
while(length_b>bs){
|
||||
hfal_hmac_nextBlock(&ctx, msg);
|
||||
msg = msg + bs/8;
|
||||
length_b-=bs;
|
||||
}
|
||||
hfal_hmac_lastBlock(&ctx, msg, length_b);
|
||||
hfal_hmac_ctx2mac(dest, &ctx);
|
||||
hfal_free(&ctx);
|
||||
}
|
||||
|
||||
uint16_t hfal_hmac_getBlocksize(const hfdesc_t* hash_descriptor){
|
||||
return hfal_hash_getBlocksize(hash_descriptor);
|
||||
}
|
||||
|
||||
uint16_t hfal_hmac_getMACsize(const hfdesc_t* hash_descriptor){
|
||||
return hfal_hash_getHashsize(hash_descriptor);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/* hfal-hmac.h */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 HFAL_HMAC_H_
|
||||
#define HFAL_HMAC_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
typedef struct {
|
||||
hfdesc_t* desc;
|
||||
void* ctx;
|
||||
void* finctx;
|
||||
} hfhmacgen_ctx_t;
|
||||
|
||||
uint8_t hfal_hmac_init(const hfdesc_t* hash_descriptor, hfhmacgen_ctx_t* ctx, const void* key, uint16_t keylength_b);
|
||||
void hfal_hmac_nextBlock(hfhmacgen_ctx_t* ctx, const void* block);
|
||||
void hfal_hmac_lastBlock(hfhmacgen_ctx_t* ctx, const void* block, uint16_t length_b);
|
||||
void hfal_hmac_ctx2mac(void* dest, hfhmacgen_ctx_t* ctx);
|
||||
void hfal_hmac_free(hfhmacgen_ctx_t* ctx);
|
||||
void hfal_hmac_mem(const hfdesc_t* hash_descriptor, const void* key, uint16_t keylength_b, void* dest, const void* msg, uint32_t length_b);
|
||||
uint16_t hfal_hmac_getBlocksize(const hfdesc_t* hash_descriptor);
|
||||
uint16_t hfal_hmac_getMACsize(const hfdesc_t* hash_descriptor);
|
||||
|
||||
#endif /* HFAL_HMAC_H_ */
|
|
@ -0,0 +1,61 @@
|
|||
/* hfal-nessie.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 hfal-nessie.c
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nessie_hash_test.h"
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include <stdint.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
void hfal_nessie(const hfdesc_t* hd){
|
||||
if(pgm_read_byte(&(hd->type))!=HFDESC_TYPE_HASHFUNCTION)
|
||||
return;
|
||||
char name[1+strlen_P((void*)pgm_read_word(&(hd->name)))];
|
||||
strcpy_P(name, (void*)pgm_read_word(&(hd->name)));
|
||||
|
||||
nessie_hash_ctx.hashsize_b = pgm_read_word(&(hd->hashsize_b));
|
||||
nessie_hash_ctx.name = name;
|
||||
nessie_hash_ctx.blocksize_B = pgm_read_word(&(hd->blocksize_b))/8;
|
||||
nessie_hash_ctx.ctx_size_B = pgm_read_word(&(hd->ctxsize_B));
|
||||
nessie_hash_ctx.hash_init = (nessie_hash_init_fpt)pgm_read_word(&(hd->init));
|
||||
nessie_hash_ctx.hash_next = (nessie_hash_next_fpt)pgm_read_word(&(hd->nextBlock));
|
||||
nessie_hash_ctx.hash_last = (nessie_hash_last_fpt)pgm_read_word(&(hd->lastBlock));
|
||||
nessie_hash_ctx.hash_conv = (nessie_hash_conv_fpt)pgm_read_word(&(hd->ctx2hash));
|
||||
|
||||
nessie_hash_run();
|
||||
}
|
||||
|
||||
void hfal_nessie_multiple(const hfdesc_t** hd_list){
|
||||
const hfdesc_t* hd;
|
||||
for(;;){
|
||||
hd = (void*)pgm_read_word(hd_list);
|
||||
if(!hd)
|
||||
return;
|
||||
hfal_nessie(hd);
|
||||
hd_list = (void*)((uint8_t*)hd_list + 2);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/* hfal-nessie.h */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 hfal-nessie.h
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_NESSIE_H_
|
||||
#define HFAL_NESSIE_H_
|
||||
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
void hfal_nessie(const hfdesc_t* hd);
|
||||
void hfal_nessie_multiple(const hfdesc_t** hd_list);
|
||||
|
||||
#endif /* HFAL_NESSIE_H_ */
|
|
@ -0,0 +1,219 @@
|
|||
/* hfal-performance.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 hfal-performance.c
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hfal-performance.h"
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "stack_measuring.h"
|
||||
#include "cli.h"
|
||||
#include "performance_test.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#define PATTERN_A 0xAA
|
||||
#define PATTERN_B 0x55
|
||||
|
||||
static
|
||||
void printvalue(unsigned long v){
|
||||
char str[20];
|
||||
int i;
|
||||
ultoa(v, str, 10);
|
||||
for(i=0; i<10-strlen(str); ++i){
|
||||
cli_putc(' ');
|
||||
}
|
||||
cli_putstr(str);
|
||||
}
|
||||
|
||||
void hfal_performance(const hfdesc_t* hd){
|
||||
hfdesc_t hf;
|
||||
memcpy_P(&hf, hd, sizeof(hfdesc_t));
|
||||
uint8_t ctx[hf.ctxsize_B];
|
||||
uint8_t data[(hf.blocksize_b+7)/8];
|
||||
uint8_t digest[(hf.hashsize_b+7)/8];
|
||||
uint64_t t;
|
||||
uint8_t i;
|
||||
|
||||
if(hf.type!=HFDESC_TYPE_HASHFUNCTION)
|
||||
return;
|
||||
calibrateTimer();
|
||||
print_overhead();
|
||||
cli_putstr_P(PSTR("\r\n\r\n === "));
|
||||
cli_putstr_P(hf.name);
|
||||
cli_putstr_P(PSTR(" performance === "
|
||||
"\r\n type: hashfunction"
|
||||
"\r\n hashsize (bits): "));
|
||||
printvalue(hf.hashsize_b);
|
||||
|
||||
cli_putstr_P(PSTR("\r\n ctxsize (bytes): "));
|
||||
printvalue(hf.ctxsize_B);
|
||||
|
||||
cli_putstr_P(PSTR("\r\n blocksize (bits): "));
|
||||
printvalue(hf.blocksize_b);
|
||||
|
||||
t=0;
|
||||
for(i=0; i<32; ++i){
|
||||
startTimer(0);
|
||||
START_TIMER;
|
||||
hf.init(&ctx);
|
||||
STOP_TIMER;
|
||||
t += stopTimer();
|
||||
if(i!=31 && hf.free){
|
||||
hf.free(&ctx);
|
||||
}
|
||||
}
|
||||
t>>=5;
|
||||
cli_putstr_P(PSTR("\r\n init (cycles): "));
|
||||
printvalue(t);
|
||||
|
||||
t=0;
|
||||
for(i=0; i<32; ++i){
|
||||
startTimer(0);
|
||||
START_TIMER;
|
||||
hf.nextBlock(&ctx, data);
|
||||
STOP_TIMER;
|
||||
t += stopTimer();
|
||||
}
|
||||
t>>=5;
|
||||
cli_putstr_P(PSTR("\r\n nextBlock (cycles): "));
|
||||
printvalue(t);
|
||||
|
||||
t=0;
|
||||
for(i=0; i<32; ++i){
|
||||
startTimer(0);
|
||||
START_TIMER;
|
||||
hf.lastBlock(&ctx, data, 0);
|
||||
STOP_TIMER;
|
||||
t += stopTimer();
|
||||
}
|
||||
t>>=5;
|
||||
cli_putstr_P(PSTR("\r\n lastBlock (cycles): "));
|
||||
printvalue(t);
|
||||
|
||||
t=0;
|
||||
for(i=0; i<32; ++i){
|
||||
startTimer(0);
|
||||
START_TIMER;
|
||||
hf.ctx2hash(digest, &ctx);
|
||||
STOP_TIMER;
|
||||
t += stopTimer();
|
||||
}
|
||||
t>>=5;
|
||||
cli_putstr_P(PSTR("\r\n ctx2hash (cycles): "));
|
||||
printvalue(t);
|
||||
|
||||
if(hf.free){
|
||||
hf.free(&ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void hfal_stacksize(const hfdesc_t* hd){
|
||||
hfdesc_t hf;
|
||||
stack_measuring_ctx_t smctx;
|
||||
memcpy_P(&hf, hd, sizeof(hfdesc_t));
|
||||
uint8_t ctx[hf.ctxsize_B];
|
||||
uint8_t data[(hf.blocksize_b+7)/8];
|
||||
uint8_t digest[(hf.hashsize_b+7)/8];
|
||||
uint16_t t1, t2;
|
||||
|
||||
if(hf.type!=HFDESC_TYPE_HASHFUNCTION)
|
||||
return;
|
||||
cli_putstr_P(PSTR("\r\n\r\n === "));
|
||||
cli_putstr_P(hf.name);
|
||||
cli_putstr_P(PSTR(" stack-usage === "));
|
||||
|
||||
cli();
|
||||
stack_measure_init(&smctx, PATTERN_A);
|
||||
hf.init(&ctx);
|
||||
t1 = stack_measure_final(&smctx);
|
||||
stack_measure_init(&smctx, PATTERN_B);
|
||||
hf.init(&ctx);
|
||||
t2 = stack_measure_final(&smctx);
|
||||
sei();
|
||||
|
||||
t1 = (t1>t2)?t1:t2;
|
||||
cli_putstr_P(PSTR("\r\n init (bytes): "));
|
||||
printvalue((unsigned long)t1);
|
||||
|
||||
cli();
|
||||
stack_measure_init(&smctx, PATTERN_A);
|
||||
hf.nextBlock(&ctx, data);
|
||||
t1 = stack_measure_final(&smctx);
|
||||
stack_measure_init(&smctx, PATTERN_B);
|
||||
hf.nextBlock(&ctx, data);
|
||||
t2 = stack_measure_final(&smctx);
|
||||
sei();
|
||||
|
||||
t1 = (t1>t2)?t1:t2;
|
||||
cli_putstr_P(PSTR("\r\n nextBlock (bytes): "));
|
||||
printvalue((unsigned long)t1);
|
||||
|
||||
cli();
|
||||
stack_measure_init(&smctx, PATTERN_A);
|
||||
hf.lastBlock(&ctx, data, 0);
|
||||
t1 = stack_measure_final(&smctx);
|
||||
stack_measure_init(&smctx, PATTERN_B);
|
||||
hf.lastBlock(&ctx, data, 0);
|
||||
t2 = stack_measure_final(&smctx);
|
||||
sei();
|
||||
|
||||
t1 = (t1>t2)?t1:t2;
|
||||
cli_putstr_P(PSTR("\r\n lastBlock (bytes): "));
|
||||
printvalue((unsigned long)t1);
|
||||
|
||||
cli();
|
||||
stack_measure_init(&smctx, PATTERN_A);
|
||||
hf.ctx2hash(digest, &ctx);
|
||||
t1 = stack_measure_final(&smctx);
|
||||
stack_measure_init(&smctx, PATTERN_B);
|
||||
hf.ctx2hash(digest, &ctx);
|
||||
t2 = stack_measure_final(&smctx);
|
||||
sei();
|
||||
|
||||
t1 = (t1>t2)?t1:t2;
|
||||
cli_putstr_P(PSTR("\r\n ctx2hash (bytes): "));
|
||||
printvalue((unsigned long)t1);
|
||||
|
||||
if(hf.free){
|
||||
hf.free(&ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void hfal_performance_multiple(const hfdesc_t** hd_list){
|
||||
const hfdesc_t* hd;
|
||||
for(;;){
|
||||
hd = (void*)pgm_read_word(hd_list);
|
||||
if(!hd){
|
||||
cli_putstr_P(PSTR("\r\n\r\n End of performance figures\r\n"));
|
||||
return;
|
||||
}
|
||||
hfal_performance(hd);
|
||||
hfal_stacksize(hd);
|
||||
hd_list = (void*)((uint8_t*)hd_list + 2);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/* hfal-performance.h */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 hfal-performance.h
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_PERFORMANCE_H_
|
||||
#define HFAL_PERFORMANCE_H_
|
||||
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
void hfal_performance(const hfdesc_t* hd);
|
||||
void hfal_performance_multiple(const hfdesc_t** hd_list);
|
||||
#endif /* HFAL_PERFORMANCE_H_ */
|
|
@ -0,0 +1,49 @@
|
|||
/* hfal-test.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 hfal-test.c
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hfal-basic.h"
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "cli.h"
|
||||
#include <stdint.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
void hfal_test(const hfdesc_t* hd, void* msg, uint32_t length_b){
|
||||
if(pgm_read_byte(&(hd->type))!=HFDESC_TYPE_HASHFUNCTION)
|
||||
return;
|
||||
uint16_t dlen = (pgm_read_word(&(hd->hashsize_b))+7)/8;
|
||||
uint8_t digest[dlen];
|
||||
cli_putstr_P(PSTR("\r\n=== "));
|
||||
cli_putstr_P((void*)pgm_read_word(&(hd->name)));
|
||||
cli_putstr_P(PSTR(" ===\r\n message:"));
|
||||
cli_hexdump_block(msg, (length_b+7)/8, 4, 16);
|
||||
hfal_hash_mem(hd, digest, msg, length_b);
|
||||
cli_putstr_P(PSTR(" \r\n digest:"));
|
||||
cli_hexdump_block(digest, dlen, 4, 16);
|
||||
cli_putstr_P(PSTR("\r\n"));
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/* hfal-test.h */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 hfal-test.h
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_TEST_H_
|
||||
#define HFAL_TEST_H_
|
||||
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void hfal_test(const hfdesc_t* hd, void* msg, uint32_t length_b);
|
||||
|
||||
#endif /* HFAL_TEST_H_ */
|
|
@ -0,0 +1,67 @@
|
|||
/* hfal_blake_large.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_blake_large.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-05-08
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "blake_large.h"
|
||||
|
||||
|
||||
static const char blake48_str[] PROGMEM = "Blake-48";
|
||||
static const char blake64_str[] PROGMEM = "Blake-64";
|
||||
|
||||
const hfdesc_t blake48_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
blake48_str,
|
||||
sizeof(blake48_ctx_t),
|
||||
BLAKE48_BLOCKSIZE,
|
||||
384,
|
||||
(hf_init_fpt)blake48_init,
|
||||
(hf_nextBlock_fpt)blake_large_nextBlock,
|
||||
(hf_lastBlock_fpt)blake_large_lastBlock,
|
||||
(hf_ctx2hash_fpt)blake48_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)blake48
|
||||
};
|
||||
|
||||
const hfdesc_t blake64_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
blake64_str,
|
||||
sizeof(blake64_ctx_t),
|
||||
BLAKE64_BLOCKSIZE,
|
||||
512,
|
||||
(hf_init_fpt)blake64_init,
|
||||
(hf_nextBlock_fpt)blake_large_nextBlock,
|
||||
(hf_lastBlock_fpt)blake_large_lastBlock,
|
||||
(hf_ctx2hash_fpt)blake64_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)blake64
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/* hfal_blake_large.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_blake_large.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-05-08
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_BLAKE_LARGE_H_
|
||||
#define HFAL_BLAKE_LARGE_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t blake48_desc;
|
||||
extern const hfdesc_t blake64_desc;
|
||||
|
||||
#endif /* HFAL_BLAKE_LARGE_H_ */
|
|
@ -0,0 +1,67 @@
|
|||
/* hfal_blake_small.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 hfal_blake_small.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-05-05
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "blake_small.h"
|
||||
|
||||
|
||||
static const char blake28_str[] PROGMEM = "Blake-28";
|
||||
static const char blake32_str[] PROGMEM = "Blake-32";
|
||||
|
||||
const hfdesc_t blake28_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
blake28_str,
|
||||
sizeof(blake28_ctx_t),
|
||||
BLAKE28_BLOCKSIZE,
|
||||
224,
|
||||
(hf_init_fpt)blake28_init,
|
||||
(hf_nextBlock_fpt)blake_small_nextBlock,
|
||||
(hf_lastBlock_fpt)blake_small_lastBlock,
|
||||
(hf_ctx2hash_fpt)blake28_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)blake28
|
||||
};
|
||||
|
||||
const hfdesc_t blake32_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
blake32_str,
|
||||
sizeof(blake32_ctx_t),
|
||||
BLAKE32_BLOCKSIZE,
|
||||
256,
|
||||
(hf_init_fpt)blake32_init,
|
||||
(hf_nextBlock_fpt)blake_small_nextBlock,
|
||||
(hf_lastBlock_fpt)blake_small_lastBlock,
|
||||
(hf_ctx2hash_fpt)blake32_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)blake32
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/* hfal_blake_small.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_blake_small.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-05-05
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_BLAKE_SMALL_H_
|
||||
#define HFAL_BLAKE_SMALL_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t blake28_desc;
|
||||
extern const hfdesc_t blake32_desc;
|
||||
|
||||
#endif /* HFAL_BLAKE_SMALL_H_ */
|
|
@ -0,0 +1,67 @@
|
|||
/* hfal_bmw_large.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_bmw_large.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-04-28
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "bmw_large.h"
|
||||
|
||||
|
||||
static const char bmw384_str[] PROGMEM = "BlueMidnightWish-384";
|
||||
static const char bmw512_str[] PROGMEM = "BlueMidnightWish-512";
|
||||
|
||||
const hfdesc_t bmw384_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
bmw384_str,
|
||||
sizeof(bmw384_ctx_t),
|
||||
BMW384_BLOCKSIZE,
|
||||
384,
|
||||
(hf_init_fpt)bmw384_init,
|
||||
(hf_nextBlock_fpt)bmw384_nextBlock,
|
||||
(hf_lastBlock_fpt)bmw384_lastBlock,
|
||||
(hf_ctx2hash_fpt)bmw384_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)bmw384
|
||||
};
|
||||
|
||||
const hfdesc_t bmw512_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
bmw512_str,
|
||||
sizeof(bmw512_ctx_t),
|
||||
BMW512_BLOCKSIZE,
|
||||
512,
|
||||
(hf_init_fpt)bmw512_init,
|
||||
(hf_nextBlock_fpt)bmw512_nextBlock,
|
||||
(hf_lastBlock_fpt)bmw512_lastBlock,
|
||||
(hf_ctx2hash_fpt)bmw512_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)bmw512
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/* hfal_bmw_large.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_bmw_large.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-04-28
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_BMW_LARGE_H_
|
||||
#define HFAL_BMW_LARGE_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t bmw384_desc;
|
||||
extern const hfdesc_t bmw512_desc;
|
||||
|
||||
#endif /* HFAL_BMW_LARGE_H_ */
|
|
@ -0,0 +1,67 @@
|
|||
/* hfal_bmw_small.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_bmw_small.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-04-28
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "bmw_small.h"
|
||||
|
||||
|
||||
static const char bmw224_str[] PROGMEM = "BlueMidnightWish-224";
|
||||
static const char bmw256_str[] PROGMEM = "BlueMidnightWish-256";
|
||||
|
||||
const hfdesc_t bmw224_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
bmw224_str,
|
||||
sizeof(bmw224_ctx_t),
|
||||
BMW224_BLOCKSIZE,
|
||||
224,
|
||||
(hf_init_fpt)bmw224_init,
|
||||
(hf_nextBlock_fpt)bmw224_nextBlock,
|
||||
(hf_lastBlock_fpt)bmw224_lastBlock,
|
||||
(hf_ctx2hash_fpt)bmw224_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)bmw224
|
||||
};
|
||||
|
||||
const hfdesc_t bmw256_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
bmw256_str,
|
||||
sizeof(bmw256_ctx_t),
|
||||
BMW256_BLOCKSIZE,
|
||||
256,
|
||||
(hf_init_fpt)bmw256_init,
|
||||
(hf_nextBlock_fpt)bmw256_nextBlock,
|
||||
(hf_lastBlock_fpt)bmw256_lastBlock,
|
||||
(hf_ctx2hash_fpt)bmw256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)bmw256
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/* hfal_bmw_small.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_bmw_small.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-04-28
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_BMW_SMALL_H_
|
||||
#define HFAL_BMW_SMALL_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t bmw224_desc;
|
||||
extern const hfdesc_t bmw256_desc;
|
||||
|
||||
#endif /* HFAL_BMW_SMALL_H_ */
|
|
@ -0,0 +1,99 @@
|
|||
/* hfal_cubehash.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 hfal_cubehash.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2010-02-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "cubehash.h"
|
||||
|
||||
|
||||
static const char cubehash224_str[] PROGMEM = "CubeHash-224";
|
||||
static const char cubehash256_str[] PROGMEM = "CubeHash-256";
|
||||
static const char cubehash384_str[] PROGMEM = "CubeHash-384";
|
||||
static const char cubehash512_str[] PROGMEM = "CubeHash-512";
|
||||
|
||||
const hfdesc_t cubehash224_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
cubehash224_str,
|
||||
sizeof(cubehash_ctx_t),
|
||||
CUBEHASH224_BLOCKSIZE,
|
||||
224,
|
||||
(hf_init_fpt)cubehash224_init,
|
||||
(hf_nextBlock_fpt)cubehash_nextBlock,
|
||||
(hf_lastBlock_fpt)cubehash_lastBlock,
|
||||
(hf_ctx2hash_fpt)cubehash224_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
const hfdesc_t cubehash256_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
cubehash256_str,
|
||||
sizeof(cubehash_ctx_t),
|
||||
CUBEHASH256_BLOCKSIZE,
|
||||
256,
|
||||
(hf_init_fpt)cubehash256_init,
|
||||
(hf_nextBlock_fpt)cubehash_nextBlock,
|
||||
(hf_lastBlock_fpt)cubehash_lastBlock,
|
||||
(hf_ctx2hash_fpt)cubehash256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
const hfdesc_t cubehash384_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
cubehash384_str,
|
||||
sizeof(cubehash_ctx_t),
|
||||
CUBEHASH384_BLOCKSIZE,
|
||||
384,
|
||||
(hf_init_fpt)cubehash384_init,
|
||||
(hf_nextBlock_fpt)cubehash_nextBlock,
|
||||
(hf_lastBlock_fpt)cubehash_lastBlock,
|
||||
(hf_ctx2hash_fpt)cubehash384_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
const hfdesc_t cubehash512_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
cubehash512_str,
|
||||
sizeof(cubehash_ctx_t),
|
||||
CUBEHASH512_BLOCKSIZE,
|
||||
512,
|
||||
(hf_init_fpt)cubehash512_init,
|
||||
(hf_nextBlock_fpt)cubehash_nextBlock,
|
||||
(hf_lastBlock_fpt)cubehash_lastBlock,
|
||||
(hf_ctx2hash_fpt)cubehash512_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/* hfal_cubehash.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 HFAL_CUBEHASH_H_
|
||||
#define HFAL_CUBEHASH_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t cubehash224_desc;
|
||||
extern const hfdesc_t cubehash256_desc;
|
||||
extern const hfdesc_t cubehash384_desc;
|
||||
extern const hfdesc_t cubehash512_desc;
|
||||
|
||||
|
||||
#endif /* HFAL_CUBEHASH_H_ */
|
|
@ -0,0 +1,99 @@
|
|||
/* hfal_echo.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 hfal_echo.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2010-02-21
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "echo.h"
|
||||
|
||||
|
||||
static const char echo224_str[] PROGMEM = "ECHO-224";
|
||||
static const char echo256_str[] PROGMEM = "ECHO-256";
|
||||
static const char echo384_str[] PROGMEM = "ECHO-384";
|
||||
static const char echo512_str[] PROGMEM = "ECHO-512";
|
||||
|
||||
const hfdesc_t echo224_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
echo224_str,
|
||||
sizeof(echo_small_ctx_t),
|
||||
ECHO224_BLOCKSIZE,
|
||||
224,
|
||||
(hf_init_fpt)echo224_init,
|
||||
(hf_nextBlock_fpt)echo_small_nextBlock,
|
||||
(hf_lastBlock_fpt)echo_small_lastBlock,
|
||||
(hf_ctx2hash_fpt)echo224_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
const hfdesc_t echo256_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
echo256_str,
|
||||
sizeof(echo_small_ctx_t),
|
||||
ECHO256_BLOCKSIZE,
|
||||
256,
|
||||
(hf_init_fpt)echo256_init,
|
||||
(hf_nextBlock_fpt)echo_small_nextBlock,
|
||||
(hf_lastBlock_fpt)echo_small_lastBlock,
|
||||
(hf_ctx2hash_fpt)echo256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
const hfdesc_t echo384_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
echo384_str,
|
||||
sizeof(echo_large_ctx_t),
|
||||
ECHO384_BLOCKSIZE,
|
||||
384,
|
||||
(hf_init_fpt)echo384_init,
|
||||
(hf_nextBlock_fpt)echo_large_nextBlock,
|
||||
(hf_lastBlock_fpt)echo_large_lastBlock,
|
||||
(hf_ctx2hash_fpt)echo384_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
const hfdesc_t echo512_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
echo512_str,
|
||||
sizeof(echo_large_ctx_t),
|
||||
ECHO512_BLOCKSIZE,
|
||||
512,
|
||||
(hf_init_fpt)echo512_init,
|
||||
(hf_nextBlock_fpt)echo_large_nextBlock,
|
||||
(hf_lastBlock_fpt)echo_large_lastBlock,
|
||||
(hf_ctx2hash_fpt)echo512_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/* hfal_echo.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 HFAL_ECHO_H_
|
||||
#define HFAL_ECHO_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t echo224_desc;
|
||||
extern const hfdesc_t echo256_desc;
|
||||
extern const hfdesc_t echo384_desc;
|
||||
extern const hfdesc_t echo512_desc;
|
||||
|
||||
#endif /* HFAL_ECHO_H_ */
|
|
@ -0,0 +1,67 @@
|
|||
/* hfal_groestl_large.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 hfal_groestl_large.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-05-05
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "groestl_large.h"
|
||||
#include "groestl_small.h"
|
||||
|
||||
|
||||
static const char groestl384_str[] PROGMEM = "Groestl-384";
|
||||
static const char groestl512_str[] PROGMEM = "Groestl-512";
|
||||
|
||||
const hfdesc_t groestl384_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
groestl384_str,
|
||||
sizeof(groestl384_ctx_t),
|
||||
GROESTL384_BLOCKSIZE,
|
||||
384,
|
||||
(hf_init_fpt)groestl384_init,
|
||||
(hf_nextBlock_fpt)groestl_large_nextBlock,
|
||||
(hf_lastBlock_fpt)groestl_large_lastBlock,
|
||||
(hf_ctx2hash_fpt)groestl384_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)groestl384
|
||||
};
|
||||
|
||||
const hfdesc_t groestl512_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
groestl512_str,
|
||||
sizeof(groestl512_ctx_t),
|
||||
GROESTL512_BLOCKSIZE,
|
||||
512,
|
||||
(hf_init_fpt)groestl512_init,
|
||||
(hf_nextBlock_fpt)groestl_large_nextBlock,
|
||||
(hf_lastBlock_fpt)groestl_large_lastBlock,
|
||||
(hf_ctx2hash_fpt)groestl512_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)groestl512
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/* hfal_groestl_large.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_groestl_large.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-06-11
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_GROESTL_LARGE_H_
|
||||
#define HFAL_GROESTL_LARGE_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t groestl384_desc;
|
||||
extern const hfdesc_t groestl512_desc;
|
||||
|
||||
#endif /* HFAL_GROESTL_LARGE_H_ */
|
|
@ -0,0 +1,67 @@
|
|||
/* hfal_groestl_small.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
Copyright (C) 2009 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 hfal_groestl_small.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-05-05
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "groestl_small.h"
|
||||
|
||||
|
||||
static const char groestl224_str[] PROGMEM = "Groestl-224";
|
||||
static const char groestl256_str[] PROGMEM = "Groestl-256";
|
||||
|
||||
const hfdesc_t groestl224_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
groestl224_str,
|
||||
sizeof(groestl224_ctx_t),
|
||||
GROESTL224_BLOCKSIZE,
|
||||
224,
|
||||
(hf_init_fpt)groestl224_init,
|
||||
(hf_nextBlock_fpt)groestl_small_nextBlock,
|
||||
(hf_lastBlock_fpt)groestl_small_lastBlock,
|
||||
(hf_ctx2hash_fpt)groestl224_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)groestl224
|
||||
};
|
||||
|
||||
const hfdesc_t groestl256_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
groestl256_str,
|
||||
sizeof(groestl256_ctx_t),
|
||||
GROESTL256_BLOCKSIZE,
|
||||
256,
|
||||
(hf_init_fpt)groestl256_init,
|
||||
(hf_nextBlock_fpt)groestl_small_nextBlock,
|
||||
(hf_lastBlock_fpt)groestl_small_lastBlock,
|
||||
(hf_ctx2hash_fpt)groestl256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)groestl256
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/* hfal_groestl_small.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_groestl_small.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-05-05
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_GROESTL_SMALL_H_
|
||||
#define HFAL_GROESTL_SMALL_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t groestl224_desc;
|
||||
extern const hfdesc_t groestl256_desc;
|
||||
|
||||
#endif /* HFAL_GROESTL_SMALL_H_ */
|
|
@ -0,0 +1,99 @@
|
|||
/* hfal_keccak.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_keccak.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2010-02-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "keccak.h"
|
||||
|
||||
|
||||
static const char keccak224_str[] PROGMEM = "Keccak-224";
|
||||
static const char keccak256_str[] PROGMEM = "Keccak-256";
|
||||
static const char keccak384_str[] PROGMEM = "Keccak-384";
|
||||
static const char keccak512_str[] PROGMEM = "Keccak-512";
|
||||
|
||||
const hfdesc_t keccak224_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
keccak224_str,
|
||||
sizeof(keccak_ctx_t),
|
||||
KECCAK224_BLOCKSIZE,
|
||||
224,
|
||||
(hf_init_fpt)keccak224_init,
|
||||
(hf_nextBlock_fpt)keccak_nextBlock,
|
||||
(hf_lastBlock_fpt)keccak_lastBlock,
|
||||
(hf_ctx2hash_fpt)keccak224_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
const hfdesc_t keccak256_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
keccak256_str,
|
||||
sizeof(keccak_ctx_t),
|
||||
KECCAK256_BLOCKSIZE,
|
||||
256,
|
||||
(hf_init_fpt)keccak256_init,
|
||||
(hf_nextBlock_fpt)keccak_nextBlock,
|
||||
(hf_lastBlock_fpt)keccak_lastBlock,
|
||||
(hf_ctx2hash_fpt)keccak256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
const hfdesc_t keccak384_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
keccak384_str,
|
||||
sizeof(keccak_ctx_t),
|
||||
KECCAK384_BLOCKSIZE,
|
||||
384,
|
||||
(hf_init_fpt)keccak384_init,
|
||||
(hf_nextBlock_fpt)keccak_nextBlock,
|
||||
(hf_lastBlock_fpt)keccak_lastBlock,
|
||||
(hf_ctx2hash_fpt)keccak384_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
const hfdesc_t keccak512_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
keccak512_str,
|
||||
sizeof(keccak_ctx_t),
|
||||
KECCAK512_BLOCKSIZE,
|
||||
512,
|
||||
(hf_init_fpt)keccak512_init,
|
||||
(hf_nextBlock_fpt)keccak_nextBlock,
|
||||
(hf_lastBlock_fpt)keccak_lastBlock,
|
||||
(hf_ctx2hash_fpt)keccak512_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/* hfal_keccak.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_keccak.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2010-02-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_KECCAK_H_
|
||||
#define HFAL_KECCAK_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t keccak224_desc;
|
||||
extern const hfdesc_t keccak256_desc;
|
||||
extern const hfdesc_t keccak384_desc;
|
||||
extern const hfdesc_t keccak512_desc;
|
||||
|
||||
#endif /* HFAL_KECCAK_H_ */
|
|
@ -0,0 +1,49 @@
|
|||
/* hfal_md5.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_md5.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-02-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "md5.h"
|
||||
|
||||
static const char md5_str[] PROGMEM = "MD5";
|
||||
|
||||
const hfdesc_t md5_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
md5_str,
|
||||
sizeof(md5_ctx_t),
|
||||
512,
|
||||
128,
|
||||
(hf_init_fpt)md5_init,
|
||||
(hf_nextBlock_fpt)md5_nextBlock,
|
||||
(hf_lastBlock_fpt)md5_lastBlock,
|
||||
(hf_ctx2hash_fpt)md5_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)md5
|
||||
};
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/* hfal_md5.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_md5.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-02-09
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_MD5_H_
|
||||
#define HFAL_MD5_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t md5_desc;
|
||||
|
||||
#endif /* HFAL_MD5_H_ */
|
|
@ -0,0 +1,49 @@
|
|||
/* hfal_sha1.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_sha1.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-02-04
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "sha1/sha1.h"
|
||||
|
||||
static const char sha1_str[] PROGMEM = "SHA-1";
|
||||
|
||||
const hfdesc_t sha1_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
sha1_str,
|
||||
sizeof(sha1_ctx_t),
|
||||
512,
|
||||
160,
|
||||
(hf_init_fpt)sha1_init,
|
||||
(hf_nextBlock_fpt)sha1_nextBlock,
|
||||
(hf_lastBlock_fpt)sha1_lastBlock,
|
||||
(hf_ctx2hash_fpt)sha1_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)sha1
|
||||
};
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/* hfal_sha1.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_sha1.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-02-04
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_SHA1_H_
|
||||
#define HFAL_SHA1_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t sha1_desc;
|
||||
|
||||
#endif /* HFAL_SHA1_H_ */
|
|
@ -0,0 +1,49 @@
|
|||
/* hfal_sha256.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_sha256.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-02-04
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "sha256.h"
|
||||
|
||||
static const char sha256_str[] PROGMEM = "SHA-256";
|
||||
|
||||
const hfdesc_t sha256_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
sha256_str,
|
||||
sizeof(sha256_ctx_t),
|
||||
512,
|
||||
256,
|
||||
(hf_init_fpt)sha256_init,
|
||||
(hf_nextBlock_fpt)sha256_nextBlock,
|
||||
(hf_lastBlock_fpt)sha256_lastBlock,
|
||||
(hf_ctx2hash_fpt)sha256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)sha256
|
||||
};
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/* hfal_sha256.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_sha256.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-02-04
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_SHA256_H_
|
||||
#define HFAL_SHA256_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t sha256_desc;
|
||||
|
||||
#endif /* HFAL_SHA256_H_ */
|
|
@ -0,0 +1,113 @@
|
|||
/* hfal_shabal.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_shabal.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-04-20
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "shabal.h"
|
||||
|
||||
|
||||
static const char shabal192_str[] PROGMEM = "Shabal-192";
|
||||
static const char shabal224_str[] PROGMEM = "Shabal-224";
|
||||
static const char shabal256_str[] PROGMEM = "Shabal-256";
|
||||
static const char shabal384_str[] PROGMEM = "Shabal-384";
|
||||
static const char shabal512_str[] PROGMEM = "Shabal-512";
|
||||
|
||||
const hfdesc_t shabal192_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
shabal192_str,
|
||||
sizeof(shabal_ctx_t),
|
||||
SHABAL_BLOCKSIZE,
|
||||
192,
|
||||
(hf_init_fpt)shabal192_init,
|
||||
(hf_nextBlock_fpt)shabal_nextBlock,
|
||||
(hf_lastBlock_fpt)shabal_lastBlock,
|
||||
(hf_ctx2hash_fpt)shabal192_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)shabal192
|
||||
};
|
||||
|
||||
const hfdesc_t shabal224_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
shabal224_str,
|
||||
sizeof(shabal_ctx_t),
|
||||
SHABAL_BLOCKSIZE,
|
||||
224,
|
||||
(hf_init_fpt)shabal224_init,
|
||||
(hf_nextBlock_fpt)shabal_nextBlock,
|
||||
(hf_lastBlock_fpt)shabal_lastBlock,
|
||||
(hf_ctx2hash_fpt)shabal224_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)shabal224
|
||||
};
|
||||
|
||||
const hfdesc_t shabal256_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
shabal256_str,
|
||||
sizeof(shabal_ctx_t),
|
||||
SHABAL_BLOCKSIZE,
|
||||
256,
|
||||
(hf_init_fpt)shabal256_init,
|
||||
(hf_nextBlock_fpt)shabal_nextBlock,
|
||||
(hf_lastBlock_fpt)shabal_lastBlock,
|
||||
(hf_ctx2hash_fpt)shabal256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)shabal256
|
||||
};
|
||||
|
||||
const hfdesc_t shabal384_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
shabal384_str,
|
||||
sizeof(shabal_ctx_t),
|
||||
SHABAL_BLOCKSIZE,
|
||||
384,
|
||||
(hf_init_fpt)shabal384_init,
|
||||
(hf_nextBlock_fpt)shabal_nextBlock,
|
||||
(hf_lastBlock_fpt)shabal_lastBlock,
|
||||
(hf_ctx2hash_fpt)shabal384_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)shabal384
|
||||
};
|
||||
|
||||
const hfdesc_t shabal512_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
shabal512_str,
|
||||
sizeof(shabal_ctx_t),
|
||||
SHABAL_BLOCKSIZE,
|
||||
512,
|
||||
(hf_init_fpt)shabal512_init,
|
||||
(hf_nextBlock_fpt)shabal_nextBlock,
|
||||
(hf_lastBlock_fpt)shabal_lastBlock,
|
||||
(hf_ctx2hash_fpt)shabal512_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)shabal512
|
||||
};
|
|
@ -0,0 +1,40 @@
|
|||
/* hfal_shabal.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_shabal.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-04-20
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_SHABAL_H_
|
||||
#define HFAL_SHABAL_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t shabal192_desc;
|
||||
extern const hfdesc_t shabal224_desc;
|
||||
extern const hfdesc_t shabal256_desc;
|
||||
extern const hfdesc_t shabal384_desc;
|
||||
extern const hfdesc_t shabal512_desc;
|
||||
|
||||
#endif /* HFAL_SHABAL_H_ */
|
|
@ -0,0 +1,162 @@
|
|||
/* hfal_skein1024.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_skein1024.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-03-13
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "skein.h"
|
||||
|
||||
|
||||
static const char skein1024_128_str[] PROGMEM = "Skein-1024-128";
|
||||
static const char skein1024_160_str[] PROGMEM = "Skein-1024-160";
|
||||
static const char skein1024_224_str[] PROGMEM = "Skein-1024-224";
|
||||
static const char skein1024_256_str[] PROGMEM = "Skein-1024-256";
|
||||
static const char skein1024_384_str[] PROGMEM = "Skein-1024-384";
|
||||
static const char skein1024_512_str[] PROGMEM = "Skein-1024-512";
|
||||
static const char skein1024_1024_str[] PROGMEM = "Skein-1024-1024";
|
||||
|
||||
void skein1024_128_init(skein1024_ctx_t* ctx){
|
||||
skein1024_init(ctx, 128);
|
||||
}
|
||||
void skein1024_160_init(skein1024_ctx_t* ctx){
|
||||
skein1024_init(ctx, 160);
|
||||
}
|
||||
void skein1024_224_init(skein1024_ctx_t* ctx){
|
||||
skein1024_init(ctx, 224);
|
||||
}
|
||||
void skein1024_256_init(skein1024_ctx_t* ctx){
|
||||
skein1024_init(ctx, 256);
|
||||
}
|
||||
void skein1024_384_init(skein1024_ctx_t* ctx){
|
||||
skein1024_init(ctx, 384);
|
||||
}
|
||||
void skein1024_512_init(skein1024_ctx_t* ctx){
|
||||
skein1024_init(ctx, 512);
|
||||
}
|
||||
void skein1024_1024_init(skein1024_ctx_t* ctx){
|
||||
skein1024_init(ctx, 1024);
|
||||
}
|
||||
|
||||
const hfdesc_t skein1024_128_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein1024_128_str,
|
||||
sizeof(skein1024_ctx_t),
|
||||
SKEIN1024_BLOCKSIZE,
|
||||
128,
|
||||
(hf_init_fpt)skein1024_128_init,
|
||||
(hf_nextBlock_fpt)skein1024_nextBlock,
|
||||
(hf_lastBlock_fpt)skein1024_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein1024_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
const hfdesc_t skein1024_160_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein1024_160_str,
|
||||
sizeof(skein1024_ctx_t),
|
||||
SKEIN1024_BLOCKSIZE,
|
||||
160,
|
||||
(hf_init_fpt)skein1024_160_init,
|
||||
(hf_nextBlock_fpt)skein1024_nextBlock,
|
||||
(hf_lastBlock_fpt)skein1024_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein1024_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
const hfdesc_t skein1024_224_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein1024_224_str,
|
||||
sizeof(skein1024_ctx_t),
|
||||
SKEIN1024_BLOCKSIZE,
|
||||
224,
|
||||
(hf_init_fpt)skein1024_224_init,
|
||||
(hf_nextBlock_fpt)skein1024_nextBlock,
|
||||
(hf_lastBlock_fpt)skein1024_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein1024_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
const hfdesc_t skein1024_256_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein1024_256_str,
|
||||
sizeof(skein1024_ctx_t),
|
||||
SKEIN1024_BLOCKSIZE,
|
||||
256,
|
||||
(hf_init_fpt)skein1024_256_init,
|
||||
(hf_nextBlock_fpt)skein1024_nextBlock,
|
||||
(hf_lastBlock_fpt)skein1024_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein1024_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
const hfdesc_t skein1024_384_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein1024_384_str,
|
||||
sizeof(skein1024_ctx_t),
|
||||
SKEIN1024_BLOCKSIZE,
|
||||
384,
|
||||
(hf_init_fpt)skein1024_384_init,
|
||||
(hf_nextBlock_fpt)skein1024_nextBlock,
|
||||
(hf_lastBlock_fpt)skein1024_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein1024_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
const hfdesc_t skein1024_512_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein1024_512_str,
|
||||
sizeof(skein1024_ctx_t),
|
||||
SKEIN1024_BLOCKSIZE,
|
||||
512,
|
||||
(hf_init_fpt)skein1024_512_init,
|
||||
(hf_nextBlock_fpt)skein1024_nextBlock,
|
||||
(hf_lastBlock_fpt)skein1024_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein1024_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
const hfdesc_t skein1024_1024_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein1024_1024_str,
|
||||
sizeof(skein1024_ctx_t),
|
||||
SKEIN1024_BLOCKSIZE,
|
||||
1024,
|
||||
(hf_init_fpt)skein1024_1024_init,
|
||||
(hf_nextBlock_fpt)skein1024_nextBlock,
|
||||
(hf_lastBlock_fpt)skein1024_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein1024_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/* hfal_skein1024.h */
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_skein1024.h
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-03-13
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_SKEIN1024_H_
|
||||
#define HFAL_SKEIN1024_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
extern const hfdesc_t skein1024_128_desc;
|
||||
extern const hfdesc_t skein1024_160_desc;
|
||||
extern const hfdesc_t skein1024_224_desc;
|
||||
extern const hfdesc_t skein1024_256_desc;
|
||||
extern const hfdesc_t skein1024_384_desc;
|
||||
extern const hfdesc_t skein1024_512_desc;
|
||||
extern const hfdesc_t skein1024_1024_desc;
|
||||
|
||||
#endif /* HFAL_SHA1024_H_ */
|
|
@ -0,0 +1,143 @@
|
|||
/* hfal_skein256.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/>.
|
||||
*/
|
||||
/**
|
||||
* \file hfal_skein256.c
|
||||
* \email daniel.otte@rub.de
|
||||
* \author Daniel Otte
|
||||
* \date 2009-03-13
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdlib.h>
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "skein.h"
|
||||
|
||||
|
||||
static const char skein256_128_str[] PROGMEM = "Skein-256-128";
|
||||
static const char skein256_160_str[] PROGMEM = "Skein-256-160";
|
||||
static const char skein256_224_str[] PROGMEM = "Skein-256-224";
|
||||
static const char skein256_256_str[] PROGMEM = "Skein-256-256";
|
||||
static const char skein256_384_str[] PROGMEM = "Skein-256-384";
|
||||
static const char skein256_512_str[] PROGMEM = "Skein-256-512";
|
||||
|
||||
void skein256_128_init(skein256_ctx_t* ctx){
|
||||
skein256_init(ctx, 128);
|
||||
}
|
||||
void skein256_160_init(skein256_ctx_t* ctx){
|
||||
skein256_init(ctx, 160);
|
||||
}
|
||||
void skein256_224_init(skein256_ctx_t* ctx){
|
||||
skein256_init(ctx, 224);
|
||||
}
|
||||
void skein256_256_init(skein256_ctx_t* ctx){
|
||||
skein256_init(ctx, 256);
|
||||
}
|
||||
void skein256_384_init(skein256_ctx_t* ctx){
|
||||
skein256_init(ctx, 384);
|
||||
}
|
||||
void skein256_512_init(skein256_ctx_t* ctx){
|
||||
skein256_init(ctx, 512);
|
||||
}
|
||||
|
||||
const hfdesc_t skein256_128_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein256_128_str,
|
||||
sizeof(skein256_ctx_t),
|
||||
SKEIN256_BLOCKSIZE,
|
||||
128,
|
||||
(hf_init_fpt)skein256_128_init,
|
||||
(hf_nextBlock_fpt)skein256_nextBlock,
|
||||
(hf_lastBlock_fpt)skein256_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
const hfdesc_t skein256_160_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein256_160_str,
|
||||
sizeof(skein256_ctx_t),
|
||||
SKEIN256_BLOCKSIZE,
|
||||
160,
|
||||
(hf_init_fpt)skein256_160_init,
|
||||
(hf_nextBlock_fpt)skein256_nextBlock,
|
||||
(hf_lastBlock_fpt)skein256_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
const hfdesc_t skein256_224_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein256_224_str,
|
||||
sizeof(skein256_ctx_t),
|
||||
SKEIN256_BLOCKSIZE,
|
||||
224,
|
||||
(hf_init_fpt)skein256_224_init,
|
||||
(hf_nextBlock_fpt)skein256_nextBlock,
|
||||
(hf_lastBlock_fpt)skein256_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
const hfdesc_t skein256_256_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein256_256_str,
|
||||
sizeof(skein256_ctx_t),
|
||||
SKEIN256_BLOCKSIZE,
|
||||
256,
|
||||
(hf_init_fpt)skein256_256_init,
|
||||
(hf_nextBlock_fpt)skein256_nextBlock,
|
||||
(hf_lastBlock_fpt)skein256_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
const hfdesc_t skein256_384_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein256_384_str,
|
||||
sizeof(skein256_ctx_t),
|
||||
SKEIN256_BLOCKSIZE,
|
||||
384,
|
||||
(hf_init_fpt)skein256_384_init,
|
||||
(hf_nextBlock_fpt)skein256_nextBlock,
|
||||
(hf_lastBlock_fpt)skein256_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
||||
const hfdesc_t skein256_512_desc PROGMEM = {
|
||||
HFDESC_TYPE_HASHFUNCTION,
|
||||
0,
|
||||
skein256_512_str,
|
||||
sizeof(skein256_ctx_t),
|
||||
SKEIN256_BLOCKSIZE,
|
||||
512,
|
||||
(hf_init_fpt)skein256_512_init,
|
||||
(hf_nextBlock_fpt)skein256_nextBlock,
|
||||
(hf_lastBlock_fpt)skein256_lastBlock,
|
||||
(hf_ctx2hash_fpt)skein256_ctx2hash,
|
||||
(hf_free_fpt)NULL,
|
||||
(hf_mem_fpt)NULL
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue