new hash function abstraction layer + shavs + dump util + ...

This commit is contained in:
bg 2009-02-04 13:50:15 +00:00
parent e9d58dce0a
commit e5a49deb52
216 changed files with 1052 additions and 361 deletions

2
A5_1.c
View File

@ -1,6 +1,6 @@
/* A5_1.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

2
A5_1.h
View File

@ -1,6 +1,6 @@
/* A5_1.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -43,7 +43,7 @@ all: $(foreach algo, $(ALGORITHMS), $(algo)_OBJ)
define MAIN_OBJ_TEMPLATE
$(2): $(3) $(4)
@echo "[ld]: $$@"
@echo "[ld] : $$@"
# echo $$^
@$(CC) $(CFLAGS) $(LDFLAGS)$(patsubst %.elf,%.map,$(2)) -o \
$(2) \
@ -120,6 +120,15 @@ $(TESTBIN_DIR)%.o: $(TESTSRC_DIR)%.S
@echo "[as] : $@"
@$(CC) $(ASFLAGS) -c -o $@ $<
$(TESTBIN_DIR)%.o: %.c
@echo "[gcc]: $@"
@$(CC) $(CFLAGS) -c -o $@ $<
$(TESTBIN_DIR)%.o: %.S
@echo "[as] : $@"
@$(CC) $(ASFLAGS) -c -o $@ $<
%.o: %.c
@echo "[gcc]: $@"

2
aes.h
View File

@ -1,6 +1,6 @@
/* aes.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes128_dec.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes128_dec.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes128_enc.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes128_enc.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes192_dec.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes192_dec.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes192_enc.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes192_enc.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes256_dec.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes256_dec.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes256_enc.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes256_enc.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes_dec-asm.S */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/* aes_dec-asm.S */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/* aes.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/* aes_dec.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes_enc-asm.S */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/* aes_enc.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes_enc.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes_sbox-asm.S */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/* aes_invsbox.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes_keyschedule-asm */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/* aes_keyschedule.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/* aes_keyschedule.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* aes_sbox-asm.S */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/* aes_sbox.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* arcfour-asm.S */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* arcfour.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* arcfour.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* avr-asm-macros.S */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal-basic.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal-basic.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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
@ -17,9 +17,19 @@
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 "blockciper_descriptor.h"
#include "keysize_descriptor.h"
uint8_t bcal_cipher_init(const bcdesc_t* cipher_descriptor,
const void* key, uint16_t keysize, 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);
#endif /* BCAL_BASIC_H_ */

View File

@ -1,6 +1,6 @@
/* bcal_aes128.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_aes128.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_aes192.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_aes192.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_aes256.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_aes256.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_camellia128.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_camellia128.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_cast5.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_cast5.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_des.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_des.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_present.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_present.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_rc5.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_rc5.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_rc6.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_rc6.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_seed.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_seed.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_serpent.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_serpent.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_skipjack.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_skipjack.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_tdes.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_tdes.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_xtea.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* bcal_xtea.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,11 +1,41 @@
/* blockcipher_descriptor.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 blockcipher_descriptor.h
* \author Daniel Otte
* \date 2009-02-04
*
* \license GPLv3 or later
*
*/
#ifndef BLOCKCIPHER_DESCRIPTOR_H_
#define BLOCKCIPHER_DESCRIPTOR_H_
#include <stdint.h>
#include <avr/pgmspace.h>
#ifndef VOID_FPT
#define VOID_FPT
typedef void(*void_fpt)(void);
#endif
typedef void(*bc_init1_fpt)(void*, void*);
typedef void(*bc_init2_fpt)(void*, uint16_t,void*);
typedef void(*bc_enc1_fpt)(void*, void*);

View File

@ -1,6 +1,6 @@
/* camellia-asm.S */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* camellia.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* camellia128-stub.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* camellia_C.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* cast5-sbox.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* cast5.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* cast5.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* config.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* debug.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

2
des.c
View File

@ -1,6 +1,6 @@
/* des.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

2
des.h
View File

@ -1,6 +1,6 @@
/* des.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* entropium.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* entropium.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* gf256mul.S */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* gf256mul.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* grain.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* grain.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

45
hashfunction_descriptor.h Normal file
View File

