cryptsetup - fix hash() frontend function
authorAlex Hornung <ahornung@gmail.com>
Thu, 9 Sep 2010 18:57:33 +0000 (19:57 +0100)
committerAlex Hornung <ahornung@gmail.com>
Thu, 9 Sep 2010 18:59:46 +0000 (19:59 +0100)
* hash() in backends.c would always return ENOENT, because the return
  variable r wasn't being updated.

* luks wasn't affected by this as it uses a different path, but using
  cryptsetup without luks would trigger this.

Reported-by: Matthias Schmidt (matthias@)
contrib/cryptsetup/lib/backends.c

index 446e812..488ccef 100644 (file)
@@ -37,7 +37,7 @@ int hash(const char *backend_name, const char *hash_name,
 
        EVP_DigestInit(&mdctx, md);
        EVP_DigestUpdate(&mdctx, passphrase, sizep);
-       EVP_DigestFinal(&mdctx, result, NULL);
+       r = !EVP_DigestFinal(&mdctx, result, NULL);
 
        if (pad) {
                memset(result+size, 0, pad);