diff options
author | technion <technion@lolware.net> | 2014-08-29 12:02:19 +1000 |
---|---|---|
committer | technion <technion@lolware.net> | 2014-08-29 12:02:19 +1000 |
commit | c75e52cc1219ff79947078772fc5c0543cbeee8b (patch) | |
tree | efe5d0d680d1a0c4fb14623b2194d526a7a3bd1a | |
parent | 0f3098e0c82c5faf10236c8b0cfff48ba5c07bff (diff) | |
parent | c88ddb27de082085a2d72e5b2eefc3e5d1557294 (diff) |
Merge pull request #27 from nmathewson/mingw-port
Compile correctly under mingw32, mingw64
-rw-r--r-- | b64.c | 10 | ||||
-rw-r--r-- | crypto_scrypt-check.c | 8 | ||||
-rw-r--r-- | crypto_scrypt-nosse.c | 3 |
3 files changed, 15 insertions, 6 deletions
@@ -121,14 +121,14 @@ static const char Pad64 = '='; int libscrypt_b64_encode(src, srclength, target, targsize) - u_char const *src; + unsigned char const *src; size_t srclength; char *target; size_t targsize; { size_t datalength = 0; - u_char input[3]; - u_char output[4]; + unsigned char input[3]; + unsigned char output[4]; unsigned int i; while (2 < srclength) { @@ -186,12 +186,12 @@ libscrypt_b64_encode(src, srclength, target, targsize) int libscrypt_b64_decode(src, target, targsize) char const *src; - u_char *target; + unsigned char *target; size_t targsize; { int state, ch; unsigned int tarindex; - u_char nextbyte; + unsigned char nextbyte; char *pos; state = 0; diff --git a/crypto_scrypt-check.c b/crypto_scrypt-check.c index c889a7c..5ed7ab0 100644 --- a/crypto_scrypt-check.c +++ b/crypto_scrypt-check.c @@ -7,6 +7,12 @@ #include "slowequals.h" #include "libscrypt.h" +#ifdef _WIN32 +/* On windows, strtok uses a thread-local static variable in strtok to + * make strtok thread-safe. It also neglects to provide a strtok_r. */ +#define strtok_r(str, val, saveptr) strtok((str), (val)) +#endif + /* pow() works with doubles. Sounds like it should cast to int correctly, * but doesn't always. This is faster anyway */ @@ -32,7 +38,9 @@ int libscrypt_check(char *mcf, const char *password) * >0 correct password */ +#ifndef _WIN32 char *saveptr = NULL; +#endif uint32_t params; uint64_t N; uint8_t r, p; diff --git a/crypto_scrypt-nosse.c b/crypto_scrypt-nosse.c index f54e42e..311e84a 100644 --- a/crypto_scrypt-nosse.c +++ b/crypto_scrypt-nosse.c @@ -28,8 +28,9 @@ */ #include <sys/types.h> +#ifndef _WIN32 #include <sys/mman.h> - +#endif #include <errno.h> #include <stdint.h> #include <stdlib.h> |