Commit 78a5d660 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

rsaenh: Use bcrypt for SHA384 hashes.

parent 6aa5fdf9
......@@ -75,7 +75,7 @@ BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext)
break;
case CALG_SHA_384:
SHA384_Init(&pHashContext->sha384);
algid = BCRYPT_SHA384_ALGORITHM;
break;
case CALG_SHA_512:
......@@ -123,10 +123,6 @@ BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, const BYTE *pb
SHA256_Update(&pHashContext->sha256, pbData, dwDataLen);
break;
case CALG_SHA_384:
SHA384_Update(&pHashContext->sha384, pbData, dwDataLen);
break;
default:
BCryptHashData(pHashContext->bcrypt_hash, (UCHAR*)pbData, dwDataLen, 0);
}
......@@ -160,10 +156,6 @@ BOOL finalize_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, BYTE *pbHash
SHA256_Final(pbHashValue, &pHashContext->sha256);
break;
case CALG_SHA_384:
SHA384_Final(pbHashValue, &pHashContext->sha384);
break;
default:
BCryptFinishHash(pHashContext->bcrypt_hash, pbHashValue, RSAENH_MAX_HASH_SIZE, 0);
BCryptDestroyHash(pHashContext->bcrypt_hash);
......
......@@ -62,7 +62,6 @@ typedef union tagHASH_CONTEXT {
MD5_CTX md5;
SHA_CTX sha;
SHA256_CTX sha256;
SHA384_CTX sha384;
BCRYPT_HASH_HANDLE bcrypt_hash;
} HASH_CONTEXT;
......
......@@ -39,12 +39,6 @@
#define SHA256_BLOCK_LENGTH 64
#define SHA256_DIGEST_LENGTH 32
#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
#define SHA384_BLOCK_LENGTH 128
#define SHA384_DIGEST_LENGTH 48
#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
#define SHA512_BLOCK_LENGTH 128
#define SHA512_DIGEST_LENGTH 64
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
/*** SHA-256/384/512 Context Structures *******************************/
......@@ -57,13 +51,6 @@ typedef struct _SHA256_CTX {
sha2_word64 bitcount;
sha2_byte buffer[SHA256_BLOCK_LENGTH];
} SHA256_CTX;
typedef struct _SHA512_CTX {
sha2_word64 state[8];
sha2_word64 bitcount[2];
sha2_byte buffer[SHA512_BLOCK_LENGTH];
} SHA512_CTX;
typedef SHA512_CTX SHA384_CTX;
/*** SHA-256/384/512 Function Prototypes ******************************/
......@@ -74,10 +61,4 @@ void SHA256_Final(sha2_byte[SHA256_DIGEST_LENGTH], SHA256_CTX*);
char* SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]);
char* SHA256_Data(const sha2_byte*, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
void SHA384_Init(SHA384_CTX*);
void SHA384_Update(SHA384_CTX*, const sha2_byte*, size_t);
void SHA384_Final(sha2_byte[SHA384_DIGEST_LENGTH], SHA384_CTX*);
char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]);
char* SHA384_Data(const sha2_byte*, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
#endif /* __SHA2_H__ */
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