Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
fc90d2bd
Commit
fc90d2bd
authored
Nov 15, 2007
by
Vijay Kiran Kamuju
Committed by
Alexandre Julliard
Nov 16, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsaenh: Add a few more tests which check the decryption strings.
parent
c698052b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
0 deletions
+93
-0
rsaenh.c
dlls/rsaenh/tests/rsaenh.c
+93
-0
No files found.
dlls/rsaenh/tests/rsaenh.c
View file @
fc90d2bd
...
@@ -31,6 +31,38 @@ static const char szContainer[] = "winetest";
...
@@ -31,6 +31,38 @@ static const char szContainer[] = "winetest";
static
const
unsigned
char
pbData
[]
=
"Wine rocks totally!"
;
static
const
unsigned
char
pbData
[]
=
"Wine rocks totally!"
;
static
const
char
szProvider
[]
=
MS_ENHANCED_PROV_A
;
static
const
char
szProvider
[]
=
MS_ENHANCED_PROV_A
;
typedef
struct
_ctdatatype
{
unsigned
char
origstr
[
32
];
unsigned
char
decstr
[
32
];
int
strlen
;
int
enclen
;
int
buflen
;
}
cryptdata
;
static
const
cryptdata
cTestData
[
4
]
=
{
{
"abcdefghijkl"
,
{
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
0x2
,
0x2
,
'k'
,
'l'
,
0
},
12
,
8
,
16
},
{
"abcdefghij"
,
{
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
0x2
,
0x2
,
0
},
10
,
8
,
16
},
{
"abcdefgh"
,
{
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
0
},
8
,
8
,
16
},
{
"abcdefghijkl"
,
{
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
0
},
12
,
12
,
16
}
};
static
void
printBytes
(
const
char
*
heading
,
BYTE
*
pb
,
size_t
cb
)
{
size_t
i
;
printf
(
"%s: "
,
heading
);
for
(
i
=
0
;
i
<
cb
;
i
++
)
printf
(
"0x%02x,"
,
pb
[
i
]);
putchar
(
'\n'
);
}
static
BOOL
(
WINAPI
*
pCryptDuplicateHash
)
(
HCRYPTHASH
,
DWORD
*
,
DWORD
,
HCRYPTHASH
*
);
static
BOOL
(
WINAPI
*
pCryptDuplicateHash
)
(
HCRYPTHASH
,
DWORD
*
,
DWORD
,
HCRYPTHASH
*
);
/*
/*
...
@@ -424,6 +456,26 @@ static void test_3des112(void)
...
@@ -424,6 +456,26 @@ static void test_3des112(void)
result
=
CryptDecrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
);
result
=
CryptDecrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
for
(
i
=
0
;
i
<
4
;
i
++
)
{
memcpy
(
pbData
,
cTestData
[
i
].
origstr
,
cTestData
[
i
].
strlen
);
dwLen
=
cTestData
[
i
].
enclen
;
result
=
CryptEncrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
,
cTestData
[
i
].
buflen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
dwLen
==
cTestData
[
i
].
buflen
,
"length incorrect, got %d, expected %d
\n
"
,
dwLen
,
cTestData
[
i
].
buflen
);
result
=
CryptDecrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
dwLen
==
cTestData
[
i
].
enclen
,
"length incorrect, got %d, expected %d
\n
"
,
dwLen
,
cTestData
[
i
].
enclen
);
ok
(
memcmp
(
pbData
,
cTestData
[
i
].
decstr
,
cTestData
[
1
].
enclen
)
==
0
,
"decryption incorrect %d
\n
"
,
i
);
if
((
dwLen
!=
cTestData
[
i
].
enclen
)
||
memcmp
(
pbData
,
cTestData
[
i
].
decstr
,
cTestData
[
i
].
enclen
))
{
printBytes
(
"expected"
,
cTestData
[
i
].
decstr
,
cTestData
[
i
].
strlen
);
printBytes
(
"got"
,
pbData
,
dwLen
);
}
}
result
=
CryptDestroyKey
(
hKey
);
result
=
CryptDestroyKey
(
hKey
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
}
}
...
@@ -460,6 +512,27 @@ static void test_des(void)
...
@@ -460,6 +512,27 @@ static void test_des(void)
result
=
CryptDecrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
);
result
=
CryptDecrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
for
(
i
=
0
;
i
<
4
;
i
++
)
{
memcpy
(
pbData
,
cTestData
[
i
].
origstr
,
cTestData
[
i
].
strlen
);
dwLen
=
cTestData
[
i
].
enclen
;
result
=
CryptEncrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
,
cTestData
[
i
].
buflen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
dwLen
==
cTestData
[
i
].
buflen
,
"length incorrect, got %d, expected %d
\n
"
,
dwLen
,
cTestData
[
i
].
buflen
);
result
=
CryptDecrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
dwLen
==
cTestData
[
i
].
enclen
,
"length incorrect, got %d, expected %d
\n
"
,
dwLen
,
cTestData
[
i
].
enclen
);
ok
(
memcmp
(
pbData
,
cTestData
[
i
].
decstr
,
cTestData
[
i
].
enclen
)
==
0
,
"decryption incorrect %d
\n
"
,
i
);
if
((
dwLen
!=
cTestData
[
i
].
enclen
)
||
memcmp
(
pbData
,
cTestData
[
i
].
decstr
,
cTestData
[
i
].
enclen
))
{
printBytes
(
"expected"
,
cTestData
[
i
].
decstr
,
cTestData
[
i
].
strlen
);
printBytes
(
"got"
,
pbData
,
dwLen
);
}
}
result
=
CryptDestroyKey
(
hKey
);
result
=
CryptDestroyKey
(
hKey
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
}
}
...
@@ -489,6 +562,26 @@ static void test_3des(void)
...
@@ -489,6 +562,26 @@ static void test_3des(void)
result
=
CryptDecrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
);
result
=
CryptDecrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
for
(
i
=
0
;
i
<
4
;
i
++
)
{
memcpy
(
pbData
,
cTestData
[
i
].
origstr
,
cTestData
[
i
].
strlen
);
dwLen
=
cTestData
[
i
].
enclen
;
result
=
CryptEncrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
,
cTestData
[
i
].
buflen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
dwLen
==
cTestData
[
i
].
buflen
,
"length incorrect, got %d, expected %d
\n
"
,
dwLen
,
cTestData
[
i
].
buflen
);
result
=
CryptDecrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwLen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
dwLen
==
cTestData
[
i
].
enclen
,
"length incorrect, got %d, expected %d
\n
"
,
dwLen
,
cTestData
[
i
].
enclen
);
ok
(
memcmp
(
pbData
,
cTestData
[
i
].
decstr
,
cTestData
[
i
].
enclen
)
==
0
,
"decryption incorrect %d
\n
"
,
i
);
if
((
dwLen
!=
cTestData
[
i
].
enclen
)
||
memcmp
(
pbData
,
cTestData
[
i
].
decstr
,
cTestData
[
i
].
enclen
))
{
printBytes
(
"expected"
,
cTestData
[
i
].
decstr
,
cTestData
[
i
].
strlen
);
printBytes
(
"got"
,
pbData
,
dwLen
);
}
}
result
=
CryptDestroyKey
(
hKey
);
result
=
CryptDestroyKey
(
hKey
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment