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

This commit is contained in:
Juan Lang 2009-01-28 21:44:11 -08:00 committed by Alexandre Julliard
parent 21a3ae0b7c
commit 8f4a491489

View File

@ -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);
}
}
@ -1059,6 +1058,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]
*
@ -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 );
}