3 * Implementation of the IDEA cipher
5 * (c) 1999 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 IDEA block cipher ------------------------------------*
30 * IDEA was invented by James Massey and Xuejia Lai. The fundamental idea
31 * underlying the cipher is combining incompatible group operations. The
32 * algorithm's main claim to fame is that it is the symmetric cipher in PGP
35 * The IDEA algorithm is allegedly patented by Ascom Tech A.G., even in the
36 * UK and Europe. Ascom are willing to grant licences for use in software
37 * which forbids commercial use, but this is not compatible with Free
38 * Software Foundation ideology. The author recommends against the use of
39 * the IDEA cipher entirely. Blowfish is conceptually simpler, appears more
40 * concervative, offers a larger keyspace, runs faster, and is in the public
44 #ifndef CATACOMB_IDEA_H
45 #define CATACOMB_IDEA_H
51 /*----- Header files ------------------------------------------------------*/
55 #include <mLib/bits.h>
57 /*----- Magical numbers ---------------------------------------------------*/
61 #define IDEA_CLASS (N, B, 64)
63 extern const octet idea_keysz[];
65 /*----- Data structures ---------------------------------------------------*/
67 typedef struct idea_ctx {
72 /*----- Functions provided ------------------------------------------------*/
74 /* --- @idea_init@ --- *
76 * Arguments: @idea_ctx *k@ = pointer to key block
77 * @const void *buf@ = pointer to key buffer
78 * @size_t sz@ = size of key material
82 * Use: Initializes an IDEA key buffer. The buffer must be exactly
83 * 16 bytes in size, because IDEA is only defined with a key
87 extern void idea_init(idea_ctx */*k*/, const void */*buf*/, size_t /*sz*/);
89 /* --- @idea_eblk@, @idea_dblk@ --- *
91 * Arguments: @const idea_ctx *k@ = pointer to a key block
92 * @const uint32 s[2]@ = pointer to source block
93 * @uint32 d[2]@ = pointer to destination block
97 * Use: Low-level block encryption and decryption.
100 extern void idea_eblk(const idea_ctx */*k*/,
101 const uint32 */*s*/, uint32 */*d*/);
102 extern void idea_dblk(const idea_ctx */*k*/,
103 const uint32 */*s*/, uint32 */*d*/);
105 /*----- That's all, folks -------------------------------------------------*/