From 68ab485e63f6b312dc529e0446d8ca93c94086ed Mon Sep 17 00:00:00 2001 From: Brent Collins Date: Mon, 10 Apr 2017 14:03:39 -0500 Subject: [PATCH] Fix logic error in reworked MD5 call for establishing keys, and fix some minor whitespace issues. --- libfreerdp/core/security.c | 2 +- winpr/libwinpr/crypto/hash.c | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/libfreerdp/core/security.c b/libfreerdp/core/security.c index 60d2ab8..cfd3863 100644 --- a/libfreerdp/core/security.c +++ b/libfreerdp/core/security.c @@ -156,7 +156,7 @@ static BOOL security_salted_hash(const BYTE* salt, const BYTE* input, int length /* Allow FIPS override for use of MD5 here, this is used for creating hashes of the premaster_secret and master_secret */ /* used for RDP licensing as described in MS-RDPELE. This is for RDP licensing packets */ /* which will already be encrypted under FIPS, so the use of MD5 here is not for sensitive data protection. */ - if (!winpr_Digest_Init_MD5_Allow_FIPS(WINPR_MD_MD5)) + if (!winpr_Digest_Init_MD5_Allow_FIPS(md5)) goto out; if (!winpr_Digest_Update(md5, salt, 48)) /* Salt (48 bytes) */ goto out; diff --git a/winpr/libwinpr/crypto/hash.c b/winpr/libwinpr/crypto/hash.c index 4f9b3ae..85def45 100644 --- a/winpr/libwinpr/crypto/hash.c +++ b/winpr/libwinpr/crypto/hash.c @@ -452,25 +452,24 @@ void winpr_Digest_Free(WINPR_DIGEST_CTX* ctx) BOOL winpr_Digest_MD5_Allow_FIPS(const BYTE* input, size_t ilen, BYTE* output, size_t olen) { BOOL result = FALSE; - WINPR_DIGEST_CTX *ctx = winpr_Digest_New(); + WINPR_DIGEST_CTX *ctx = winpr_Digest_New(); if (!ctx) - return FALSE; + return FALSE; if (!winpr_Digest_Init_MD5_Allow_FIPS(ctx)) - goto out; - if (!winpr_Digest_Update(ctx, input, ilen)) - goto out; - if (!winpr_Digest_Final(ctx, output, olen)) - goto out; + goto out; + if (!winpr_Digest_Update(ctx, input, ilen)) + goto out; + if (!winpr_Digest_Final(ctx, output, olen)) + goto out; - result = TRUE; + result = TRUE; out: - winpr_Digest_Free(ctx); - return result; - - + winpr_Digest_Free(ctx); + return result; } + BOOL winpr_Digest(int md, const BYTE* input, size_t ilen, BYTE* output, size_t olen) { BOOL result = FALSE; -- 2.7.4