3 * The MARS block cipher
5 * (c) 2001 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of Catacomb.
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.
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.
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,
28 /*----- Notes on the MARS block cipher ------------------------------------*
30 * MARS was IBM's submission to the AES contest. It was designed by a number
31 * of clever people at the T. J. Watson labs, and made it to the second round
32 * of the contest. Unfortunately, MARS is rather messy. There are some
33 * awkward corner cases in the key schedule algorithm, for example, that show
37 #ifndef CATACOMB_MARS_H
38 #define CATACOMB_MARS_H
44 /*----- Header files ------------------------------------------------------*/
48 #include <mLib/bits.h>
50 /*----- Magical numbers ---------------------------------------------------*/
54 #define MARS_CLASS (N, L, 128)
56 extern const octet mars_keysz[];
58 /*----- Data structures ---------------------------------------------------*/
60 typedef struct mars_ctx {
64 /*----- Functions provided ------------------------------------------------*/
66 /* --- @mars_init@ --- *
68 * Arguments: @mars_ctx *k@ = pointer to key block to fill in
69 * @const void *buf@ = pointer to buffer of key material
70 * @size_t sz@ = size of key material
74 * Use: Initializes a MARS key buffer. MARS accepts key sizes
75 * between 128 and 448 bits which are a multiple of 32 bits.
78 extern void mars_init(mars_ctx */*k*/,
79 const void */*buf*/, size_t /*sz*/);
81 /* --- @mars_eblk@, @mars_dblk@ --- *
83 * Arguments: @const mars_ctx *k@ = pointer to key block
84 * @const uint32 s[4]@ = pointer to source block
85 * @uint32 d[4]@ = pointer to destination block
89 * Use: Low-level block encryption and decryption.
92 extern void mars_eblk(const mars_ctx */*k*/,
93 const uint32 */*s*/, uint32 */*d*/);
95 extern void mars_dblk(const mars_ctx */*k*/,
96 const uint32 */*s*/, uint32 */*d*/);
98 /*----- That's all, folks -------------------------------------------------*/