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
3e855644
Commit
3e855644
authored
Dec 07, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsaenh: Use bcrypt for MD5 hashes.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2b7fcef8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
47 deletions
+6
-47
implglue.c
dlls/rsaenh/implglue.c
+6
-37
implglue.h
dlls/rsaenh/implglue.h
+0
-10
No files found.
dlls/rsaenh/implglue.c
View file @
3e855644
...
...
@@ -33,10 +33,6 @@
#include <stdio.h>
/* Function prototypes copied from dlls/advapi32/crypt_md5.c */
VOID
WINAPI
MD5Init
(
MD5_CTX
*
ctx
);
VOID
WINAPI
MD5Update
(
MD5_CTX
*
ctx
,
const
unsigned
char
*
buf
,
unsigned
int
len
);
VOID
WINAPI
MD5Final
(
MD5_CTX
*
ctx
);
/* Function prototype copied from dlls/advapi32/crypt.c */
BOOL
WINAPI
SystemFunction036
(
PVOID
pbBuffer
,
ULONG
dwLen
);
...
...
@@ -56,8 +52,8 @@ BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext)
break
;
case
CALG_MD5
:
MD5Init
(
&
pHashContext
->
md5
);
return
TRUE
;
status
=
BCryptOpenAlgorithmProvider
(
&
provider
,
BCRYPT_MD5_ALGORITHM
,
MS_PRIMITIVE_PROVIDER
,
0
);
break
;
case
CALG_SHA
:
status
=
BCryptOpenAlgorithmProvider
(
&
provider
,
BCRYPT_SHA1_ALGORITHM
,
MS_PRIMITIVE_PROVIDER
,
0
);
...
...
@@ -89,48 +85,21 @@ BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext)
BOOL
update_hash_impl
(
ALG_ID
aiAlgid
,
HASH_CONTEXT
*
pHashContext
,
const
BYTE
*
pbData
,
DWORD
dwDataLen
)
{
switch
(
aiAlgid
)
{
case
CALG_MD5
:
MD5Update
(
&
pHashContext
->
md5
,
pbData
,
dwDataLen
);
break
;
default:
BCryptHashData
(
pHashContext
->
bcrypt_hash
,
(
UCHAR
*
)
pbData
,
dwDataLen
,
0
);
}
BCryptHashData
(
pHashContext
->
bcrypt_hash
,
(
UCHAR
*
)
pbData
,
dwDataLen
,
0
);
return
TRUE
;
}
BOOL
finalize_hash_impl
(
ALG_ID
aiAlgid
,
HASH_CONTEXT
*
pHashContext
,
BYTE
*
pbHashValue
)
{
switch
(
aiAlgid
)
{
case
CALG_MD5
:
MD5Final
(
&
pHashContext
->
md5
);
memcpy
(
pbHashValue
,
pHashContext
->
md5
.
digest
,
16
);
break
;
default:
BCryptFinishHash
(
pHashContext
->
bcrypt_hash
,
pbHashValue
,
RSAENH_MAX_HASH_SIZE
,
0
);
BCryptDestroyHash
(
pHashContext
->
bcrypt_hash
);
break
;
}
BCryptFinishHash
(
pHashContext
->
bcrypt_hash
,
pbHashValue
,
RSAENH_MAX_HASH_SIZE
,
0
);
BCryptDestroyHash
(
pHashContext
->
bcrypt_hash
);
return
TRUE
;
}
BOOL
duplicate_hash_impl
(
ALG_ID
aiAlgid
,
const
HASH_CONTEXT
*
pSrcHashContext
,
HASH_CONTEXT
*
pDestHashContext
)
{
switch
(
aiAlgid
)
{
case
CALG_MD5
:
*
pDestHashContext
=
*
pSrcHashContext
;
return
TRUE
;
default:
return
!
BCryptDuplicateHash
(
pSrcHashContext
->
bcrypt_hash
,
&
pDestHashContext
->
bcrypt_hash
,
NULL
,
0
,
0
);
}
return
!
BCryptDuplicateHash
(
pSrcHashContext
->
bcrypt_hash
,
&
pDestHashContext
->
bcrypt_hash
,
NULL
,
0
,
0
);
}
BOOL
new_key_impl
(
ALG_ID
aiAlgid
,
KEY_CONTEXT
*
pKeyContext
,
DWORD
dwKeyLen
)
...
...
dlls/rsaenh/implglue.h
View file @
3e855644
...
...
@@ -29,17 +29,7 @@
#define RSAENH_MAX_HASH_SIZE 104
/* Next typedef copied from dlls/advapi32/crypt_md5.c */
typedef
struct
tagMD5_CTX
{
unsigned
int
i
[
2
];
unsigned
int
buf
[
4
];
unsigned
char
in
[
64
];
unsigned
char
digest
[
16
];
}
MD5_CTX
;
typedef
union
tagHASH_CONTEXT
{
MD5_CTX
md5
;
BCRYPT_HASH_HANDLE
bcrypt_hash
;
}
HASH_CONTEXT
;
...
...
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