summaryrefslogtreecommitdiff
path: root/src/Blowfish.c
diff options
context:
space:
mode:
authorKouki Hashimoto <hsmtkk@gmail.com>2009-04-25 13:13:35 -0400
committerDwayne C. Litzenberger <dlitz@dlitz.net>2009-04-25 13:18:00 -0400
commitba560621d7f74d47f833d05a54dc7cf7f64943e1 (patch)
treeb3bd68949426f9b9e05adf756ea6346ec832069b /src/Blowfish.c
parenta626f8301d803e5cfd901eb2474e9572f0142691 (diff)
downloadpycrypto-ba560621d7f74d47f833d05a54dc7cf7f64943e1.tar.gz
Blowfish: Fix conflicting declaration for "encrypt" on Mac OS X
Apparently OS X declares an "encrypt" function in its unistd.h. Patch posted to Lauchpad by Kouki Hashimoto. See https://bugs.launchpad.net/pycrypto/+bug/361058
Diffstat (limited to 'src/Blowfish.c')
-rw-r--r--src/Blowfish.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Blowfish.c b/src/Blowfish.c
index c767626..021ae7f 100644
--- a/src/Blowfish.c
+++ b/src/Blowfish.c
@@ -68,7 +68,7 @@ static inline void word_to_bytes(uint32_t w, unsigned char *out)
out[3] = w & 0xff;
}
-static inline void encrypt(Blowfish_state *self, uint32_t *pxL, uint32_t *pxR)
+static inline void inline_encrypt(Blowfish_state *self, uint32_t *pxL, uint32_t *pxR)
{
int i;
uint32_t xL = *pxL;
@@ -142,7 +142,7 @@ static void Blowfish_encrypt(Blowfish_state *self, const unsigned char *in, unsi
xL = bytes_to_word(in);
xR = bytes_to_word(in+4);
- encrypt(self, &xL, &xR);
+ inline_encrypt(self, &xL, &xR);
/* big endian */
word_to_bytes(xL, out);
@@ -205,27 +205,27 @@ static void Blowfish_init(Blowfish_state *self, const unsigned char *key, int ke
/* Stir the subkeys */
xL = xR = 0;
for (i = 0; i < 18; i += 2) {
- encrypt(self, &xL, &xR);
+ inline_encrypt(self, &xL, &xR);
self->P[i] = xL;
self->P[i+1] = xR;
}
for (i = 0; i < 256; i += 2) {
- encrypt(self, &xL, &xR);
+ inline_encrypt(self, &xL, &xR);
self->S1[i] = xL;
self->S1[i+1] = xR;
}
for (i = 0; i < 256; i += 2) {
- encrypt(self, &xL, &xR);
+ inline_encrypt(self, &xL, &xR);
self->S2[i] = xL;
self->S2[i+1] = xR;
}
for (i = 0; i < 256; i += 2) {
- encrypt(self, &xL, &xR);
+ inline_encrypt(self, &xL, &xR);
self->S3[i] = xL;
self->S3[i+1] = xR;
}
for (i = 0; i < 256; i += 2) {
- encrypt(self, &xL, &xR);
+ inline_encrypt(self, &xL, &xR);
self->S4[i] = xL;
self->S4[i+1] = xR;
}