SSL_CTX_get0_param.3ossl 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "SSL_CTX_GET0_PARAM 3ossl"
  58. .TH SSL_CTX_GET0_PARAM 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. SSL_CTX_get0_param, SSL_get0_param, SSL_CTX_set1_param, SSL_set1_param,
  65. SSL_CTX_set_purpose, SSL_CTX_set_trust, SSL_set_purpose, SSL_set_trust \-
  66. get and set verification parameters
  67. .SH SYNOPSIS
  68. .IX Header "SYNOPSIS"
  69. .Vb 1
  70. \& #include <openssl/ssl.h>
  71. \&
  72. \& X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx);
  73. \& X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl);
  74. \& int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
  75. \& int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);
  76. \&
  77. \& int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose);
  78. \& int SSL_set_purpose(SSL *ssl, int purpose);
  79. \&
  80. \& int SSL_CTX_set_trust(SSL_CTX *ctx, int trust);
  81. \& int SSL_set_trust(SSL *ssl, int trust);
  82. .Ve
  83. .SH DESCRIPTION
  84. .IX Header "DESCRIPTION"
  85. \&\fBSSL_CTX_get0_param()\fR and \fBSSL_get0_param()\fR retrieve an internal pointer to
  86. the verification parameters for \fBctx\fR or \fBssl\fR respectively. The returned
  87. pointer must not be freed by the calling application.
  88. .PP
  89. \&\fBSSL_CTX_set1_param()\fR and \fBSSL_set1_param()\fR set the verification parameters
  90. to \fBvpm\fR for \fBctx\fR or \fBssl\fR.
  91. .PP
  92. The functions \fBSSL_CTX_set_purpose()\fR and \fBSSL_set_purpose()\fR are shorthands which
  93. set the purpose parameter on the verification parameters object. These functions
  94. are equivalent to calling \fBX509_VERIFY_PARAM_set_purpose()\fR directly.
  95. .PP
  96. The functions \fBSSL_CTX_set_trust()\fR and \fBSSL_set_trust()\fR are similarly shorthands
  97. which set the trust parameter on the verification parameters object. These
  98. functions are equivalent to calling \fBX509_VERIFY_PARAM_set_trust()\fR directly.
  99. .SH NOTES
  100. .IX Header "NOTES"
  101. Typically parameters are retrieved from an \fBSSL_CTX\fR or \fBSSL\fR structure
  102. using \fBSSL_CTX_get0_param()\fR or \fBSSL_get0_param()\fR and an application modifies
  103. them to suit its needs: for example to add a hostname check.
  104. .SH "RETURN VALUES"
  105. .IX Header "RETURN VALUES"
  106. \&\fBSSL_CTX_get0_param()\fR and \fBSSL_get0_param()\fR return a pointer to an
  107. \&\fBX509_VERIFY_PARAM\fR structure.
  108. .PP
  109. \&\fBSSL_CTX_set1_param()\fR, \fBSSL_set1_param()\fR, \fBSSL_CTX_set_purpose()\fR,
  110. \&\fBSSL_set_purpose()\fR, \fBSSL_CTX_set_trust()\fR and \fBSSL_set_trust()\fR return 1 for success
  111. and 0 for failure.
  112. .SH EXAMPLES
  113. .IX Header "EXAMPLES"
  114. Check hostname matches "www.foo.com" in peer certificate:
  115. .PP
  116. .Vb 2
  117. \& X509_VERIFY_PARAM *vpm = SSL_get0_param(ssl);
  118. \& X509_VERIFY_PARAM_set1_host(vpm, "www.foo.com", 0);
  119. .Ve
  120. .SH "SEE ALSO"
  121. .IX Header "SEE ALSO"
  122. \&\fBssl\fR\|(7),
  123. \&\fBX509_VERIFY_PARAM_set_flags\fR\|(3)
  124. .SH HISTORY
  125. .IX Header "HISTORY"
  126. These functions were added in OpenSSL 1.0.2.
  127. .SH COPYRIGHT
  128. .IX Header "COPYRIGHT"
  129. Copyright 2015\-2022 The OpenSSL Project Authors. All Rights Reserved.
  130. .PP
  131. Licensed under the Apache License 2.0 (the "License"). You may not use
  132. this file except in compliance with the License. You can obtain a copy
  133. in the file LICENSE in the source distribution or at
  134. <https://www.openssl.org/source/license.html>.