mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
rsaenh: Validate pad byte when decrypting a block cipher.
This commit is contained in:
parent
894cf6dbaf
commit
f0d2766fdc
1 changed files with 10 additions and 1 deletions
|
@ -2080,7 +2080,16 @@ BOOL WINAPI RSAENH_CPDecrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash,
|
|||
}
|
||||
memcpy(in, out, pCryptKey->dwBlockLen);
|
||||
}
|
||||
if (Final) *pdwDataLen -= pbData[*pdwDataLen-1];
|
||||
if (Final) {
|
||||
if (pbData[*pdwDataLen-1] &&
|
||||
pbData[*pdwDataLen-1] <= pCryptKey->dwBlockLen &&
|
||||
pbData[*pdwDataLen-1] < *pdwDataLen)
|
||||
*pdwDataLen -= pbData[*pdwDataLen-1];
|
||||
else {
|
||||
SetLastError(NTE_BAD_DATA);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (GET_ALG_TYPE(pCryptKey->aiAlgid) == ALG_TYPE_STREAM) {
|
||||
encrypt_stream_impl(pCryptKey->aiAlgid, &pCryptKey->context, pbData, *pdwDataLen);
|
||||
|
|
Loading…
Reference in a new issue