+/* nessie_bc_test.c */
+/*
+ This file is part of the Crypto-avr-lib/microcrypt-lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
/**
*
* author: Daniel Otte
/* single test */
nessie_print_item("key", key, (nessie_bc_ctx.keysize_b+7)/8);
nessie_bc_ctx.cipher_genctx(key, nessie_bc_ctx.keysize_b, ctx);
+
memcpy(buffer, pt, nessie_bc_ctx.blocksize_B);
nessie_print_item("plain", buffer, nessie_bc_ctx.blocksize_B);
nessie_bc_ctx.cipher_enc(buffer, ctx);
nessie_print_item("cipher", buffer, nessie_bc_ctx.blocksize_B);
- nessie_bc_ctx.cipher_dec(buffer, ctx);
- nessie_print_item("decrypted", buffer, nessie_bc_ctx.blocksize_B);
-
+ if(nessie_bc_ctx.cipher_dec){
+ nessie_bc_ctx.cipher_dec(buffer, ctx);
+ nessie_print_item("decrypted", buffer, nessie_bc_ctx.blocksize_B);
+ }
/* 100 times test */
memcpy(buffer, pt, nessie_bc_ctx.blocksize_B);
for(i=0; i<100; ++i){
}
nessie_bc_enc(key, buffer);
/* half done ;-) */
+ if(nessie_bc_ctx.cipher_dec==NULL)
+ return;
/* test set 5 */
set=5;
nessie_print_setheader(set);