diff options
author | technion <technion@lolware.net> | 2014-09-21 10:14:59 +1000 |
---|---|---|
committer | technion <technion@lolware.net> | 2014-09-21 10:14:59 +1000 |
commit | 0217f5828a07caff3c43ae1400e0479d40cce62a (patch) | |
tree | a3648353751dffeeadc3e2c597ec4c1103c294e7 /crypto-mcf.c | |
parent | c75e52cc1219ff79947078772fc5c0543cbeee8b (diff) | |
parent | 1023e18857560035d8eb2f25e1321abbba770714 (diff) |
Merge pull request #28 from Convey-Compliance/master
Minimal changes to allow compilation in Visual Studio
Diffstat (limited to 'crypto-mcf.c')
-rw-r--r-- | crypto-mcf.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto-mcf.c b/crypto-mcf.c index 74e7be0..8ad3eb8 100644 --- a/crypto-mcf.c +++ b/crypto-mcf.c @@ -25,13 +25,19 @@ static uint32_t scrypt_ilog2(uint32_t n) while (((uint32_t)1 << t) < n) { if(t > SCRYPT_SAFE_N) - return -1; /* Check for insanity */ + return (uint32_t) -1; /* Check for insanity */ t++; } return t; } +#ifdef _MSC_VER + #define SNPRINTF _snprintf +#else + #define SNPRINTF snprintf +#endif + int libscrypt_mcf(uint32_t N, uint32_t r, uint32_t p, const char *salt, const char *hash, char *mcf) { @@ -59,7 +65,7 @@ int libscrypt_mcf(uint32_t N, uint32_t r, uint32_t p, const char *salt, * determined that mcf should be defined as at least SCRYPT_MCF_LEN * in length */ - s = snprintf(mcf, SCRYPT_MCF_LEN, SCRYPT_MCF_ID "$%06x$%s$%s", (unsigned int)params, salt, hash); + s = SNPRINTF(mcf, SCRYPT_MCF_LEN, SCRYPT_MCF_ID "$%06x$%s$%s", (unsigned int)params, salt, hash); if (s > SCRYPT_MCF_LEN) return 0; |