From 3b7c61dc2a888e0b3bb39e90ae1b91f466ca62f0 Mon Sep 17 00:00:00 2001 From: Bruno Jesus <00cpxxx@gmail.com> Date: Sat, 12 Jul 2014 13:11:51 -0300 Subject: [PATCH] rsaenh/tests: Add a pre XP DES compatibility test. --- dlls/rsaenh/tests/rsaenh.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/rsaenh/tests/rsaenh.c b/dlls/rsaenh/tests/rsaenh.c index 4fabaad59f3..467551e43d0 100644 --- a/dlls/rsaenh/tests/rsaenh.c +++ b/dlls/rsaenh/tests/rsaenh.c @@ -894,6 +894,9 @@ static void test_des(void) static const BYTE des[16] = { 0x58, 0x86, 0x42, 0x46, 0x65, 0x4b, 0x92, 0x62, 0xcf, 0x0f, 0x65, 0x37, 0x43, 0x7a, 0x82, 0xb9 }; + static const BYTE des_old_behavior[16] = { + 0xb0, 0xfd, 0x11, 0x69, 0x76, 0xb1, 0xa1, 0x03, + 0xf7, 0xbc, 0x23, 0xaa, 0xd4, 0xc1, 0xc9, 0x55 }; int i; result = derive_key(CALG_DES, &hKey, 0); @@ -981,6 +984,25 @@ static void test_des(void) result = CryptDestroyKey(hKey); ok(result, "%08x\n", GetLastError()); + + /* Windows >= XP changed the way DES keys are derived, this test ensures we don't break that */ + derive_key(CALG_DES, &hKey, 56); + + dwMode = CRYPT_MODE_ECB; + result = CryptSetKeyParam(hKey, KP_MODE, (BYTE*)&dwMode, 0); + ok(result, "%08x\n", GetLastError()); + + for (i=0; i