Home | History | Annotate | Download | only in Pk
      1 /** @file
      2   PBKDF2 Key Derivation Function Wrapper Implementation which does not provide real
      3   capabilities.
      4 
      5 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
      6 This program and the accompanying materials
      7 are licensed and made available under the terms and conditions of the BSD License
      8 which accompanies this distribution.  The full text of the license may be found at
      9 http://opensource.org/licenses/bsd-license.php
     10 
     11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 
     14 **/
     15 
     16 #include "InternalCryptLib.h"
     17 #include <openssl/evp.h>
     18 #include <openssl/hmac.h>
     19 
     20 /**
     21   Derives a key from a password using a salt and iteration count, based on PKCS#5 v2.0
     22   password based encryption key derivation function PBKDF2, as specified in RFC 2898.
     23 
     24   Return FALSE to indicate this interface is not supported.
     25 
     26   @param[in]  PasswordLength  Length of input password in bytes.
     27   @param[in]  Password        Pointer to the array for the password.
     28   @param[in]  SaltLength      Size of the Salt in bytes.
     29   @param[in]  Salt            Pointer to the Salt.
     30   @param[in]  IterationCount  Number of iterations to perform. Its value should be
     31                               greater than or equal to 1.
     32   @param[in]  DigestSize      Size of the message digest to be used (eg. SHA256_DIGEST_SIZE).
     33                               NOTE: DigestSize will be used to determine the hash algorithm.
     34                                     Only SHA1_DIGEST_SIZE or SHA256_DIGEST_SIZE is supported.
     35   @param[in]  KeyLength       Size of the derived key buffer in bytes.
     36   @param[out] OutKey          Pointer to the output derived key buffer.
     37 
     38   @retval  FALSE  This interface is not supported.
     39 
     40 **/
     41 BOOLEAN
     42 EFIAPI
     43 Pkcs5HashPassword (
     44   IN  UINTN        PasswordLength,
     45   IN  CONST CHAR8  *Password,
     46   IN  UINTN        SaltLength,
     47   IN  CONST UINT8  *Salt,
     48   IN  UINTN        IterationCount,
     49   IN  UINTN        DigestSize,
     50   IN  UINTN        KeyLength,
     51   OUT UINT8        *OutKey
     52   )
     53 {
     54   ASSERT (FALSE);
     55   return FALSE;
     56 }
     57