3 * $Id: desx.h,v 1.2 2004/04/08 01:36:15 mdw Exp $
7 * (c) 2001 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 /*----- Notes on DESX -----------------------------------------------------*
32 * DESX was designed by Ron Rivest in 1986 as a simple and cheap way to
33 * strengthen DES against exhaustive search. It also increases the
34 * difficulty of differential and linear attacks.
37 #ifndef CATACOMB_DESX_H
38 #define CATACOMB_DESX_H
44 /*----- Header files ------------------------------------------------------*/
48 #include <mLib/bits.h>
50 #ifndef CATACOMB_DES_H
54 /*----- Magical numbers ---------------------------------------------------*/
58 #define DESX_CLASS (N, B, 64)
60 extern const octet desx_keysz
[];
62 /*----- Data structures ---------------------------------------------------*/
64 typedef struct desx_ctx
{
70 /*----- Functions provided ------------------------------------------------*/
72 /* --- @desx_init@ --- *
74 * Arguments: @desx_ctx *k@ = pointer to key block
75 * @const void *buf@ = pointer to key buffer
76 * @size_t sz@ = size of key material
80 * Use: Initializes a DESX key buffer. The key buffer contains, in
81 * order, an optional 8-byte pre-whitening key, a single-DES key
82 * (either 7 or 8 bytes), and an optional 8-byte port-whitening
83 * key. If no whitening keys are specified, the algorithm
84 * becomes the same as single-DES.
87 extern void desx_init(desx_ctx */
*k*/
, const void */
*buf*/
, size_t /*sz*/);
89 /* --- @desx_eblk@, @desx_dblk@ --- *
91 * Arguments: @const desx_ctx *k@ = pointer to 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 desx_eblk(const desx_ctx */
*k*/
,
101 const uint32 */
*s*/
, uint32 */
*d*/
);
102 extern void desx_dblk(const desx_ctx */
*k*/
,
103 const uint32 */
*s*/
, uint32 */
*d*/
);
105 /*----- That's all, folks -------------------------------------------------*/