From faf40a19466e88f439dccd8be2da87bfdee7c360 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 2 Mar 2017 14:19:45 +0100 Subject: [PATCH] Define scrypt's opslimit_max as UINT32_MAX This is consistent with Argon2, will always be plenty enough, and ensures that the constant is the same on 32- and 64-bit architectures. Adjust memlimit_max accordingly --- .../crypto_pwhash_scryptsalsa208sha256.h | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h b/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h index bcef2703..9b5c2a8d 100644 --- a/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +++ b/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h @@ -14,7 +14,7 @@ extern "C" { #endif -#define crypto_pwhash_scryptsalsa208sha256_BYTES_MIN 16ULL +#define crypto_pwhash_scryptsalsa208sha256_BYTES_MIN 16U SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_bytes_min(void); @@ -22,7 +22,7 @@ size_t crypto_pwhash_scryptsalsa208sha256_bytes_min(void); SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_bytes_max(void); -#define crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN 0ULL +#define crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN 0U SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_passwd_min(void); @@ -30,11 +30,11 @@ size_t crypto_pwhash_scryptsalsa208sha256_passwd_min(void); SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_passwd_max(void); -#define crypto_pwhash_scryptsalsa208sha256_SALTBYTES 32ULL +#define crypto_pwhash_scryptsalsa208sha256_SALTBYTES 32U SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_saltbytes(void); -#define crypto_pwhash_scryptsalsa208sha256_STRBYTES 102ULL +#define crypto_pwhash_scryptsalsa208sha256_STRBYTES 102U SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_strbytes(void); @@ -42,35 +42,35 @@ size_t crypto_pwhash_scryptsalsa208sha256_strbytes(void); SODIUM_EXPORT const char *crypto_pwhash_scryptsalsa208sha256_strprefix(void); -#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN 32768ULL +#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN 32768U SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_opslimit_min(void); -#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX 18446744073709551615ULL +#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX 4294967295U SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_opslimit_max(void); -#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN 16777216ULL +#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN 16777216U SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_memlimit_min(void); -#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX 18446744073709551615ULL +#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX ((SIZE_MAX >= 68719476736U) ? : 68719476736U : SIZE_MAX) SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_memlimit_max(void); -#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 524288ULL +#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 524288U SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(void); -#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 16777216ULL +#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 16777216U SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(void); -#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 33554432ULL +#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 33554432U SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(void); -#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 1073741824ULL +#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 1073741824U SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void);