X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/70f31709e822f1a1877cf72d7f27bab5259b6c9d..298182ad446aaced14dea7ed0e7c968946787288:/blkc.h diff --git a/blkc.h b/blkc.h index 54f883d..d785f1d 100644 --- a/blkc.h +++ b/blkc.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: blkc.h,v 1.5 2001/05/07 17:28:42 mdw Exp $ + * $Id$ * * Common definitions for block ciphers * @@ -27,28 +27,6 @@ * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: blkc.h,v $ - * Revision 1.5 2001/05/07 17:28:42 mdw - * Support block ciphers with larger blocks. - * - * Revision 1.4 2001/04/29 17:39:15 mdw - * Removed `-sched' tests. Reorganized so that we can theoretically have - * multiple tests in the same file. (This isn't so useful in production, - * but it's handy when doing test builds.) - * - * Revision 1.3 2000/06/17 10:47:06 mdw - * Slight support for 96-bit ciphers. Support for counter-mode ciphers. - * - * Revision 1.2 1999/12/10 23:29:48 mdw - * Change header file guard names. - * - * Revision 1.1 1999/09/03 08:41:11 mdw - * Initial import. - * - */ - #ifndef CATACOMB_BLKC_H #define CATACOMB_BLKC_H @@ -123,6 +101,10 @@ BLKC_GLUE(BLKC_STEP_X_, BLKC_ENDIAN(PRE)) \ (PRE, w) +#define BLKC_ZERO(PRE, w) \ + BLKC_GLUE(BLKC_ZERO_, BLKC_TYPE(PRE)) \ + (PRE, w, BLKC_BITS(PRE)) + #define BLKC_SET(PRE, w, x) \ BLKC_GLUE(BLKC_SET_X_, BLKC_ENDIAN(PRE)) \ (PRE, w, x) @@ -176,6 +158,9 @@ BLKC_SKEL_X(PRE, BLKC_W(w); const BLKC_WX(wx);, \ *_w ^= *_wx; _w++; _wx++; ) \ +#define BLKC_ZERO_X(PRE, w, n) \ + BLKC_SKEL_X(PRE, BLKC_W(w);, *_w++ = 0;) + #define BLKC_STEP_X_B(PRE, w) do { \ unsigned _i = PRE##_BLKSZ / 4; BLKC_W(w); uint32 _x = 0; \ while (_i && !_x) { _i--; _w[_i] = _x = U32(_w[_i] + 1); } \ @@ -230,6 +215,7 @@ #define BLKC_XLOAD_GUTS(op, i) _w[i] ^= op(_p + 4 * i) #define BLKC_MOVE_GUTS(op, i) _w[i] = _wx[i] #define BLKC_XMOVE_GUTS(op, i) _w[i] ^= _wx[i] +#define BLKC_ZERO_GUTS(op, i) _w[i] = 0 #define BLKC_STORE_N(PRE, b, w, op, n) \ BLKC_GLUE(BLKC_SKEL_, n) \ @@ -252,6 +238,10 @@ BLKC_GLUE(BLKC_SKEL_, n) \ (PRE, BLKC_W(w); const BLKC_WX(wx);, op, BLKC_MOVE_GUTS) +#define BLKC_ZERO_N(PRE, w, n) \ + BLKC_GLUE(BLKC_SKEL_, n) \ + (PRE, BLKC_W(w); , op, BLKC_ZERO_GUTS) + #define BLKC_XMOVE_N(PRE, w, wx, n) \ BLKC_GLUE(BLKC_SKEL_, n) \ (PRE, BLKC_W(w); const BLKC_WX(wx);, op, BLKC_XMOVE_GUTS) @@ -267,6 +257,8 @@ #ifdef TEST_RIG +#include + #include #include @@ -330,7 +322,7 @@ static int pre##_verify(dstr *v) \ \ BLKC_VERIFY(PRE, pre) \ \ -static test_chunk defs[] = { \ +static const test_chunk defs[] = { \ { #pre, pre##_verify, { &type_hex, &type_hex, &type_hex, 0 } }, \ { 0, 0, { 0 } } \ }; \