diff options
Diffstat (limited to 'src/lib/libcrypto/des/des.h')
-rw-r--r-- | src/lib/libcrypto/des/des.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/lib/libcrypto/des/des.h b/src/lib/libcrypto/des/des.h index 98a9c4127c..ead67986d9 100644 --- a/src/lib/libcrypto/des/des.h +++ b/src/lib/libcrypto/des/des.h | |||
@@ -78,10 +78,7 @@ extern "C" { | |||
78 | typedef unsigned char des_cblock[8]; | 78 | typedef unsigned char des_cblock[8]; |
79 | typedef /* const */ unsigned char const_des_cblock[8]; | 79 | typedef /* const */ unsigned char const_des_cblock[8]; |
80 | /* With "const", gcc 2.8.1 on Solaris thinks that des_cblock * | 80 | /* With "const", gcc 2.8.1 on Solaris thinks that des_cblock * |
81 | * and const_des_cblock * are incompatible pointer types. | 81 | * and const_des_cblock * are incompatible pointer types. */ |
82 | * I haven't seen that warning on other systems ... I'll look | ||
83 | * what the standard says. */ | ||
84 | |||
85 | 82 | ||
86 | typedef struct des_ks_struct | 83 | typedef struct des_ks_struct |
87 | { | 84 | { |
@@ -141,8 +138,26 @@ void des_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits, | |||
141 | int enc); | 138 | int enc); |
142 | void des_ecb_encrypt(const_des_cblock *input,des_cblock *output, | 139 | void des_ecb_encrypt(const_des_cblock *input,des_cblock *output, |
143 | des_key_schedule ks,int enc); | 140 | des_key_schedule ks,int enc); |
141 | |||
142 | /* This is the DES encryption function that gets called by just about | ||
143 | every other DES routine in the library. You should not use this | ||
144 | function except to implement 'modes' of DES. I say this because the | ||
145 | functions that call this routine do the conversion from 'char *' to | ||
146 | long, and this needs to be done to make sure 'non-aligned' memory | ||
147 | access do not occur. The characters are loaded 'little endian'. | ||
148 | Data is a pointer to 2 unsigned long's and ks is the | ||
149 | des_key_schedule to use. enc, is non zero specifies encryption, | ||
150 | zero if decryption. */ | ||
144 | void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); | 151 | void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); |
152 | |||
153 | /* This functions is the same as des_encrypt() except that the DES | ||
154 | initial permutation (IP) and final permutation (FP) have been left | ||
155 | out. As for des_encrypt(), you should not use this function. | ||
156 | It is used by the routines in the library that implement triple DES. | ||
157 | IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same | ||
158 | as des_encrypt() des_encrypt() des_encrypt() except faster :-). */ | ||
145 | void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); | 159 | void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); |
160 | |||
146 | void des_encrypt3(DES_LONG *data, des_key_schedule ks1, | 161 | void des_encrypt3(DES_LONG *data, des_key_schedule ks1, |
147 | des_key_schedule ks2, des_key_schedule ks3); | 162 | des_key_schedule ks2, des_key_schedule ks3); |
148 | void des_decrypt3(DES_LONG *data, des_key_schedule ks1, | 163 | void des_decrypt3(DES_LONG *data, des_key_schedule ks1, |
@@ -192,6 +207,7 @@ int des_read_2passwords(des_cblock *key1,des_cblock *key2, | |||
192 | const char *prompt,int verify); | 207 | const char *prompt,int verify); |
193 | int des_read_pw_string(char *buf,int length,const char *prompt,int verify); | 208 | int des_read_pw_string(char *buf,int length,const char *prompt,int verify); |
194 | void des_set_odd_parity(des_cblock *key); | 209 | void des_set_odd_parity(des_cblock *key); |
210 | int des_check_key_parity(const_des_cblock *key); | ||
195 | int des_is_weak_key(const_des_cblock *key); | 211 | int des_is_weak_key(const_des_cblock *key); |
196 | /* des_set_key (= set_key = des_key_sched = key_sched) calls | 212 | /* des_set_key (= set_key = des_key_sched = key_sched) calls |
197 | * des_set_key_checked if global variable des_check_key is set, | 213 | * des_set_key_checked if global variable des_check_key is set, |
@@ -209,9 +225,6 @@ void des_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length, | |||
209 | des_key_schedule schedule,des_cblock *ivec,int *num); | 225 | des_key_schedule schedule,des_cblock *ivec,int *num); |
210 | int des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); | 226 | int des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); |
211 | 227 | ||
212 | /* Extra functions from Mark Murray <mark@grondar.za> */ | ||
213 | void des_cblock_print_file(const_des_cblock *cb, FILE *fp); | ||
214 | |||
215 | /* The following definitions provide compatibility with the MIT Kerberos | 228 | /* The following definitions provide compatibility with the MIT Kerberos |
216 | * library. The des_key_schedule structure is not binary compatible. */ | 229 | * library. The des_key_schedule structure is not binary compatible. */ |
217 | 230 | ||
@@ -241,11 +254,11 @@ void des_cblock_print_file(const_des_cblock *cb, FILE *fp); | |||
241 | # define xcbc_encrypt des_xcbc_encrypt | 254 | # define xcbc_encrypt des_xcbc_encrypt |
242 | # define cbc_cksum des_cbc_cksum | 255 | # define cbc_cksum des_cbc_cksum |
243 | # define quad_cksum des_quad_cksum | 256 | # define quad_cksum des_quad_cksum |
257 | # define check_parity des_check_key_parity | ||
244 | #endif | 258 | #endif |
245 | 259 | ||
246 | typedef des_key_schedule bit_64; | 260 | typedef des_key_schedule bit_64; |
247 | #define des_fixup_key_parity des_set_odd_parity | 261 | #define des_fixup_key_parity des_set_odd_parity |
248 | #define des_check_key_parity check_parity | ||
249 | 262 | ||
250 | #ifdef __cplusplus | 263 | #ifdef __cplusplus |
251 | } | 264 | } |