Add an internal-representation no-op function.
[u/mdw/catacomb] / desx.h
CommitLineData
b348397a 1/* -*-c-*-
2 *
3 * $Id: desx.h,v 1.1 2001/04/03 19:36:50 mdw Exp $
4 *
5 * The DESX algorithm
6 *
7 * (c) 2001 Straylight/Edgeware
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of Catacomb.
13 *
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.
18 *
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.
23 *
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,
27 * MA 02111-1307, USA.
28 */
29
30/*----- Revision history --------------------------------------------------*
31 *
32 * $Log: desx.h,v $
33 * Revision 1.1 2001/04/03 19:36:50 mdw
34 * New block cipher DESX added.
35 *
36 */
37
38/*----- Notes on DESX -----------------------------------------------------*
39 *
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.
43 */
44
45#ifndef CATACOMB_DESX_H
46#define CATACOMB_DESX_H
47
48#ifdef __cplusplus
49 extern "C" {
50#endif
51
52/*----- Header files ------------------------------------------------------*/
53
54#include <stddef.h>
55
56#include <mLib/bits.h>
57
58#ifndef CATACOMB_DES_H
59# include "des.h"
60#endif
61
62/*----- Magical numbers ---------------------------------------------------*/
63
64#define DESX_BLKSZ 8
65#define DESX_KEYSZ 23
66#define DESX_CLASS (N, B, 64)
67
68extern const octet desx_keysz[];
69
70/*----- Data structures ---------------------------------------------------*/
71
72typedef struct desx_ctx {
73 des_ctx k;
74 uint32 prea, preb;
75 uint32 posta, postb;
76} desx_ctx;
77
78/*----- Functions provided ------------------------------------------------*/
79
80/* --- @desx_init@ --- *
81 *
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
85 *
86 * Returns: ---
87 *
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.
93 */
94
95extern void desx_init(desx_ctx */*k*/, const void */*buf*/, size_t /*sz*/);
96
97/* --- @desx_eblk@, @desx_dblk@ --- *
98 *
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
102 *
103 * Returns: ---
104 *
105 * Use: Low-level block encryption and decryption.
106 */
107
108extern void desx_eblk(const desx_ctx */*k*/,
109 const uint32 */*s*/, uint32 */*d*/);
110extern void desx_dblk(const desx_ctx */*k*/,
111 const uint32 */*s*/, uint32 */*d*/);
112
113/*----- That's all, folks -------------------------------------------------*/
114
115#ifdef __cplusplus
116 }
117#endif
118
119#endif