From 32947225e44975b29e23ec816b45a100922a1bb2 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 28 Jun 2014 18:46:03 -0700 Subject: [PATCH] Add pwhash recommended minimum parameters (interactive & sensitive) --- .../pwhash_scryptsalsa208sha256.c | 24 +++++++++++++++++++ .../crypto_pwhash_scryptsalsa208sha256.h | 16 +++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c index c9c41032..b4e64a5a 100644 --- a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c +++ b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c @@ -61,6 +61,30 @@ crypto_pwhash_scryptsalsa208sha256_strbytes(void) return crypto_pwhash_scryptsalsa208sha256_STRBYTES; } +size_t +crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(void) +{ + return crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE; +} + +size_t +crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(void) +{ + return crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE; +} + +size_t +crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(void) +{ + return crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE; +} + +size_t +crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void) +{ + return crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE; +} + int crypto_pwhash_scryptsalsa208sha256(unsigned char * const out, unsigned long long outlen, diff --git a/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h b/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h index dacd2931..68bd5508 100644 --- a/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +++ b/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h @@ -20,6 +20,22 @@ size_t crypto_pwhash_scryptsalsa208sha256_saltbytes(void); SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_strbytes(void); +#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 524288 +SODIUM_EXPORT +size_t crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(void); + +#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 16777216 +SODIUM_EXPORT +size_t crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(void); + +#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 33554432 +SODIUM_EXPORT +size_t crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(void); + +#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 1073741824 +SODIUM_EXPORT +size_t crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void); + SODIUM_EXPORT int crypto_pwhash_scryptsalsa208sha256(unsigned char * const out, unsigned long long outlen,