I just sent a patch to testbot - the patch tests using the BCRYPT_HASH_REUSABLE_FLAG and expects a return code of STATUS_INVALID_PARAMETER: https://testbot.winehq.org/JobDetails.pl?Key=48735
This passes on everything but Windows 8 and 10. On Win8 and 10, BCRYPT_HASH_REUSABLE_FLAG is implemented - so the return code is STATUS_SUCCESS.
My patch to the mailing list is based on a change I made to my local build to fix an issue while running .NET Core. I can see in the .NET Core code, that it passes BCRYPT_HASH_REUSABLE_FLAG to BCryptCreateHash and expects STATUS_INVALID_PARAMETER if the OS is pre-Win8 (I'm using Win7). That code can be seen here (it's under the MIT licence): https://github.com/dotnet/corefx/blob/master/src/Common/src/Internal/Cryptog...
So until BCRYPT_HASH_REUSABLE_FLAG is implemented - maybe it is better to return STATUS_INVALID_PARAMETER?
On 5/3/19 9:07 pm, Hans Leidekker wrote:
On Tue, 2019-03-05 at 20:33 +1100, Brendan McGrath wrote:
OK - so it should return STATUS_NOT_IMPLEMENTED when BCRYPT_HASH_REUSABLE_FLAG is passed and STATUS_INVALID_PARAMETER otherwise?
Yes, though note that your test is not exhaustive, it checks just one flag while your fix rejects all of them. There might be undocumented flags, and there's always the possibility that new flags are added.
It's very unlikely that applications depend on the exact error code, so it's not worth spending a lot of time getting these checks exactly right.