SSL_CTX_get0_param.pod 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_get0_param, SSL_get0_param, SSL_CTX_set1_param, SSL_set1_param,
  4. SSL_CTX_set_purpose, SSL_CTX_set_trust, SSL_set_purpose, SSL_set_trust -
  5. get and set verification parameters
  6. =head1 SYNOPSIS
  7. #include <openssl/ssl.h>
  8. X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx);
  9. X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl);
  10. int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
  11. int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);
  12. int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose);
  13. int SSL_set_purpose(SSL *ssl, int purpose);
  14. int SSL_CTX_set_trust(SSL_CTX *ctx, int trust);
  15. int SSL_set_trust(SSL *ssl, int trust);
  16. =head1 DESCRIPTION
  17. SSL_CTX_get0_param() and SSL_get0_param() retrieve an internal pointer to
  18. the verification parameters for B<ctx> or B<ssl> respectively. The returned
  19. pointer must not be freed by the calling application.
  20. SSL_CTX_set1_param() and SSL_set1_param() set the verification parameters
  21. to B<vpm> for B<ctx> or B<ssl>.
  22. The functions SSL_CTX_set_purpose() and SSL_set_purpose() are shorthands which
  23. set the purpose parameter on the verification parameters object. These functions
  24. are equivalent to calling X509_VERIFY_PARAM_set_purpose() directly.
  25. The functions SSL_CTX_set_trust() and SSL_set_trust() are similarly shorthands
  26. which set the trust parameter on the verification parameters object. These
  27. functions are equivalent to calling X509_VERIFY_PARAM_set_trust() directly.
  28. =head1 NOTES
  29. Typically parameters are retrieved from an B<SSL_CTX> or B<SSL> structure
  30. using SSL_CTX_get0_param() or SSL_get0_param() and an application modifies
  31. them to suit its needs: for example to add a hostname check.
  32. =head1 RETURN VALUES
  33. SSL_CTX_get0_param() and SSL_get0_param() return a pointer to an
  34. B<X509_VERIFY_PARAM> structure.
  35. SSL_CTX_set1_param(), SSL_set1_param(), SSL_CTX_set_purpose(),
  36. SSL_set_purpose(), SSL_CTX_set_trust() and SSL_set_trust() return 1 for success
  37. and 0 for failure.
  38. =head1 EXAMPLES
  39. Check hostname matches "www.foo.com" in peer certificate:
  40. X509_VERIFY_PARAM *vpm = SSL_get0_param(ssl);
  41. X509_VERIFY_PARAM_set1_host(vpm, "www.foo.com", 0);
  42. =head1 SEE ALSO
  43. L<ssl(7)>,
  44. L<X509_VERIFY_PARAM_set_flags(3)>
  45. =head1 HISTORY
  46. These functions were added in OpenSSL 1.0.2.
  47. =head1 COPYRIGHT
  48. Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
  49. Licensed under the Apache License 2.0 (the "License"). You may not use
  50. this file except in compliance with the License. You can obtain a copy
  51. in the file LICENSE in the source distribution or at
  52. L<https://www.openssl.org/source/license.html>.
  53. =cut