X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=CryptoPkg%2FLibrary%2FBaseCryptLib%2FHash%2FCryptMd4.c;h=d9cc4455a883567fd9008d81291fb5c1fd30d8f8;hb=b7d1ba0a8ae9719689ad9725e02e4cb5d469a3ae;hp=633d34379032b5c9ad9537e6d709bf2e4813bb66;hpb=90a40219673303f97890d5ea2e367ee2dc04a0b3;p=mirror_edk2.git diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4.c index 633d343790..d9cc4455a8 100644 --- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4.c +++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4.c @@ -1,7 +1,7 @@ /** @file MD4 Digest Wrapper Implementation over OpenSSL. -Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -181,3 +181,49 @@ Md4Final ( // return (BOOLEAN) (MD4_Final (HashValue, (MD4_CTX *) Md4Context)); } + +/** + Computes the MD4 message digest of a input data buffer. + + This function performs the MD4 message digest of a given data buffer, and places + the digest value into the specified memory. + + If this interface is not supported, then return FALSE. + + @param[in] Data Pointer to the buffer containing the data to be hashed. + @param[in] DataSize Size of Data buffer in bytes. + @param[out] HashValue Pointer to a buffer that receives the MD4 digest + value (16 bytes). + + @retval TRUE MD4 digest computation succeeded. + @retval FALSE MD4 digest computation failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Md4HashAll ( + IN CONST VOID *Data, + IN UINTN DataSize, + OUT UINT8 *HashValue + ) +{ + // + // Check input parameters. + // + if (HashValue == NULL) { + return FALSE; + } + if (Data == NULL && DataSize != 0) { + return FALSE; + } + + // + // OpenSSL MD4 Hash Computation. + // + if (MD4 (Data, DataSize, HashValue) == NULL) { + return FALSE; + } else { + return TRUE; + } +}