]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cryptkit/lib/ckDES.h
Security-58286.51.6.tar.gz
[apple/security.git] / OSX / libsecurity_cryptkit / lib / ckDES.h
1 /* Copyright (c) 1998,2011,2014 Apple Inc. All Rights Reserved.
2 *
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, INC. AND THE
6 * ORIGINAL LICENSEE THAT OBTAINED THESE MATERIALS FROM APPLE,
7 * INC. ANY USE OF THESE MATERIALS NOT PERMITTED BY SUCH AGREEMENT WILL
8 * EXPOSE YOU TO LIABILITY.
9 ***************************************************************************
10 *
11 * DES.h - raw DES encryption engine interface
12 *
13 * Revision History
14 * ----------------
15 * 31 Mar 97 at Apple
16 * Put per-instance data in struct _desInst
17 * 21 Aug 96 at NeXT
18 * Broke out from NSDESCryptor.m
19 * 22 Feb 96 at NeXT
20 * Created.
21 */
22
23 #ifndef _CK_DES_H_
24 #define _CK_DES_H_
25
26 #include "ckconfig.h"
27
28 #if CRYPTKIT_SYMMETRIC_ENABLE
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #define DES_BLOCK_SIZE_BYTES 8 /* in bytes */
35 #define DES_KEY_SIZE_BITS 56 /* effective key size in bits */
36 #define DES_KEY_SIZE_BITS_EXTERNAL 64 /* clients actually pass in this much */
37 #define DES_KEY_SIZE_BYTES_EXTERNAL (DES_KEY_SIZE_BITS_EXTERNAL / 8)
38
39 #define DES_MODE_STD 0 /* standard Data Encryption Algorithm */
40 #define DES_MODE_FAST 1 /* DEA without initial and final */
41 /* permutations for speed */
42 #define DES_MODE_128 2 /* DEA without permutations and with */
43 /* 128-byte key (completely independent */
44 /* subkeys for each round) */
45
46 /*
47 * Per-instance data.
48 */
49 struct _desInst {
50 /* 8 16-bit subkeys for each of 16 rounds, initialized by setkey()
51 */
52 unsigned char kn[16][8];
53 int desmode;
54 };
55
56 typedef struct _desInst *desInst;
57
58 int desinit(desInst dinst, int mode);
59 void dessetkey(desInst dinst, char *key);
60 void endes(desInst dinst, char *block);
61 void dedes(desInst dinst, char *block);
62 void desdone(desInst dinst);
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68 #endif /* CRYPTKIT_SYMMETRIC_ENABLE */
69
70 #endif /*_CK_DES_H_*/