aboutsummaryrefslogtreecommitdiffstats
path: root/src/constructs/passhash
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-01 17:24:26 +0000
committerlloyd <[email protected]>2010-03-01 17:24:26 +0000
commitaf752a4fb655723d6bda88278d258d893c9dac5e (patch)
tree0724959477eab74b7305258f690de1a93b4bde82 /src/constructs/passhash
parent4daa551d9f75fa1233fb1e94fcddcf1833f9ce74 (diff)
passhash9: Ensure that choose_pbkdf_prf returns a PRF if possible
Diffstat (limited to 'src/constructs/passhash')
-rw-r--r--src/constructs/passhash/passhash9.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/constructs/passhash/passhash9.cpp b/src/constructs/passhash/passhash9.cpp
index 9e5ff3257..b869e2812 100644
--- a/src/constructs/passhash/passhash9.cpp
+++ b/src/constructs/passhash/passhash9.cpp
@@ -37,8 +37,14 @@ MessageAuthenticationCode* get_pbkdf_prf(byte alg_id)
std::pair<byte, MessageAuthenticationCode*> choose_pbkdf_prf()
{
- byte alg_id = 0;
- return std::make_pair(alg_id, get_pbkdf_prf(alg_id));
+ for(byte alg_id = 0; alg_id != 255; ++alg_id)
+ {
+ MessageAuthenticationCode* prf = get_pbkdf_prf(alg_id);
+ if(prf)
+ return std::make_pair(alg_id, prf);
+ }
+
+ throw Internal_Error("Passhash9: No PRF available");
}
}