rsaenh: Merge the encrypting and decrypting states, as encrypting and decrypting are allowed with the same key.

This commit is contained in:
Juan Lang 2008-02-07 13:27:40 -08:00 committed by Alexandre Julliard
parent ebe9b3c995
commit ad6a7a788d
1 changed files with 3 additions and 4 deletions

View File

@ -75,8 +75,7 @@ typedef struct tagCRYPTHASH
#define RSAENH_MAX_BLOCK_SIZE 24 #define RSAENH_MAX_BLOCK_SIZE 24
#define RSAENH_KEYSTATE_IDLE 0 #define RSAENH_KEYSTATE_IDLE 0
#define RSAENH_KEYSTATE_ENCRYPTING 1 #define RSAENH_KEYSTATE_ENCRYPTING 1
#define RSAENH_KEYSTATE_DECRYPTING 2 #define RSAENH_KEYSTATE_MASTERKEY 2
#define RSAENH_KEYSTATE_MASTERKEY 3
typedef struct _RSAENH_SCHANNEL_INFO typedef struct _RSAENH_SCHANNEL_INFO
{ {
SCHANNEL_ALG saEncAlg; SCHANNEL_ALG saEncAlg;
@ -2115,9 +2114,9 @@ BOOL WINAPI RSAENH_CPDecrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash,
} }
if (pCryptKey->dwState == RSAENH_KEYSTATE_IDLE) if (pCryptKey->dwState == RSAENH_KEYSTATE_IDLE)
pCryptKey->dwState = RSAENH_KEYSTATE_DECRYPTING; pCryptKey->dwState = RSAENH_KEYSTATE_ENCRYPTING;
if (pCryptKey->dwState != RSAENH_KEYSTATE_DECRYPTING) if (pCryptKey->dwState != RSAENH_KEYSTATE_ENCRYPTING)
{ {
SetLastError(NTE_BAD_DATA); SetLastError(NTE_BAD_DATA);
return FALSE; return FALSE;