rsaenh: Reorder padding code to avoid unnecessary comparison.
This commit is contained in:
parent
57dee443f5
commit
16c40d9112
|
@ -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;
|
||||
else if (dwEncryptedLen > dwBufLen) {
|
||||
*pdwDataLen = dwEncryptedLen;
|
||||
|
||||
if (*pdwDataLen > dwBufLen)
|
||||
{
|
||||
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:
|
||||
|
|
Loading…
Reference in New Issue