Juan Lang : rsaenh: Disallow deriving schannel encryption keys before setting the encryption algorithm .
Alexandre Julliard
julliard at winehq.org
Fri Feb 11 11:16:36 CST 2011
Module: wine
Branch: master
Commit: 8e479f7803c2a5e484082a0bdc0d51beab20ea72
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8e479f7803c2a5e484082a0bdc0d51beab20ea72
Author: Juan Lang <juan.lang at gmail.com>
Date: Thu Feb 10 09:38:36 2011 -0800
rsaenh: Disallow deriving schannel encryption keys before setting the encryption algorithm.
---
dlls/rsaenh/rsaenh.c | 6 ++++++
dlls/rsaenh/tests/rsaenh.c | 1 -
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c
index 5f67589..0acf4c7 100644
--- a/dlls/rsaenh/rsaenh.c
+++ b/dlls/rsaenh/rsaenh.c
@@ -3923,6 +3923,12 @@ BOOL WINAPI RSAENH_CPDeriveKey(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseD
{
/* See RFC 2246, chapter 6.3 Key calculation */
case CALG_SCHANNEL_ENC_KEY:
+ if (!pMasterKey->siSChannelInfo.saEncAlg.Algid ||
+ !pMasterKey->siSChannelInfo.saEncAlg.cBits)
+ {
+ SetLastError(NTE_BAD_FLAGS);
+ return FALSE;
+ }
*phKey = new_key(hProv, pMasterKey->siSChannelInfo.saEncAlg.Algid,
MAKELONG(LOWORD(dwFlags),pMasterKey->siSChannelInfo.saEncAlg.cBits),
&pCryptKey);
diff --git a/dlls/rsaenh/tests/rsaenh.c b/dlls/rsaenh/tests/rsaenh.c
index 0476275..6b0faeb 100644
--- a/dlls/rsaenh/tests/rsaenh.c
+++ b/dlls/rsaenh/tests/rsaenh.c
@@ -2371,7 +2371,6 @@ static void test_schannel_provider(void)
* succeed before the encryption key algorithm is set.
*/
result = CryptDeriveKey(hProv, CALG_SCHANNEL_ENC_KEY, hMasterHash, CRYPT_SERVER, &hServerWriteKey);
- todo_wine
ok (!result && GetLastError() == NTE_BAD_FLAGS,
"expected NTE_BAD_FLAGS, got %08x\n", GetLastError());
More information about the wine-cvs
mailing list