/* 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
/* 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
define MAIN_OBJ_TEMPLATE
$(2): $(3) $(4)
- @echo "[ld]: $$@"
+ @echo "[ld] : $$@"
# echo $$^
@$(CC) $(CFLAGS) $(LDFLAGS)$(patsubst %.elf,%.map,$(2)) -o \
$(2) \
@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]: $@"
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
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_ */
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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*);
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
--- /dev/null
+/* 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_ */
+
--- /dev/null
+/* 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);
+}
--- /dev/null
+/* 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_ */
--- /dev/null
+/* 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
+};
+
--- /dev/null
+/* 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_ */
/* 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
/* 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
/* 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
/* 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
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="";
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
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
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+".";
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;
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
$(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"
$(ALGO_NAME)_OBJ := aes_enc-asm.o aes_dec-asm.o aes_sbox-asm.o aes_invsbox.o \
aes_keyschedule-asm.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_OBJ := aes_enc-asm.o aes_dec-asm_faster.o aes_sbox-asm.o aes_invsbox-asm.o \
aes_keyschedule-asm.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
aes128_enc.o aes128_dec.o aes192_enc.o aes192_dec.o \
aes256_enc.o aes256_dec.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_OBJ := arcfour-asm.o
$(ALGO_NAME)_TEST_BIN := main-arcfour-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 \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := arcfour.o
$(ALGO_NAME)_TEST_BIN := main-arcfour-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 \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := camellia128-stub.o camellia-asm.o
$(ALGO_NAME)_TEST_BIN := main-camellia-test.o debug.o uart.o serial-tools.o \
nessie_bc_test.o \
- nessie_common.o cli.o performance_test.o
+ nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := cast5.o
-$(ALGO_NAME)_TEST_BIN := main-cast5-test.o debug.o uart.o serial-tools.o cli.o\
+$(ALGO_NAME)_TEST_BIN := main-cast5-test.o debug.o uart.o serial-tools.o cli.o string-extras.o\
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := des.o
$(ALGO_NAME)_TEST_BIN := main-des-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := entropium.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-entropium-test.o debug.o uart.o serial-tools.o \
- cli.o performance_test.o
+ cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := grain.o
$(ALGO_NAME)_TEST_BIN := main-grain-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 \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
MACS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := hmac-sha1.o sha1-asm.o
-$(ALGO_NAME)_TEST_BIN := main-hmac-sha1-test.o debug.o uart.o serial-tools.o cli.o \
+$(ALGO_NAME)_TEST_BIN := main-hmac-sha1-test.o debug.o uart.o serial-tools.o cli.o string-extras.o \
nessie_mac_test.o nessie_common.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := hmac-sha256.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-hmac-sha256-test.o debug.o uart.o serial-tools.o \
- nessie_mac_test.o nessie_common.o cli.o
+ nessie_mac_test.o nessie_common.o cli.o string-extras.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := md5.o
$(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := md5-asm.o
$(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := noekeon_asm.o
$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_OBJ := noekeon.o
$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_OBJ := noekeon_asm.o omac_noekeon.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o serial-tools.o \
- nessie_mac_test.o nessie_common.o cli.o performance_test.o
+ nessie_mac_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_OBJ := noekeon_asm.o omac_noekeon_C.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o serial-tools.o \
- nessie_mac_test.o nessie_common.o cli.o performance_test.o
+ nessie_mac_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_OBJ := present.o
$(ALGO_NAME)_TEST_BIN := main-present-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := rc5.o
$(ALGO_NAME)_TEST_BIN := main-rc5-test.o debug.o uart.o serial-tools.o \
nessie_bc_test.o \
- nessie_common.o cli.o performance_test.o
+ nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_OBJ := rc6.o
$(ALGO_NAME)_TEST_BIN := main-rc6-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_OBJ := seed-asm.o
$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o serial-tools.o \
nessie_bc_test.o nessie_common.o \
- cli.o performance_test.o
+ cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := seed_C.o
$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o serial-tools.o \
nessie_bc_test.o nessie_common.o \
- cli.o performance_test.o
+ cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-bitslice-asm.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := serpent-sboxes-bitslice-asm.o serpent-asm.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-fast.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-small.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := serpent.o serpent-sboxes_c.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := sha1-asm.o
$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := sha1.o
$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o \
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o \
+ hfal-basic.o hfal_sha256.o shavs.o dump.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := sha256.o
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := shabea.o sha256-asm.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-shabea-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := shacal1_enc.o sha1-asm.o
$(ALGO_NAME)_TEST_BIN := main-shacal1_enc-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := shacal2_enc.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-shacal2_enc-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := skipjack.o
$(ALGO_NAME)_TEST_BIN := main-skipjack-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o \
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := des.o
$(ALGO_NAME)_TEST_BIN := main-tdes-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := trivium.o
$(ALGO_NAME)_TEST_BIN := main-trivium-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 \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := twister-small-asm.o twister-asm.o twister224.o
$(ALGO_NAME)_TEST_BIN := main-twister224-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := twister.o twister-small.o memxor.o gf256mul.o
$(ALGO_NAME)_TEST_BIN := main-twister224-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := twister-asm.o twister-small-asm.o twister256.o
$(ALGO_NAME)_TEST_BIN := main-twister256-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := twister.o twister-small.o memxor.o gf256mul.o
$(ALGO_NAME)_TEST_BIN := main-twister256-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := twister-asm.o twister-big-asm.o twister384.o
$(ALGO_NAME)_TEST_BIN := main-twister384-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := twister.o twister-big.o memxor.o gf256mul.o
$(ALGO_NAME)_TEST_BIN := main-twister384-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := twister-asm.o twister-big-asm.o twister512.o
$(ALGO_NAME)_TEST_BIN := main-twister512-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := twister.o twister-big.o memxor.o gf256mul.o
$(ALGO_NAME)_TEST_BIN := main-twister512-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := xtea-asm.o
$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := xtea.o
$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
/* noekeon.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
/* noekeon.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
/* noekeon_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
/* noekeon_cbc_enc.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
/* noekeon_ctr.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
/* noekeon_ctr.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
/* noekeon_omac.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
/* 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
/* 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
/* 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
/* 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
/* 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
/* 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
/* seed-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
/* 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
/* seed_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
/* seed_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
/* serpent_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
/* serpent-sboxes-bitslice.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
/* serpent-sboxes-bitslice.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
/* serpent-sboxes-fast.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
/* serpent_sboxes.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
/* serpent-sboxes.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
/* serpent-sboxes.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
/* 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
/* 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
/* sha1-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
/* 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
/* sha1.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
/* sha256-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
/* 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
/* 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
/* shacal1_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
/* shacal1_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
/* shacal2_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
/* shacal2_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
/* 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
/* 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
#include <ctype.h>
#include <string.h>
#include <avr/pgmspace.h>
+#include "string-extras.h"
#include "cli.h"
#include "config.h"
cli_tx_fpt cli_tx = NULL;
uint8_t cli_echo=1;
+void cli_putc(char c){
+ if(cli_tx)
+ cli_tx(c);
+}
+
+uint16_t cli_getc(void){
+ if(cli_rx)
+ return cli_rx();
+ return ((uint16_t)-1);
+}
+
+
+uint16_t cli_getc_cecho(void){
+ char c;
+ if(cli_rx){
+ c = cli_rx();
+ if(cli_tx && cli_echo)
+ cli_tx(c);
+ return c;
+ }
+ return ((uint16_t)-1);
+}
+
void cli_putstr(char* s){
if(!cli_tx)
return;
}
}
+void cli_hexdump2(void* data, uint16_t length){
+ char hex_tab[] = {'0', '1', '2', '3',
+ '4', '5', '6', '7',
+ '8', '9', 'A', 'B',
+ 'C', 'D', 'E', 'F'};
+ if(!cli_tx)
+ return;
+ while(length--){
+ cli_tx(hex_tab[(*((uint8_t*)data))>>4]);
+ cli_tx(hex_tab[(*((uint8_t*)data))&0xf]);
+ cli_tx(' ');
+ data = (uint8_t*)data +1;
+ }
+}
+
static
void cli_auto_help(uint16_t maxcmdlength, PGM_VOID_P cmdlist){
cmdlist_entry_t item;
item.cmd_name = (void*)pgm_read_word(cmdlist+0);
item.cmd_param_str = (void*)pgm_read_word(cmdlist+2);
item.cmd_function = (void_fpt)pgm_read_word(cmdlist+4);
- cmdlist = (uint8_t*)cmdlist+6;
+ cmdlist = (uint8_t*)cmdlist+CMDLIST_ENTRY_SIZE;
if(item.cmd_name==NULL){
return;
}
}
}
-static
-uint16_t firstword_length(char* s){
- uint16_t ret=0;
- while(isalnum(*s++))
- ret++;
- return ret;
-}
-
void echo_ctrl(char* s){
+ s = strstrip(s);
if(s==NULL || *s=='\0'){
cli_putstr_P(PSTR("\r\necho is "));
cli_putstr_P(cli_echo?PSTR("on"):PSTR("off"));
item.cmd_name = (void*)pgm_read_word(cmdlist+0);
item.cmd_param_str = (void*)pgm_read_word(cmdlist+2);
item.cmd_function = (void_fpt)pgm_read_word(cmdlist+4);
- cmdlist = (uint8_t*)cmdlist+6;
+ cmdlist = (uint8_t*)cmdlist+CMDLIST_ENTRY_SIZE;
}while(item.cmd_name!=NULL && strcmp_P(fw, item.cmd_name));
if(item.cmd_name==NULL){
cli_auto_help(maxcmdlength, cmdlist_orig);
char* str;
for(;;){
str = (char*)pgm_read_word(cmdlist);
- cmdlist = (uint8_t*)cmdlist + 6;
+ cmdlist = (uint8_t*)cmdlist + CMDLIST_ENTRY_SIZE;
if(str==NULL)
return ret;
t = strlen_P(str);
}
}
-uint16_t stridentcnt_P(char* a, PGM_P b){
- uint16_t i=0;
- char c;
- for(;;){
- c = pgm_read_byte(b++);
- if(*a != c || c=='\0')
- return i;
- i++;
- a++;
- }
-}
-
uint8_t cli_completion(char* buffer, uint16_t maxcmdlength, PGM_VOID_P cmdlist){
uint8_t i=0;
char ref[maxcmdlength+1];
ref[0]='\0';
/* check if we are behind the first word */
while(buffer[i]){
- if(!isalnum(buffer[i++]))
+ if(!isgraph(buffer[i++]))
return 0;
}
for(;;){
itemstr = (char*)pgm_read_word(cmdlist);
if(itemstr==NULL)
break;
- cmdlist = (uint8_t*)cmdlist +6;
+ cmdlist = (uint8_t*)cmdlist +CMDLIST_ENTRY_SIZE;
if(!strncmp_P(buffer, itemstr, i)){
if(!ref[0]){
strcpy_P(ref, itemstr);
cli_putstr(buffer);
return;
}
- cmdlist = (uint8_t*)cmdlist +6;
+ cmdlist = (uint8_t*)cmdlist +CMDLIST_ENTRY_SIZE;
if(!strncmp_P(buffer, itemstr, len)){
cli_putstr_P(PSTR("\r\n "));
cli_putstr_P(itemstr);
#include <stdint.h>
#include <avr/pgmspace.h>
+#ifndef VOID_FPT
+#define VOID_FPT
typedef void(*void_fpt)(void);
+#endif
typedef char (*cli_rx_fpt)(void);
typedef void (*cli_tx_fpt)(char);
#define CLI_BUFFER_BS 20
+#define CMDLIST_ENTRY_SIZE 8
typedef struct {
PGM_P cmd_name; /* string containing the function name */
PGM_P cmd_param_str; /* param descriptor string */
void_fpt cmd_function; /* function pointer */
+ void_fpt options;
} cmdlist_entry_t;
extern cli_rx_fpt cli_rx;
extern cli_tx_fpt cli_tx;
extern uint8_t cli_echo;
+
+void cli_putc(char c);
+uint16_t cli_getc(void);
+uint16_t cli_getc_cecho(void);
void cli_putstr(char* s);
void cli_putstr_P(PGM_P s);
void cli_hexdump(void* data, uint16_t length);
+void cli_hexdump2(void* data, uint16_t length);
void echo_ctrl(char* s);
int8_t cmd_interface(PGM_VOID_P cmd_desc);
--- /dev/null
+/* dump.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 dump.c
+ * \email daniel.otte@rub.de
+ * \author Daniel Otte
+ * \date 2009-02-04
+ * \license GPLv3 or later
+ *
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <avr/pgmspace.h>
+#include "cli.h"
+#include "string-extras.h"
+
+#define DUMP_WIDTH 16
+
+static
+void dump_chars(uint8_t* buffer){
+ uint8_t i;
+ cli_putc('|');
+ for(i=0; i<DUMP_WIDTH; ++i){
+ if(isprint(buffer[i])){
+ cli_putc(buffer[i]);
+ }else{
+ cli_putc('.');
+ }
+ }
+ cli_putc('|');
+}
+
+
+void dump(char* s){
+ uint8_t flash=1;
+ uint32_t addr=0;
+ uint32_t size=128;
+ uint8_t i,buffer[DUMP_WIDTH];
+ char tstr[9];
+ s=strstrip(s);
+ if(*s=='r' || *s=='R' || *s=='m' || *s=='M')
+ flash=0;
+ if(isalpha(*s)){
+ while(isalpha(*s))
+ ++s;
+ }
+ char* eptr;
+ if(*s)
+ addr = strtoul(s, &eptr, 0);
+ if(eptr)
+ size = strtoul(eptr, NULL, 0);
+ if(!size)
+ size = 32;
+
+ cli_putstr_P(PSTR("\r\ndumping "));
+ ultoa(size, tstr, 10);
+ cli_putstr(tstr);
+ cli_putstr_P(PSTR(" bytes of "));
+ cli_putstr_P(flash?PSTR("flash"):PSTR("ram"));
+ cli_putstr_P(PSTR(", beginning at 0x"));
+ ultoa(addr, tstr, 16);
+ cli_putstr(tstr);
+ cli_putstr_P(PSTR(":\r\n"));
+ while(size>=DUMP_WIDTH){
+ if(flash){
+ for(i=0; i<DUMP_WIDTH; ++i){
+#ifdef pgm_read_byte_far
+ buffer[i]=pgm_read_byte_far(addr+i);
+#else
+ buffer[i]=pgm_read_byte(addr+i);
+#endif
+ }
+ }else{
+ memcpy(buffer, (void*)((uint16_t)addr), DUMP_WIDTH);
+ }
+ ultoa(addr, tstr, 16);
+ sprintf(tstr,"%6lX", addr);
+ cli_putstr(tstr);
+ cli_putstr_P(PSTR(": "));
+ cli_hexdump2(buffer, DUMP_WIDTH);
+ cli_putc('\t');
+ dump_chars(buffer);
+ addr+=DUMP_WIDTH;
+ size-=DUMP_WIDTH;
+ cli_putstr_P(PSTR("\r\n"));
+ }
+ if(size){
+ if(flash){
+ for(i=0; i<size; ++i){
+#ifdef pgm_read_byte_far
+ buffer[i]=pgm_read_byte_far(addr+i);
+#else
+ buffer[i]=pgm_read_byte(addr+i);
+#endif
+ }
+ }else{
+ memcpy(buffer, (void*)((uint16_t)addr), size);
+ }
+ ultoa(addr, tstr, 16);
+ sprintf(tstr,"%6lX", addr);
+ cli_putstr(tstr);
+ cli_putstr_P(PSTR(": "));
+ cli_hexdump2(buffer, size);
+ cli_putstr_P(PSTR("\r\n"));
+ }
+}
+
--- /dev/null
+/* dump.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 dump.h
+ * \email daniel.otte@rub.de
+ * \author Daniel Otte
+ * \date 2009-02-04
+ * \license GPLv3 or later
+ *
+ */
+
+#ifndef DUMP_H_
+#define DUMP_H_
+
+#include <stdint.h>
+#include <string.h>
+#include <ctype.h>
+#include <avr/pgmspace.h>
+#include "cli.h"
+#include "string-extras.h"
+
+#define DUMP_WIDTH 16
+
+void dump(char* s);
+
+#endif /* DUMP_H_ */
const char echo_str[] PROGMEM = "echo";
cmdlist_entry_t cmdlist[] PROGMEM = {
- { nessie_str, NULL, testrun_nessie_a51 },
-/* { performance_str, NULL, testrun_performance_a51}, */
- { echo_str, (void*)1, (void_fpt)echo_ctrl},
- { NULL, NULL, NULL}
+ { nessie_str, NULL, testrun_nessie_a51, NULL},
+/* { performance_str, NULL, testrun_performance_a51, NULL}, */
+ { echo_str, (void*)1, (void_fpt)echo_ctrl, NULL},
+ { NULL, NULL, NULL, NULL}
};
int main (void){
#include <string.h>
#include <stdlib.h>
#include "cli.h"
+#include "shavs.h"
+#include "hfal_sha256.h"
+#include "dump.h"
char* algo_name = "SHA-256";
const char test_str[] PROGMEM = "test";
const char performance_str[] PROGMEM = "performance";
const char echo_str[] PROGMEM = "echo";
+const char shavs_list_str[] PROGMEM = "shavs_list";
+const char shavs_set_str[] PROGMEM = "shavs_set";
+const char dump_str[] PROGMEM = "dump";
+
+const hfdesc_t* algo_list[] PROGMEM = {
+ (hfdesc_t*)&sha256_desc,
+ NULL
+};
cmdlist_entry_t cmdlist[] PROGMEM = {
- { nessie_str, NULL, testrun_nessie_sha256},
- { test_str, NULL, testrun_nessie_sha256},
- { performance_str, NULL, testrun_performance_sha256},
- { echo_str, (void*)1, (void_fpt)echo_ctrl},
- { NULL, NULL, NULL}
+ { nessie_str, NULL, testrun_nessie_sha256},
+ { test_str, NULL, testrun_nessie_sha256},
+ { performance_str, NULL, testrun_performance_sha256},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { shavs_list_str, NULL, shavs_listalgos},
+ { shavs_set_str, (void*)1, (void_fpt)shavs_setalgo},
+ { dump_str, (void*)1, (void_fpt)dump},
+ { NULL, NULL, NULL}
};
int main (void){
uart_putstr("\r\n");
cli_rx = uart_getc;
cli_tx = uart_putc;
+ algolist=algo_list;
for(;;){
uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
uart_putstr(algo_name);
memcpy(buffer, pt, nessie_bc_ctx.blocksize_B);
for(i=0; i<100; ++i){
nessie_bc_ctx.cipher_enc(buffer, ctx);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_print_item("Iterated 100 times", buffer, nessie_bc_ctx.blocksize_B);
#ifndef NESSIE_NO1KTEST
/* 1000 times test, we use the 100 precedig steps to fasten things a bit */
for(; i<1000; ++i){
nessie_bc_ctx.cipher_enc(buffer, ctx);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_print_item("Iterated 1000 times", buffer, nessie_bc_ctx.blocksize_B);
#endif
#include <stdint.h>
#include <avr/pgmspace.h>
#include <stdlib.h> /* utoa() */
-#include "uart.h"
+#include "nessie_common.h"
+
+
+#ifdef NESSIE_ALIVE
+void nessie_send_alive(void){
+ NESSIE_PUTC(NESSIE_ALIVE_CHAR);
+}
+
+void nessie_send_alive_a(uint16_t i){
+ if((i&63)==63)
+ NESSIE_PUTC(NESSIE_ALIVE_CHAR);
+}
+#endif
void nessie_print_block(uint8_t* block, uint16_t blocksize_bit){
char tab [] = {'0', '1', '2', '3',
'C', 'D', 'E', 'F'};
uint16_t i;
for(i=0; i<(blocksize_bit+7)/8; ++i){
- uart_putc(tab[(block[i])>>4]);
- uart_putc(tab[(block[i])&0xf]);
+ NESSIE_PUTC(tab[(block[i])>>4]);
+ NESSIE_PUTC(tab[(block[i])&0xf]);
}
}
uint8_t i;
name_len=strlen(name);
if(name_len>SPACES-1){
- uart_putstr_P(PSTR("\r\n!!! formatting error !!!\r\n"));
+ NESSIE_PUTSTR_P(PSTR("\r\n!!! formatting error !!!\r\n"));
return;
}
- uart_putstr_P(PSTR("\r\n"));
+ NESSIE_PUTSTR_P(PSTR("\r\n"));
for(i=0; i<SPACES-name_len-1; ++i){
- uart_putc(' ');
+ NESSIE_PUTC(' ');
}
- uart_putstr(name);
- uart_putc('=');
+ NESSIE_PUTSTR(name);
+ NESSIE_PUTC('=');
/* now the data printing begins */
if(size_B<=BYTESPERLINE){
/* one line seems sufficient */
int16_t toprint = size_B - BYTESPERLINE;
buffer += BYTESPERLINE;
while(toprint > 0){
- uart_putstr_P(PSTR("\r\n"));
+ NESSIE_PUTSTR_P(PSTR("\r\n"));
for(i=0; i<SPACES; ++i){
- uart_putc(' ');
+ NESSIE_PUTC(' ');
}
nessie_print_block(buffer, ((toprint>BYTESPERLINE)?BYTESPERLINE:toprint)*8);
buffer += BYTESPERLINE;
void nessie_print_set_vector(uint8_t set, uint16_t vector){
- uart_putstr_P(PSTR("\r\n\r\nSet "));
- uart_putc('0'+set%10);
- uart_putstr_P(PSTR(", vector#"));
- uart_putc((vector<1000)?' ':'0'+vector/1000);
- uart_putc((vector<100)?' ':'0'+(vector/100)%10);
- uart_putc((vector<10 )?' ':'0'+(vector/10)%10);
- uart_putc('0'+vector%10);
- uart_putc(':');
+ NESSIE_PUTSTR_P(PSTR("\r\n\r\nSet "));
+ NESSIE_PUTC('0'+set%10);
+ NESSIE_PUTSTR_P(PSTR(", vector#"));
+ NESSIE_PUTC((vector<1000)?' ':'0'+vector/1000);
+ NESSIE_PUTC((vector<100)?' ':'0'+(vector/100)%10);
+ NESSIE_PUTC((vector<10 )?' ':'0'+(vector/10)%10);
+ NESSIE_PUTC('0'+vector%10);
+ NESSIE_PUTC(':');
}
/* example:
=====================
*/
void nessie_print_setheader(uint8_t set){
- uart_putstr_P(PSTR("\r\n\r\nTest vectors -- set "));
- uart_putc('0'+set%10);
- uart_putstr_P(PSTR("\r\n====================="));
+ NESSIE_PUTSTR_P(PSTR("\r\n\r\nTest vectors -- set "));
+ NESSIE_PUTC('0'+set%10);
+ NESSIE_PUTSTR_P(PSTR("\r\n====================="));
}
/* example:
uint16_t macsize_b,
uint16_t ivsize_b ){
uint16_t i;
- uart_putstr_P(PSTR("\r\n\r\n"
+ NESSIE_PUTSTR_P(PSTR("\r\n\r\n"
"********************************************************************************\r\n"
"* micro-crypt - crypto primitives for microcontrolles by Daniel Otte *\r\n"
"********************************************************************************\r\n"
"\r\n"));
- uart_putstr_P(PSTR("Primitive Name: "));
- uart_putstr(name);
- uart_putstr_P(PSTR("\r\n"));
+ NESSIE_PUTSTR_P(PSTR("Primitive Name: "));
+ NESSIE_PUTSTR(name);
+ NESSIE_PUTSTR_P(PSTR("\r\n"));
/* underline */
for(i=0; i<16+strlen(name); ++i){
- uart_putc('=');
+ NESSIE_PUTC('=');
}
char str[6]; /* must catch numbers up to 65535 + terminatin \0 */
if(keysize_b){
- uart_putstr_P(PSTR("\r\nKey size: "));
+ NESSIE_PUTSTR_P(PSTR("\r\nKey size: "));
utoa(keysize_b, str, 10);
- uart_putstr(str);
- uart_putstr_P(PSTR(" bits"));
+ NESSIE_PUTSTR(str);
+ NESSIE_PUTSTR_P(PSTR(" bits"));
}
if(blocksize_b){
- uart_putstr_P(PSTR("\r\nBlock size: "));
+ NESSIE_PUTSTR_P(PSTR("\r\nBlock size: "));
utoa(blocksize_b, str, 10);
- uart_putstr(str);
- uart_putstr_P(PSTR(" bits"));
+ NESSIE_PUTSTR(str);
+ NESSIE_PUTSTR_P(PSTR(" bits"));
}
if(hashsize_b){
- uart_putstr_P(PSTR("\r\nHash size: "));
+ NESSIE_PUTSTR_P(PSTR("\r\nHash size: "));
utoa(hashsize_b, str, 10);
- uart_putstr(str);
- uart_putstr_P(PSTR(" bits"));
+ NESSIE_PUTSTR(str);
+ NESSIE_PUTSTR_P(PSTR(" bits"));
}
if(macsize_b){
- uart_putstr_P(PSTR("\r\nMac size: "));
+ NESSIE_PUTSTR_P(PSTR("\r\nMac size: "));
utoa(macsize_b, str, 10);
- uart_putstr(str);
- uart_putstr_P(PSTR(" bits"));
+ NESSIE_PUTSTR(str);
+ NESSIE_PUTSTR_P(PSTR(" bits"));
}
if(ivsize_b){
if(ivsize_b==(uint16_t)-1){
- uart_putstr_P(PSTR("\r\nNo initial value (IV) mode"));
+ NESSIE_PUTSTR_P(PSTR("\r\nNo initial value (IV) mode"));
}
{
- uart_putstr_P(PSTR("\r\nIV size: "));
+ NESSIE_PUTSTR_P(PSTR("\r\nIV size: "));
utoa(ivsize_b, str, 10);
- uart_putstr(str);
- uart_putstr_P(PSTR(" bits"));
+ NESSIE_PUTSTR(str);
+ NESSIE_PUTSTR_P(PSTR(" bits"));
}
}
- uart_putstr_P(PSTR("\r\n"));
+ NESSIE_PUTSTR_P(PSTR("\r\n"));
}
void nessie_print_footer(void){
- uart_putstr_P(PSTR("\r\n\r\n\r\n\r\nEnd of test vectors\r\n\r\n"));
+ NESSIE_PUTSTR_P(PSTR("\r\n\r\n\r\n\r\nEnd of test vectors\r\n\r\n"));
}
#ifndef NESSIE_COMMON_H_
#define NESSIE_COMMON_H_
+#define NESSIE_ALIVE_CHAR 0x06
+#define NESSIE_ALIVE
+#define NESSIE_USE_CLI
#include <stdint.h>
+#ifdef NESSIE_ALIVE
+#define NESSIE_SEND_ALIVE nessie_send_alive()
+void nessie_send_alive(void);
+#define NESSIE_SEND_ALIVE_A(i) nessie_send_alive_a(i)
+void nessie_send_alive_a(uint16_t i);
+#else
+#define NESSIE_SEND_ALIVE
+#define NESSIE_SEND_ALIVE_A(i)
+#endif
+
+
+#ifdef NESSIE_USE_CLI
+#include "cli.h"
+#define NESSIE_PUTC cli_putc
+#define NESSIE_PUTSTR cli_putstr
+#define NESSIE_PUTSTR_P cli_putstr_P
+#else
+#include "uart.h"
+#define NESSIE_PUTC uart_putc
+#define NESSIE_PUTSTR uart_putstr
+#define NESSIE_PUTSTR_P uart_putstr_P
+#endif
+
void nessie_print_block(uint8_t* block, uint16_t blocksize_bit);
void nessie_print_item(char* name, uint8_t* buffer, uint16_t size_B);
void nessie_print_set_vector(uint8_t set, uint16_t vector);
uint8_t hash[(nessie_hash_ctx.hashsize_b+7)/8];
uint16_t sl;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr(desc);
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR(desc);
nessie_hash_ctx.hash_init(ctx);
sl = strlen(data);
while(sl>=nessie_hash_ctx.blocksize_B){
uint8_t hash[(nessie_hash_ctx.hashsize_b+7)/8];
uint8_t block[nessie_hash_ctx.blocksize_B];
uint32_t n=1000000LL;
+ uint16_t i=0;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr_P(PSTR("1 million times \"a\""));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("1 million times \"a\""));
memset(block, 'a', nessie_hash_ctx.blocksize_B);
nessie_hash_ctx.hash_init(ctx);
while(n>=nessie_hash_ctx.blocksize_B){
nessie_hash_ctx.hash_next(block, ctx);
n -= nessie_hash_ctx.blocksize_B;
+ NESSIE_SEND_ALIVE_A(i++);
}
nessie_hash_ctx.hash_last(block, n*8, ctx);
nessie_hash_ctx.hash_conv(hash, ctx);
uint8_t hash[(nessie_hash_ctx.hashsize_b+7)/8];
uint8_t block[nessie_hash_ctx.blocksize_B];
- uart_putstr_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
if(n>=10000)
- uart_putc('0'+n/10000);
+ NESSIE_PUTC('0'+n/10000);
if(n>=1000)
- uart_putc('0'+(n/1000)%10);
+ NESSIE_PUTC('0'+(n/1000)%10);
if(n>=100)
- uart_putc('0'+(n/100)%10);
+ NESSIE_PUTC('0'+(n/100)%10);
if(n>=10)
- uart_putc('0'+(n/10)%10);
- uart_putc('0'+n%10);
- uart_putstr_P(PSTR(" zero bits"));
+ NESSIE_PUTC('0'+(n/10)%10);
+ NESSIE_PUTC('0'+n%10);
+ NESSIE_PUTSTR_P(PSTR(" zero bits"));
memset(block, 0, nessie_hash_ctx.blocksize_B);
nessie_hash_ctx.hash_init(ctx);
"08", "04", "02", "01" };
pos&=511;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr_P(PSTR("512-bit string: "));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("512-bit string: "));
if((pos/8) >=10){
- uart_putc('0'+(pos/8/10)%10);
+ NESSIE_PUTC('0'+(pos/8/10)%10);
} else {
- uart_putc(' ');
+ NESSIE_PUTC(' ');
}
- uart_putc('0'+(pos/8)%10);
- uart_putstr_P(PSTR("*00,"));
- uart_putstr(tab[pos&7]);
- uart_putc(',');
+ NESSIE_PUTC('0'+(pos/8)%10);
+ NESSIE_PUTSTR_P(PSTR("*00,"));
+ NESSIE_PUTSTR(tab[pos&7]);
+ NESSIE_PUTC(',');
if(63-(pos/8) >=10){
- uart_putc('0'+((63-pos/8)/10)%10);
+ NESSIE_PUTC('0'+((63-pos/8)/10)%10);
} else {
- uart_putc(' ');
+ NESSIE_PUTC(' ');
}
- uart_putc('0'+(63-pos/8)%10);
- uart_putstr_P(PSTR("*00"));
+ NESSIE_PUTC('0'+(63-pos/8)%10);
+ NESSIE_PUTSTR_P(PSTR("*00"));
/* now the real stuff */
memset(block, 0, 512/8);
uint16_t n=nessie_hash_ctx.hashsize_b;
uint32_t i;
- uart_putstr_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
if(nessie_hash_ctx.hashsize_b>=10000)
- uart_putc('0' + (nessie_hash_ctx.hashsize_b/10000)%10);
+ NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/10000)%10);
if(nessie_hash_ctx.hashsize_b>=1000)
- uart_putc('0' + (nessie_hash_ctx.hashsize_b/1000)%10);
+ NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/1000)%10);
if(nessie_hash_ctx.hashsize_b>=100)
- uart_putc('0' + (nessie_hash_ctx.hashsize_b/100)%10);
+ NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/100)%10);
if(nessie_hash_ctx.hashsize_b>=10)
- uart_putc('0' + (nessie_hash_ctx.hashsize_b/10)%10);
- uart_putc('0' + nessie_hash_ctx.hashsize_b%10);
+ NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/10)%10);
+ NESSIE_PUTC('0' + nessie_hash_ctx.hashsize_b%10);
- uart_putstr_P(PSTR(" zero bits"));
+ NESSIE_PUTSTR_P(PSTR(" zero bits"));
memset(block, 0, 256/8);
nessie_hash_ctx.hash_init(ctx);
nessie_hash_ctx.hash_init(ctx);
nessie_hash_ctx.hash_last(hash, nessie_hash_ctx.hashsize_b, ctx);
nessie_hash_ctx.hash_conv(hash, ctx);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_print_item("iterated 100000 times", hash, (nessie_hash_ctx.hashsize_b+7)/8);
}
uint8_t mac[MACSIZE_B];
uint16_t sl;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr(desc);
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR(desc);
PRINTKEY;
nessie_mac_ctx.mac_init(key, nessie_mac_ctx.keysize_b, ctx);
sl = strlen(data);
uint8_t mac[MACSIZE_B];
uint8_t block[nessie_mac_ctx.blocksize_B];
uint32_t n=1000000LL;
+ uint16_t i=0;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr_P(PSTR("1 million times \"a\""));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("1 million times \"a\""));
PRINTKEY;
memset(block, 'a', nessie_mac_ctx.blocksize_B);
while(n>nessie_mac_ctx.blocksize_B){
nessie_mac_ctx.mac_next(block, ctx);
n -= nessie_mac_ctx.blocksize_B;
+ NESSIE_SEND_ALIVE_A(i++);
}
nessie_mac_ctx.mac_last(block, n*8, key, nessie_mac_ctx.keysize_b, ctx);
nessie_mac_ctx.mac_conv(mac, ctx);
uint8_t mac[MACSIZE_B];
uint8_t block[nessie_mac_ctx.blocksize_B];
- uart_putstr_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
if(n>=10000)
- uart_putc('0'+n/10000);
+ NESSIE_PUTC('0'+n/10000);
if(n>=1000)
- uart_putc('0'+(n/1000)%10);
+ NESSIE_PUTC('0'+(n/1000)%10);
if(n>=100)
- uart_putc('0'+(n/100)%10);
+ NESSIE_PUTC('0'+(n/100)%10);
if(n>=10)
- uart_putc('0'+(n/10)%10);
- uart_putc('0'+n%10);
- uart_putstr_P(PSTR(" zero bits"));
+ NESSIE_PUTC('0'+(n/10)%10);
+ NESSIE_PUTC('0'+n%10);
+ NESSIE_PUTSTR_P(PSTR(" zero bits"));
PRINTKEY;
memset(block, 0, nessie_mac_ctx.blocksize_B);
"08", "04", "02", "01" };
pos&=511;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr_P(PSTR("512-bit string: "));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("512-bit string: "));
if((pos/8) >=10){
- uart_putc('0'+(pos/8/10)%10);
+ NESSIE_PUTC('0'+(pos/8/10)%10);
} else {
- uart_putc(' ');
+ NESSIE_PUTC(' ');
}
- uart_putc('0'+(pos/8)%10);
- uart_putstr_P(PSTR("*00,"));
- uart_putstr(tab[pos&7]);
- uart_putc(',');
+ NESSIE_PUTC('0'+(pos/8)%10);
+ NESSIE_PUTSTR_P(PSTR("*00,"));
+ NESSIE_PUTSTR(tab[pos&7]);
+ NESSIE_PUTC(',');
if(63-(pos/8) >=10){
- uart_putc('0'+((63-pos/8)/10)%10);
+ NESSIE_PUTC('0'+((63-pos/8)/10)%10);
} else {
- uart_putc(' ');
+ NESSIE_PUTC(' ');
}
- uart_putc('0'+(63-pos/8)%10);
- uart_putstr_P(PSTR("*00"));
+ NESSIE_PUTC('0'+(63-pos/8)%10);
+ NESSIE_PUTSTR_P(PSTR("*00"));
PRINTKEY;
/* now the real stuff */
uint16_t n=256;
uint32_t i;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr(PSTR("256 zero bits"));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR(PSTR("256 zero bits"));
memset(block, 0, 256/8);
nessie_mac_ctx.mac_init(key, nessie_mac_ctx.keysize_b, ctx);;
nessie_mac_ctx.mac_init(key, nessie_mac_ctx.keysize_b, ctx);;
nessie_mac_ctx.mac_last(mac, nessie_mac_ctx.macsize_b, key, nessie_mac_ctx.keysize_b, ctx);
nessie_mac_ctx.mac_conv(mac, ctx);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_print_item("iterated 100000 times", mac, MACSIZE_B);
}
for(i=0; i<((65472-0)/BLOCKSIZE_B-1); ++i){
nessie_gen_block(ctx, buffer);
memxor(xorbuffer, buffer, BLOCKSIZE_B);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_gen_block(ctx, buffer);
for(i=0; i<((131008-65536)/BLOCKSIZE_B-1); ++i){
nessie_gen_block(ctx, buffer);
memxor(xorbuffer, buffer, BLOCKSIZE_B);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_gen_block(ctx, buffer);
--- /dev/null
+/* shavs.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 shavs.c
+ * \author Daniel Otte
+ * \date 2006-05-16
+ * \license GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "shavs.h"
+#include "string-extras.h"
+#include "cli.h"
+
+hfdesc_t* algo=NULL;
+hfdesc_t** algolist=NULL;
+
+void shavs_listalgos(void){
+ char option = 'a';
+
+ cli_putstr_P(PSTR("\r\nDBG: &algolist: "));
+ cli_hexdump(&algolist, 2);
+ cli_putstr_P(PSTR("\r\nDBG: algolist[0]: "));
+ cli_hexdump(algolist, 8);
+
+ hfdesc_t* t;
+ uint8_t i=0;
+ cli_putstr_P(PSTR("\r\nthe following algorithms are available:\r\n"));
+ while(option<='z' && (t=(hfdesc_t*)pgm_read_word(&(algolist[i])))){
+ cli_putc('\t');
+ cli_putc((t==algo)?'*':' ');
+ cli_putc(option++);
+ cli_putstr_P(PSTR(":\t"));
+ cli_putstr_P((void*)(pgm_read_word(&(t->name))));
+ cli_putstr_P(PSTR("\r\n"));
+ i++;
+ }
+}
+
+void shavs_setalgo(char* param){
+ param = strstrip(param);
+ if(param[1]=='\0'){ /* single letter specified */
+ uint8_t i,option = param[0]-'a';
+
+ if(!algolist){
+ cli_putstr_P(PSTR("\r\nERROR: algolist not set!"));
+ return;
+ }
+ for(i=0; i<=option; ++i){
+ if((void*)pgm_read_word(&(algolist[i]))==NULL){
+ cli_putstr_P(PSTR("\r\nERROR: invalid selection!"));
+ return;
+ }
+ }
+ algo=(hfdesc_t*)pgm_read_word(&(algolist[option]));
+ } else { /* name specifyed */
+ hfdesc_t* t=NULL;
+ uint8_t i=0;
+ while((t=(hfdesc_t*)pgm_read_word(&(algolist[i]))) &&
+ strcasecmp_P(param, (void*)pgm_read_word(&(t->name))))
+ ++i;
+ if(t){
+ algo=t;
+ }else{
+ cli_putstr_P(PSTR("\r\nERROR: could not find \""));
+ cli_putstr(param);
+ cli_putstr_P(PSTR("\"!"));
+ }
+ }
+}
+
--- /dev/null
+/* shavs.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 shavs.h
+ * \author Daniel Otte
+ * \date 2006-05-16
+ * \license GPLv3 or later
+ *
+ */
+
+#ifndef SHAVS_H_
+#define SHAVS_H_
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+
+extern hfdesc_t* algo;
+extern hfdesc_t** algolist;
+
+void shavs_listalgos(void);
+void shavs_setalgo(char* param);
+
+#endif /* SHAVS */
/* trivium.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
/* trivium.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
/* twister-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
/* twister-big-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
/* twister-big.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
/* twister-small-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
/* twister.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
#include "twister_tables.h"
#include "memxor.h"
-#ifndef TWISTER_MUL_TABLE
+//#ifndef TWISTER_MUL_TABLE
# include "gf256mul.h"
-#endif
+//#endif
#define MDS(a,b) pgm_read_byte(&(twister_mds[(a)][(b)]))
-#ifdef TWISTER_MUL_TABLE
-# define MULT(a,b) pgm_read_byte(&(twister_multab[(a)][(b)]))
-#else
+//#ifdef TWISTER_MUL_TABLE
+//# define MULT(a,b) pgm_read_byte(&(twister_multab[(a)][(b)]))
+//#else
# define MULT(a,b) gf256mul((a),(b), 0x4D)
-#endif
+//#endif
void twister_blank_round(twister_state_t* ctx){
uint8_t i,j,k;
for( j=0; j<8; j++ ){
k=(i+1)&7;
ctx->s[j][i] =
- MULT( MDS(j,0), tmp[0][i] ) ^
- MULT( MDS(j,1), tmp[1][k] ) ^
- MULT( MDS(j,2), tmp[2][(++k)&7] ) ^
- MULT( MDS(j,3), tmp[3][(++k)&7] ) ^
- MULT( MDS(j,4), tmp[4][(++k)&7] ) ^
- MULT( MDS(j,5), tmp[5][(++k)&7] ) ^
- MULT( MDS(j,6), tmp[6][(++k)&7] ) ^
- MULT( MDS(j,7), tmp[7][(++k)&7] ) ;
+ MULT( MDS(j,0), (tmp[0][i]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,1), (tmp[1][k]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,2), (tmp[2][((++k)&7)]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,3), (tmp[3][((++k)&7)]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,4), (tmp[4][((++k)&7)]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,5), (tmp[5][((++k)&7)]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,6), (tmp[6][((++k)&7)]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,7), (tmp[7][((++k)&7)]) );
}
}
}
-
void twister_mini_round(twister_state_t* ctx, const void* msg){
/* inject message */
uint8_t i;
/* twister.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
/* twister224.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
/* twister256.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
/* twister384.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
/* twister512.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
/* uart.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
/* xtea-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
/* 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
/* 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