From b71a2d09f2a789192ad07a7735cda48389cd7bdc Mon Sep 17 00:00:00 2001 From: philsmd Date: Sat, 19 Aug 2023 11:40:05 +0200 Subject: [PATCH] verify test fix for -m 6800 = LastPass sniffed --- tools/test_modules/m06800.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/test_modules/m06800.pm b/tools/test_modules/m06800.pm index 51d9d0430..2a37d119f 100644 --- a/tools/test_modules/m06800.pm +++ b/tools/test_modules/m06800.pm @@ -19,8 +19,7 @@ sub module_generate_hash my $word = shift; my $salt = shift; my $iter = shift // 100100; - - my $iv = random_bytes(16); + my $iv = shift // random_bytes (16); my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256); @@ -56,16 +55,21 @@ sub module_verify_hash { my $line = shift; - my ($hash, $iter, $salt, $word) = split ":", $line; + my ($hash, $iter, $salt, $iv, $word) = split ":", $line; return unless defined $hash; return unless defined $iter; return unless defined $salt; return unless defined $word; + return unless defined $iv; + + return unless ($iv =~ m/^[0-9a-fA-F]{32}$/); + + $iv = pack ("H*", $iv); $word = pack_if_HEX_notation ($word); - my $new_hash = module_generate_hash ($word, $salt, $iter); + my $new_hash = module_generate_hash ($word, $salt, $iter, $iv); return ($new_hash, $word); }