Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
cd3954e7
Commit
cd3954e7
authored
17 years ago
by
Juan Lang
Committed by
Alexandre Julliard
17 years ago
Browse files
Options
Downloads
Patches
Plain Diff
rsaenh: Get rid of the hash idle state, native doesn't behave as though it has one.
parent
8d051c81
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/rsaenh/rsaenh.c
+1
-10
1 addition, 10 deletions
dlls/rsaenh/rsaenh.c
dlls/rsaenh/tests/rsaenh.c
+36
-3
36 additions, 3 deletions
dlls/rsaenh/tests/rsaenh.c
with
37 additions
and
13 deletions
dlls/rsaenh/rsaenh.c
+
1
−
10
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
);
...
...
This diff is collapsed.
Click to expand it.
dlls/rsaenh/tests/rsaenh.c
+
36
−
3
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
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment