Skip TCRYPT KDF if hash is not available.
authorMilan Broz <gmazyland@gmail.com>
Sat, 29 Dec 2012 19:21:53 +0000 (20:21 +0100)
committerMilan Broz <gmazyland@gmail.com>
Sat, 29 Dec 2012 19:23:52 +0000 (20:23 +0100)
lib/tcrypt/tcrypt.c
tests/tcrypt-compat-test

index 11b712f..7ff590a 100644 (file)
@@ -508,6 +508,11 @@ static int TCRYPT_init_hdr(struct crypt_device *cd,
                                hdr->salt, TCRYPT_HDR_SALT_LEN,
                                key, TCRYPT_HDR_KEY_LEN,
                                tcrypt_kdf[i].iterations);
+               if (r < 0 && crypt_hash_size(tcrypt_kdf[i].hash) < 0) {
+                       log_verbose(cd, _("PBKDF2 hash algorithm %s not available, skipping.\n"),
+                                     tcrypt_kdf[i].hash);
+                       continue;
+               }
                if (r < 0)
                        break;
 
index 93af99a..71545bc 100755 (executable)
@@ -37,6 +37,10 @@ function test_one()
 
 function test_required()
 {
+       echo "REQUIRED KDF TEST"
+       $CRYPTSETUP benchmark -h ripemd160 | grep "N/A" && skip
+       $CRYPTSETUP benchmark -h whirlpool | grep "N/A" && skip
+
        echo "REQUIRED CIPHERS TEST"
        echo "#  Algorithm | Key | Encryption | Decryption"