EVP_PKEY_CTX_set_scrypt_N.pod 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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<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. The scrypt KDF also uses EVP_PKEY_CTX_set1_pbe_pass() as well as
  40. the value from the string controls "pass" and "hexpass".
  41. See L<EVP_PKEY_CTX_set1_pbe_pass(3)>.
  42. All the functions described here are implemented as macros.
  43. =head1 RETURN VALUES
  44. All these functions return 1 for success and 0 or a negative value for
  45. failure.
  46. In particular a return value of -2 indicates the operation is not
  47. supported by the public key algorithm.
  48. =head1 SEE ALSO
  49. L<scrypt(7)>,
  50. L<EVP_PKEY_CTX_new(3)>,
  51. L<EVP_PKEY_CTX_ctrl_str(3)>,
  52. L<EVP_PKEY_derive(3)>
  53. =head1 COPYRIGHT
  54. Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
  55. Licensed under the Apache License 2.0 (the "License"). You may not use
  56. this file except in compliance with the License. You can obtain a copy
  57. in the file LICENSE in the source distribution or at
  58. L<https://www.openssl.org/source/license.html>.
  59. =cut