3 * $Id: desx.h,v 1.1 2001/04/03 19:36:50 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 /*----- Revision history --------------------------------------------------*
33 * Revision 1.1 2001/04/03 19:36:50 mdw
34 * New block cipher DESX added.
38 /*----- Notes on DESX -----------------------------------------------------*
40 * DESX was designed by Ron Rivest in 1986 as a simple and cheap way to
41 * strengthen DES against exhaustive search. It also increases the
42 * difficulty of differential and linear attacks.
45 #ifndef CATACOMB_DESX_H
46 #define CATACOMB_DESX_H
52 /*----- Header files ------------------------------------------------------*/
56 #include <mLib/bits.h>
58 #ifndef CATACOMB_DES_H
62 /*----- Magical numbers ---------------------------------------------------*/
66 #define DESX_CLASS (N, B, 64)
68 extern const octet desx_keysz
[];
70 /*----- Data structures ---------------------------------------------------*/
72 typedef struct desx_ctx
{
78 /*----- Functions provided ------------------------------------------------*/
80 /* --- @desx_init@ --- *
82 * Arguments: @desx_ctx *k@ = pointer to key block
83 * @const void *buf@ = pointer to key buffer
84 * @size_t sz@ = size of key material
88 * Use: Initializes a DESX key buffer. The key buffer contains, in
89 * order, an optional 8-byte pre-whitening key, a single-DES key
90 * (either 7 or 8 bytes), and an optional 8-byte port-whitening
91 * key. If no whitening keys are specified, the algorithm
92 * becomes the same as single-DES.
95 extern void desx_init(desx_ctx */
*k*/
, const void */
*buf*/
, size_t /*sz*/);
97 /* --- @desx_eblk@, @desx_dblk@ --- *
99 * Arguments: @const desx_ctx *k@ = pointer to key block
100 * @const uint32 s[2]@ = pointer to source block
101 * @uint32 d[2]@ = pointer to destination block
105 * Use: Low-level block encryption and decryption.
108 extern void desx_eblk(const desx_ctx */
*k*/
,
109 const uint32 */
*s*/
, uint32 */
*d*/
);
110 extern void desx_dblk(const desx_ctx */
*k*/
,
111 const uint32 */
*s*/
, uint32 */
*d*/
);
113 /*----- That's all, folks -------------------------------------------------*/