]> git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/corecrypto/ccpbkdf2.h
xnu-4903.241.1.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / corecrypto / ccpbkdf2.h
1 /*
2 * ccpbkdf2.h
3 * corecrypto
4 *
5 * Created on 12/15/2010
6 *
7 * Copyright (c) 2010,2011,2012,2015 Apple Inc. All rights reserved.
8 *
9 */
10
11 #ifndef _CORECRYPTO_CCPBKDF2_H_
12 #define _CORECRYPTO_CCPBKDF2_H_
13
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
19 an HMAC PRF of the callers slection (any Digest, typically SHA-1) returning dkLen bytes
20 containing the entropy.
21
22 Considerations:
23 The salt used should be at least 8 bytes long. Each session should use it's own salt.
24 We use the password as the key for the HMAC and the running data as the text for the HMAC to make a PRF.
25 SHA-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 */
36 int ccpbkdf2_hmac(const struct ccdigest_info *di,
37 size_t passwordLen, const void *password,
38 size_t saltLen, const void *salt,
39 size_t iterations,
40 size_t dkLen, void *dk);
41
42 #endif /* _CORECRYPTO_CCPBKDF2_H_ */