rsaenh: Fix the case when the CPEncrypt function is asked for the needed buffer size.

This commit is contained in:
Karsten Elfenbein 2006-07-25 20:57:34 +02:00 committed by Alexandre Julliard
parent 4b792c6d56
commit bf1ad6c324
1 changed files with 6 additions and 0 deletions

View File

@ -1889,6 +1889,12 @@ BOOL WINAPI RSAENH_CPEncrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash,
}
dwEncryptedLen = (*pdwDataLen/pCryptKey->dwBlockLen+(Final?1:0))*pCryptKey->dwBlockLen;
if (pbData == NULL) {
*pdwDataLen = dwEncryptedLen;
return TRUE;
}
for (i=*pdwDataLen; i<dwEncryptedLen && i<dwBufLen; i++) pbData[i] = dwEncryptedLen - *pdwDataLen;
*pdwDataLen = dwEncryptedLen;