From 216730221575d88a72b06ed3d71c9a54cffc5719 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 18 Sep 2014 20:51:02 -0700 Subject: [PATCH] crypto: don't hash zero sized buffer libnss returns an error and we assert in that case. Signed-off-by: Yehuda Sadeh (cherry picked from commit 7b137246b49a9f0b4d8b8d5cebfa78cc1ebd14e7) --- src/common/ceph_crypto.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/ceph_crypto.h b/src/common/ceph_crypto.h index c55359431d4ef..686efb4896121 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; -- 2.39.5