summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3')
-rw-r--r--src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3 b/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3
new file mode 100644
index 0000000000..333e45250e
--- /dev/null
+++ b/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3
@@ -0,0 +1,106 @@
1.Dd $Mdocdate: November 3 2016 $
2.Dt PKCS5_PBKDF2_HMAC 3
3.Os
4.Sh NAME
5.Nm PKCS5_PBKDF2_HMAC ,
6.Nm PKCS5_PBKDF2_HMAC_SHA1
7.Nd password based derivation routines with salt and iteration count
8.Sh SYNOPSIS
9.In openssl/evp.h
10.Ft int
11.Fo PKCS5_PBKDF2_HMAC
12.Fa "const char *pass"
13.Fa "int passlen"
14.Fa "const unsigned char *salt"
15.Fa "int saltlen"
16.Fa "int iter"
17.Fa "const EVP_MD *digest"
18.Fa "int keylen"
19.Fa "unsigned char *out"
20.Fc
21.Ft int
22.Fo PKCS5_PBKDF2_HMAC_SHA1
23.Fa "const char *pass"
24.Fa "int passlen"
25.Fa "const unsigned char *salt"
26.Fa "int saltlen"
27.Fa "int iter"
28.Fa "int keylen"
29.Fa "unsigned char *out"
30.Fc
31.Sh DESCRIPTION
32.Fn PKCS5_PBKDF2_HMAC
33derives a key from a password using a salt and iteration count as
34specified in RFC 2898.
35.Pp
36.Fa pass
37is the password used in the derivation of length
38.Fa passlen .
39.Fa pass
40is an optional parameter and can be
41.Dv NULL .
42If
43.Fa passlen
44is -1, then the function will calculate the length of
45.Fa pass
46using
47.Xr strlen 3 .
48.Pp
49.Fa salt
50is the salt used in the derivation of length
51.Fa saltlen .
52If the
53.Fa salt
54is
55.Dv NULL ,
56then
57.Fa saltlen
58must be 0.
59The function will not attempt to calculate the length of the
60.Fa salt
61because it is not assumed to be NUL terminated.
62.Pp
63.Fa iter
64is the iteration count and its value should be greater than or equal to 1.
65RFC 2898 suggests an iteration count of at least 1000.
66Any
67.Fa iter
68less than 1 is treated as a single iteration.
69.Pp
70.Fa digest
71is the message digest function used in the derivation.
72Values include any of the EVP_* message digests.
73.Fn PKCS5_PBKDF2_HMAC_SHA1
74calls
75.Fn PKCS5_PBKDF2_HMAC
76with
77.Xr EVP_sha1 3 .
78.Pp
79The derived key will be written to
80.Fa out .
81The size of the
82.Fa out
83buffer is specified via
84.Fa keylen .
85.Pp
86A typical application of this function is to derive keying material for
87an encryption algorithm from a password in the
88.Fa pass ,
89a salt in
90.Fa salt ,
91and an iteration count.
92.Pp
93Increasing the
94.Fa iter
95parameter slows down the algorithm which makes it harder for an attacker
96to perform a brute force attack using a large number of candidate
97passwords.
98.Sh RETURN VALUES
99.Fn PKCS5_PBKDF2_HMAC
100and
101.Fn PBKCS5_PBKDF2_HMAC_SHA1
102return 1 on success or 0 on error.
103.Sh SEE ALSO
104.Xr evp 3 ,
105.Xr EVP_BytesToKey 3 ,
106.Xr rand 3