https://bugs.winehq.org/show_bug.cgi?id=34829
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com --- I think it's worth to try to zero this one:
--- SAFE_PROVIDER_FUNCTIONS funcs = { sizeof(SAFE_PROVIDER_FUNCTIONS), 0 }; ---
not just a first pointer but all of them, it's possible some garbage value sits there.
If this doesn't help another possibility is that CRYPT_PROVIDER_DATA.cbStruct should be initialized.