winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
November 2007
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
757 discussions
Start a n
N
ew thread
Juan Lang : rsaenh: Use helper function to read key pairs from registry.
by Alexandre Julliard
07 Nov '07
07 Nov '07
Module: wine Branch: master Commit: 5408471b23e903c308c256284cf16c367c75b9f2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5408471b23e903c308c256284…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Nov 6 13:05:23 2007 -0800 rsaenh: Use helper function to read key pairs from registry. --- dlls/rsaenh/rsaenh.c | 106 +++++++++++++++++++++++++------------------------ 1 files changed, 54 insertions(+), 52 deletions(-) diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c index 4c154c1..2d89751 100644 --- a/dlls/rsaenh/rsaenh.c +++ b/dlls/rsaenh/rsaenh.c @@ -1100,6 +1100,51 @@ static HCRYPTPROV new_key_container(PCCH pszContainerName, DWORD dwFlags, const } /****************************************************************************** + * read_key_value [Internal] + * + * Reads a key pair value from the registry + * + * PARAMS + * hKeyContainer [I] Crypt provider to use to import the key + * hKey [I] Registry key from which to read the key pair + * szValueName [I] Registry value from which to read the key pair's value + * dwFlags [I] Flags for unprotecting the key + * phCryptKey [O] Returned key + */ +static BOOL read_key_value(HCRYPTPROV hKeyContainer, HKEY hKey, LPCSTR szValueName, DWORD dwFlags, HCRYPTKEY *phCryptKey) +{ + DWORD dwValueType, dwLen; + BYTE *pbKey; + DATA_BLOB blobIn, blobOut; + BOOL ret = FALSE; + + if (RegQueryValueExA(hKey, szValueName, 0, &dwValueType, NULL, &dwLen) == + ERROR_SUCCESS) + { + pbKey = HeapAlloc(GetProcessHeap(), 0, dwLen); + if (pbKey) + { + if (RegQueryValueExA(hKey, szValueName, 0, &dwValueType, pbKey, &dwLen) == + ERROR_SUCCESS) + { + blobIn.pbData = pbKey; + blobIn.cbData = dwLen; + + if (CryptUnprotectData(&blobIn, NULL, NULL, NULL, NULL, + dwFlags, &blobOut)) + { + ret = RSAENH_CPImportKey(hKeyContainer, blobOut.pbData, blobOut.cbData, 0, 0, + phCryptKey); + HeapFree(GetProcessHeap(), 0, blobOut.pbData); + } + } + HeapFree(GetProcessHeap(), 0, pbKey); + } + } + return ret; +} + +/****************************************************************************** * read_key_container [Internal] * * Tries to read the persistent state of the key container (mainly the signature @@ -1115,12 +1160,9 @@ static HCRYPTPROV new_key_container(PCCH pszContainerName, DWORD dwFlags, const */ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, const VTableProvStruc *pVTable) { - BYTE *pbKey; HKEY hKey; - DWORD dwValueType, dwLen; KEYCONTAINER *pKeyContainer; HCRYPTPROV hKeyContainer; - DATA_BLOB blobIn, blobOut; HCRYPTKEY hCryptKey; if (!open_container_key(pszContainerName, dwFlags, &hKey)) @@ -1132,59 +1174,19 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, cons hKeyContainer = new_key_container(pszContainerName, dwFlags, pVTable); if (hKeyContainer != (HCRYPTPROV)INVALID_HANDLE_VALUE) { + DWORD dwProtectFlags = (dwFlags & CRYPT_MACHINE_KEYSET) ? + CRYPTPROTECT_LOCAL_MACHINE : 0; + if (!lookup_handle(&handle_table, hKeyContainer, RSAENH_MAGIC_CONTAINER, (OBJECTHDR**)&pKeyContainer)) return (HCRYPTPROV)INVALID_HANDLE_VALUE; - if (RegQueryValueExA(hKey, "KeyExchangeKeyPair", 0, &dwValueType, NULL, &dwLen) == - ERROR_SUCCESS) - { - pbKey = HeapAlloc(GetProcessHeap(), 0, dwLen); - if (pbKey) - { - if (RegQueryValueExA(hKey, "KeyExchangeKeyPair", 0, &dwValueType, pbKey, &dwLen) == - ERROR_SUCCESS) - { - blobIn.pbData = pbKey; - blobIn.cbData = dwLen; - - if (CryptUnprotectData(&blobIn, NULL, NULL, NULL, NULL, - (dwFlags & CRYPT_MACHINE_KEYSET) ? CRYPTPROTECT_LOCAL_MACHINE : 0, &blobOut)) - { - if(RSAENH_CPImportKey(hKeyContainer, blobOut.pbData, blobOut.cbData, 0, 0, - &hCryptKey)) - pKeyContainer->hKeyExchangeKeyPair = hCryptKey; - HeapFree(GetProcessHeap(), 0, blobOut.pbData); - } - } - HeapFree(GetProcessHeap(), 0, pbKey); - } - } - - if (RegQueryValueExA(hKey, "SignatureKeyPair", 0, &dwValueType, NULL, &dwLen) == - ERROR_SUCCESS) - { - pbKey = HeapAlloc(GetProcessHeap(), 0, dwLen); - if (pbKey) - { - if (RegQueryValueExA(hKey, "SignatureKeyPair", 0, &dwValueType, pbKey, &dwLen) == - ERROR_SUCCESS) - { - blobIn.pbData = pbKey; - blobIn.cbData = dwLen; - - if (CryptUnprotectData(&blobIn, NULL, NULL, NULL, NULL, - (dwFlags & CRYPT_MACHINE_KEYSET) ? CRYPTPROTECT_LOCAL_MACHINE : 0, &blobOut)) - { - if(RSAENH_CPImportKey(hKeyContainer, blobOut.pbData, blobOut.cbData, 0, 0, - &hCryptKey)) - pKeyContainer->hSignatureKeyPair = hCryptKey; - HeapFree(GetProcessHeap(), 0, blobOut.pbData); - } - } - HeapFree(GetProcessHeap(), 0, pbKey); - } - } + if (read_key_value(hKeyContainer, hKey, "KeyExchangeKeyPair", + dwProtectFlags, &hCryptKey)) + pKeyContainer->hKeyExchangeKeyPair = hCryptKey; + if (read_key_value(hKeyContainer, hKey, "SignatureKeyPair", + dwProtectFlags, &hCryptKey)) + pKeyContainer->hSignatureKeyPair = hCryptKey; } return hKeyContainer;
1
0
0
0
Juan Lang : rsaenh: Use helper function to delete a key container' s registry key.
by Alexandre Julliard
07 Nov '07
07 Nov '07
Module: wine Branch: master Commit: 9260fcf7acafc15364340b457e7f01bb1216b564 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9260fcf7acafc15364340b457…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Nov 6 11:53:14 2007 -0800 rsaenh: Use helper function to delete a key container's registry key. --- dlls/rsaenh/rsaenh.c | 52 +++++++++++++++++++++++++++++++------------------ 1 files changed, 33 insertions(+), 19 deletions(-) diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c index fbb0238..4c154c1 100644 --- a/dlls/rsaenh/rsaenh.c +++ b/dlls/rsaenh/rsaenh.c @@ -965,6 +965,38 @@ static BOOL open_container_key(LPCSTR pszContainerName, DWORD dwFlags, HKEY *phK } /****************************************************************************** + * delete_container_key [Internal] + * + * Deletes a key container's persistent storage. + * + * PARAMS + * pszContainerName [I] Name of the container to be opened. + * dwFlags [I] Flags indicating which keyset to be opened. + */ +static BOOL delete_container_key(LPCSTR pszContainerName, DWORD dwFlags) +{ + CHAR szRegKey[MAX_PATH]; + + if (snprintf(szRegKey, MAX_PATH, RSAENH_REGKEY, pszContainerName) >= MAX_PATH) { + SetLastError(NTE_BAD_KEYSET_PARAM); + return FALSE; + } else { + HKEY hRootKey; + if (dwFlags & CRYPT_MACHINE_KEYSET) + hRootKey = HKEY_LOCAL_MACHINE; + else + hRootKey = HKEY_CURRENT_USER; + if (!RegDeleteKeyA(hRootKey, szRegKey)) { + SetLastError(ERROR_SUCCESS); + return TRUE; + } else { + SetLastError(NTE_BAD_KEYSET); + return FALSE; + } + } +} + +/****************************************************************************** * store_key_container_keys [Internal] * * Stores key container's keys in a persistent location. @@ -1479,7 +1511,6 @@ BOOL WINAPI RSAENH_CPAcquireContext(HCRYPTPROV *phProv, LPSTR pszContainer, DWORD dwFlags, PVTableProvStruc pVTable) { CHAR szKeyContainerName[MAX_PATH]; - CHAR szRegKey[MAX_PATH]; TRACE("(phProv=%p, pszContainer=%s, dwFlags=%08x, pVTable=%p)\n", phProv, debugstr_a(pszContainer), dwFlags, pVTable); @@ -1501,24 +1532,7 @@ BOOL WINAPI RSAENH_CPAcquireContext(HCRYPTPROV *phProv, LPSTR pszContainer, break; case CRYPT_DELETEKEYSET: - if (snprintf(szRegKey, MAX_PATH, RSAENH_REGKEY, szKeyContainerName) >= MAX_PATH) { - SetLastError(NTE_BAD_KEYSET_PARAM); - return FALSE; - } else { - HKEY hRootKey; - if (dwFlags & CRYPT_MACHINE_KEYSET) - hRootKey = HKEY_LOCAL_MACHINE; - else - hRootKey = HKEY_CURRENT_USER; - if (!RegDeleteKeyA(hRootKey, szRegKey)) { - SetLastError(ERROR_SUCCESS); - return TRUE; - } else { - SetLastError(NTE_BAD_KEYSET); - return FALSE; - } - } - break; + return delete_container_key(szKeyContainerName, dwFlags); case CRYPT_NEWKEYSET: *phProv = read_key_container(szKeyContainerName, dwFlags, pVTable);
1
0
0
0
Juan Lang : rsaenh: Use helper function to open a key container' s registry key.
by Alexandre Julliard
07 Nov '07
07 Nov '07
Module: wine Branch: master Commit: 88405a68e7121a82cb326fe85e3cb68af1de36d9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=88405a68e7121a82cb326fe85…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Nov 6 11:48:29 2007 -0800 rsaenh: Use helper function to open a key container's registry key. --- dlls/rsaenh/rsaenh.c | 58 +++++++++++++++++++++++++++++-------------------- 1 files changed, 34 insertions(+), 24 deletions(-) diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c index 2e9ebfd..fbb0238 100644 --- a/dlls/rsaenh/rsaenh.c +++ b/dlls/rsaenh/rsaenh.c @@ -935,6 +935,36 @@ static BOOL create_container_key(KEYCONTAINER *pKeyContainer, REGSAM sam, HKEY * } /****************************************************************************** + * open_container_key [Internal] + * + * Opens a key container's persistent storage for reading. + * + * PARAMS + * pszContainerName [I] Name of the container to be opened. May be the empty + * string if the parent key of all containers is to be + * opened. + * dwFlags [I] Flags indicating which keyset to be opened. + * phKey [O] Returned key + */ +static BOOL open_container_key(LPCSTR pszContainerName, DWORD dwFlags, HKEY *phKey) +{ + CHAR szRSABase[MAX_PATH]; + HKEY hRootKey; + + sprintf(szRSABase, RSAENH_REGKEY, pszContainerName); + + if (dwFlags & CRYPT_MACHINE_KEYSET) + hRootKey = HKEY_LOCAL_MACHINE; + else + hRootKey = HKEY_CURRENT_USER; + + /* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */ + /* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */ + return RegOpenKeyExA(hRootKey, szRSABase, 0, KEY_READ, phKey) == + ERROR_SUCCESS; +} + +/****************************************************************************** * store_key_container_keys [Internal] * * Stores key container's keys in a persistent location. @@ -1053,26 +1083,15 @@ static HCRYPTPROV new_key_container(PCCH pszContainerName, DWORD dwFlags, const */ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, const VTableProvStruc *pVTable) { - CHAR szRSABase[MAX_PATH]; BYTE *pbKey; - HKEY hKey, hRootKey; + HKEY hKey; DWORD dwValueType, dwLen; KEYCONTAINER *pKeyContainer; HCRYPTPROV hKeyContainer; DATA_BLOB blobIn, blobOut; HCRYPTKEY hCryptKey; - sprintf(szRSABase, RSAENH_REGKEY, pszContainerName); - - if (dwFlags & CRYPT_MACHINE_KEYSET) { - hRootKey = HKEY_LOCAL_MACHINE; - } else { - hRootKey = HKEY_CURRENT_USER; - } - - /* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */ - /* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */ - if (RegOpenKeyExA(hRootKey, szRSABase, 0, KEY_READ, &hKey) != ERROR_SUCCESS) + if (!open_container_key(pszContainerName, dwFlags, &hKey)) { SetLastError(NTE_BAD_KEYSET); return (HCRYPTPROV)INVALID_HANDLE_VALUE; @@ -2913,8 +2932,7 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, KEYCONTAINER *pKeyContainer; PROV_ENUMALGS provEnumalgs; DWORD dwTemp; - CHAR szRSABase[MAX_PATH]; - HKEY hKey, hRootKey; + HKEY hKey; /* This is for dwParam 41, which does not seem to be documented * on MSDN. IE6 SP1 asks for it in the 'About' dialog, however. @@ -3000,15 +3018,7 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, return TRUE; } - sprintf(szRSABase, RSAENH_REGKEY, ""); - - if (dwFlags & CRYPT_MACHINE_KEYSET) { - hRootKey = HKEY_LOCAL_MACHINE; - } else { - hRootKey = HKEY_CURRENT_USER; - } - - if (RegOpenKeyExA(hRootKey, szRSABase, 0, KEY_READ, &hKey) != ERROR_SUCCESS) + if (!open_container_key("", dwFlags, &hKey)) { SetLastError(ERROR_NO_MORE_ITEMS); return FALSE;
1
0
0
0
Juan Lang : rsaenh: Use helper function to create a container' s registry key.
by Alexandre Julliard
07 Nov '07
07 Nov '07
Module: wine Branch: master Commit: 060ed4cf02d6144e5a35d6f01f94f26dbe44634f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=060ed4cf02d6144e5a35d6f01…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Nov 6 11:37:00 2007 -0800 rsaenh: Use helper function to create a container's registry key. --- dlls/rsaenh/rsaenh.c | 64 +++++++++++++++++++++++++++++--------------------- 1 files changed, 37 insertions(+), 27 deletions(-) diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c index 3561339..2e9ebfd 100644 --- a/dlls/rsaenh/rsaenh.c +++ b/dlls/rsaenh/rsaenh.c @@ -906,6 +906,35 @@ static void store_key_pair(HCRYPTKEY hCryptKey, HKEY hKey, LPCSTR szValueName, D } /****************************************************************************** + * create_container_key [Internal] + * + * Creates the registry key for a key container's persistent storage. + * + * PARAMS + * pKeyContainer [I] Pointer to the key container + * sam [I] Desired registry access + * phKey [O] Returned key + */ +static BOOL create_container_key(KEYCONTAINER *pKeyContainer, REGSAM sam, HKEY *phKey) +{ + CHAR szRSABase[MAX_PATH]; + HKEY hRootKey; + + sprintf(szRSABase, RSAENH_REGKEY, pKeyContainer->szName); + + if (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET) + hRootKey = HKEY_LOCAL_MACHINE; + else + hRootKey = HKEY_CURRENT_USER; + + /* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */ + /* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */ + return RegCreateKeyExA(hRootKey, szRSABase, 0, NULL, + REG_OPTION_NON_VOLATILE, sam, NULL, phKey, NULL) + == ERROR_SUCCESS; +} + +/****************************************************************************** * store_key_container_keys [Internal] * * Stores key container's keys in a persistent location. @@ -915,27 +944,19 @@ static void store_key_pair(HCRYPTKEY hCryptKey, HKEY hKey, LPCSTR szValueName, D */ static void store_key_container_keys(KEYCONTAINER *pKeyContainer) { - CHAR szRSABase[MAX_PATH]; - HKEY hKey, hRootKey; + HKEY hKey; DWORD dwFlags; /* On WinXP, persistent keys are stored in a file located at: * $AppData$\\Microsoft\\Crypto\\RSA\\$SID$\\some_hex_string */ - sprintf(szRSABase, RSAENH_REGKEY, pKeyContainer->szName); - if (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET) { - hRootKey = HKEY_LOCAL_MACHINE; + if (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET) dwFlags = CRYPTPROTECT_LOCAL_MACHINE; - } else { - hRootKey = HKEY_CURRENT_USER; + else dwFlags = 0; - } - - /* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */ - /* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */ - if (RegCreateKeyExA(hRootKey, szRSABase, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) + + if (create_container_key(pKeyContainer, KEY_WRITE, &hKey)) { store_key_pair(pKeyContainer->hKeyExchangeKeyPair, hKey, "KeyExchangeKeyPair", dwFlags); @@ -1006,21 +1027,10 @@ static HCRYPTPROV new_key_container(PCCH pszContainerName, DWORD dwFlags, const /* The new key container has to be inserted into the CSP immediately * after creation to be available for CPGetProvParam's PP_ENUMCONTAINERS. */ if (!(dwFlags & CRYPT_VERIFYCONTEXT)) { - CHAR szRSABase[MAX_PATH]; - HKEY hRootKey, hKey; - - sprintf(szRSABase, RSAENH_REGKEY, pKeyContainer->szName); - - if (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET) { - hRootKey = HKEY_LOCAL_MACHINE; - } else { - hRootKey = HKEY_CURRENT_USER; - } + HKEY hKey; - /* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */ - /* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */ - RegCreateKeyA(hRootKey, szRSABase, &hKey); - RegCloseKey(hKey); + if (create_container_key(pKeyContainer, KEY_WRITE, &hKey)) + RegCloseKey(hKey); } }
1
0
0
0
Juan Lang : rsaenh: Use helper function to persist keys.
by Alexandre Julliard
07 Nov '07
07 Nov '07
Module: wine Branch: master Commit: 58269419e508e1cb8b88420466f0a4daa94d56bc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=58269419e508e1cb8b8842046…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Nov 6 11:27:24 2007 -0800 rsaenh: Use helper function to persist keys. --- dlls/rsaenh/rsaenh.c | 161 +++++++++++++++++++++++++------------------------- 1 files changed, 80 insertions(+), 81 deletions(-) diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c index 3318da6..3561339 100644 --- a/dlls/rsaenh/rsaenh.c +++ b/dlls/rsaenh/rsaenh.c @@ -858,108 +858,107 @@ static HCRYPTKEY new_key(HCRYPTPROV hProv, ALG_ID aiAlgid, DWORD dwFlags, CRYPTK } /****************************************************************************** - * destroy_key_container [Internal] + * store_key_pair [Internal] * - * Destructor for key containers. + * Stores a key pair to the registry * * PARAMS - * pObjectHdr [I] Pointer to the key container to be destroyed. + * hCryptKey [I] Handle to the key to be stored + * hKey [I] Registry key where the key pair is to be stored + * szValueName [I] Registry value where key pair's value is to be stored + * dwFlags [I] Flags for protecting the key */ -static void destroy_key_container(OBJECTHDR *pObjectHdr) +static void store_key_pair(HCRYPTKEY hCryptKey, HKEY hKey, LPCSTR szValueName, DWORD dwFlags) { - KEYCONTAINER *pKeyContainer = (KEYCONTAINER*)pObjectHdr; DATA_BLOB blobIn, blobOut; CRYPTKEY *pKey; - CHAR szRSABase[MAX_PATH]; - HKEY hKey, hRootKey; DWORD dwLen; BYTE *pbKey; - if (!(pKeyContainer->dwFlags & CRYPT_VERIFYCONTEXT)) { - /* On WinXP, persistent keys are stored in a file located at: - * $AppData$\\Microsoft\\Crypto\\RSA\\$SID$\\some_hex_string - */ - sprintf(szRSABase, RSAENH_REGKEY, pKeyContainer->szName); - - if (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET) { - hRootKey = HKEY_LOCAL_MACHINE; - } else { - hRootKey = HKEY_CURRENT_USER; - } - - /* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */ - /* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */ - if (RegCreateKeyExA(hRootKey, szRSABase, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) + if (lookup_handle(&handle_table, hCryptKey, RSAENH_MAGIC_KEY, + (OBJECTHDR**)&pKey)) + { + if (RSAENH_CPExportKey(pKey->hProv, hCryptKey, 0, PRIVATEKEYBLOB, 0, 0, + &dwLen)) { - if (lookup_handle(&handle_table, pKeyContainer->hKeyExchangeKeyPair, RSAENH_MAGIC_KEY, - (OBJECTHDR**)&pKey)) + pbKey = HeapAlloc(GetProcessHeap(), 0, dwLen); + if (pbKey) { - if (RSAENH_CPExportKey(pKey->hProv, pKeyContainer->hKeyExchangeKeyPair, 0, - PRIVATEKEYBLOB, 0, 0, &dwLen)) + if (RSAENH_CPExportKey(pKey->hProv, hCryptKey, 0, + PRIVATEKEYBLOB, 0, pbKey, &dwLen)) { - pbKey = HeapAlloc(GetProcessHeap(), 0, dwLen); - if (pbKey) - { - if (RSAENH_CPExportKey(pKey->hProv, pKeyContainer->hKeyExchangeKeyPair, 0, - PRIVATEKEYBLOB, 0, pbKey, &dwLen)) - { - blobIn.pbData = pbKey; - blobIn.cbData = dwLen; - - if (CryptProtectData(&blobIn, NULL, NULL, NULL, NULL, - (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET) ? - CRYPTPROTECT_LOCAL_MACHINE : 0, - &blobOut)) - { - RegSetValueExA(hKey, "KeyExchangeKeyPair", 0, REG_BINARY, - blobOut.pbData, blobOut.cbData); - HeapFree(GetProcessHeap(), 0, blobOut.pbData); - } - } - HeapFree(GetProcessHeap(), 0, pbKey); - } - } - release_handle(&handle_table, pKeyContainer->hKeyExchangeKeyPair, - RSAENH_MAGIC_KEY); - } + blobIn.pbData = pbKey; + blobIn.cbData = dwLen; - if (lookup_handle(&handle_table, pKeyContainer->hSignatureKeyPair, RSAENH_MAGIC_KEY, - (OBJECTHDR**)&pKey)) - { - if (RSAENH_CPExportKey(pKey->hProv, pKeyContainer->hSignatureKeyPair, 0, - PRIVATEKEYBLOB, 0, 0, &dwLen)) - { - pbKey = HeapAlloc(GetProcessHeap(), 0, dwLen); - if (pbKey) + if (CryptProtectData(&blobIn, NULL, NULL, NULL, NULL, + dwFlags, &blobOut)) { - if (RSAENH_CPExportKey(pKey->hProv, pKeyContainer->hSignatureKeyPair, 0, - PRIVATEKEYBLOB, 0, pbKey, &dwLen)) - { - blobIn.pbData = pbKey; - blobIn.cbData = dwLen; - - if (CryptProtectData(&blobIn, NULL, NULL, NULL, NULL, - (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET) ? - CRYPTPROTECT_LOCAL_MACHINE : 0, - &blobOut)) - { - RegSetValueExA(hKey, "SignatureKeyPair", 0, REG_BINARY, - blobOut.pbData, blobOut.cbData); - HeapFree(GetProcessHeap(), 0, blobOut.pbData); - } - } - HeapFree(GetProcessHeap(), 0, pbKey); + RegSetValueExA(hKey, szValueName, 0, REG_BINARY, + blobOut.pbData, blobOut.cbData); + HeapFree(GetProcessHeap(), 0, blobOut.pbData); } } - release_handle(&handle_table, pKeyContainer->hSignatureKeyPair, - RSAENH_MAGIC_KEY); + HeapFree(GetProcessHeap(), 0, pbKey); } - - RegCloseKey(hKey); } + release_handle(&handle_table, hCryptKey, RSAENH_MAGIC_KEY); + } +} + +/****************************************************************************** + * store_key_container_keys [Internal] + * + * Stores key container's keys in a persistent location. + * + * PARAMS + * pKeyContainer [I] Pointer to the key container to be destroyed. + */ +static void store_key_container_keys(KEYCONTAINER *pKeyContainer) +{ + CHAR szRSABase[MAX_PATH]; + HKEY hKey, hRootKey; + DWORD dwFlags; + + /* On WinXP, persistent keys are stored in a file located at: + * $AppData$\\Microsoft\\Crypto\\RSA\\$SID$\\some_hex_string + */ + sprintf(szRSABase, RSAENH_REGKEY, pKeyContainer->szName); + + if (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET) { + hRootKey = HKEY_LOCAL_MACHINE; + dwFlags = CRYPTPROTECT_LOCAL_MACHINE; + } else { + hRootKey = HKEY_CURRENT_USER; + dwFlags = 0; } + /* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */ + /* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */ + if (RegCreateKeyExA(hRootKey, szRSABase, 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) + { + store_key_pair(pKeyContainer->hKeyExchangeKeyPair, hKey, + "KeyExchangeKeyPair", dwFlags); + store_key_pair(pKeyContainer->hSignatureKeyPair, hKey, + "SignatureKeyPair", dwFlags); + RegCloseKey(hKey); + } +} + +/****************************************************************************** + * destroy_key_container [Internal] + * + * Destructor for key containers. + * + * PARAMS + * pObjectHdr [I] Pointer to the key container to be destroyed. + */ +static void destroy_key_container(OBJECTHDR *pObjectHdr) +{ + KEYCONTAINER *pKeyContainer = (KEYCONTAINER*)pObjectHdr; + + if (!(pKeyContainer->dwFlags & CRYPT_VERIFYCONTEXT)) + store_key_container_keys(pKeyContainer); HeapFree( GetProcessHeap(), 0, pKeyContainer ); }
1
0
0
0
Alexandre Julliard : include: Mark imported functions with hidden visibility.
by Alexandre Julliard
07 Nov '07
07 Nov '07
Module: wine Branch: master Commit: 95c728551d5ee9b71d2a6328d0220a8b678c5225 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=95c728551d5ee9b71d2a6328d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Nov 7 12:31:16 2007 +0100 include: Mark imported functions with hidden visibility. --- include/winnt.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/winnt.h b/include/winnt.h index f068b53..78fa1f7 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -43,13 +43,13 @@ extern "C" { #define NTAPI __stdcall -#if (defined(_M_IX86) || defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(MIDL_PASS) +#ifndef MIDL_PASS # if defined(_MSC_VER) # define DECLSPEC_IMPORT __declspec(dllimport) # elif defined(__MINGW32__) # define DECLSPEC_IMPORT __attribute__((dllimport)) # else -# define DECLSPEC_IMPORT +# define DECLSPEC_IMPORT DECLSPEC_HIDDEN # endif #else # define DECLSPEC_IMPORT
1
0
0
0
Alexandre Julliard : include: Only use DECLSPEC_IMPORT for Windows compilers in unicode.h.
by Alexandre Julliard
07 Nov '07
07 Nov '07
Module: wine Branch: master Commit: 6678c07f5784365fee9dc3c43f71f9712897cfde URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6678c07f5784365fee9dc3c43…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Nov 7 12:30:51 2007 +0100 include: Only use DECLSPEC_IMPORT for Windows compilers in unicode.h. --- include/wine/unicode.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/include/wine/unicode.h b/include/wine/unicode.h index 27d7cee..49f9062 100644 --- a/include/wine/unicode.h +++ b/include/wine/unicode.h @@ -32,7 +32,11 @@ #endif #ifndef WINE_UNICODE_API -#define WINE_UNICODE_API DECLSPEC_IMPORT +# if defined(_MSC_VER) || defined(__MINGW32__) +# define WINE_UNICODE_API DECLSPEC_IMPORT +# else +# define WINE_UNICODE_API +# endif #endif #ifndef WINE_UNICODE_INLINE
1
0
0
0
Alexandre Julliard : include: Add NTSYSAPI to the exported ntdll functions.
by Alexandre Julliard
07 Nov '07
07 Nov '07
Module: wine Branch: master Commit: 6cf2df5a0c38472faa1081e477fb626079174e4f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6cf2df5a0c38472faa1081e47…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Nov 7 12:28:59 2007 +0100 include: Add NTSYSAPI to the exported ntdll functions. --- include/winnt.h | 20 +- include/winternl.h | 1185 +++++++++++++++++++++++++--------------------------- 2 files changed, 592 insertions(+), 613 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=6cf2df5a0c38472faa108…
1
0
0
0
Alexandre Julliard : include: Add WINBASEAPI to the exported kernel32 functions.
by Alexandre Julliard
07 Nov '07
07 Nov '07
Module: wine Branch: master Commit: 16d85e2d303e5612c575ab0fd1fd51542d670506 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=16d85e2d303e5612c575ab0fd…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Nov 7 12:27:51 2007 +0100 include: Add WINBASEAPI to the exported kernel32 functions. --- include/winbase.h | 1817 ++++++++++++++++++++++++++--------------------------- include/wincon.h | 149 ++--- include/winnls.h | 196 +++--- 3 files changed, 1073 insertions(+), 1089 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=16d85e2d303e5612c575a…
1
0
0
0
Alexandre Julliard : include: Add WINADVAPI to the exported advapi32 functions.
by Alexandre Julliard
07 Nov '07
07 Nov '07
Module: wine Branch: master Commit: 2d1da3430c2481e61f030475c24894a4df97b2bf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2d1da3430c2481e61f030475c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Nov 7 12:27:27 2007 +0100 include: Add WINADVAPI to the exported advapi32 functions. --- include/aclapi.h | 126 +++++++++++++--------------------- include/wincred.h | 38 ++++++---- include/wincrypt.h | 123 ++++++++++++++------------------- include/winreg.h | 196 ++++++++++++++++++++++++--------------------------- include/winsvc.h | 130 +++++++++++++++++----------------- 5 files changed, 279 insertions(+), 334 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=2d1da3430c2481e61f030…
1
0
0
0
← Newer
1
...
57
58
59
60
61
62
63
...
76
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Results per page:
10
25
50
100
200