]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crypto: don't hash zero sized buffer
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 19 Sep 2014 03:51:02 +0000 (20:51 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 23 Sep 2014 20:55:49 +0000 (13:55 -0700)
libnss returns an error and we assert in that case.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit 7b137246b49a9f0b4d8b8d5cebfa78cc1ebd14e7)

src/common/ceph_crypto.h

index c55359431d4efbde9cff29a42005a6562c0bfae6..686efb4896121f2fafae856eea6388b6afcfabbd 100644 (file)
@@ -78,9 +78,11 @@ namespace ceph {
        assert(s == SECSuccess);
       }
       void Update (const byte *input, size_t length) {
-       SECStatus s;
-       s = PK11_DigestOp(ctx, input, length);
-       assert(s == SECSuccess);
+        if (length) {
+         SECStatus s;
+         s = PK11_DigestOp(ctx, input, length);
+         assert(s == SECSuccess);
+        }
       }
       void Final (byte *digest) {
        SECStatus s;