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
d5688169
Commit
d5688169
authored
Oct 09, 2020
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dssenh: Implement CPHashData.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e7a79ce4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
13 deletions
+21
-13
main.c
dlls/dssenh/main.c
+9
-1
dssenh.c
dlls/dssenh/tests/dssenh.c
+12
-12
No files found.
dlls/dssenh/main.c
View file @
d5688169
/*
* Copyright 2008 Maarten Lankhorst
* Copyright 2020 Hans Leidekker for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -418,7 +419,14 @@ BOOL WINAPI CPDestroyHash( HCRYPTPROV hprov, HCRYPTHASH hhash )
BOOL
WINAPI
CPHashData
(
HCRYPTPROV
hprov
,
HCRYPTHASH
hhash
,
const
BYTE
*
data
,
DWORD
len
,
DWORD
flags
)
{
return
FALSE
;
struct
hash
*
hash
=
(
struct
hash
*
)
hhash
;
TRACE
(
"%p, %p, %p, %u, %08x
\n
"
,
(
void
*
)
hprov
,
(
void
*
)
hhash
,
data
,
len
,
flags
);
if
(
hash
->
magic
!=
MAGIC_HASH
)
return
FALSE
;
if
(
hash
->
finished
||
BCryptHashData
(
hash
->
handle
,
(
UCHAR
*
)
data
,
len
,
0
))
return
FALSE
;
return
TRUE
;
}
BOOL
WINAPI
CPGetHashParam
(
HCRYPTPROV
hprov
,
HCRYPTHASH
hhash
,
DWORD
param
,
BYTE
*
data
,
DWORD
*
len
,
DWORD
flags
)
...
...
dlls/dssenh/tests/dssenh.c
View file @
d5688169
...
...
@@ -449,15 +449,15 @@ static void test_hash(const struct hash_test *tests, int testLen)
ok
(
result
,
"Expected creation of a hash.
\n
"
);
result
=
CryptHashData
(
hHash
,
data
,
dataLen
,
0
);
ok
(
result
,
"Expected data to be added to hash.
\n
"
);
dataLen
=
sizeof
(
DWORD
);
result
=
CryptGetHashParam
(
hHash
,
HP_HASHSIZE
,
(
BYTE
*
)
&
hashLen
,
&
dataLen
,
0
);
if
(
!
result
)
{
skip
(
"skipping hash tests
\n
"
);
return
;
}
ok
(
result
,
"Expected data to be added to hash.
\n
"
);
dataLen
=
sizeof
(
DWORD
);
result
=
CryptGetHashParam
(
hHash
,
HP_HASHSIZE
,
(
BYTE
*
)
&
hashLen
,
&
dataLen
,
0
);
ok
(
result
&&
(
hashLen
==
tests
[
i
].
hashLen
),
"Expected %d hash len, got %d.Error: %x
\n
"
,
tests
[
i
].
hashLen
,
hashLen
,
GetLastError
());
...
...
@@ -608,15 +608,15 @@ static void test_data_encryption(const struct encrypt_test *tests, int testLen)
ok
(
result
,
"Expected creation of a MD5 hash for key derivation.
\n
"
);
result
=
CryptHashData
(
hHash
,
(
BYTE
*
)
dataToHash
,
sizeof
(
dataToHash
),
0
);
ok
(
result
,
"Expected data to be added to hash for key derivation.
\n
"
);
/* Derive key */
result
=
CryptDeriveKey
(
hProv
,
tests
[
i
].
algid
,
hHash
,
tests
[
i
].
keyLength
,
&
pKey
);
if
(
!
result
)
{
skip
(
"skipping encryption tests
\n
"
);
return
;
}
ok
(
result
,
"Expected data to be added to hash for key derivation.
\n
"
);
/* Derive key */
result
=
CryptDeriveKey
(
hProv
,
tests
[
i
].
algid
,
hHash
,
tests
[
i
].
keyLength
,
&
pKey
);
ok
(
result
,
"Expected a derived key.
\n
"
);
result
=
CryptDestroyHash
(
hHash
);
...
...
@@ -698,15 +698,15 @@ static void test_cipher_modes(const struct ciphermode_test *tests, int testLen)
ok
(
result
,
"Expected creation of a MD5 hash for key derivation.
\n
"
);
result
=
CryptHashData
(
hHash
,
(
BYTE
*
)
dataToHash
,
sizeof
(
dataToHash
),
0
);
ok
(
result
,
"Expected data to be added to hash for key derivation.
\n
"
);
/* Derive a CALG_RC2 key, but could be any other encryption cipher */
result
=
CryptDeriveKey
(
hProv
,
CALG_RC2
,
hHash
,
40
<<
16
,
&
pKey
);
if
(
!
result
)
{
skip
(
"skipping ciper modes tests
\n
"
);
return
;
}
ok
(
result
,
"Expected data to be added to hash for key derivation.
\n
"
);
/* Derive a CALG_RC2 key, but could be any other encryption cipher */
result
=
CryptDeriveKey
(
hProv
,
CALG_RC2
,
hHash
,
40
<<
16
,
&
pKey
);
ok
(
result
,
"Expected a derived key.
\n
"
);
result
=
CryptDestroyHash
(
hHash
);
...
...
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