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
e73d4e55
Commit
e73d4e55
authored
Dec 07, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Added support for MD4 hashes.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b0329620
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
0 deletions
+35
-0
bcrypt_internal.h
dlls/bcrypt/bcrypt_internal.h
+11
-0
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+17
-0
bcrypt.c
dlls/bcrypt/tests/bcrypt.c
+6
-0
bcrypt.h
include/bcrypt.h
+1
-0
No files found.
dlls/bcrypt/bcrypt_internal.h
View file @
e73d4e55
...
...
@@ -61,6 +61,17 @@ void md2_update(MD2_CTX *ctx, const unsigned char *buf, ULONG len) DECLSPEC_HIDD
void
md2_finalize
(
MD2_CTX
*
ctx
,
unsigned
char
*
hash
)
DECLSPEC_HIDDEN
;
/* Definitions from advapi32 */
typedef
struct
tagMD4_CTX
{
unsigned
int
buf
[
4
];
unsigned
int
i
[
2
];
unsigned
char
in
[
64
];
unsigned
char
digest
[
16
];
}
MD4_CTX
;
VOID
WINAPI
MD4Init
(
MD4_CTX
*
ctx
);
VOID
WINAPI
MD4Update
(
MD4_CTX
*
ctx
,
const
unsigned
char
*
buf
,
unsigned
int
len
);
VOID
WINAPI
MD4Final
(
MD4_CTX
*
ctx
);
typedef
struct
{
unsigned
int
i
[
2
];
...
...
dlls/bcrypt/bcrypt_main.c
View file @
e73d4e55
...
...
@@ -146,6 +146,7 @@ enum alg_id
{
ALG_ID_AES
,
ALG_ID_MD2
,
ALG_ID_MD4
,
ALG_ID_MD5
,
ALG_ID_RNG
,
ALG_ID_SHA1
,
...
...
@@ -165,6 +166,7 @@ static const struct {
}
alg_props
[]
=
{
/* ALG_ID_AES */
{
654
,
0
,
0
,
BCRYPT_AES_ALGORITHM
},
/* ALG_ID_MD2 */
{
270
,
16
,
128
,
BCRYPT_MD2_ALGORITHM
},
/* ALG_ID_MD4 */
{
270
,
16
,
512
,
BCRYPT_MD4_ALGORITHM
},
/* ALG_ID_MD5 */
{
274
,
16
,
512
,
BCRYPT_MD5_ALGORITHM
},
/* ALG_ID_RNG */
{
0
,
0
,
0
,
BCRYPT_RNG_ALGORITHM
},
/* ALG_ID_SHA1 */
{
278
,
20
,
512
,
BCRYPT_SHA1_ALGORITHM
},
...
...
@@ -238,6 +240,7 @@ NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR
if
(
!
strcmpW
(
id
,
BCRYPT_AES_ALGORITHM
))
alg_id
=
ALG_ID_AES
;
else
if
(
!
strcmpW
(
id
,
BCRYPT_MD2_ALGORITHM
))
alg_id
=
ALG_ID_MD2
;
else
if
(
!
strcmpW
(
id
,
BCRYPT_MD4_ALGORITHM
))
alg_id
=
ALG_ID_MD4
;
else
if
(
!
strcmpW
(
id
,
BCRYPT_MD5_ALGORITHM
))
alg_id
=
ALG_ID_MD5
;
else
if
(
!
strcmpW
(
id
,
BCRYPT_RNG_ALGORITHM
))
alg_id
=
ALG_ID_RNG
;
else
if
(
!
strcmpW
(
id
,
BCRYPT_SHA1_ALGORITHM
))
alg_id
=
ALG_ID_SHA1
;
...
...
@@ -291,6 +294,7 @@ struct hash_impl
union
{
MD2_CTX
md2
;
MD4_CTX
md4
;
MD5_CTX
md5
;
SHA_CTX
sha1
;
SHA256_CTX
sha256
;
...
...
@@ -306,6 +310,10 @@ static NTSTATUS hash_init( struct hash_impl *hash, enum alg_id alg_id )
md2_init
(
&
hash
->
u
.
md2
);
break
;
case
ALG_ID_MD4
:
MD4Init
(
&
hash
->
u
.
md4
);
break
;
case
ALG_ID_MD5
:
MD5Init
(
&
hash
->
u
.
md5
);
break
;
...
...
@@ -342,6 +350,10 @@ static NTSTATUS hash_update( struct hash_impl *hash, enum alg_id alg_id,
md2_update
(
&
hash
->
u
.
md2
,
input
,
size
);
break
;
case
ALG_ID_MD4
:
MD4Update
(
&
hash
->
u
.
md4
,
input
,
size
);
break
;
case
ALG_ID_MD5
:
MD5Update
(
&
hash
->
u
.
md5
,
input
,
size
);
break
;
...
...
@@ -378,6 +390,11 @@ static NTSTATUS hash_finish( struct hash_impl *hash, enum alg_id alg_id,
md2_finalize
(
&
hash
->
u
.
md2
,
output
);
break
;
case
ALG_ID_MD4
:
MD4Final
(
&
hash
->
u
.
md4
);
memcpy
(
output
,
hash
->
u
.
md4
.
digest
,
16
);
break
;
case
ALG_ID_MD5
:
MD5Final
(
&
hash
->
u
.
md5
);
memcpy
(
output
,
hash
->
u
.
md5
.
digest
,
16
);
...
...
dlls/bcrypt/tests/bcrypt.c
View file @
e73d4e55
...
...
@@ -329,6 +329,12 @@ static void test_hashes(void)
"7f05b0638d77f4a27f3a9c4d353cd648"
},
{
"MD4"
,
16
,
"74b5db93c0b41e36ca7074338fc0b637"
,
"bc2e8ac4d8248ed21b8d26227a30ea3a"
},
{
"MD5"
,
16
,
"e2a3e68d23ce348b8f68b3079de3d4c9"
,
...
...
include/bcrypt.h
View file @
e73d4e55
...
...
@@ -65,6 +65,7 @@ typedef LONG NTSTATUS;
#define BCRYPT_AES_ALGORITHM (const WCHAR []){'A','E','S',0}
#define BCRYPT_MD2_ALGORITHM (const WCHAR []){'M','D','2',0}
#define BCRYPT_MD4_ALGORITHM (const WCHAR []){'M','D','4',0}
#define BCRYPT_MD5_ALGORITHM (const WCHAR []){'M','D','5',0}
#define BCRYPT_RNG_ALGORITHM (const WCHAR []){'R','N','G',0}
#define BCRYPT_SHA1_ALGORITHM (const WCHAR []){'S','H','A','1',0}
...
...
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