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
https://bugs.winehq.org/show_bug.cgi?id=42652
Sagawa sagawa.aki+winebugs@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sagawa.aki+winebugs@gmail.c | |om
https://bugs.winehq.org/show_bug.cgi?id=42652
--- Comment #1 from Sagawa sagawa.aki+winebugs@gmail.com --- Hi, Thanks for reporting and good testcase. My test shows CryptImportKey() with a public key doesn't update a key container on native. However, on wine, it does. I'll send a patch for the issue. After patching, your test application works well.
https://bugs.winehq.org/show_bug.cgi?id=42652
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest@luukku.com
--- Comment #2 from winetest@luukku.com --- (In reply to Sagawa from comment #1)
Hi, Thanks for reporting and good testcase. My test shows CryptImportKey() with a public key doesn't update a key container on native. However, on wine, it does. I'll send a patch for the issue. After patching, your test application works well.
Your patches were committed so this is now...fixed?
https://bugs.winehq.org/show_bug.cgi?id=42652
--- Comment #3 from Sagawa sagawa.aki+winebugs@gmail.com --- Yes, I believe it is fixed by e705dfc27f15164e8f2cdd17cf505c19d78415e2. Shirouzu, could you update bug status?
https://bugs.winehq.org/show_bug.cgi?id=42652
shirouzu shirouzu@ipmsg.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED
--- Comment #4 from shirouzu shirouzu@ipmsg.org --- Thank you for fixing!
I changed bug status to RESOLVED/FIXED.
https://bugs.winehq.org/show_bug.cgi?id=42652
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |e705dfc27f15164e8f2cdd17cf5 | |05c19d78415e2
https://bugs.winehq.org/show_bug.cgi?id=42652
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 2.8.