3 * $Id: des.h,v 1.3 2000/06/17 10:52:32 mdw Exp $
5 * The Data Encryption Standard
7 * (c) 1999 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.3 2000/06/17 10:52:32 mdw
34 * Support new key size interface.
36 * Revision 1.2 1999/12/10 23:29:48 mdw
37 * Change header file guard names.
39 * Revision 1.1 1999/09/03 08:41:11 mdw
44 /*----- Notes on the Data Encryption Standard -----------------------------*
46 * Almost twenty years after it was first accepted, DES is still the standard
47 * block cipher. It's showing its age in its small key size and poor
48 * optimiziation for software implementations, but it's not really been badly
49 * dented by the intensive analysis thrown at it.
51 * This interface is here for compatibility with existing protocols, and
52 * because it's a trivial veneer over the base DES code which is used by the
53 * @des3@ interface which implements proper strong triple-DES.
56 #ifndef CATACOMB_DES_H
57 #define CATACOMB_DES_H
63 /*----- Header files ------------------------------------------------------*/
67 #include <mLib/bits.h>
69 /*----- Magical numbers ---------------------------------------------------*/
73 #define DES_CLASS (N, B, 64)
75 extern const octet des_keysz
[];
77 /*----- Data structures ---------------------------------------------------*/
79 typedef struct des_ctx
{
83 /*----- Functions provided ------------------------------------------------*/
85 /* --- @des_init@ --- *
87 * Arguments: @des_ctx *k@ = pointer to key block
88 * @const void *buf@ = pointer to key buffer
89 * @size_t sz@ = size of key material
93 * Use: Initializes a DES key buffer. The key buffer may be either 7
94 * or 8 bytes long. If it's 8 bytes, the key is assumed to be
95 * padded with parity bits in the low order bit of each octet.
96 * These are stripped out without checking prior to the actual
100 extern void des_init(des_ctx */
*k*/
, const void */
*buf*/
, size_t /*sz*/);
102 /* --- @des_eblk@, @des_dblk@ --- *
104 * Arguments: @const des_ctx *k@ = pointer to key block
105 * @const uint32 s[2]@ = pointer to source block
106 * @uint32 d[2]@ = pointer to destination block
110 * Use: Low-level block encryption and decryption.
113 extern void des_eblk(const des_ctx */
*k*/
,
114 const uint32 */
*s*/
, uint32 */
*d*/
);
115 extern void des_dblk(const des_ctx */
*k*/
,
116 const uint32 */
*s*/
, uint32 */
*d*/
);
118 /*----- That's all, folks -------------------------------------------------*/