OSSL_CALLBACK.pod 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. =pod
  2. =head1 NAME
  3. OSSL_CALLBACK, OSSL_PASSPHRASE_CALLBACK - OpenSSL Core type to define callbacks
  4. =head1 SYNOPSIS
  5. #include <openssl/core.h>
  6. typedef int (OSSL_CALLBACK)(const OSSL_PARAM params[], void *arg);
  7. typedef int (OSSL_PASSPHRASE_CALLBACK)(char *pass, size_t pass_size,
  8. size_t *pass_len,
  9. const OSSL_PARAM params[],
  10. void *arg);
  11. =head1 DESCRIPTION
  12. For certain events or activities, provider functionality may need help from
  13. the application or the calling OpenSSL libraries themselves. For example,
  14. user input or direct (possibly optional) user output could be implemented
  15. this way.
  16. Callback functions themselves are always provided by or through the calling
  17. OpenSSL libraries, along with a generic pointer to data I<arg>. As far as
  18. the function receiving the pointer to the function pointer and I<arg> is
  19. concerned, the data that I<arg> points at is opaque, and the pointer should
  20. simply be passed back to the callback function when it's called.
  21. =over 4
  22. =item B<OSSL_CALLBACK>
  23. This is a generic callback function. When calling this callback function,
  24. the caller is expected to build an L<OSSL_PARAM(3)> array of data it wants or
  25. is expected to pass back, and pass that as I<params>, as well as the opaque
  26. data pointer it received, as I<arg>.
  27. =item B<OSSL_PASSPHRASE_CALLBACK>
  28. This is a specialised callback function, used specifically to prompt the
  29. user for a passphrase. When calling this callback function, a buffer to
  30. store the pass phrase needs to be given with I<pass>, and its size with
  31. I<pass_size>. The length of the prompted pass phrase will be given back in
  32. I<*pass_len>.
  33. Additional parameters can be passed with the L<OSSL_PARAM(3)> array I<params>,
  34. =back
  35. =begin comment RETURN VALUES doesn't make sense for a manual that only
  36. describes a type, but document checkers still want that section, and
  37. to have more than just the section title.
  38. =head1 RETURN VALUES
  39. txt
  40. =end comment
  41. =head1 SEE ALSO
  42. L<openssl-core.h(7)>
  43. =head1 HISTORY
  44. The types described here were added in OpenSSL 3.0.
  45. =head1 COPYRIGHT
  46. Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
  47. Licensed under the Apache License 2.0 (the "License"). You may not use
  48. this file except in compliance with the License. You can obtain a copy
  49. in the file LICENSE in the source distribution or at
  50. L<https://www.openssl.org/source/license.html>.
  51. =cut