aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-04-11 20:30:04 +0000
committerlloyd <[email protected]>2011-04-11 20:30:04 +0000
commitb958d1d28fab4d9c23a85c0745dc7c1dc3446b61 (patch)
tree66c61effd1b23c9ddcc3d86078dd5416cba091bf
parent14fa61b489d059e7a7b10a205a4b0b498fac1695 (diff)
Make the alg_id param for passhash9 optional. Update callers.
-rw-r--r--checks/validate.cpp2
-rw-r--r--src/passhash/passhash9/passhash9.cpp13
-rw-r--r--src/passhash/passhash9/passhash9.h14
3 files changed, 5 insertions, 24 deletions
diff --git a/checks/validate.cpp b/checks/validate.cpp
index 9acf73419..d79f9783a 100644
--- a/checks/validate.cpp
+++ b/checks/validate.cpp
@@ -239,7 +239,7 @@ bool test_passhash(RandomNumberGenerator& rng)
for(byte alg_id = 0; alg_id <= 2; ++alg_id)
{
- std::string gen_hash = generate_passhash9(input, alg_id, rng, 1);
+ std::string gen_hash = generate_passhash9(input, rng, 2, alg_id);
if(!check_passhash9(input, gen_hash))
return false;
diff --git a/src/passhash/passhash9/passhash9.cpp b/src/passhash/passhash9/passhash9.cpp
index e5f379052..e1e37da1e 100644
--- a/src/passhash/passhash9/passhash9.cpp
+++ b/src/passhash/passhash9/passhash9.cpp
@@ -23,8 +23,6 @@ const size_t ALGID_BYTES = 1;
const size_t SALT_BYTES = 12; // 96 bits of salt
const size_t PASSHASH9_PBKDF_OUTPUT_LEN = 24; // 192 bits output
-const byte PASSHASH9_DEFAULT_ALGO = 0; // HMAC(SHA-1)
-
const size_t WORK_FACTOR_SCALE = 10000;
MessageAuthenticationCode* get_pbkdf_prf(byte alg_id)
@@ -49,15 +47,8 @@ MessageAuthenticationCode* get_pbkdf_prf(byte alg_id)
std::string generate_passhash9(const std::string& pass,
RandomNumberGenerator& rng,
- u16bit work_factor)
- {
- return generate_passhash9(pass, PASSHASH9_DEFAULT_ALGO, rng, work_factor);
- }
-
-std::string generate_passhash9(const std::string& pass,
- byte alg_id,
- RandomNumberGenerator& rng,
- u16bit work_factor)
+ u16bit work_factor,
+ byte alg_id)
{
MessageAuthenticationCode* prf = get_pbkdf_prf(alg_id);
diff --git a/src/passhash/passhash9/passhash9.h b/src/passhash/passhash9/passhash9.h
index 92cc391dc..3c0a4be51 100644
--- a/src/passhash/passhash9/passhash9.h
+++ b/src/passhash/passhash9/passhash9.h
@@ -17,26 +17,16 @@ namespace Botan {
* @param password the password
* @param rng a random number generator
* @param work_factor how much work to do to slow down guessing attacks
-*/
-std::string BOTAN_DLL generate_passhash9(const std::string& password,
- RandomNumberGenerator& rng,
- u16bit work_factor = 10);
-
-/**
-* Create a password hash using PBKDF2
-* @param password the password
* @param alg_id specifies which PRF to use with PBKDF2
* 0 is HMAC(SHA-1)
* 1 is HMAC(SHA-256)
* 2 is CMAC(Blowfish)
* all other values are currently undefined
-* @param rng a random number generator
-* @param work_factor how much work to do to slow down guessing attacks
*/
std::string BOTAN_DLL generate_passhash9(const std::string& password,
- byte alg_id,
RandomNumberGenerator& rng,
- u16bit work_factor = 10);
+ u16bit work_factor = 10,
+ byte alg_id = 0);
/**
* Check a previously created password hash