diff --git a/AUTHORS b/AUTHORS index 20be3e30..a93dbe33 100644 --- a/AUTHORS +++ b/AUTHORS @@ -100,7 +100,7 @@ crypto_onetimeauth/poly1305/donna --------------------------------- Andrew "floodyberry" Moon. -crypto_pwhash/scryptxsalsa208sha256 +crypto_pwhash/scryptsalsa208sha256 -------------------------------- Colin Percival Alexander Peslyak diff --git a/ChangeLog b/ChangeLog index d7ebb499..6820be5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,7 +6,7 @@ unlocking them. - High-level wrappers for crypto_box and crypto_secretbox (crypto_box_easy and crypto_secretbox_easy) can be used to avoid dealing with the specific memory layout regular functions depend on. - - crypto_pwhash_scryptxsalsa208sha256* functions have been added + - crypto_pwhash_scryptsalsa208sha256* functions have been added to derive a key from a password, and for password storage. - Salsa20 and ed25519 implementations now support overlapping inputs/keys/outputs (changes imported from supercop-20140505). diff --git a/README.markdown b/README.markdown index 62122bd1..6a9aca07 100644 --- a/README.markdown +++ b/README.markdown @@ -305,7 +305,7 @@ Meanwhile, the [scrypt](http://www.tarsnap.com/scrypt.html) function is available through explicitly-named functions, and will remain available in the library even after the PHC. - int crypto_pwhash_scryptxsalsa208sha256(unsigned char *out, + int crypto_pwhash_scryptsalsa208sha256(unsigned char *out, unsigned long long outlen, const char *passwd, unsigned long long passwdlen, @@ -314,7 +314,7 @@ in the library even after the PHC. size_t memlimit); This function derives `outlen` bytes from a password `passwd` and a -salt `salt` that has to be `crypto_pwhash_scryptxsalsa208sha256_SALTBYTES` +salt `salt` that has to be `crypto_pwhash_scryptsalsa208sha256_SALTBYTES` bytes long. The function will use at most `memlimit` bytes of memory and `opslimit` @@ -325,14 +325,14 @@ security. Although password storage was not the primary goal of the scrypt function, it can still be used for this purpose: - int crypto_pwhash_scryptxsalsa208sha256_str - (char out[crypto_pwhash_scryptxsalsa208sha256_STRBYTES], + int crypto_pwhash_scryptsalsa208sha256_str + (char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES], const char *passwd, unsigned long long passwdlen, unsigned long long opslimit, size_t memlimit); -This function returns a `crypto_pwhash_scryptxsalsa208sha256_STRBYTES` +This function returns a `crypto_pwhash_scryptsalsa208sha256_STRBYTES` bytes C string (the length includes the final `\0`) suitable for storage. The string is guaranteed to only include ASCII characters. @@ -343,8 +343,8 @@ included in the output string, and do not need to be stored separately. The function automatically generates a random salt, which is also included in the output string. - int crypto_pwhash_scryptxsalsa208sha256_str_verify - (const char str[crypto_pwhash_scryptxsalsa208sha256_STRBYTES], + int crypto_pwhash_scryptsalsa208sha256_str_verify + (const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES], const char *passwd, unsigned long long passwdlen); diff --git a/builds/msvc/vs2010/libsodium/libsodium.vcxproj b/builds/msvc/vs2010/libsodium/libsodium.vcxproj index ab9efd9f..e910fc02 100644 --- a/builds/msvc/vs2010/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2010/libsodium/libsodium.vcxproj @@ -67,9 +67,9 @@ - - - + + + @@ -96,7 +96,7 @@ - + @@ -182,12 +182,12 @@ - - - - - - + + + + + + @@ -342,4 +342,4 @@ - \ No newline at end of file + diff --git a/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters index 9af69a14..2c4bea5f 100644 --- a/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters @@ -61,7 +61,7 @@ include\sodium - + include\sodium @@ -562,11 +562,11 @@ src\crypto_stream\aes128ctr\portable - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_stream\aes256estream\hongjun @@ -601,11 +601,11 @@ src\crypto_stream\aes128ctr\portable - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_sign\ed25519\ref10 @@ -619,14 +619,14 @@ src\crypto_sign\edwards25519sha512batch\ref - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_sign\ed25519\ref10 - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_stream\aes128ctr\portable @@ -640,14 +640,14 @@ src\sodium - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 - - src\crypto_pwhash\scryptxsalsa208sha256\nosse + + src\crypto_pwhash\scryptsalsa208sha256\nosse - - src\crypto_pwhash\scryptxsalsa208sha256\sse + + src\crypto_pwhash\scryptsalsa208sha256\sse src\crypto_auth\hmacsha512256\cp @@ -916,7 +916,7 @@ {b788850f-cd6a-49bb-a2fc-5dc217fb21a3} - + {4dd0cec6-9024-4ca9-ad9f-e877e0aa4e39} @@ -976,10 +976,10 @@ {4a1f7816-c9b5-4cfc-a4f3-54d094e13520} - + {629a0d99-8735-4761-b41b-b2a91b1fdffa} - + {08465b05-7a80-40b5-bbe5-31914fdd6e7e} @@ -1034,4 +1034,4 @@ {99f433de-7c93-48d2-9e94-0e43420b2c09} - \ No newline at end of file + diff --git a/builds/msvc/vs2012/libsodium/libsodium.vcxproj b/builds/msvc/vs2012/libsodium/libsodium.vcxproj index 9dd6b216..eb42284c 100644 --- a/builds/msvc/vs2012/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2012/libsodium/libsodium.vcxproj @@ -67,9 +67,9 @@ - - - + + + @@ -96,7 +96,7 @@ - + @@ -182,12 +182,12 @@ - - - - - - + + + + + + @@ -342,4 +342,4 @@ - \ No newline at end of file + diff --git a/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters index 9af69a14..2c4bea5f 100644 --- a/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters @@ -61,7 +61,7 @@ include\sodium - + include\sodium @@ -562,11 +562,11 @@ src\crypto_stream\aes128ctr\portable - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_stream\aes256estream\hongjun @@ -601,11 +601,11 @@ src\crypto_stream\aes128ctr\portable - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_sign\ed25519\ref10 @@ -619,14 +619,14 @@ src\crypto_sign\edwards25519sha512batch\ref - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_sign\ed25519\ref10 - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_stream\aes128ctr\portable @@ -640,14 +640,14 @@ src\sodium - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 - - src\crypto_pwhash\scryptxsalsa208sha256\nosse + + src\crypto_pwhash\scryptsalsa208sha256\nosse - - src\crypto_pwhash\scryptxsalsa208sha256\sse + + src\crypto_pwhash\scryptsalsa208sha256\sse src\crypto_auth\hmacsha512256\cp @@ -916,7 +916,7 @@ {b788850f-cd6a-49bb-a2fc-5dc217fb21a3} - + {4dd0cec6-9024-4ca9-ad9f-e877e0aa4e39} @@ -976,10 +976,10 @@ {4a1f7816-c9b5-4cfc-a4f3-54d094e13520} - + {629a0d99-8735-4761-b41b-b2a91b1fdffa} - + {08465b05-7a80-40b5-bbe5-31914fdd6e7e} @@ -1034,4 +1034,4 @@ {99f433de-7c93-48d2-9e94-0e43420b2c09} - \ No newline at end of file + diff --git a/builds/msvc/vs2013/libsodium/libsodium.vcxproj b/builds/msvc/vs2013/libsodium/libsodium.vcxproj index fc918afb..c362b2c7 100644 --- a/builds/msvc/vs2013/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2013/libsodium/libsodium.vcxproj @@ -67,9 +67,9 @@ - - - + + + @@ -96,7 +96,7 @@ - + @@ -182,12 +182,12 @@ - - - - - - + + + + + + @@ -342,4 +342,4 @@ - \ No newline at end of file + diff --git a/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters index 9af69a14..2c4bea5f 100644 --- a/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters @@ -61,7 +61,7 @@ include\sodium - + include\sodium @@ -562,11 +562,11 @@ src\crypto_stream\aes128ctr\portable - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_stream\aes256estream\hongjun @@ -601,11 +601,11 @@ src\crypto_stream\aes128ctr\portable - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_sign\ed25519\ref10 @@ -619,14 +619,14 @@ src\crypto_sign\edwards25519sha512batch\ref - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_sign\ed25519\ref10 - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 src\crypto_stream\aes128ctr\portable @@ -640,14 +640,14 @@ src\sodium - - src\crypto_pwhash\scryptxsalsa208sha256 + + src\crypto_pwhash\scryptsalsa208sha256 - - src\crypto_pwhash\scryptxsalsa208sha256\nosse + + src\crypto_pwhash\scryptsalsa208sha256\nosse - - src\crypto_pwhash\scryptxsalsa208sha256\sse + + src\crypto_pwhash\scryptsalsa208sha256\sse src\crypto_auth\hmacsha512256\cp @@ -916,7 +916,7 @@ {b788850f-cd6a-49bb-a2fc-5dc217fb21a3} - + {4dd0cec6-9024-4ca9-ad9f-e877e0aa4e39} @@ -976,10 +976,10 @@ {4a1f7816-c9b5-4cfc-a4f3-54d094e13520} - + {629a0d99-8735-4761-b41b-b2a91b1fdffa} - + {08465b05-7a80-40b5-bbe5-31914fdd6e7e} @@ -1034,4 +1034,4 @@ {99f433de-7c93-48d2-9e94-0e43420b2c09} - \ No newline at end of file + diff --git a/libsodium.vcxproj b/libsodium.vcxproj index 70bee651..fa3d3bfe 100644 --- a/libsodium.vcxproj +++ b/libsodium.vcxproj @@ -336,7 +336,7 @@ - + @@ -413,12 +413,12 @@ - - - - - - + + + + + + @@ -517,4 +517,4 @@ - \ No newline at end of file + diff --git a/libsodium.vcxproj.filters b/libsodium.vcxproj.filters index 6c56fcb7..c7b18056 100644 --- a/libsodium.vcxproj.filters +++ b/libsodium.vcxproj.filters @@ -165,7 +165,7 @@ Header Files - + Header Files @@ -574,16 +574,16 @@ Source Files - + Source Files - + Source Files - + Source Files - + Source Files @@ -595,11 +595,11 @@ Source Files - + Source Files - + Source Files - \ No newline at end of file + diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 7859efcf..fa58cd7a 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -59,15 +59,15 @@ libsodium_la_SOURCES = \ crypto_onetimeauth/poly1305/donna/poly1305_donna64.h \ crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c \ crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c \ - crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt-common.c \ - crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt.h \ - crypto_pwhash/scryptxsalsa208sha256/scrypt_platform.c \ - crypto_pwhash/scryptxsalsa208sha256/pbkdf2-sha256.c \ - crypto_pwhash/scryptxsalsa208sha256/pbkdf2-sha256.h \ - crypto_pwhash/scryptxsalsa208sha256/pwhash_scryptxsalsa208sha256.c \ - crypto_pwhash/scryptxsalsa208sha256/sysendian.h \ - crypto_pwhash/scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256_nosse.c \ - crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256_sse.c \ + crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c \ + crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h \ + crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c \ + crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c \ + crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.h \ + crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c \ + crypto_pwhash/scryptsalsa208sha256/sysendian.h \ + crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c \ + crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c \ crypto_scalarmult/crypto_scalarmult.c \ crypto_scalarmult/curve25519/scalarmult_curve25519_api.c \ crypto_secretbox/crypto_secretbox.c \ diff --git a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt-common.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c similarity index 97% rename from src/libsodium/crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt-common.c rename to src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c index 9e3156ca..89e88b40 100644 --- a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt-common.c +++ b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c @@ -21,7 +21,7 @@ #include #include -#include "crypto_pwhash_scryptxsalsa208sha256.h" +#include "crypto_pwhash_scryptsalsa208sha256.h" #include "crypto_scrypt.h" #include "runtime.h" #include "utils.h" @@ -107,7 +107,7 @@ uint8_t * escrypt_r(escrypt_local_t * local, const uint8_t * passwd, size_t passwdlen, const uint8_t * setting, uint8_t * buf, size_t buflen) { - uint8_t hash[crypto_pwhash_scryptxsalsa208sha256_STRHASHBYTES]; + uint8_t hash[crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES]; escrypt_kdf_t escrypt_kdf; const uint8_t *src; const uint8_t *salt; @@ -149,7 +149,7 @@ escrypt_r(escrypt_local_t * local, const uint8_t * passwd, size_t passwdlen, saltlen = strlen((char *)salt); } need = prefixlen + saltlen + 1 + - crypto_pwhash_scryptxsalsa208sha256_STRHASHBYTES_ENCODED + 1; + crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES_ENCODED + 1; if (need > buflen || need < saltlen) { return NULL; } diff --git a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt.h b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h similarity index 90% rename from src/libsodium/crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt.h rename to src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h index b53e7337..5710b16a 100644 --- a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt.h +++ b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h @@ -32,12 +32,12 @@ #include -#define crypto_pwhash_scryptxsalsa208sha256_STRPREFIXBYTES 14 -#define crypto_pwhash_scryptxsalsa208sha256_STRSETTINGBYTES 57 -#define crypto_pwhash_scryptxsalsa208sha256_STRSALTBYTES 32 -#define crypto_pwhash_scryptxsalsa208sha256_STRSALTBYTES_ENCODED 43 -#define crypto_pwhash_scryptxsalsa208sha256_STRHASHBYTES 32 -#define crypto_pwhash_scryptxsalsa208sha256_STRHASHBYTES_ENCODED 43 +#define crypto_pwhash_scryptsalsa208sha256_STRPREFIXBYTES 14 +#define crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES 57 +#define crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES 32 +#define crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES_ENCODED 43 +#define crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES 32 +#define crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES_ENCODED 43 #define BYTES2CHARS(bytes) ((((bytes) * 8) + 5) / 6) diff --git a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256_nosse.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c similarity index 100% rename from src/libsodium/crypto_pwhash/scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256_nosse.c rename to src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c diff --git a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pbkdf2-sha256.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c similarity index 100% rename from src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pbkdf2-sha256.c rename to src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c diff --git a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pbkdf2-sha256.h b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.h similarity index 100% rename from src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pbkdf2-sha256.h rename to src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.h diff --git a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pwhash_scryptxsalsa208sha256.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c similarity index 73% rename from src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pwhash_scryptxsalsa208sha256.c rename to src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c index 57f40ca0..3aa81ffc 100644 --- a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pwhash_scryptxsalsa208sha256.c +++ b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c @@ -5,7 +5,7 @@ #include #include -#include "crypto_pwhash_scryptxsalsa208sha256.h" +#include "crypto_pwhash_scryptsalsa208sha256.h" #include "crypto_scrypt.h" #include "randombytes.h" #include "utils.h" @@ -50,19 +50,19 @@ pickparams(unsigned long long opslimit, const size_t memlimit, } size_t -crypto_pwhash_scryptxsalsa208sha256_saltbytes(void) +crypto_pwhash_scryptsalsa208sha256_saltbytes(void) { - return crypto_pwhash_scryptxsalsa208sha256_SALTBYTES; + return crypto_pwhash_scryptsalsa208sha256_SALTBYTES; } size_t -crypto_pwhash_scryptxsalsa208sha256_strbytes(void) +crypto_pwhash_scryptsalsa208sha256_strbytes(void) { - return crypto_pwhash_scryptxsalsa208sha256_STRBYTES; + return crypto_pwhash_scryptsalsa208sha256_STRBYTES; } int -crypto_pwhash_scryptxsalsa208sha256(unsigned char * const out, +crypto_pwhash_scryptsalsa208sha256(unsigned char * const out, unsigned long long outlen, const char * const passwd, unsigned long long passwdlen, @@ -85,26 +85,26 @@ crypto_pwhash_scryptxsalsa208sha256(unsigned char * const out, } return crypto_scrypt_compat((const uint8_t *) passwd, (size_t) passwdlen, (const uint8_t *) salt, - crypto_pwhash_scryptxsalsa208sha256_SALTBYTES, + crypto_pwhash_scryptsalsa208sha256_SALTBYTES, (uint64_t) (1) << N_log2, r, p, out, (size_t) outlen); } int -crypto_pwhash_scryptxsalsa208sha256_str(char out[crypto_pwhash_scryptxsalsa208sha256_STRBYTES], +crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES], const char * const passwd, unsigned long long passwdlen, unsigned long long opslimit, size_t memlimit) { - uint8_t salt[crypto_pwhash_scryptxsalsa208sha256_STRSALTBYTES]; - char setting[crypto_pwhash_scryptxsalsa208sha256_STRSETTINGBYTES + 1U]; + uint8_t salt[crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES]; + char setting[crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES + 1U]; escrypt_local_t escrypt_local; uint32_t N_log2; uint32_t p; uint32_t r; - memset(out, 0, crypto_pwhash_scryptxsalsa208sha256_STRBYTES); + memset(out, 0, crypto_pwhash_scryptsalsa208sha256_STRBYTES); if (passwdlen > SIZE_MAX) { errno = EFBIG; return -1; @@ -124,7 +124,7 @@ crypto_pwhash_scryptxsalsa208sha256_str(char out[crypto_pwhash_scryptxsalsa208sh } if (escrypt_r(&escrypt_local, (const uint8_t *) passwd, (size_t) passwdlen, (const uint8_t *) setting, (uint8_t *) out, - crypto_pwhash_scryptxsalsa208sha256_STRBYTES) == NULL) { + crypto_pwhash_scryptsalsa208sha256_STRBYTES) == NULL) { escrypt_free_local(&escrypt_local); errno = EINVAL; return -1; @@ -132,27 +132,27 @@ crypto_pwhash_scryptxsalsa208sha256_str(char out[crypto_pwhash_scryptxsalsa208sh escrypt_free_local(&escrypt_local); (void) sizeof - (int[SETTING_SIZE(crypto_pwhash_scryptxsalsa208sha256_STRSALTBYTES) - == crypto_pwhash_scryptxsalsa208sha256_STRSETTINGBYTES ? 1 : -1]); + (int[SETTING_SIZE(crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES) + == crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES ? 1 : -1]); (void) sizeof - (int[crypto_pwhash_scryptxsalsa208sha256_STRSETTINGBYTES + 1U + - crypto_pwhash_scryptxsalsa208sha256_STRHASHBYTES_ENCODED + 1U - == crypto_pwhash_scryptxsalsa208sha256_STRBYTES ? 1 : -1]); + (int[crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES + 1U + + crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES_ENCODED + 1U + == crypto_pwhash_scryptsalsa208sha256_STRBYTES ? 1 : -1]); return 0; } int -crypto_pwhash_scryptxsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptxsalsa208sha256_STRBYTES], +crypto_pwhash_scryptsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES], const char * const passwd, unsigned long long passwdlen) { - char wanted[crypto_pwhash_scryptxsalsa208sha256_STRBYTES]; + char wanted[crypto_pwhash_scryptsalsa208sha256_STRBYTES]; escrypt_local_t escrypt_local; int ret = -1; - if (memchr(str, 0, crypto_pwhash_scryptxsalsa208sha256_STRBYTES) != - &str[crypto_pwhash_scryptxsalsa208sha256_STRBYTES - 1U]) { + if (memchr(str, 0, crypto_pwhash_scryptsalsa208sha256_STRBYTES) != + &str[crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1U]) { return -1; } if (escrypt_init_local(&escrypt_local) != 0) { diff --git a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/scrypt_platform.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c similarity index 100% rename from src/libsodium/crypto_pwhash/scryptxsalsa208sha256/scrypt_platform.c rename to src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c diff --git a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256_sse.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c similarity index 100% rename from src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256_sse.c rename to src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c diff --git a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sysendian.h b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sysendian.h similarity index 100% rename from src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sysendian.h rename to src/libsodium/crypto_pwhash/scryptsalsa208sha256/sysendian.h diff --git a/src/libsodium/include/Makefile.am b/src/libsodium/include/Makefile.am index 4cc68f56..68440d2b 100644 --- a/src/libsodium/include/Makefile.am +++ b/src/libsodium/include/Makefile.am @@ -20,7 +20,7 @@ SODIUM_EXPORT = \ sodium/crypto_onetimeauth.h \ sodium/crypto_onetimeauth_poly1305.h \ sodium/crypto_onetimeauth_poly1305_donna.h \ - sodium/crypto_pwhash_scryptxsalsa208sha256.h \ + sodium/crypto_pwhash_scryptsalsa208sha256.h \ sodium/crypto_scalarmult.h \ sodium/crypto_scalarmult_curve25519.h \ sodium/crypto_secretbox.h \ diff --git a/src/libsodium/include/sodium.h b/src/libsodium/include/sodium.h index 66103e05..8da36f50 100644 --- a/src/libsodium/include/sodium.h +++ b/src/libsodium/include/sodium.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/libsodium/include/sodium/crypto_pwhash_scryptxsalsa208sha256.h b/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h similarity index 64% rename from src/libsodium/include/sodium/crypto_pwhash_scryptxsalsa208sha256.h rename to src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h index d995848a..f86f0794 100644 --- a/src/libsodium/include/sodium/crypto_pwhash_scryptxsalsa208sha256.h +++ b/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h @@ -1,5 +1,5 @@ -#ifndef crypto_pwhash_scryptxsalsa208sha256_H -#define crypto_pwhash_scryptxsalsa208sha256_H +#ifndef crypto_pwhash_scryptsalsa208sha256_H +#define crypto_pwhash_scryptsalsa208sha256_H #include @@ -12,16 +12,16 @@ extern "C" { #endif -#define crypto_pwhash_scryptxsalsa208sha256_SALTBYTES 32 +#define crypto_pwhash_scryptsalsa208sha256_SALTBYTES 32 SODIUM_EXPORT -size_t crypto_pwhash_scryptxsalsa208sha256_saltbytes(void); +size_t crypto_pwhash_scryptsalsa208sha256_saltbytes(void); -#define crypto_pwhash_scryptxsalsa208sha256_STRBYTES 102 +#define crypto_pwhash_scryptsalsa208sha256_STRBYTES 102 SODIUM_EXPORT -size_t crypto_pwhash_scryptxsalsa208sha256_strbytes(void); +size_t crypto_pwhash_scryptsalsa208sha256_strbytes(void); SODIUM_EXPORT -int crypto_pwhash_scryptxsalsa208sha256(unsigned char * const out, +int crypto_pwhash_scryptsalsa208sha256(unsigned char * const out, unsigned long long outlen, const char * const passwd, unsigned long long passwdlen, @@ -30,14 +30,14 @@ int crypto_pwhash_scryptxsalsa208sha256(unsigned char * const out, size_t memlimit); SODIUM_EXPORT -int crypto_pwhash_scryptxsalsa208sha256_str(char out[crypto_pwhash_scryptxsalsa208sha256_STRBYTES], +int crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES], const char * const passwd, unsigned long long passwdlen, unsigned long long opslimit, size_t memlimit); SODIUM_EXPORT -int crypto_pwhash_scryptxsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptxsalsa208sha256_STRBYTES], +int crypto_pwhash_scryptsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES], const char * const passwd, unsigned long long passwdlen); diff --git a/test/default/pwhash.c b/test/default/pwhash.c index 8b956b4e..7d00902d 100644 --- a/test/default/pwhash.c +++ b/test/default/pwhash.c @@ -26,7 +26,7 @@ static void tv(void) {"a14975c26c088755a8b715ff2528d647cd343987fcf4aa25e7194a8417fb2b4b3f7268da9f3182b4cfb22d138b2749d673a47ecc7525dd15a0a3c66046971784bb63d7eae24cc84f2631712075a10e10a96b0e0ee67c43e01c423cb9c44e5371017e9c496956b632158da3fe12addecb88912e6759bc37f9af2f45af72c5cae3b179ffb676a697de6ebe45cd4c16d4a9d642d29ddc0186a0a48cb6cd62bfc3dd229d313b301560971e740e2cf1f99a9a090a5b283f35475057e96d7064e2e0fc81984591068d55a3b4169f22cccb0745a2689407ea1901a0a766eb99", 220, "3d968b2752b8838431165059319f3ff8910b7b8ecb54ea01d3f54769e9d98daf", 167, 717248, 10784179}, }; char passwd[256]; - unsigned char salt[crypto_pwhash_scryptxsalsa208sha256_SALTBYTES]; + unsigned char salt[crypto_pwhash_scryptsalsa208sha256_SALTBYTES]; unsigned char out[256]; char out_hex[256 * 2 + 1]; size_t i = 0U; @@ -38,7 +38,7 @@ static void tv(void) sodium_hex2bin(salt, sizeof salt, tests[i].salt_hex, strlen(tests[i].salt_hex), NULL, NULL, NULL); - if (crypto_pwhash_scryptxsalsa208sha256(out, tests[i].outlen, + if (crypto_pwhash_scryptsalsa208sha256(out, tests[i].outlen, passwd, tests[i].passwdlen, (const unsigned char *) salt, tests[i].opslimit, @@ -70,7 +70,7 @@ static void tv2(void) size_t i = 0U; do { - if (crypto_pwhash_scryptxsalsa208sha256_str_verify(tests[i].out, + if (crypto_pwhash_scryptsalsa208sha256_str_verify(tests[i].out, tests[i].passwd, strlen(tests[i].passwd)) != 0) { printf("pwhash_str failure\n"); @@ -84,8 +84,8 @@ static void tv2(void) int main(void) { - char str_out[crypto_pwhash_scryptxsalsa208sha256_STRBYTES]; - char str_out2[crypto_pwhash_scryptxsalsa208sha256_STRBYTES]; + char str_out[crypto_pwhash_scryptsalsa208sha256_STRBYTES]; + char str_out2[crypto_pwhash_scryptsalsa208sha256_STRBYTES]; unsigned char out[OUT_LEN]; char out_hex[OUT_LEN * 2 + 1]; const char *salt = "[<~A 32-bytes salt for scrypt~>]"; @@ -94,28 +94,28 @@ int main(void) tv(); tv2(); - if (crypto_pwhash_scryptxsalsa208sha256_str(str_out, passwd, strlen(passwd), + if (crypto_pwhash_scryptsalsa208sha256_str(str_out, passwd, strlen(passwd), OPSLIMIT, MEMLIMIT) != 0) { printf("pwhash_str failure\n"); } - if (crypto_pwhash_scryptxsalsa208sha256_str(str_out2, passwd, strlen(passwd), + if (crypto_pwhash_scryptsalsa208sha256_str(str_out2, passwd, strlen(passwd), OPSLIMIT, MEMLIMIT) != 0) { printf("pwhash_str(2) failure\n"); } if (strcmp(str_out, str_out2) == 0) { printf("pwhash_str doesn't generate different salts\n"); } - if (crypto_pwhash_scryptxsalsa208sha256_str_verify(str_out, passwd, + if (crypto_pwhash_scryptsalsa208sha256_str_verify(str_out, passwd, strlen(passwd)) != 0) { printf("pwhash_str_verify failure\n"); } - if (crypto_pwhash_scryptxsalsa208sha256_str_verify(str_out, passwd, + if (crypto_pwhash_scryptsalsa208sha256_str_verify(str_out, passwd, strlen(passwd)) != 0) { printf("pwhash_str_verify failure\n"); } for (i = 14U; i < sizeof str_out; i++) { str_out[i]++; - if (crypto_pwhash_scryptxsalsa208sha256_str_verify(str_out, passwd, + if (crypto_pwhash_scryptsalsa208sha256_str_verify(str_out, passwd, strlen(passwd)) == 0) { printf("pwhash_str_verify(2) failure\n"); }