Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
cd3954e7
Commit
cd3954e7
authored
Jul 10, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Jul 11, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsaenh: Get rid of the hash idle state, native doesn't behave as though it has one.
parent
8d051c81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
13 deletions
+37
-13
rsaenh.c
dlls/rsaenh/rsaenh.c
+1
-10
rsaenh.c
dlls/rsaenh/tests/rsaenh.c
+36
-3
No files found.
dlls/rsaenh/rsaenh.c
View file @
cd3954e7
...
...
@@ -44,7 +44,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt);
*/
#define RSAENH_MAGIC_HASH 0x85938417u
#define RSAENH_MAX_HASH_SIZE 104
#define RSAENH_HASHSTATE_IDLE 0
#define RSAENH_HASHSTATE_HASHING 1
#define RSAENH_HASHSTATE_FINISHED 2
typedef
struct
_RSAENH_TLS1PRF_PARAMS
...
...
@@ -1598,7 +1597,7 @@ BOOL WINAPI RSAENH_CPCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
pCryptHash
->
aiAlgid
=
Algid
;
pCryptHash
->
hKey
=
hKey
;
pCryptHash
->
hProv
=
hProv
;
pCryptHash
->
dwState
=
RSAENH_HASHSTATE_
IDLE
;
pCryptHash
->
dwState
=
RSAENH_HASHSTATE_
HASHING
;
pCryptHash
->
pHMACInfo
=
(
PHMAC_INFO
)
NULL
;
pCryptHash
->
dwHashSize
=
peaAlgidInfo
->
dwDefaultLen
>>
3
;
init_data_blob
(
&
pCryptHash
->
tpPRFParams
.
blobLabel
);
...
...
@@ -2629,11 +2628,6 @@ BOOL WINAPI RSAENH_CPGetHashParam(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwPa
return
TRUE
;
}
if
(
pCryptHash
->
dwState
==
RSAENH_HASHSTATE_IDLE
)
{
SetLastError
(
NTE_BAD_HASH_STATE
);
return
FALSE
;
}
if
(
pbData
&&
(
pCryptHash
->
dwState
!=
RSAENH_HASHSTATE_FINISHED
))
{
finalize_hash
(
pCryptHash
);
...
...
@@ -3290,9 +3284,6 @@ BOOL WINAPI RSAENH_CPHashData(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pb
return
FALSE
;
}
if
(
pCryptHash
->
dwState
==
RSAENH_HASHSTATE_IDLE
)
pCryptHash
->
dwState
=
RSAENH_HASHSTATE_HASHING
;
if
(
pCryptHash
->
dwState
!=
RSAENH_HASHSTATE_HASHING
)
{
SetLastError
(
NTE_BAD_HASH_STATE
);
...
...
dlls/rsaenh/tests/rsaenh.c
View file @
cd3954e7
...
...
@@ -165,6 +165,9 @@ static void test_hashes(void)
static
const
unsigned
char
md4hash
[
16
]
=
{
0x8e
,
0x2a
,
0x58
,
0xbf
,
0xf2
,
0xf5
,
0x26
,
0x23
,
0x79
,
0xd2
,
0x92
,
0x36
,
0x1b
,
0x23
,
0xe3
,
0x81
};
static
const
unsigned
char
empty_md5hash
[
16
]
=
{
0xd4
,
0x1d
,
0x8c
,
0xd9
,
0x8f
,
0x00
,
0xb2
,
0x04
,
0xe9
,
0x80
,
0x09
,
0x98
,
0xec
,
0xf8
,
0x42
,
0x7e
};
static
const
unsigned
char
md5hash
[
16
]
=
{
0x15
,
0x76
,
0xa9
,
0x4d
,
0x6c
,
0xb3
,
0x34
,
0xdd
,
0x12
,
0x6c
,
0xb1
,
0xc2
,
0x7f
,
0x19
,
0xe0
,
0xf2
};
...
...
@@ -227,13 +230,13 @@ static void test_hashes(void)
result
=
CryptCreateHash
(
hProv
,
CALG_MD5
,
0
,
0
,
&
hHash
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
result
=
CryptHashData
(
hHash
,
(
BYTE
*
)
pbData
,
sizeof
(
pbData
),
0
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
len
=
sizeof
(
DWORD
);
result
=
CryptGetHashParam
(
hHash
,
HP_HASHSIZE
,
(
BYTE
*
)
&
hashlen
,
&
len
,
0
);
ok
(
result
&&
(
hashlen
==
16
),
"%08x, hashlen: %d
\n
"
,
GetLastError
(),
hashlen
);
result
=
CryptHashData
(
hHash
,
(
BYTE
*
)
pbData
,
sizeof
(
pbData
),
0
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
len
=
16
;
result
=
CryptGetHashParam
(
hHash
,
HP_HASHVAL
,
pbHashValue
,
&
len
,
0
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
...
...
@@ -243,6 +246,36 @@ static void test_hashes(void)
result
=
CryptDestroyHash
(
hHash
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
result
=
CryptCreateHash
(
hProv
,
CALG_MD5
,
0
,
0
,
&
hHash
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
/* The hash is available even if CryptHashData hasn't been called */
len
=
16
;
result
=
CryptGetHashParam
(
hHash
,
HP_HASHVAL
,
pbHashValue
,
&
len
,
0
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
!
memcmp
(
pbHashValue
,
empty_md5hash
,
16
),
"Wrong MD5 hash!
\n
"
);
/* It's also stable: getting it twice results in the same value */
result
=
CryptGetHashParam
(
hHash
,
HP_HASHVAL
,
pbHashValue
,
&
len
,
0
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
!
memcmp
(
pbHashValue
,
empty_md5hash
,
16
),
"Wrong MD5 hash!
\n
"
);
/* Can't add data after the hash been retrieved */
SetLastError
(
0xdeadbeef
);
result
=
CryptHashData
(
hHash
,
(
BYTE
*
)
pbData
,
sizeof
(
pbData
),
0
);
ok
(
!
result
&&
GetLastError
()
==
NTE_BAD_HASH_STATE
,
"%08x
\n
"
,
GetLastError
());
/* You can still retrieve the hash, its value just hasn't changed */
result
=
CryptGetHashParam
(
hHash
,
HP_HASHVAL
,
pbHashValue
,
&
len
,
0
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
!
memcmp
(
pbHashValue
,
empty_md5hash
,
16
),
"Wrong MD5 hash!
\n
"
);
result
=
CryptDestroyHash
(
hHash
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
/* SHA1 Hashing */
result
=
CryptCreateHash
(
hProv
,
CALG_SHA
,
0
,
0
,
&
hHash
);
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