3 * $Id: serpent.h,v 1.1 2000/06/17 12:08:43 mdw Exp $
5 * The Serpent block cipher
7 * (c) 2000 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of Catacomb.
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 /*----- Revision history --------------------------------------------------*
33 * Revision 1.1 2000/06/17 12:08:43 mdw
38 /*----- Notes on the Serpent block cipher ---------------------------------*
40 * Serpent was designed and proposed for the AES contest by Ross Anderson,
41 * Eli Biham and Lars Knudsen. It's not particularly quick, but is
42 * stunningly secure. The best differential and linear attacks are
43 * speculated to require %$2^{256}$% texts (it's a 128-bit block cipher).
44 * The designers originally intended to file a patent, but failed to persue
45 * it. Use of the algorithm is completely unencumbered.
48 #ifndef CATACOMB_SERPENT_H
49 #define CATACOMB_SERPENT_H
55 /*----- Header files ------------------------------------------------------*/
59 #include <mLib/bits.h>
61 /*----- Magic numbers -----------------------------------------------------*/
63 #define SERPENT_BLKSZ 16
64 #define SERPENT_KEYSZ 32
65 #define SERPENT_CLASS (N, L, 128)
67 extern const octet serpent_keysz
[];
69 /*----- Data structures ---------------------------------------------------*/
71 typedef struct serpent_ctx
{
75 /*----- Functions provided ------------------------------------------------*/
77 /* --- @serpent_init@ --- *
79 * Arguments: @serpent_ctx *k@ = pointer to context block to initialize
80 * @const void *buf@ = pointer to input buffer
81 * @size_t sz@ = size of input buffer
85 * Use: Initializes a Serpent context. The key may be any length of
86 * up to 32 bytes (256 bits).
89 extern void serpent_init(serpent_ctx */
*k*/
,
90 const void */
*buf*/
, size_t /*sz*/);
92 /* --- @serpent_eblk@, @serpent_dblk@ --- *
94 * Arguments: @const serpent_ctx *k@ = pointer to key context
95 * @const uint32 s[4]@ = pointer to source block
96 * @uint32 d[4]@ = pointer to destination block
100 * Use: Low-level block encryption.
103 extern void serpent_eblk(const serpent_ctx */
*k*/
,
104 const uint32 */
*s*/
, uint32 */
*d*/
);
105 extern void serpent_dblk(const serpent_ctx */
*k*/
,
106 const uint32 */
*s*/
, uint32 */
*d*/
);
108 /*----- That's all, folks -------------------------------------------------*/