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:
@@ -388,7 +388,9 @@ p11_md_update(EVP_MD_CTX *ctx, const void *data, size_t length)
|
|||||||
|
|
||||||
assert(p11_module != NULL);
|
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;
|
return rv == CKR_OK;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user