1 |
#define MAX_THREADS 5 /* Maximum number of threads */ |
2 |
|
3 |
#ifdef HAVE_CONFIG_H |
4 |
# include <config.h> |
5 |
#endif |
6 |
|
7 |
#ifdef WIN32 |
8 |
# include <sys/types.h> |
9 |
# include <malloc.h> |
10 |
# define HAVE_MEMMOVE |
11 |
# define HAVE_MEMSET |
12 |
# define STDC_HEADERS |
13 |
#endif |
14 |
|
15 |
|
16 |
#ifdef STDC_HEADERS |
17 |
# include <string.h> |
18 |
# include <stdlib.h> |
19 |
# include <stdio.h> |
20 |
#endif |
21 |
|
22 |
#ifdef WIN32 |
23 |
# include <windows.h> |
24 |
# include <string.h> |
25 |
# include <sys/types.h> |
26 |
# include <malloc.h> |
27 |
#endif |
28 |
|
29 |
#ifdef HAVE_STRINGS_H |
30 |
# include <strings.h> |
31 |
#endif |
32 |
|
33 |
#ifdef HAVE_UNISTD_H |
34 |
# include <unistd.h> |
35 |
#endif |
36 |
|
37 |
#if SIZEOF_UNSIGNED_LONG_INT == 4 |
38 |
typedef unsigned long word32; |
39 |
typedef signed long sword32; |
40 |
#elif SIZEOF_UNSIGNED_INT == 4 |
41 |
typedef unsigned int word32; |
42 |
typedef signed int sword32; |
43 |
#else |
44 |
# warn "Cannot find a 32 bit integer in your system. Using defaults." |
45 |
typedef unsigned int word32; |
46 |
typedef signed int sword32; |
47 |
#endif |
48 |
|
49 |
#if SIZEOF_UNSIGNED_INT == 2 |
50 |
typedef unsigned int word16; |
51 |
#elif SIZEOF_UNSIGNED_SHORT_INT == 2 |
52 |
typedef unsigned short word16; |
53 |
#else |
54 |
# warn "Cannot find a 16 bit integer in your system. Using defaults." |
55 |
typedef unsigned short word16; |
56 |
#endif |
57 |
|
58 |
#if SIZEOF_UNSIGNED_CHAR == 1 |
59 |
typedef unsigned char word8; |
60 |
#else |
61 |
# warn "Cannot find an 8 bit char in your system. Using defaults" |
62 |
typedef unsigned char word8; |
63 |
#endif |
64 |
|
65 |
/* originally was in 3way.c */ |
66 |
#define RAND32 (word32) ((word32)rand() << 17 ^ (word32)rand() << 9 ^ rand()) |
67 |
|
68 |
#ifndef HAVE_MEMMOVE |
69 |
# ifdef HAVE_BCOPY |
70 |
# define memmove(d, s, n) bcopy ((s), (d), (n)) |
71 |
# else |
72 |
# error "Neither memmove nor bcopy exists on your system." |
73 |
# endif |
74 |
#endif |
75 |
|
76 |
#define ENCRYPT 0 |
77 |
#define DECRYPT 1 |
78 |
|
79 |
#define MAX_KEY_LEN 513 /* for gen_key */ |