diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-08-28 09:42:43 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-08-28 09:42:43 -0400 |
commit | c88ddb27de082085a2d72e5b2eefc3e5d1557294 (patch) | |
tree | efe5d0d680d1a0c4fb14623b2194d526a7a3bd1a | |
parent | 23225508d2d82ac805e4cc820a800ed6eabbac6b (diff) |
Use strtok() on Windows.
See the MSDN documentation for strtok(): They don't provide a
strtok_r, but they do have a thread-safe strtok().
-rw-r--r-- | crypto_scrypt-check.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |