crypto: don't hash zero sized buffer

libnss returns an error and we assert in that case.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2014-09-18 20:51:02 -07:00
parent 705abd9f3d
commit 7b137246b4

View 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;