5 EVP_PKEY_CTX_set1_scrypt_salt,
6 EVP_PKEY_CTX_set_scrypt_N,
7 EVP_PKEY_CTX_set_scrypt_r,
8 EVP_PKEY_CTX_set_scrypt_p,
9 EVP_PKEY_CTX_set_scrypt_maxmem_bytes
10 - EVP_PKEY scrypt KDF support functions
14 #include <openssl/kdf.h>
16 int EVP_PKEY_CTX_set1_scrypt_salt(EVP_PKEY_CTX *pctx, unsigned char *salt,
19 int EVP_PKEY_CTX_set_scrypt_N(EVP_PKEY_CTX *pctx, uint64_t N);
21 int EVP_PKEY_CTX_set_scrypt_r(EVP_PKEY_CTX *pctx, uint64_t r);
23 int EVP_PKEY_CTX_set_scrypt_p(EVP_PKEY_CTX *pctx, uint64_t p);
25 int EVP_PKEY_CTX_set_scrypt_maxmem_bytes(EVP_PKEY_CTX *pctx,
30 These functions are used to set up the necessary data to use the
32 For more information on scrypt, see L<EVP_KDF-SCRYPT(7)>.
34 EVP_PKEY_CTX_set1_scrypt_salt() sets the B<saltlen> bytes long salt
37 EVP_PKEY_CTX_set_scrypt_N(), EVP_PKEY_CTX_set_scrypt_r() and
38 EVP_PKEY_CTX_set_scrypt_p() configure the work factors N, r and p.
40 EVP_PKEY_CTX_set_scrypt_maxmem_bytes() sets how much RAM key
41 derivation may maximally use, given in bytes.
42 If RAM is exceeded because the load factors are chosen too high, the
43 key derivation will fail.
47 scrypt also supports string based control operations via
48 L<EVP_PKEY_CTX_ctrl_str(3)>.
49 Similarly, the B<salt> can either be specified using the B<type>
50 parameter "salt" or in hex encoding by using the "hexsalt" parameter.
51 The work factors B<N>, B<r> and B<p> as well as B<maxmem_bytes> can be
52 set by using the parameters "N", "r", "p" and "maxmem_bytes",
57 There is a newer generic API for KDFs, L<EVP_KDF(3)>, which is
58 preferred over the EVP_PKEY method.
60 The scrypt KDF also uses EVP_PKEY_CTX_set1_pbe_pass() as well as
61 the value from the string controls "pass" and "hexpass".
62 See L<EVP_PKEY_CTX_set1_pbe_pass(3)>.
64 All the functions described here are implemented as macros.
68 All these functions return 1 for success and 0 or a negative value for
70 In particular a return value of -2 indicates the operation is not
71 supported by the public key algorithm.
76 L<EVP_PKEY_CTX_new(3)>,
77 L<EVP_PKEY_CTX_ctrl_str(3)>,
82 Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
84 Licensed under the Apache License 2.0 (the "License"). You may not use
85 this file except in compliance with the License. You can obtain a copy
86 in the file LICENSE in the source distribution or at
87 L<https://www.openssl.org/source/license.html>.