aboutsummaryrefslogtreecommitdiffstats
path: root/checks
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-06-20 18:05:53 +0000
committerlloyd <[email protected]>2011-06-20 18:05:53 +0000
commitd03430f5aa465a518225791c32580f62ee687e8b (patch)
treef65a3c5bbaa8e865fa9815767ae05456a7f88e99 /checks
parent3d2adee8a113929cd36cb00bc7759cf0fd29ca7e (diff)
Add a second test for bcrypt, using an 8-bit character. This test
exposed a bug in JtR's blowfish code: http://www.openwall.com/lists/john-dev/2011/06/19/2
Diffstat (limited to 'checks')
-rw-r--r--checks/validate.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/checks/validate.cpp b/checks/validate.cpp
index d79f9783a..65317604e 100644
--- a/checks/validate.cpp
+++ b/checks/validate.cpp
@@ -183,19 +183,23 @@ bool test_bcrypt(RandomNumberGenerator& rng)
#if defined(BOTAN_HAS_BCRYPT)
std::cout << "Testing Bcrypt: " << std::flush;
- const std::string input = "abc";
+ bool ok = true;
// Generated by jBCrypt 0.3
- const std::string fixed_hash =
- "$2a$05$DfPyLs.G6.To9fXEFgUL1O6HpYw3jIXgPcl/L3Qt3jESuWmhxtmpS";
+ if(!check_bcrypt("abc",
+ "$2a$05$DfPyLs.G6.To9fXEFgUL1O6HpYw3jIXgPcl/L3Qt3jESuWmhxtmpS"))
+ {
+ std::cout << "Fixed bcrypt test failed\n";
+ ok = false;
+ }
std::cout << "." << std::flush;
- bool ok = true;
-
- if(!check_bcrypt(input, fixed_hash))
+ // http://www.openwall.com/lists/john-dev/2011/06/19/2
+ if(!check_bcrypt("\xA3",
+ "$2a$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq"))
{
- std::cout << "Fixed bcrypt test failed\n";
+ std::cout << "Fixed bcrypt test 2 failed\n";
ok = false;
}
@@ -203,7 +207,8 @@ bool test_bcrypt(RandomNumberGenerator& rng)
for(u16bit level = 1; level != 5; ++level)
{
- std::string gen_hash = generate_bcrypt(input, rng, level);
+ const std::string input = "some test passphrase 123";
+ const std::string gen_hash = generate_bcrypt(input, rng, level);
if(!check_bcrypt(input, gen_hash))
{