]> Savannah Git Hosting - gnulib.git/commitdiff
af_alg: fix error handling when hash not returned
authorPádraig Brady <P@draigBrady.com>
Sun, 24 Jun 2018 08:29:55 +0000 (01:29 -0700)
committerPádraig Brady <P@draigBrady.com>
Sun, 24 Jun 2018 20:53:44 +0000 (13:53 -0700)
* lib/af_alg.c (afalg_stream): Handle the case where we've
successfully written data to the kernel in the read/write loop,
but the kernel doesn't respond with the hash.

ChangeLog
lib/af_alg.c

index bb2fabf2490e31d27038bf9e0fbee60db2a2c13b..093ec41fb5a533cb01955b2af44c2511b3c5b2fb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * tests/test-wcwidth.c (main): If the wchar-single module is present,
        skip the tests in the C locale.
 
+2018-06-24  Pádraig Brady  <P@draigBrady.com>
+
+       af_alg: fix error handling when hash not returned
+       * lib/af_alg.c (afalg_stream): Handle the case where we've
+       successfully written data to the kernel in the read/write loop,
+       but the kernel doesn't respond with the hash.
+
 2018-06-23  Pádraig Brady  <P@draigBrady.com>
 
        crypto: mention --without-linux-crypto in --with-openssl --help
index ded4b326b7f883fc12a3f0c4bde4f6f822ec3f67..f362caba8b3f164bb5f2d913330feaa8054eb81b 100644 (file)
@@ -145,7 +145,12 @@ afalg_stream (FILE *stream, const char *alg,
     }
 
   if (result == 0 && read (ofd, resblock, hashlen) != hashlen)
-    result = -EAFNOSUPPORT;
+    {
+      if (nseek == 0 || fseeko (stream, nseek, SEEK_CUR) == 0)
+        result = -EAFNOSUPPORT;
+      else
+        result = -EIO;
+    }
   close (ofd);
   return result;
 }