https://bugs.winehq.org/show_bug.cgi?id=42652
Bug ID: 42652 Summary: CryptCreateHash error NTE_FAIL after CryptImportKey(public-key) Product: Wine Version: 2.2 Hardware: x86 OS: Mac OS X Status: UNCONFIRMED Severity: normal Priority: P2 Component: rsaenh Assignee: wine-bugs@winehq.org Reporter: shirouzu@ipmsg.org
Created attachment 57588 --> https://bugs.winehq.org/attachment.cgi?id=57588 reproduction-project
Hello, wine developers.
I got CryptCreateHash error (NTE_FAIL=0x80090020) after CryptImportKey(another user's 'public' key).
Always OK : WindowsXP/Vista/7/8/8.1/10 Always NG : Wine 1.8/2.0(and wine-hq 2.2) in MacOSX(sierra) and Linux debian(testing, wheezy, or etc).
In the following Senario ... Encrypt with another user's public key, and sign with my PrivateKey.
1. CryptAcquireContext(...MS_ENHANCED_PROV, PROV_RSA_FULL...) 2. CryptGenKey() or CryptUserKey() for private key 3. CryptImportKey(another users' public key, &hExKey) 4. CryptEncrypt(hExKey, data...) 5. CryptCreateHash() for sign 6. CryptHashData() 7. CryptSignHash() ... I got OK in Windows, but NTE_FAIL in wine.
I post a reproduction-project as attachment-file. Please see signhash_test.cpp in it.
I think CPSignHash -> encrypt_block_impl -> rsa_exptmod error. https://github.com/wine-mirror/wine/blob/master/dlls/rsaenh/rsaenh.c