]> git.saurik.com Git - apple/security.git/blame - libsecurity_cryptkit/lib/ckDES.h
Security-55471.14.18.tar.gz
[apple/security.git] / libsecurity_cryptkit / lib / ckDES.h
CommitLineData
b1ab9ed8
A
1/* Copyright (c) 1998 Apple Computer, 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 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 ***************************************************************************
10 *
11 * DES.h - raw DES encryption engine interface
12 *
13 * Revision History
14 * ----------------
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
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
31extern "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 */
49struct _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
56typedef struct _desInst *desInst;
57
58int desinit(desInst dinst, int mode);
59void dessetkey(desInst dinst, char *key);
60void endes(desInst dinst, char *block);
61void dedes(desInst dinst, char *block);
62void desdone(desInst dinst);
63
64#ifdef __cplusplus
65}
66#endif
67
68#endif /* CRYPTKIT_SYMMETRIC_ENABLE */
69
70#endif /*_CK_DES_H_*/