rsaenh: Test and correct the maximum allowable salt length
James Hawkins
truiken at gmail.com
Mon Jul 28 22:02:12 CDT 2008
On Mon, Jul 28, 2008 at 9:58 PM, Juan Lang <juan.lang at gmail.com> wrote:
> Inspired by a patch by Karsten Elfenbein.
+ /* What sizes salt can I set? */
+ salt.pbData = pbData;
+ for (i=0; i<24; i++)
+ {
+ salt.cbData = i;
+ result = CryptSetKeyParam(hKey, KP_SALT_EX, (BYTE *)&salt, 0);
+ ok(result, "setting salt failed for size %d: %08x\n", i,
GetLastError());
+ }
+ salt.cbData = 25;
+ SetLastError(0xdeadbeef);
+ result = CryptSetKeyParam(hKey, KP_SALT_EX, (BYTE *)&salt, 0);
+ ok(!result && GetLastError() == NTE_BAD_DATA, "%08x\n",
GetLastError());
+
+ /* What sizes salt can I set? */
+ salt.pbData = pbData;
+ for (i=0; i<24; i++)
+ {
+ salt.cbData = i;
+ result = CryptSetKeyParam(hKey, KP_SALT_EX, (BYTE *)&salt, 0);
+ ok(result, "setting salt failed for size %d: %08x\n", i,
GetLastError());
+ }
+ salt.cbData = 25;
+ SetLastError(0xdeadbeef);
+ result = CryptSetKeyParam(hKey, KP_SALT_EX, (BYTE *)&salt, 0);
+ ok(!result && GetLastError() == NTE_BAD_DATA, "%08x\n",
GetLastError());
+
Did you mean to test that block twice?
--
James Hawkins
More information about the wine-devel
mailing list