some mor ciphers for the blockcipher abstraction layer
This commit is contained in:
parent
017345097a
commit
1a1a9f5631
17
bcal-basic.c
17
bcal-basic.c
|
@ -63,35 +63,24 @@ void bcal_cipher_free(bcgen_ctx_t* ctx){
|
|||
}
|
||||
|
||||
void bcal_cipher_enc(void* block, const bcgen_ctx_t* ctx){
|
||||
uint8_t flags;
|
||||
bc_enc_fpt enc_fpt;
|
||||
flags = pgm_read_byte(ctx->desc_ptr->flags);
|
||||
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;
|
||||
}
|
||||
if((flags&BC_ENC_TYPE)==BC_ENC_TYPE_1){
|
||||
enc_fpt.enc1(block, ctx->ctx);
|
||||
}else{
|
||||
enc_fpt.enc2(block, block, ctx->ctx);
|
||||
}
|
||||
enc_fpt.enc1(block, ctx->ctx);
|
||||
|
||||
}
|
||||
|
||||
void bcal_cipher_dec(void* block, const bcgen_ctx_t* ctx){
|
||||
uint8_t flags;
|
||||
bc_dec_fpt dec_fpt;
|
||||
flags = pgm_read_byte(ctx->desc_ptr->flags);
|
||||
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;
|
||||
}
|
||||
if((flags&BC_DEC_TYPE)==BC_DEC_TYPE_1){
|
||||
dec_fpt.dec1(block, ctx->ctx);
|
||||
}else{
|
||||
dec_fpt.dec2(block, block, ctx->ctx);
|
||||
}
|
||||
dec_fpt.dec1(block, ctx->ctx);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/* bcal_aes128.c */
|
||||
/*
|
||||
This file is part of the Crypto-avr-lib/microcrypt-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_2,
|
||||
aes128_str,
|
||||
sizeof(aes128_ctx_t),
|
||||
128,
|
||||
{(void_fpt)aes_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 Crypto-avr-lib/microcrypt-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 "blopckcipher_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 Crypto-avr-lib/microcrypt-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_2,
|
||||
aes192_str,
|
||||
sizeof(aes192_ctx_t),
|
||||
128,
|
||||
{(void_fpt)aes_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 Crypto-avr-lib/microcrypt-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 "blopckcipher_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 Crypto-avr-lib/microcrypt-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_2,
|
||||
aes256_str,
|
||||
sizeof(aes256_ctx_t),
|
||||
128,
|
||||
{(void_fpt)aes_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 Crypto-avr-lib/microcrypt-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 "blopckcipher_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 Crypto-avr-lib/microcrypt-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 Crypto-avr-lib/microcrypt-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 "blopckcipher_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 Crypto-avr-lib/microcrypt-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 Crypto-avr-lib/microcrypt-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 "blopckcipher_descriptor.h"
|
||||
#include "cast5.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t cast5_desc;
|
|
@ -0,0 +1,61 @@
|
|||
/* bcal_des.c */
|
||||
/*
|
||||
This file is part of the Crypto-avr-lib/microcrypt-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, coid* key){
|
||||
des_enc(block, block, key);
|
||||
}
|
||||
|
||||
static
|
||||
void des_dummy_dec(void* block, coid* 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 Crypto-avr-lib/microcrypt-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 "blopckcipher_descriptor.h"
|
||||
#include "des.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t des_desc;
|
|
@ -9,7 +9,7 @@
|
|||
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, 128,
|
||||
const uint8_t noekeon_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
|
||||
KS_TYPE_TERMINATOR };
|
||||
|
||||
const bcdesc_t noekeon_direct_desc PROGMEM = {
|
||||
|
@ -18,10 +18,10 @@ const bcdesc_t noekeon_direct_desc PROGMEM = {
|
|||
noekeon_direct_str,
|
||||
16,
|
||||
128,
|
||||
(void_fpt)NULL,
|
||||
(void_fpt)noekeon_enc,
|
||||
(void_fpt)noekeon_dec,
|
||||
(void_fpt)NULL,
|
||||
{(void_fpt)NULL},
|
||||
{(void_fpt)noekeon_enc},
|
||||
{(void_fpt)noekeon_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
noekeon_keysize_desc
|
||||
};
|
||||
|
||||
|
@ -31,10 +31,10 @@ const bcdesc_t noekeon_indirect_desc PROGMEM = {
|
|||
noekeon_indirect_str,
|
||||
16,
|
||||
128,
|
||||
(void_fpt)noekeon_init,
|
||||
(void_fpt)noekeon_enc,
|
||||
(void_fpt)noekeon_dec,
|
||||
(void_fpt)NULL,
|
||||
{(void_fpt)noekeon_init},
|
||||
{(void_fpt)noekeon_enc},
|
||||
{(void_fpt)noekeon_dec},
|
||||
(bc_free_fpt)NULL,
|
||||
noekeon_keysize_desc
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* bcal_present.c */
|
||||
/*
|
||||
This file is part of the Crypto-avr-lib/microcrypt-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_1,
|
||||
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 Crypto-avr-lib/microcrypt-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 "blopckcipher_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 Crypto-avr-lib/microcrypt-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_4,
|
||||
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 Crypto-avr-lib/microcrypt-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 "blopckcipher_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 Crypto-avr-lib/microcrypt-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 Crypto-avr-lib/microcrypt-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 "blopckcipher_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 Crypto-avr-lib/microcrypt-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 Crypto-avr-lib/microcrypt-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 "blopckcipher_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 Crypto-avr-lib/microcrypt-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 Crypto-avr-lib/microcrypt-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 "blopckcipher_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 Crypto-avr-lib/microcrypt-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 Crypto-avr-lib/microcrypt-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 "blopckcipher_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 Crypto-avr-lib/microcrypt-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,
|
||||
128,
|
||||
{(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 Crypto-avr-lib/microcrypt-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 "blopckcipher_descriptor.h"
|
||||
#include "des.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t tdes_desc;
|
|
@ -0,0 +1,62 @@
|
|||
/* bcal_xtea.c */
|
||||
/*
|
||||
This file is part of the Crypto-avr-lib/microcrypt-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 Crypto-avr-lib/microcrypt-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 "blopckcipher_descriptor.h"
|
||||
#include "xtea.h"
|
||||
#include "keysize_descriptor.h"
|
||||
|
||||
extern const bcdesc_t xtea_desc;
|
2
cast5.c
2
cast5.c
|
@ -130,7 +130,7 @@ void cast5_init_rM(uint8_t *klo, uint8_t *khi, uint8_t offset, uint8_t *src, boo
|
|||
|
||||
|
||||
|
||||
void cast5_init(const void* key, uint8_t keylength_b, cast5_ctx_t* s){
|
||||
void cast5_init(const void* key, uint16_t keylength_b, cast5_ctx_t* s){
|
||||
/* we migth return if the key is valid and if setup was sucessfull */
|
||||
uint32_t x[4], z[4];
|
||||
#define BPX ((uint8_t*)&(x[0]))
|
||||
|
|
13
cast5.h
13
cast5.h
|
@ -16,20 +16,11 @@
|
|||
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: cast5.h
|
||||
* Author: Daniel Otte
|
||||
* Date: 2006-07-26
|
||||
* License: GPL
|
||||
* Description: Implementation of the CAST5 (aka CAST-128) cipher algorithm as described in RFC 2144
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file cast5.h
|
||||
* \author Daniel Otte
|
||||
* \date 2006-07-26
|
||||
* \license GPL
|
||||
* \license GPLv3 or later
|
||||
* \brief Implementation of the CAST5 (aka CAST-128) cipher algorithm as described in RFC 2144
|
||||
*
|
||||
*/
|
||||
|
@ -74,7 +65,7 @@ typedef struct cast5_ctx_st{
|
|||
* \param keylength_b length of the key in bits (maximum 128 bits)
|
||||
* \param s pointer to the context
|
||||
*/
|
||||
void cast5_init(const void* key, uint8_t keylength_b, cast5_ctx_t* s);
|
||||
void cast5_init(const void* key, uint16_t keylength_b, cast5_ctx_t* s);
|
||||
|
||||
/** \fn void cast5_enc(void* block, const cast5_ctx_t *s);
|
||||
* \brief encrypt a block with the CAST-5 algorithm
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#define KS_TYPE_RANGE 0x02
|
||||
#define KS_TYPE_ARG_RANGE 0x03
|
||||
|
||||
#define KS_INT(a) ((a)&0xFF), ((a)>>8)
|
||||
|
||||
typedef struct{ /* keysize is valid if listed in items */
|
||||
uint8_t n_items; /* number of items (value 0 is reserved) */
|
||||
|
|
Loading…
Reference in New Issue