Juan Lang : rsaenh: Separate storing a key container' s keys from releasing them.

Alexandre Julliard julliard at winehq.org
Thu Jan 29 09:15:03 CST 2009


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Wed Jan 28 21:44:11 2009 -0800

rsaenh: Separate storing a key container's keys from releasing them.

---

 dlls/rsaenh/rsaenh.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c
index 059dad2..4dc8aa6 100644
--- a/dlls/rsaenh/rsaenh.c
+++ b/dlls/rsaenh/rsaenh.c
@@ -932,7 +932,6 @@ static void store_key_pair(HCRYPTKEY hCryptKey, HKEY hKey, LPCSTR szValueName, D
                 HeapFree(GetProcessHeap(), 0, pbKey);
             }
         }
-        release_handle(&handle_table, hCryptKey, RSAENH_MAGIC_KEY);
     }
 }
 
@@ -1060,6 +1059,22 @@ static void store_key_container_keys(KEYCONTAINER *pKeyContainer)
 }
 
 /******************************************************************************
+ * release_key_container_keys [Internal]
+ *
+ * Releases key container's keys.
+ *
+ * PARAMS
+ *  pKeyContainer [I] Pointer to the key container whose keys are to be released.
+ */
+static void release_key_container_keys(KEYCONTAINER *pKeyContainer)
+{
+    release_handle(&handle_table, pKeyContainer->hKeyExchangeKeyPair,
+                   RSAENH_MAGIC_KEY);
+    release_handle(&handle_table, pKeyContainer->hSignatureKeyPair,
+                   RSAENH_MAGIC_KEY);
+}
+
+/******************************************************************************
  * destroy_key_container [Internal]
  *
  * Destructor for key containers.
@@ -1072,7 +1087,10 @@ static void destroy_key_container(OBJECTHDR *pObjectHdr)
     KEYCONTAINER *pKeyContainer = (KEYCONTAINER*)pObjectHdr;
 
     if (!(pKeyContainer->dwFlags & CRYPT_VERIFYCONTEXT))
+    {
         store_key_container_keys(pKeyContainer);
+        release_key_container_keys(pKeyContainer);
+    }
     HeapFree( GetProcessHeap(), 0, pKeyContainer );
 }
 




More information about the wine-cvs mailing list