diff options
Diffstat (limited to 'src/lib/libcrypto/bf/blowfish.h')
-rw-r--r-- | src/lib/libcrypto/bf/blowfish.h | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/src/lib/libcrypto/bf/blowfish.h b/src/lib/libcrypto/bf/blowfish.h index c4a8085a29..02f73b2f30 100644 --- a/src/lib/libcrypto/bf/blowfish.h +++ b/src/lib/libcrypto/bf/blowfish.h | |||
@@ -63,14 +63,35 @@ | |||
63 | extern "C" { | 63 | extern "C" { |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #ifdef NO_BF | ||
67 | #error BF is disabled. | ||
68 | #endif | ||
69 | |||
66 | #define BF_ENCRYPT 1 | 70 | #define BF_ENCRYPT 1 |
67 | #define BF_DECRYPT 0 | 71 | #define BF_DECRYPT 0 |
68 | 72 | ||
69 | /* If you make this 'unsigned int' the pointer variants will work on | 73 | /* |
70 | * the Alpha, otherwise they will not. Strangly using the '8 byte' | 74 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
71 | * BF_LONG and the default 'non-pointer' inner loop is the best configuration | 75 | * ! BF_LONG has to be at least 32 bits wide. If it's wider, then ! |
72 | * for the Alpha */ | 76 | * ! BF_LONG_LOG2 has to be defined along. ! |
77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
78 | */ | ||
79 | |||
80 | #if defined(WIN16) || defined(__LP32__) | ||
73 | #define BF_LONG unsigned long | 81 | #define BF_LONG unsigned long |
82 | #elif defined(_CRAY) || defined(__ILP64__) | ||
83 | #define BF_LONG unsigned long | ||
84 | #define BF_LONG_LOG2 3 | ||
85 | /* | ||
86 | * _CRAY note. I could declare short, but I have no idea what impact | ||
87 | * does it have on performance on none-T3E machines. I could declare | ||
88 | * int, but at least on C90 sizeof(int) can be chosen at compile time. | ||
89 | * So I've chosen long... | ||
90 | * <appro@fy.chalmers.se> | ||
91 | */ | ||
92 | #else | ||
93 | #define BF_LONG unsigned int | ||
94 | #endif | ||
74 | 95 | ||
75 | #define BF_ROUNDS 16 | 96 | #define BF_ROUNDS 16 |
76 | #define BF_BLOCK 8 | 97 | #define BF_BLOCK 8 |
@@ -81,7 +102,6 @@ typedef struct bf_key_st | |||
81 | BF_LONG S[4*256]; | 102 | BF_LONG S[4*256]; |
82 | } BF_KEY; | 103 | } BF_KEY; |
83 | 104 | ||
84 | #ifndef NOPROTO | ||
85 | 105 | ||
86 | void BF_set_key(BF_KEY *key, int len, unsigned char *data); | 106 | void BF_set_key(BF_KEY *key, int len, unsigned char *data); |
87 | void BF_ecb_encrypt(unsigned char *in,unsigned char *out,BF_KEY *key, | 107 | void BF_ecb_encrypt(unsigned char *in,unsigned char *out,BF_KEY *key, |
@@ -94,20 +114,7 @@ void BF_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | |||
94 | BF_KEY *schedule, unsigned char *ivec, int *num, int enc); | 114 | BF_KEY *schedule, unsigned char *ivec, int *num, int enc); |
95 | void BF_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | 115 | void BF_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, |
96 | BF_KEY *schedule, unsigned char *ivec, int *num); | 116 | BF_KEY *schedule, unsigned char *ivec, int *num); |
97 | char *BF_options(void); | 117 | const char *BF_options(void); |
98 | |||
99 | #else | ||
100 | |||
101 | void BF_set_key(); | ||
102 | void BF_ecb_encrypt(); | ||
103 | void BF_encrypt(); | ||
104 | void BF_decrypt(); | ||
105 | void BF_cbc_encrypt(); | ||
106 | void BF_cfb64_encrypt(); | ||
107 | void BF_ofb64_encrypt(); | ||
108 | char *BF_options(); | ||
109 | |||
110 | #endif | ||
111 | 118 | ||
112 | #ifdef __cplusplus | 119 | #ifdef __cplusplus |
113 | } | 120 | } |