@ -0,0 +1,45 @@
/* hashfunction_descriptor.h */
#ifndef HASHFUNCTION_DESCRIPTOR_H_
#define HASHFUNCTION_DESCRIPTOR_H_
#include <stdint.h>
#include <avr/pgmspace.h>
#ifndef VOID_FPT
#define VOID_FPT
typedef void(*void_fpt)(void);
#endif
typedef void(*hf_init_fpt)(void*);
typedef void(*hf_nextBlock_fpt)(void*, const void*);
typedef void(*hf_lastBlock_fpt)(void*, const void*, uint16_t);
typedef void(*hf_ctx2hash_fpt)(void*, void*);
typedef void(*hf_free_fpt)(void*);
typedef void(*hf_mem_fpt)(void*, void*, uint32_t);
#define HFDESC_TYPE_HASHFUNCTION 0x02
typedef struct {
uint8_t type; /* 2 == hashfunction */
uint8_t flags;
PGM_P name;
uint16_t ctxsize_B;
uint16_t blocksize_b;
uint16_t hashsize_b;
hf_init_fpt init;
hf_nextBlock_fpt nextBlock;
hf_lastBlock_fpt lastBlock;
hf_ctx2hash_fpt ctx2hash;
hf_free_fpt free;
hf_mem_fpt mem;
} hfdesc_t; /* blockcipher descriptor type */
typedef struct{
hfdesc_t* desc_ptr;
void* ctx;
} hfgen_ctx_t;
#endif /* HASHFUNCTION_DESCRIPTOR_H_ */

83
hfal-basic.c Normal file
View File

@ -0,0 +1,83 @@
/* 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;
ctx->desc_ptr = (hfdesc_t*)hash_descriptor;
if(!(ctx->ctx=malloc(pgm_read_word(&(hash_descriptor->ctxsize_B)))))
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 size){
hf_lastBlock_fpt f;
hfdesc_t* x=ctx->desc_ptr;
f =(hf_lastBlock_fpt)pgm_read_word(&(x->lastBlock));
f(ctx->ctx, block, size);
}
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;
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);
}

33
hfal-basic.h Normal file
View File

@ -0,0 +1,33 @@
/* 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 size);
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);
#endif /* HFAL_BASIC_H_ */

49
hfal_sha256.c Normal file
View File

@ -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"
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)NULL
};

36
hfal_sha256.h Normal file
View File

@ -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_ */

View File

@ -1,6 +1,6 @@
/* hmac-sha1.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* hmac-sha256.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* hmac-sha256.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* hmac-sha256.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -2,6 +2,15 @@
require 'serialport'
def read_line
s = $sp.gets()
if s==nil
puts "ERROR: read timeout!\n";
return nil
end
s.gsub(/\006/, '');
end
def readTestVector(param)
fname=$dir;
lb="";
@ -9,11 +18,8 @@ def readTestVector(param)
set=0;
vector=0;
begin
ctr=$extended_wait;
while((lb=$sp.gets())==nil && ctr>=0)do
ctr -= 1;
end
if (m=/unknown command/.match(lb) || m=/[Ee][Rr]{2}[Oo][Rr]/.match(lb))
lb = read_line()
if (m=/unknown command/.match(lb) || m=/[Ee][Rr]{2}[Oo][Rr]/.match(lb))
puts("ERROR: "+lb);
exit(2);
end
@ -24,10 +30,7 @@ def readTestVector(param)
buffer += lb;
begin
ctr=$extended_wait;
while((lb=$sp.gets())==nil && ctr>=0)do
ctr -= 1;
end
lb = read_line()
if(lb==nil)
return false;
end
@ -40,10 +43,7 @@ def readTestVector(param)
fname+=m[1]+".";
end
buffer+=lb;
ctr=$extended_wait;
while((lb=$sp.gets())==nil && ctr>=0)do
ctr -= 1;
end
lb = read_line();
end
if(param!="")
fname+=param+".";
@ -65,10 +65,7 @@ def readTestVector(param)
end
printf(" %4u", vector);
end
ctr=$extended_wait;
while((lb=$sp.gets())==nil && ctr>=0)do
ctr -= 1;
end
lb=read_line();
if(lb==nil)
file.close();
return false;

View File

@ -1,6 +1,6 @@
/* keysize_descriptor.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* keysize_descriptor.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* md5-asm.S */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

2
md5.c
View File

@ -1,6 +1,6 @@
/* md5.c */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

2
md5.h
View File

@ -1,6 +1,6 @@
/* md5.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* md5_sbox.h */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -1,6 +1,6 @@
/* memxor.S */
/*
This file is part of the This file is part of the AVR-Crypto-Lib.
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

View File

@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := A5_1.o
$(ALGO_NAME)_TEST_BIN := main-a5_1-test.o debug.o uart.o serial-tools.o \
nessie_stream_test.o nessie_common.o cli.o
nessie_stream_test.o nessie_common.o cli.o string-extras.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

Some files were not shown because too many files have changed in this diff Show More