X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/3a65506d4df316377c9b838ef5954b5d856215ee..813390c45f438f411662b1a55678e63f11681eb4:/rijndael.h diff --git a/rijndael.h b/rijndael.h index 155f7a6..b1ba75f 100644 --- a/rijndael.h +++ b/rijndael.h @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: rijndael.h,v 1.1 2000/06/17 11:56:07 mdw Exp $ + * $Id: rijndael.h,v 1.4 2004/04/08 01:36:15 mdw Exp $ * * The Rijndael block cipher * * (c) 2000 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,32 +15,25 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb 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 Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: rijndael.h,v $ - * Revision 1.1 2000/06/17 11:56:07 mdw - * New cipher. - * - */ - /*----- Notes on the Rijndael block cipher --------------------------------* * - * Invented by Joan Daemen and Vincent Rijmen, Rijndael is a fast and - * relatively simple 128-bit block cipher proposed by the designers as an AES - * candidate. At the time of writing, the AES winner hasn't been decided. - * Rijnadel is fast, but has a low security margin. I recommend waiting + * Invented by Joan Daemen and Vincent Rijmen, Rijndael is a fast, elegant + * and relatively simple 128-bit block cipher. It was chosen by NIST to be + * the new Advanced Encryption Standard (AES) algorithm. + * + * Rijnadel appears to have a low security margin. I recommend waiting * before using Rijndael for any sensitive applications. */ @@ -61,14 +54,14 @@ #define RIJNDAEL_BLKSZ 16 #define RIJNDAEL_KEYSZ 32 -#define RIJNDAEL_CLASS (N, L, 128) +#define RIJNDAEL_CLASS (N, B, 128) extern const octet rijndael_keysz[]; /*----- Data structures ---------------------------------------------------*/ -#define RIJNDAEL_MAXROUNDS 32 -#define RIJNDAEL_KWORDS ((RIJNDAEL_MAXROUNDS + 1) * (RIJNDAEL_BLKSZ / 4)) +#define RIJNDAEL_MAXROUNDS 16 +#define RIJNDAEL_KWORDS ((RIJNDAEL_MAXROUNDS + 1) * 8) typedef struct rijndael_ctx { unsigned nr; @@ -78,6 +71,21 @@ typedef struct rijndael_ctx { /*----- Functions provided ------------------------------------------------*/ +/* --- @rijndael_setup@ --- * + * + * Arguments: @rijndael_ctx *k@ = pointer to context to initialize + * @unsigned nb@ = number of words in the block + * @const void *buf@ = pointer to buffer of key material + * @size_t sz@ = size of the key material + * + * Returns: --- + * + * Use: Low-level key-scheduling. Don't call this directly. + */ + +extern void rijndael_setup(rijndael_ctx */*k*/, unsigned /*nb*/, + const void */*buf*/, size_t /*sz*/); + /* --- @rijndael_init@ --- * * * Arguments: @rijndael_ctx *k@ = pointer to context to initialize