Fix logic error in reworked MD5 call for establishing keys, and fix some minor whitespace issues.

This commit is contained in:
Brent Collins 2017-04-10 14:03:39 -05:00 committed by Armin Novak
parent 7aa9e7a97f
commit 68ab485e63
2 changed files with 12 additions and 13 deletions

View File

@ -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;

View File

@ -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;