From: bg Date: Sat, 8 May 2010 16:34:44 +0000 (+0200) Subject: speed variant of bmw384/512 X-Git-Url: https://git.cryptolib.org/?p=arm-crypto-lib.git;a=commitdiff_plain;h=e0fbef3e36b457e05c8b7146a75c1d95e02b60ba speed variant of bmw384/512 --- diff --git a/bmw/bmw_large_speed.c b/bmw/bmw_large_speed.c new file mode 100644 index 0000000..fcd4a13 --- /dev/null +++ b/bmw/bmw_large_speed.c @@ -0,0 +1,477 @@ +/* bmw_large_speed.c */ +/* + This file is part of the ARM-Crypto-Lib. + Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +/* + * \file bmw_large.c + * \author Daniel Otte + * \email daniel.otte@rub.de + * \date 2009-04-27 + * \license GPLv3 or later + * + */ + +#include +#include +#include "bmw_large.h" + +#define SHL64(a,n) ((a)<<(n)) +#define SHR64(a,n) ((a)>>(n)) +#define ROTL64(a,n) (((a)<<(n))|((a)>>(64-(n)))) +#define ROTR64(a,n) (((a)>>(n))|((a)<<(64-(n)))) + +#define TWEAK 1 +#define BUG24 0 +#define F0_HACK 0 + +#define DEBUG 0 + +#if DEBUG + #include "cli.h" + + void ctx_dump(const bmw_large_ctx_t* ctx){ + uint8_t i; + cli_putstr("\r\n==== ctx dump ===="); + for(i=0; i<16;++i){ + cli_putstr("\r\n h["); + cli_hexdump(&i, 1); + cli_putstr("] = "); + cli_hexdump_rev(&(ctx->h[i]), 8); + } + cli_putstr("\r\n counter = "); + cli_hexdump(&(ctx->counter), 4); + } + + void dump_x(const uint64_t* q, uint8_t elements, char x){ + uint8_t i; + cli_putstr("\r\n==== "); + cli_putc(x); + cli_putstr(" dump ===="); + for(i=0; i