EVP_PKEY_CTX_set_scrypt_N.pod 2.6 KB

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