]>
git.saurik.com Git - apple/security.git/blob - AppleCSP/MiscCSPAlgs/DES.h
1 /* Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
3 * NOTICE: USE OF THE MATERIALS ACCOMPANYING THIS NOTICE IS SUBJECT
4 * TO THE TERMS OF THE SIGNED "FAST ELLIPTIC ENCRYPTION (FEE) REFERENCE
5 * SOURCE CODE EVALUATION AGREEMENT" BETWEEN APPLE COMPUTER, INC. AND THE
6 * ORIGINAL LICENSEE THAT OBTAINED THESE MATERIALS FROM APPLE COMPUTER,
7 * INC. ANY USE OF THESE MATERIALS NOT PERMITTED BY SUCH AGREEMENT WILL
8 * EXPOSE YOU TO LIABILITY.
9 ***************************************************************************
11 * DES.h - raw DES encryption engine interface
15 * 31 Mar 97 Doug Mitchell at Apple
16 * Put per-instance data in struct _desInst
17 * 21 Aug 96 Doug Mitchell at NeXT
18 * Broke out from NSDESCryptor.m
19 * 22 Feb 96 Blaine Garst at NeXT
30 #define DES_BLOCK_SIZE_BYTES 8 /* in bytes */
31 #define DES_KEY_SIZE_BITS 56 /* effective key size in bits */
32 #define DES_KEY_SIZE_BITS_EXTERNAL 64 /* clients actually pass in this much */
33 #define DES_KEY_SIZE_BYTES_EXTERNAL (DES_KEY_SIZE_BITS_EXTERNAL / 8)
35 #define DES_MODE_STD 0 /* standard Data Encryption Algorithm */
36 #define DES_MODE_FAST 1 /* DEA without initial and final */
37 /* permutations for speed */
38 #define DES_MODE_128 2 /* DEA without permutations and with */
39 /* 128-byte key (completely independent */
40 /* subkeys for each round) */
46 /* 8 16-bit subkeys for each of 16 rounds, initialized by setkey()
48 unsigned char kn
[16][8];
52 typedef struct _desInst
*desInst
;
54 /* Warning: desinit() is NOT thread safe. Caller must single-thread. */
55 int desinit(desInst dinst
, int mode
);
56 void dessetkey(desInst dinst
, char *key
);
57 void endes(desInst dinst
, char *block
);
58 void dedes(desInst dinst
, char *block
);
59 void desdone(desInst dinst
);