/** @file
Application for HMAC Primitives Validation.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Cryptest.h"
//
// Max Known Digest Size is SHA512 Output (64 bytes) by far
//
//
// Data string for HMAC validation
//
//
// Key value for HMAC-MD5 validation. (From "2. Test Cases for HMAC-MD5" of IETF RFC2202)
//
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b
};
//
// Result for HMAC-MD5("Hi There"). (From "2. Test Cases for HMAC-MD5" of IETF RFC2202)
//
0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c, 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d
};
//
// Key value for HMAC-SHA-1 validation. (From "3. Test Cases for HMAC-SHA-1" of IETF RFC2202)
//
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b
};
//
// Result for HMAC-SHA-1 ("Hi There"). (From "3. Test Cases for HMAC-SHA-1" of IETF RFC2202)
//
0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e,
0xf1, 0x46, 0xbe, 0x00
};
/**
Validate UEFI-OpenSSL Message Authentication Codes Interfaces.
@retval EFI_SUCCESS Validation succeeded.
@retval EFI_ABORTED Validation failed.
**/
)
{
Print (L" \nUEFI-OpenSSL HMAC Engine Testing:\n");
Print (L"- HMAC-MD5: ");
//
// HMAC-MD5 Digest Validation
//
CtxSize = HmacMd5GetContextSize ();
Print (L"Init... ");
if (!Status) {
Print (L"[Fail]");
return EFI_ABORTED;
}
Print (L"Update... ");
if (!Status) {
Print (L"[Fail]");
return EFI_ABORTED;
}
Print (L"Finalize... ");
if (!Status) {
Print (L"[Fail]");
return EFI_ABORTED;
}
Print (L"Check Value... ");
Print (L"[Fail]");
return EFI_ABORTED;
}
Print (L"[Pass]\n");
Print (L"- HMAC-SHA1: ");
//
// HMAC-SHA1 Digest Validation
//
Print (L"Init... ");
if (!Status) {
Print (L"[Fail]");
return EFI_ABORTED;
}
Print (L"Update... ");
if (!Status) {
Print (L"[Fail]");
return EFI_ABORTED;
}
Print (L"Finalize... ");
if (!Status) {
Print (L"[Fail]");
return EFI_ABORTED;
}
Print (L"Check Value... ");
Print (L"[Fail]");
return EFI_ABORTED;
}
Print (L"[Pass]\n");
return EFI_SUCCESS;
}