3 * The Extended Tiny Encryption Algorithm
5 * (c) 2000 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 Tiny Encryption Algorithm ----------------------------*
30 * XTEA is an amazingly simple 64-round Feistel network. It's tiny, fairly
31 * quick and surprisingly strong. It was invented by David Wheeler and Roger
32 * Needham. It's unpatented. XTEA is a new version of TEA, by the same
33 * designers, which fixes some weaknesses in TEA's key schedule.
35 * This implementation uses big-endian byte order, following SCAN.
38 #ifndef CATACOMB_XTEA_H
39 #define CATACOMB_XTEA_H
45 /*----- Header files ------------------------------------------------------*/
49 #include <mLib/bits.h>
51 /*----- Magical numbers ---------------------------------------------------*/
55 #define XTEA_CLASS (N, B, 64)
57 extern const octet xtea_keysz[];
59 /*----- Data structures ---------------------------------------------------*/
61 typedef struct xtea_ctx {
66 /*----- Functions provided ------------------------------------------------*/
68 /* --- @xtea_init@ --- *
70 * Arguments: @xtea_ctx *k@ = pointer to key block
71 * @const void *buf@ = pointer to key buffer
72 * @size_t sz@ = size of key material
76 * Use: Initializes an XTEA key buffer. The key buffer may be up to
80 extern void xtea_init(xtea_ctx */*k*/, const void */*buf*/, size_t /*sz*/);
82 /* --- @xtea_eblk@, @xtea_dblk@ --- *
84 * Arguments: @const xtea_ctx *k@ = pointer to key block
85 * @const uint32 s[2]@ = pointer to source block
86 * @uint32 d[2]@ = pointer to xteatination block
90 * Use: Low-level block encryption and decryption.
93 extern void xtea_eblk(const xtea_ctx */*k*/,
94 const uint32 */*s*/, uint32 */*d*/);
95 extern void xtea_dblk(const xtea_ctx */*k*/,
96 const uint32 */*s*/, uint32 */*d*/);
98 /*----- That's all, folks -------------------------------------------------*/