hcrypto PKCS#11 backend: allow digest update with NULL (#378)

Some callers of EVP_DigestUpdate (such as libntlm) pass NULL as the
data argument. PKCS#11 returns CKR_ARGUMENTS_BAD which may poison
the context. Pass an empty string to C_DigestUpdate work around this.
This commit is contained in:
Luke Howard
2018-05-11 13:16:44 +10:00
parent a88d00660e
commit 590be3d7da

View File

@@ -388,7 +388,9 @@ p11_md_update(EVP_MD_CTX *ctx, const void *data, size_t length)
assert(p11_module != NULL);
rv = p11_module->C_DigestUpdate(p11ctx->hSession, (unsigned char *)data, length);
rv = p11_module->C_DigestUpdate(p11ctx->hSession,
data ? (CK_BYTE_PTR)data : (CK_BYTE_PTR)"",
length);
return rv == CKR_OK;
}