Module: wine Branch: master Commit: c579945b98e86ad7dc7dbd4ae17a867d229cd6de URL: http://source.winehq.org/git/wine.git/?a=commit;h=c579945b98e86ad7dc7dbd4ae1...
Author: Bruno Jesus 00cpxxx@gmail.com Date: Sat Jul 12 13:11:30 2014 -0300
rsaenh/tests: Add DES/3DES-112 const buffer test.
---
dlls/rsaenh/tests/rsaenh.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/rsaenh/tests/rsaenh.c b/dlls/rsaenh/tests/rsaenh.c index c90bc79..4fabaad 100644 --- a/dlls/rsaenh/tests/rsaenh.c +++ b/dlls/rsaenh/tests/rsaenh.c @@ -802,6 +802,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); @@ -817,6 +820,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());
@@ -886,9 +891,12 @@ 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); + result = derive_key(CALG_DES, &hKey, 0); if (!result) { /* rsaenh compiled without OpenSSL */ ok(GetLastError()==NTE_BAD_ALGID, "%08x\n", GetLastError()); @@ -909,6 +917,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());