Commit 2b7fcef8 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

rsaenh: Use bcrypt for MD4 hashes.

parent e73d4e55
...@@ -33,10 +33,6 @@ ...@@ -33,10 +33,6 @@
#include <stdio.h> #include <stdio.h>
/* Function prototypes copied from dlls/advapi32/crypt_md4.c */
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 );
/* Function prototypes copied from dlls/advapi32/crypt_md5.c */ /* Function prototypes copied from dlls/advapi32/crypt_md5.c */
VOID WINAPI MD5Init( MD5_CTX *ctx ); VOID WINAPI MD5Init( MD5_CTX *ctx );
VOID WINAPI MD5Update( MD5_CTX *ctx, const unsigned char *buf, unsigned int len ); VOID WINAPI MD5Update( MD5_CTX *ctx, const unsigned char *buf, unsigned int len );
...@@ -56,8 +52,8 @@ BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext) ...@@ -56,8 +52,8 @@ BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext)
break; break;
case CALG_MD4: case CALG_MD4:
MD4Init(&pHashContext->md4); status = BCryptOpenAlgorithmProvider(&provider, BCRYPT_MD4_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
return TRUE; break;
case CALG_MD5: case CALG_MD5:
MD5Init(&pHashContext->md5); MD5Init(&pHashContext->md5);
...@@ -95,10 +91,6 @@ BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, const BYTE *pb ...@@ -95,10 +91,6 @@ BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, const BYTE *pb
{ {
switch (aiAlgid) switch (aiAlgid)
{ {
case CALG_MD4:
MD4Update(&pHashContext->md4, pbData, dwDataLen);
break;
case CALG_MD5: case CALG_MD5:
MD5Update(&pHashContext->md5, pbData, dwDataLen); MD5Update(&pHashContext->md5, pbData, dwDataLen);
break; break;
...@@ -114,11 +106,6 @@ BOOL finalize_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, BYTE *pbHash ...@@ -114,11 +106,6 @@ BOOL finalize_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, BYTE *pbHash
{ {
switch (aiAlgid) switch (aiAlgid)
{ {
case CALG_MD4:
MD4Final(&pHashContext->md4);
memcpy(pbHashValue, pHashContext->md4.digest, 16);
break;
case CALG_MD5: case CALG_MD5:
MD5Final(&pHashContext->md5); MD5Final(&pHashContext->md5);
memcpy(pbHashValue, pHashContext->md5.digest, 16); memcpy(pbHashValue, pHashContext->md5.digest, 16);
...@@ -138,7 +125,6 @@ BOOL duplicate_hash_impl(ALG_ID aiAlgid, const HASH_CONTEXT *pSrcHashContext, ...@@ -138,7 +125,6 @@ BOOL duplicate_hash_impl(ALG_ID aiAlgid, const HASH_CONTEXT *pSrcHashContext,
{ {
switch (aiAlgid) switch (aiAlgid)
{ {
case CALG_MD4:
case CALG_MD5: case CALG_MD5:
*pDestHashContext = *pSrcHashContext; *pDestHashContext = *pSrcHashContext;
return TRUE; return TRUE;
......
...@@ -29,14 +29,6 @@ ...@@ -29,14 +29,6 @@
#define RSAENH_MAX_HASH_SIZE 104 #define RSAENH_MAX_HASH_SIZE 104
/* Next typedef copied from dlls/advapi32/crypt_md4.c */
typedef struct tagMD4_CTX {
unsigned int buf[4];
unsigned int i[2];
unsigned char in[64];
unsigned char digest[16];
} MD4_CTX;
/* Next typedef copied from dlls/advapi32/crypt_md5.c */ /* Next typedef copied from dlls/advapi32/crypt_md5.c */
typedef struct tagMD5_CTX typedef struct tagMD5_CTX
{ {
...@@ -47,7 +39,6 @@ typedef struct tagMD5_CTX ...@@ -47,7 +39,6 @@ typedef struct tagMD5_CTX
} MD5_CTX; } MD5_CTX;
typedef union tagHASH_CONTEXT { typedef union tagHASH_CONTEXT {
MD4_CTX md4;
MD5_CTX md5; MD5_CTX md5;
BCRYPT_HASH_HANDLE bcrypt_hash; BCRYPT_HASH_HANDLE bcrypt_hash;
} HASH_CONTEXT; } HASH_CONTEXT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment