Commit 16c40d91 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

rsaenh: Reorder padding code to avoid unnecessary comparison.

parent 57dee443
......@@ -1907,16 +1907,16 @@ BOOL WINAPI RSAENH_CPEncrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash,
*pdwDataLen = dwEncryptedLen;
return TRUE;
}
for (i=*pdwDataLen; i<dwEncryptedLen && i<dwBufLen; i++) pbData[i] = dwEncryptedLen - *pdwDataLen;
*pdwDataLen = dwEncryptedLen;
if (*pdwDataLen > dwBufLen)
{
else if (dwEncryptedLen > dwBufLen) {
*pdwDataLen = dwEncryptedLen;
SetLastError(ERROR_MORE_DATA);
return FALSE;
}
/* Pad final block with length bytes */
for (i=*pdwDataLen; i<dwEncryptedLen; i++) pbData[i] = dwEncryptedLen - *pdwDataLen;
*pdwDataLen = dwEncryptedLen;
for (i=0, in=pbData; i<*pdwDataLen; i+=pCryptKey->dwBlockLen, in+=pCryptKey->dwBlockLen) {
switch (pCryptKey->dwMode) {
case CRYPT_MODE_ECB:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment