Bruno Jesus : rsaenh: The RC2 algorithm from Base provider supports only 40 bit keys.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 4 15:29:38 CDT 2014


Module: wine
Branch: master
Commit: 86dd877f4e5d6b1652501b53c8648e017b8a03c9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=86dd877f4e5d6b1652501b53c8648e017b8a03c9

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Wed Jul 30 23:21:11 2014 -0300

rsaenh: The RC2 algorithm from Base provider supports only 40 bit keys.

---

 dlls/rsaenh/rsaenh.c       | 11 +++++++++--
 dlls/rsaenh/tests/rsaenh.c |  1 -
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c
index fce9f1a..dc9e70f 100644
--- a/dlls/rsaenh/rsaenh.c
+++ b/dlls/rsaenh/rsaenh.c
@@ -3495,22 +3495,29 @@ BOOL WINAPI RSAENH_CPSetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam
         case KP_EFFECTIVE_KEYLEN:
             switch (pCryptKey->aiAlgid) {
                 case CALG_RC2:
+                {
+                    DWORD keylen;
+                    KEYCONTAINER *pKeyContainer = get_key_container(pCryptKey->hProv);
+
                     if (!pbData)
                     {
                         SetLastError(ERROR_INVALID_PARAMETER);
                         return FALSE;
                     }
-                    else if (!*(DWORD *)pbData || *(DWORD *)pbData > 1024)
+                    keylen = *(DWORD *)pbData;
+                    if (!keylen || keylen > 1024 || (keylen != 40 &&
+                        pKeyContainer->dwPersonality == RSAENH_PERSONALITY_BASE))
                     {
                         SetLastError(NTE_BAD_DATA);
                         return FALSE;
                     }
                     else
                     {
-                        pCryptKey->dwEffectiveKeyLen = *(DWORD *)pbData;
+                        pCryptKey->dwEffectiveKeyLen = keylen;
                         setup_key(pCryptKey);
                     }
                     break;
+                }
                 default:
                     SetLastError(NTE_BAD_TYPE);
                     return FALSE;
diff --git a/dlls/rsaenh/tests/rsaenh.c b/dlls/rsaenh/tests/rsaenh.c
index 1dfca3c..46d0451 100644
--- a/dlls/rsaenh/tests/rsaenh.c
+++ b/dlls/rsaenh/tests/rsaenh.c
@@ -1529,7 +1529,6 @@ static void test_rc2(void)
         if (!BASE_PROV)
             ok(result, "expected success, got error 0x%08X\n", GetLastError());
         else
-            todo_wine
             ok(!result, "expected error\n");
 
         dwLen = sizeof(dwKeyLen);




More information about the wine-cvs mailing list