1EVP_PKEY_CTX_SET_SCRYPT_N(3ossl) OpenSSL EVP_PKEY_CTX_SET_SCRYPT_N(3ossl)
2
3
4
6 EVP_PKEY_CTX_set1_scrypt_salt, EVP_PKEY_CTX_set_scrypt_N,
7 EVP_PKEY_CTX_set_scrypt_r, EVP_PKEY_CTX_set_scrypt_p,
8 EVP_PKEY_CTX_set_scrypt_maxmem_bytes - EVP_PKEY scrypt KDF support
9 functions
10
12 #include <openssl/kdf.h>
13
14 int EVP_PKEY_CTX_set1_scrypt_salt(EVP_PKEY_CTX *pctx, unsigned char *salt,
15 int saltlen);
16
17 int EVP_PKEY_CTX_set_scrypt_N(EVP_PKEY_CTX *pctx, uint64_t N);
18
19 int EVP_PKEY_CTX_set_scrypt_r(EVP_PKEY_CTX *pctx, uint64_t r);
20
21 int EVP_PKEY_CTX_set_scrypt_p(EVP_PKEY_CTX *pctx, uint64_t p);
22
23 int EVP_PKEY_CTX_set_scrypt_maxmem_bytes(EVP_PKEY_CTX *pctx,
24 uint64_t maxmem);
25
27 These functions are used to set up the necessary data to use the scrypt
28 KDF. For more information on scrypt, see EVP_KDF-SCRYPT(7).
29
30 EVP_PKEY_CTX_set1_scrypt_salt() sets the saltlen bytes long salt value.
31
32 EVP_PKEY_CTX_set_scrypt_N(), EVP_PKEY_CTX_set_scrypt_r() and
33 EVP_PKEY_CTX_set_scrypt_p() configure the work factors N, r and p.
34
35 EVP_PKEY_CTX_set_scrypt_maxmem_bytes() sets how much RAM key derivation
36 may maximally use, given in bytes. If RAM is exceeded because the load
37 factors are chosen too high, the key derivation will fail.
38
40 scrypt also supports string based control operations via
41 EVP_PKEY_CTX_ctrl_str(3). Similarly, the salt can either be specified
42 using the type parameter "salt" or in hex encoding by using the
43 "hexsalt" parameter. The work factors N, r and p as well as
44 maxmem_bytes can be set by using the parameters "N", "r", "p" and
45 "maxmem_bytes", respectively.
46
48 There is a newer generic API for KDFs, EVP_KDF(3), which is preferred
49 over the EVP_PKEY method.
50
51 The scrypt KDF also uses EVP_PKEY_CTX_set1_pbe_pass() as well as the
52 value from the string controls "pass" and "hexpass". See
53 EVP_PKEY_CTX_set1_pbe_pass(3).
54
56 All these functions return 1 for success and 0 or a negative value for
57 failure. In particular a return value of -2 indicates the operation is
58 not supported by the public key algorithm.
59
61 EVP_KDF(3) EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3),
62 EVP_PKEY_derive(3)
63
65 All of the functions described here were converted from macros to
66 functions in OpenSSL 3.0.
67
69 Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
70
71 Licensed under the Apache License 2.0 (the "License"). You may not use
72 this file except in compliance with the License. You can obtain a copy
73 in the file LICENSE in the source distribution or at
74 <https://www.openssl.org/source/license.html>.
75
76
77
783.1.1 2023-08-31 EVP_PKEY_CTX_SET_SCRYPT_N(3ossl)