diff options
author | qlong <qlong@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-12-31 07:22:48 +0000 |
---|---|---|
committer | qlong <qlong@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-12-31 07:22:48 +0000 |
commit | 4a567c9690db97ecbf982e9428727f073bada504 (patch) | |
tree | 92682c435813f60c29afd83ad98d04ebc24903ac /CryptoPkg/Application/Cryptest/HashVerify.c | |
parent | 2a6433fef2413df583db6399008c7e6716a8e243 (diff) | |
download | edk2-platforms-4a567c9690db97ecbf982e9428727f073bada504.tar.xz |
1. Add new API supports for PEM & X509 key retrieving & verification;
2. Add new MD4 hash supports;
3. Add corresponding test case in Cryptest utility;
4. Fix MACRO definition issue in OpensslLib.inf and parameter checking issues in some wrapper implementations.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11214 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'CryptoPkg/Application/Cryptest/HashVerify.c')
-rw-r--r-- | CryptoPkg/Application/Cryptest/HashVerify.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/CryptoPkg/Application/Cryptest/HashVerify.c b/CryptoPkg/Application/Cryptest/HashVerify.c index 1b218965ee..107ff45cc8 100644 --- a/CryptoPkg/Application/Cryptest/HashVerify.c +++ b/CryptoPkg/Application/Cryptest/HashVerify.c @@ -25,6 +25,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *HashData = "abc";
//
+// Result for MD4("abc"). (From "A.5 Test suite" of IETF RFC1320)
+//
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Md4Digest[MD4_DIGEST_SIZE] = {
+ 0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d
+ };
+
+//
// Result for MD5("abc"). (From "A.5 Test suite" of IETF RFC1321)
//
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Md5Digest[MD5_DIGEST_SIZE] = {
@@ -68,6 +75,46 @@ ValidateCryptDigest ( Print (L" UEFI-OpenSSL Hash Engine Testing:\n");
DataSize = AsciiStrLen (HashData);
+ Print (L"- MD4: ");
+
+ //
+ // MD4 Digest Validation
+ //
+ ZeroMem (Digest, MAX_DIGEST_SIZE);
+ CtxSize = Md4GetContextSize ();
+ HashCtx = AllocatePool (CtxSize);
+
+ Print (L"Init... ");
+ Status = Md4Init (HashCtx);
+ if (!Status) {
+ Print (L"[Fail]");
+ return EFI_ABORTED;
+ }
+
+ Print (L"Update... ");
+ Status = Md4Update (HashCtx, HashData, DataSize);
+ if (!Status) {
+ Print (L"[Fail]");
+ return EFI_ABORTED;
+ }
+
+ Print (L"Finalize... ");
+ Status = Md4Final (HashCtx, Digest);
+ if (!Status) {
+ Print (L"[Fail]");
+ return EFI_ABORTED;
+ }
+
+ FreePool (HashCtx);
+
+ Print (L"Check Value... ");
+ if (CompareMem (Digest, Md4Digest, MD5_DIGEST_SIZE) != 0) {
+ Print (L"[Fail]");
+ return EFI_ABORTED;
+ }
+
+ Print (L"[Pass]\n");
+
Print (L"- MD5: ");
//
|