1 | /*
|
---|
2 | * Copyright (c) 2005 Kungliga Tekniska Högskolan
|
---|
3 | * (Royal Institute of Technology, Stockholm, Sweden).
|
---|
4 | * All rights reserved.
|
---|
5 | *
|
---|
6 | * Redistribution and use in source and binary forms, with or without
|
---|
7 | * modification, are permitted provided that the following conditions
|
---|
8 | * are met:
|
---|
9 | *
|
---|
10 | * 1. Redistributions of source code must retain the above copyright
|
---|
11 | * notice, this list of conditions and the following disclaimer.
|
---|
12 | *
|
---|
13 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
14 | * notice, this list of conditions and the following disclaimer in the
|
---|
15 | * documentation and/or other materials provided with the distribution.
|
---|
16 | *
|
---|
17 | * 3. Neither the name of the Institute nor the names of its contributors
|
---|
18 | * may be used to endorse or promote products derived from this software
|
---|
19 | * without specific prior written permission.
|
---|
20 | *
|
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
---|
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
---|
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
---|
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
31 | * SUCH DAMAGE.
|
---|
32 | */
|
---|
33 |
|
---|
34 | /* $Id$ */
|
---|
35 |
|
---|
36 | #ifndef _DESperate_H
|
---|
37 | #define _DESperate_H 1
|
---|
38 |
|
---|
39 | /* symbol renaming */
|
---|
40 | #define _DES_ipfp_test _hc_DES_ipfp_test
|
---|
41 | #define DES_cbc_cksum hc_DES_cbc_cksum
|
---|
42 | #define DES_cbc_encrypt hc_DES_cbc_encrypt
|
---|
43 | #define DES_cfb64_encrypt hc_DES_cfb64_encrypt
|
---|
44 | #define DES_check_key_parity hc_DES_check_key_parity
|
---|
45 | #define DES_ecb3_encrypt hc_DES_ecb3_encrypt
|
---|
46 | #define DES_ecb_encrypt hc_DES_ecb_encrypt
|
---|
47 | #define DES_ede3_cbc_encrypt hc_DES_ede3_cbc_encrypt
|
---|
48 | #define DES_encrypt hc_DES_encrypt
|
---|
49 | #define DES_generate_random_block hc_DES_generate_random_block
|
---|
50 | #define DES_init_random_number_generator hc_DES_init_random_number_generator
|
---|
51 | #define DES_is_weak_key hc_DES_is_weak_key
|
---|
52 | #define DES_key_sched hc_DES_key_sched
|
---|
53 | #define DES_new_random_key hc_DES_new_random_key
|
---|
54 | #define DES_pcbc_encrypt hc_DES_pcbc_encrypt
|
---|
55 | #define DES_rand_data hc_DES_rand_data
|
---|
56 | #define DES_random_key hc_DES_random_key
|
---|
57 | #define DES_read_password hc_DES_read_password
|
---|
58 | #define DES_set_key hc_DES_set_key
|
---|
59 | #define DES_set_key_checked hc_DES_set_key_checked
|
---|
60 | #define DES_set_key_unchecked hc_DES_set_key_unchecked
|
---|
61 | #define DES_set_key_sched hc_DES_set_key_sched
|
---|
62 | #define DES_set_odd_parity hc_DES_set_odd_parity
|
---|
63 | #define DES_set_random_generator_seed hc_DES_set_random_generator_seed
|
---|
64 | #define DES_set_sequence_number hc_DES_set_sequence_number
|
---|
65 | #define DES_string_to_key hc_DES_string_to_key
|
---|
66 |
|
---|
67 | /*
|
---|
68 | *
|
---|
69 | */
|
---|
70 |
|
---|
71 | #define DES_CBLOCK_LEN 8
|
---|
72 | #define DES_KEY_SZ 8
|
---|
73 |
|
---|
74 | #define DES_ENCRYPT 1
|
---|
75 | #define DES_DECRYPT 0
|
---|
76 |
|
---|
77 | typedef unsigned char DES_cblock[DES_CBLOCK_LEN];
|
---|
78 | typedef struct DES_key_schedule
|
---|
79 | {
|
---|
80 | uint32_t ks[32];
|
---|
81 | } DES_key_schedule;
|
---|
82 |
|
---|
83 | /*
|
---|
84 | *
|
---|
85 | */
|
---|
86 |
|
---|
87 | #ifndef HC_DEPRECATED
|
---|
88 | #if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1 )))
|
---|
89 | #define HC_DEPRECATED __attribute__((deprecated))
|
---|
90 | #elif defined(_MSC_VER) && (_MSC_VER>1200)
|
---|
91 | #define HC_DEPRECATED __declspec(deprecated)
|
---|
92 | #else
|
---|
93 | #define HC_DEPRECATED
|
---|
94 | #endif
|
---|
95 | #endif
|
---|
96 |
|
---|
97 | #ifdef __cplusplus
|
---|
98 | extern "C" {
|
---|
99 | #endif
|
---|
100 |
|
---|
101 | void DES_set_odd_parity(DES_cblock *);
|
---|
102 | int DES_check_key_parity(DES_cblock *);
|
---|
103 | int DES_is_weak_key(DES_cblock *);
|
---|
104 | int HC_DEPRECATED DES_set_key(DES_cblock *, DES_key_schedule *);
|
---|
105 | int DES_set_key_checked(DES_cblock *, DES_key_schedule *);
|
---|
106 | int DES_set_key_unchecked(DES_cblock *, DES_key_schedule *);
|
---|
107 | int DES_key_sched(DES_cblock *, DES_key_schedule *);
|
---|
108 | void DES_string_to_key(const char *, DES_cblock *);
|
---|
109 | int DES_read_password(DES_cblock *, char *, int);
|
---|
110 |
|
---|
111 | void HC_DEPRECATED DES_rand_data(void *, int);
|
---|
112 | void HC_DEPRECATED DES_set_random_generator_seed(DES_cblock *);
|
---|
113 | void HC_DEPRECATED DES_generate_random_block(DES_cblock *);
|
---|
114 | void HC_DEPRECATED DES_set_sequence_number(void *);
|
---|
115 | void HC_DEPRECATED DES_init_random_number_generator(DES_cblock *);
|
---|
116 | void HC_DEPRECATED DES_random_key(DES_cblock *);
|
---|
117 | int HC_DEPRECATED DES_new_random_key(DES_cblock *);
|
---|
118 |
|
---|
119 |
|
---|
120 | void DES_encrypt(uint32_t [2], DES_key_schedule *, int);
|
---|
121 | void DES_ecb_encrypt(DES_cblock *, DES_cblock *, DES_key_schedule *, int);
|
---|
122 | void DES_ecb3_encrypt(DES_cblock *,DES_cblock *, DES_key_schedule *,
|
---|
123 | DES_key_schedule *, DES_key_schedule *, int);
|
---|
124 | void DES_pcbc_encrypt(const void *, void *, long,
|
---|
125 | DES_key_schedule *, DES_cblock *, int);
|
---|
126 | void DES_cbc_encrypt(const void *, void *, long,
|
---|
127 | DES_key_schedule *, DES_cblock *, int);
|
---|
128 | void DES_ede3_cbc_encrypt(const void *, void *, long,
|
---|
129 | DES_key_schedule *, DES_key_schedule *,
|
---|
130 | DES_key_schedule *, DES_cblock *, int);
|
---|
131 | void DES_cfb64_encrypt(const void *, void *, long,
|
---|
132 | DES_key_schedule *, DES_cblock *, int *, int);
|
---|
133 |
|
---|
134 |
|
---|
135 | uint32_t DES_cbc_cksum(const void *, DES_cblock *,
|
---|
136 | long, DES_key_schedule *, DES_cblock *);
|
---|
137 |
|
---|
138 |
|
---|
139 | void _DES_ipfp_test(void);
|
---|
140 |
|
---|
141 | #ifdef __cplusplus
|
---|
142 | }
|
---|
143 | #endif
|
---|
144 |
|
---|
145 |
|
---|
146 | #endif /* _DESperate_H */
|
---|