EVP_PKEY_CTX_SET_SCRYPT_N(3ossl)
π EVP_PKEY_CTX_SET_SCRYPT_N(3ossl) β the OpenSSL scrypt KDF bestie handbook π
okay so bestie, welcome to the OpenSSL manual, page EVP_PKEY_CTX_SET_SCRYPT_N(3ossl). This is the whole little squad of functions you use to set up scrypt: EVP_PKEY_CTX_set1_scrypt_salt, EVP_PKEY_CTX_set_scrypt_N, EVP_PKEY_CTX_set_scrypt_r, EVP_PKEY_CTX_set_scrypt_p, and EVP_PKEY_CTX_set_scrypt_maxmem_bytes. It's giving EVP_PKEY scrypt KDF support functions energy. π«Ά
β¨ SYNOPSIS β¨
#include <openssl/kdf.h>
int EVP_PKEY_CTX_set1_scrypt_salt(EVP_PKEY_CTX *pctx, unsigned char *salt,
int saltlen);
int EVP_PKEY_CTX_set_scrypt_N(EVP_PKEY_CTX *pctx, uint64_t N);
int EVP_PKEY_CTX_set_scrypt_r(EVP_PKEY_CTX *pctx, uint64_t r);
int EVP_PKEY_CTX_set_scrypt_p(EVP_PKEY_CTX *pctx, uint64_t p);
int EVP_PKEY_CTX_set_scrypt_maxmem_bytes(EVP_PKEY_CTX *pctx,
uint64_t maxmem);
like, copy that exactly, no cap. π
πΈ DESCRIPTION πΈ
These functions are literally here to set up all the necessary data you need before you can use the scrypt KDF. If you want the full scrypt lore, go read EVP_KDF-SCRYPT(7) β it's the main character of that page. π
EVP_PKEY_CTX_set1_scrypt_salt()β sets the salt value, and that salt is exactlysaltlenbytes long. yes, the salt matters, bestie, don't skip it π§EVP_PKEY_CTX_set_scrypt_N(),EVP_PKEY_CTX_set_scrypt_r()andEVP_PKEY_CTX_set_scrypt_p()β these three configure the work factorsN,randp. They're the trio. The friend group. π₯EVP_PKEY_CTX_set_scrypt_maxmem_bytes()β sets how much RAM key derivation may maximally use, given in bytes. And lowkey important: if RAM is exceeded because the load factors are chosen too high, the key derivation will fail. so maybe don't crank those numbers for fun π
π STRING CTRLS π
scrypt also supports string based control operations via EVP_PKEY_CTX_ctrl_str(3). So you've got options, bestie. Similarly, the salt can either be specified using the type parameter "salt" β or in hex encoding by using the "hexsalt" parameter. Pick your vibe. π¦
The work factors N, r and p as well as maxmem_bytes can be set by using the parameters "N", "r", "p" and "maxmem_bytes", respectively. matching names, so iconic of them. β¨
π NOTES π
okay so real talk: there is a newer generic API for KDFs, EVP_KDF(3), which is preferred over the EVP_PKEY method. The new one is the moment, fr fr. π
Also, the scrypt KDF also uses EVP_PKEY_CTX_set1_pbe_pass() as well as the value from the string controls "pass" and "hexpass". See EVP_PKEY_CTX_set1_pbe_pass(3) for the details. π
β RETURN VALUES β
All these functions return 1 for success and 0 or a negative value for failure. And in particular β mark this down β a return value of -2 indicates the operation is not supported by the public key algorithm. So if you see -2, that's what's up. π
π SEE ALSO π
π¦ HISTORY π¦
All of the functions described here were converted from macros to functions in OpenSSL 3.0. glow up era. β¨
π COPYRIGHT π
Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie! π«Ά this was OpenSSL 3.5.9, dated 2026-09-29, and the manual page is EVP_PKEY_CTX_SET_SCRYPT_N(3ossl). go forth and salt responsibly π§π
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms