From: Yehuda Sadeh Date: Fri, 19 Sep 2014 03:51:02 +0000 (-0700) Subject: crypto: don't hash zero sized buffer X-Git-Tag: v0.86~50^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7b137246b49a9f0b4d8b8d5cebfa78cc1ebd14e7;p=ceph.git crypto: don't hash zero sized buffer libnss returns an error and we assert in that case. Signed-off-by: Yehuda Sadeh --- diff --git a/src/common/ceph_crypto.h b/src/common/ceph_crypto.h index c55359431d4e..686efb489612 100644 --- a/src/common/ceph_crypto.h +++ b/src/common/ceph_crypto.h @@ -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;