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