X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=CryptoPkg%2FApplication%2FCryptest%2FHashVerify.c;fp=CryptoPkg%2FApplication%2FCryptest%2FHashVerify.c;h=a35cad5b52775a1f973a38c3cc5f4b6514133ecd;hp=ca64361c3890a3eeafed0672af78e70a10c11942;hb=b7d1ba0a8ae9719689ad9725e02e4cb5d469a3ae;hpb=90a40219673303f97890d5ea2e367ee2dc04a0b3 diff --git a/CryptoPkg/Application/Cryptest/HashVerify.c b/CryptoPkg/Application/Cryptest/HashVerify.c index ca64361c38..a35cad5b52 100644 --- a/CryptoPkg/Application/Cryptest/HashVerify.c +++ b/CryptoPkg/Application/Cryptest/HashVerify.c @@ -1,7 +1,7 @@ /** @file Application for Hash Primitives Validation. -Copyright (c) 2010 - 2014, 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 @@ -127,7 +127,19 @@ ValidateCryptDigest ( FreePool (HashCtx); Print (L"Check Value... "); - if (CompareMem (Digest, Md4Digest, MD5_DIGEST_SIZE) != 0) { + if (CompareMem (Digest, Md4Digest, MD4_DIGEST_SIZE) != 0) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + + Print (L"HashAll... "); + ZeroMem (Digest, MD5_DIGEST_SIZE); + Status = Md4HashAll (HashData, DataSize, Digest); + if (!Status) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + if (CompareMem (Digest, Md4Digest, MD4_DIGEST_SIZE) != 0) { Print (L"[Fail]"); return EFI_ABORTED; } @@ -172,6 +184,18 @@ ValidateCryptDigest ( return EFI_ABORTED; } + Print (L"HashAll... "); + ZeroMem (Digest, MD5_DIGEST_SIZE); + Status = Md5HashAll (HashData, DataSize, Digest); + if (!Status) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + if (CompareMem (Digest, Md5Digest, MD5_DIGEST_SIZE) != 0) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + Print (L"[Pass]\n"); Print (L"- SHA1: "); @@ -212,6 +236,18 @@ ValidateCryptDigest ( return EFI_ABORTED; } + Print (L"HashAll... "); + ZeroMem (Digest, SHA1_DIGEST_SIZE); + Status = Sha1HashAll (HashData, DataSize, Digest); + if (!Status) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + if (CompareMem (Digest, Sha1Digest, SHA1_DIGEST_SIZE) != 0) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + Print (L"[Pass]\n"); Print (L"- SHA256: "); @@ -252,6 +288,18 @@ ValidateCryptDigest ( return EFI_ABORTED; } + Print (L"HashAll... "); + ZeroMem (Digest, SHA256_DIGEST_SIZE); + Status = Sha256HashAll (HashData, DataSize, Digest); + if (!Status) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + if (CompareMem (Digest, Sha256Digest, SHA256_DIGEST_SIZE) != 0) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + Print (L"[Pass]\n"); Print (L"- SHA384: "); @@ -292,6 +340,18 @@ ValidateCryptDigest ( return EFI_ABORTED; } + Print (L"HashAll... "); + ZeroMem (Digest, SHA384_DIGEST_SIZE); + Status = Sha384HashAll (HashData, DataSize, Digest); + if (!Status) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + if (CompareMem (Digest, Sha384Digest, SHA384_DIGEST_SIZE) != 0) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + Print (L"[Pass]\n"); Print (L"- SHA512: "); @@ -332,6 +392,18 @@ ValidateCryptDigest ( return EFI_ABORTED; } + Print (L"HashAll... "); + ZeroMem (Digest, SHA512_DIGEST_SIZE); + Status = Sha512HashAll (HashData, DataSize, Digest); + if (!Status) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + if (CompareMem (Digest, Sha512Digest, SHA512_DIGEST_SIZE) != 0) { + Print (L"[Fail]"); + return EFI_ABORTED; + } + Print (L"[Pass]\n"); return EFI_SUCCESS;