From: Bruno Jesus <00cpxxx@gmail.com> Subject: rsaenh/tests: Add DES/3DES-112 const buffer test Message-Id: Date: Thu, 10 Jul 2014 23:40:11 -0300 While fixing bug http://bugs.winehq.org/show_bug.cgi?id=36765 I found an issue in CPDeriveKey, to ensure I don't make any mistake I'm adding tests to functions that didn't have const buffer tests. --- dlls/rsaenh/tests/rsaenh.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/rsaenh/tests/rsaenh.c b/dlls/rsaenh/tests/rsaenh.c index abc90e1..eed27fc 100644 --- a/dlls/rsaenh/tests/rsaenh.c +++ b/dlls/rsaenh/tests/rsaenh.c @@ -787,6 +787,9 @@ static void test_3des112(void) BOOL result; DWORD dwLen; unsigned char pbData[16], enc_data[16], bad_data[16]; + static const BYTE des112[16] = { + 0x8e, 0x0c, 0x3c, 0xa3, 0x05, 0x88, 0x5f, 0x7a, + 0x32, 0xa1, 0x06, 0x52, 0x64, 0xd2, 0x44, 0x1c }; int i; result = derive_key(CALG_3DES_112, &hKey, 0); @@ -802,6 +805,8 @@ static void test_3des112(void) result = CryptEncrypt(hKey, 0, TRUE, 0, pbData, &dwLen, 16); ok(result, "%08x\n", GetLastError()); + ok(!memcmp(pbData, des112, sizeof(des112)), "3DES_112 encryption failed!\n"); + result = CryptDecrypt(hKey, 0, TRUE, 0, pbData, &dwLen); ok(result, "%08x\n", GetLastError()); @@ -871,6 +876,9 @@ static void test_des(void) BOOL result; DWORD dwLen, dwMode; unsigned char pbData[16], enc_data[16], bad_data[16]; + static const BYTE des[16] = { + 0x58, 0x86, 0x42, 0x46, 0x65, 0x4b, 0x92, 0x62, + 0xcf, 0x0f, 0x65, 0x37, 0x43, 0x7a, 0x82, 0xb9 }; int i; result = derive_key(CALG_DES, &hKey, 56); @@ -894,6 +902,8 @@ static void test_des(void) result = CryptEncrypt(hKey, 0, TRUE, 0, pbData, &dwLen, 16); ok(result, "%08x\n", GetLastError()); + ok(!memcmp(pbData, des, sizeof(des)), "DES encryption failed!\n"); + result = CryptDecrypt(hKey, 0, TRUE, 0, pbData, &dwLen); ok(result, "%08x\n", GetLastError()); -- 1.8.3.2