9#include "InternalCryptLib.h"
10#include <openssl/evp.h>
11#include <openssl/hmac.h>
51 CONST EVP_MD *HashAlg;
58 if ((Password ==
NULL) || (Salt ==
NULL) || (OutKey ==
NULL)) {
62 if ((PasswordLength == 0) || (PasswordLength > INT_MAX) ||
63 (SaltLength == 0) || (SaltLength > INT_MAX) ||
64 (KeyLength == 0) || (KeyLength > INT_MAX) ||
65 (IterationCount < 1) || (IterationCount > INT_MAX))
75 HashAlg = EVP_sha1 ();
78 HashAlg = EVP_sha256 ();
88 return (BOOLEAN)PKCS5_PBKDF2_HMAC (
89 (
const char *)Password,
91 (
const unsigned char *)Salt,
96 (
unsigned char *)OutKey
#define SHA256_DIGEST_SIZE
BOOLEAN EFIAPI Pkcs5HashPassword(IN UINTN PasswordLength, IN CONST CHAR8 *Password, IN UINTN SaltLength, IN CONST UINT8 *Salt, IN UINTN IterationCount, IN UINTN DigestSize, IN UINTN KeyLength, OUT UINT8 *OutKey)