]> git.saurik.com Git - apple/xnu.git/blame - EXTERNAL_HEADERS/corecrypto/ccpbkdf2.h
xnu-2782.40.9.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / corecrypto / ccpbkdf2.h
CommitLineData
316670eb
A
1/*
2 * ccpbkdf.h
3 * corecrypto
4 *
5 * Copyright 1999-2001, 2010 Apple Inc. All rights reserved.
6 *
7 * Derived from pbkdf2.h by Mitch Adler on 09-12-2010.
8 *
9 */
10
11#ifndef _CORECRYPTO_CCPBKDF2_H_
12#define _CORECRYPTO_CCPBKDF2_H_
13
316670eb
A
14#include <corecrypto/ccdigest.h>
15
16/*! @function ccpbkdf2_hmac
17 @abstract perform a pbkdf2 using HMAC(di) for the PRF (see PKCS#5 for specification)
18 @discussion This performs a standard PBKDF2 transformation of password and salt through
19an HMAC PRF of the callers slection (any Digest, typically SHA-1) returning dkLen bytes
20containing the entropy.
21
22Considerations:
23The salt used should be at least 8 bytes long. Each session should use it's own salt.
24We use the password as the key for the HMAC and the running data as the text for the HMAC to make a PRF.
25SHA-1 is a good hash to use for the core of the HMAC PRF.
26 @param di digest info defining the digest type to use in the PRF.
27 @param passwordLen amount of data to be fed in
28 @param password data to be fed into the PBKDF
29 @param saltLen length of the salt
30 @param salt salt to be used in pbkdf
31 @param iterations itrations to go
32 @param dkLen length of the results
33 @param dk buffer for the results of the PBKDF tranformation, must be dkLen big
34
35 */
36int ccpbkdf2_hmac(const struct ccdigest_info *di,
37 unsigned long passwordLen, const void *password,
38 unsigned long saltLen, const void *salt,
39 unsigned long iterations,
40 unsigned long dkLen, void *dk);
41
42#endif /* _CORECRYPTO_CCPBKDF2_H_ */