OSSL_ENCODER_to_bio.pod 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. =pod
  2. =head1 NAME
  3. OSSL_ENCODER_to_data,
  4. OSSL_ENCODER_to_bio,
  5. OSSL_ENCODER_to_fp
  6. - Routines to perform an encoding
  7. =head1 SYNOPSIS
  8. #include <openssl/encoder.h>
  9. int OSSL_ENCODER_to_data(OSSL_ENCODER_CTX *ctx, unsigned char **pdata,
  10. size_t *pdata_len);
  11. int OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX *ctx, BIO *out);
  12. int OSSL_ENCODER_to_fp(OSSL_ENCODER_CTX *ctx, FILE *fp);
  13. Feature availability macros:
  14. =over 4
  15. =item OSSL_ENCODER_to_fp() is only available when B<OPENSSL_NO_STDIO>
  16. is undefined.
  17. =back
  18. =head1 DESCRIPTION
  19. OSSL_ENCODER_to_data() runs the encoding process for the context I<ctx>,
  20. with the output going to the I<*pdata> and I<*pdata_len>.
  21. If I<*pdata> is NULL when OSSL_ENCODER_to_data() is called, a buffer will be
  22. allocated using L<OPENSSL_zalloc(3)>, and I<*pdata> will be set to point at
  23. the start of that buffer, and I<*pdata_len> will be assigned its length when
  24. OSSL_ENCODER_to_data() returns.
  25. If I<*pdata> is non-NULL when OSSL_ENCODER_to_data() is called, I<*pdata_len>
  26. is assumed to have its size. In this case, I<*pdata> will be set to point
  27. after the encoded bytes, and I<*pdata_len> will be assigned the number of
  28. remaining bytes.
  29. OSSL_ENCODER_to_bio() runs the encoding process for the context I<ctx>, with
  30. the output going to the B<BIO> I<out>.
  31. OSSL_ENCODER_to_fp() does the same thing as OSSL_ENCODER_to_bio(), except
  32. that the output is going to the B<FILE> I<fp>.
  33. =for comment Know your encoder!
  34. For OSSL_ENCODER_to_bio() and OSSL_ENCODER_to_fp(), the application is
  35. required to set up the B<BIO> or B<FILE> properly, for example to have
  36. it in text or binary mode as is appropriate for the encoder output type.
  37. =head1 RETURN VALUES
  38. OSSL_ENCODER_to_bio(), OSSL_ENCODER_to_fp() and OSSL_ENCODER_to_data()
  39. return 1 on success, or 0 on failure.
  40. =begin comment TODO(3.0) Add examples!
  41. =head1 EXAMPLES
  42. Text, because pod2xxx doesn't like empty sections
  43. =end comment
  44. =head1 SEE ALSO
  45. L<provider(7)>, L<OSSL_ENCODER_CTX(3)>
  46. =head1 HISTORY
  47. The functions described here were added in OpenSSL 3.0.
  48. =head1 COPYRIGHT
  49. Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
  50. Licensed under the Apache License 2.0 (the "License"). You may not use
  51. this file except in compliance with the License. You can obtain a copy
  52. in the file LICENSE in the source distribution or at
  53. L<https://www.openssl.org/source/license.html>.
  54. =cut