2 Application for PKCS#5 PBKDF2 Function Validation.
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 // PBKDF2 HMAC-SHA1 Test Vector from RFC6070
20 GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8
*Password
= "password"; // Input Password
21 GLOBAL_REMOVE_IF_UNREFERENCED UINTN PassLen
= 8; // Length of Input Password
22 GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8
*Salt
= "salt"; // Input Salt
23 GLOBAL_REMOVE_IF_UNREFERENCED UINTN SaltLen
= 4; // Length of Input Salt
24 GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN Count
= 2; // InterationCount
25 GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN KeyLen
= 20; // Length of derived key
26 GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 DerivedKey
[] = { // Expected output key
27 0xea, 0x6c, 0x01, 0x4d, 0xc7, 0x2d, 0x6f, 0x8c, 0xcd, 0x1e, 0xd9, 0x2a, 0xce, 0x1d, 0x41, 0xf0,
28 0xd8, 0xde, 0x89, 0x57
32 Validate UEFI-OpenSSL PKCS#5 PBKDF2 Interface.
34 @retval EFI_SUCCESS Validation succeeded.
35 @retval EFI_ABORTED Validation failed.
39 ValidateCryptPkcs5Pbkdf2 (
46 Print (L
"\nUEFI-OpenSSL PKCS#5 PBKDF2 Testing: ");
47 Print (L
"\n- PKCS#5 PBKDF2 Verification: ");
49 OutKey
= AllocatePool (KeyLen
);
56 // Verify PKCS#5 PBKDF2 Key Derivation Function
58 Print (L
"Deriving Key... ");
59 Status
= Pkcs5HashPassword (
77 // Check the output key with the expected key result
79 Print (L
"Check Derived Key... ");
80 if (CompareMem (OutKey
, DerivedKey
, KeyLen
) != 0) {