]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cryptkit/lib/ckDES.h
1 /* Copyright (c) 1998,2011,2014 Apple 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, 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 ***************************************************************************
11 * DES.h - raw DES encryption engine interface
16 * Put per-instance data in struct _desInst
18 * Broke out from NSDESCryptor.m
28 #if CRYPTKIT_SYMMETRIC_ENABLE
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)
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) */
50 /* 8 16-bit subkeys for each of 16 rounds, initialized by setkey()
52 unsigned char kn
[16][8];
56 typedef struct _desInst
*desInst
;
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
);
68 #endif /* CRYPTKIT_SYMMETRIC_ENABLE */