| 1 | /* -*-c-*- |
| 2 | * |
| 3 | * The Rijndael block cipher, 256-bit version |
| 4 | * |
| 5 | * (c) 2001 Straylight/Edgeware |
| 6 | */ |
| 7 | |
| 8 | /*----- Licensing notice --------------------------------------------------* |
| 9 | * |
| 10 | * This file is part of Catacomb. |
| 11 | * |
| 12 | * Catacomb is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU Library General Public License as |
| 14 | * published by the Free Software Foundation; either version 2 of the |
| 15 | * License, or (at your option) any later version. |
| 16 | * |
| 17 | * Catacomb is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU Library General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU Library General Public |
| 23 | * License along with Catacomb; if not, write to the Free |
| 24 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| 25 | * MA 02111-1307, USA. |
| 26 | */ |
| 27 | |
| 28 | #ifndef CATACOMB_RIJNDAEL256_H |
| 29 | #define CATACOMB_RIJNDAEL256_H |
| 30 | |
| 31 | #ifdef __cplusplus |
| 32 | extern "C" { |
| 33 | #endif |
| 34 | |
| 35 | /*----- Header files ------------------------------------------------------*/ |
| 36 | |
| 37 | #ifndef CATACOMB_RIJNDAEL_H |
| 38 | # include "rijndael.h" |
| 39 | #endif |
| 40 | |
| 41 | /*----- Magical numbers ---------------------------------------------------*/ |
| 42 | |
| 43 | #define RIJNDAEL256_BLKSZ 32 |
| 44 | #define RIJNDAEL256_KEYSZ 32 |
| 45 | #define RIJNDAEL256_CLASS (N, B, 256) |
| 46 | |
| 47 | #define rijndael256_keysz rijndael_keysz |
| 48 | |
| 49 | /*----- Data structures ---------------------------------------------------*/ |
| 50 | |
| 51 | typedef struct rijndael_ctx rijndael256_ctx; |
| 52 | |
| 53 | /*----- Functions provided ------------------------------------------------*/ |
| 54 | |
| 55 | /* --- @rijndael256_init@ --- * |
| 56 | * |
| 57 | * Arguments: @rijndael_ctx *k@ = pointer to context to initialize |
| 58 | * @const void *buf@ = pointer to buffer of key material |
| 59 | * @size_t sz@ = size of the key material |
| 60 | * |
| 61 | * Returns: --- |
| 62 | * |
| 63 | * Use: Initializes a Rijndael context with a particular key. This |
| 64 | * implementation of Rijndael doesn't impose any particular |
| 65 | * limits on the key size except that it must be multiple of 4 |
| 66 | * bytes long. 256 bits seems sensible, though. |
| 67 | */ |
| 68 | |
| 69 | extern void rijndael256_init(rijndael_ctx */*k*/, |
| 70 | const void */*buf*/, size_t /*sz*/); |
| 71 | |
| 72 | /* --- @rijndael_eblk@, @rijndael_dblk@ --- * |
| 73 | * |
| 74 | * Arguments: @const rijndael_ctx *k@ = pointer to Rijndael context |
| 75 | * @const uint32 s[4]@ = pointer to source block |
| 76 | * @uint32 d[4]@ = pointer to destination block |
| 77 | * |
| 78 | * Returns: --- |
| 79 | * |
| 80 | * Use: Low-level block encryption and decryption. |
| 81 | */ |
| 82 | |
| 83 | extern void rijndael256_eblk(const rijndael_ctx */*k*/, |
| 84 | const uint32 */*s*/, uint32 */*dst*/); |
| 85 | extern void rijndael256_dblk(const rijndael_ctx */*k*/, |
| 86 | const uint32 */*s*/, uint32 */*dst*/); |
| 87 | |
| 88 | /*----- That's all, folks -------------------------------------------------*/ |
| 89 | |
| 90 | #ifdef __cplusplus |
| 91 | } |
| 92 | #endif |
| 93 | |
| 94 | #endif |