EVP_KEM_free.3ossl 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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 "EVP_KEM_FREE 3ossl"
  58. .TH EVP_KEM_FREE 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. EVP_KEM_fetch, EVP_KEM_free, EVP_KEM_up_ref,
  65. EVP_KEM_get0_name, EVP_KEM_is_a, EVP_KEM_get0_provider,
  66. EVP_KEM_do_all_provided, EVP_KEM_names_do_all, EVP_KEM_get0_description,
  67. EVP_KEM_gettable_ctx_params, EVP_KEM_settable_ctx_params
  68. \&\- Functions to manage EVP_KEM algorithm objects
  69. .SH SYNOPSIS
  70. .IX Header "SYNOPSIS"
  71. .Vb 1
  72. \& #include <openssl/evp.h>
  73. \&
  74. \& EVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
  75. \& const char *properties);
  76. \& void EVP_KEM_free(EVP_KEM *kem);
  77. \& int EVP_KEM_up_ref(EVP_KEM *kem);
  78. \& const char *EVP_KEM_get0_name(const EVP_KEM *kem);
  79. \& int EVP_KEM_is_a(const EVP_KEM *kem, const char *name);
  80. \& OSSL_PROVIDER *EVP_KEM_get0_provider(const EVP_KEM *kem);
  81. \& void EVP_KEM_do_all_provided(OSSL_LIB_CTX *libctx,
  82. \& void (*fn)(EVP_KEM *kem, void *arg), void *arg);
  83. \& int EVP_KEM_names_do_all(const EVP_KEM *kem,
  84. \& void (*fn)(const char *name, void *data), void *data);
  85. \& const char *EVP_KEM_get0_description(const EVP_KEM *kem);
  86. \& const OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem);
  87. \& const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem);
  88. .Ve
  89. .SH DESCRIPTION
  90. .IX Header "DESCRIPTION"
  91. \&\fBEVP_KEM_fetch()\fR fetches the implementation for the given \fBalgorithm\fR from any
  92. provider offering it, within the criteria given by the \fBproperties\fR and in the
  93. scope of the given library context \fBctx\fR (see \fBOSSL_LIB_CTX\fR\|(3)). The algorithm
  94. will be one offering functions for performing asymmetric kem related tasks such
  95. as key encapsulation and decapsulation.
  96. See "ALGORITHM FETCHING" in \fBcrypto\fR\|(7) for further information.
  97. .PP
  98. The returned value must eventually be freed with \fBEVP_KEM_free()\fR.
  99. .PP
  100. \&\fBEVP_KEM_free()\fR decrements the reference count for the \fBEVP_KEM\fR structure.
  101. Typically this structure will have been obtained from an earlier call to
  102. \&\fBEVP_KEM_fetch()\fR. If the reference count drops to 0 then the structure is freed.
  103. If the argument is NULL, nothing is done.
  104. .PP
  105. \&\fBEVP_KEM_up_ref()\fR increments the reference count for an \fBEVP_KEM\fR structure.
  106. .PP
  107. \&\fBEVP_KEM_is_a()\fR returns 1 if \fIkem\fR is an implementation of an
  108. algorithm that's identifiable with \fIname\fR, otherwise 0.
  109. .PP
  110. \&\fBEVP_KEM_get0_provider()\fR returns the provider that \fIkem\fR was fetched from.
  111. .PP
  112. \&\fBEVP_KEM_do_all_provided()\fR traverses all EVP_KEMs implemented by all activated
  113. providers in the given library context \fIlibctx\fR, and for each of the
  114. implementations, calls the given function \fIfn\fR with the implementation method
  115. and the given \fIarg\fR as argument.
  116. .PP
  117. \&\fBEVP_KEM_get0_name()\fR returns the algorithm name from the provided
  118. implementation for the given \fIkem\fR. Note that the \fIkem\fR may have
  119. multiple synonyms associated with it. In this case the first name from the
  120. algorithm definition is returned. Ownership of the returned string is retained
  121. by the \fIkem\fR object and should not be freed by the caller.
  122. .PP
  123. \&\fBEVP_KEM_names_do_all()\fR traverses all names for \fIkem\fR, and calls \fIfn\fR with
  124. each name and \fIdata\fR.
  125. .PP
  126. \&\fBEVP_KEM_get0_description()\fR returns a description of the \fIkem\fR, meant for
  127. display and human consumption. The description is at the discretion of
  128. the \fIkem\fR implementation.
  129. .PP
  130. \&\fBEVP_KEM_gettable_ctx_params()\fR and \fBEVP_KEM_settable_ctx_params()\fR return
  131. a constant \fBOSSL_PARAM\fR\|(3) array that describes the names and types of key
  132. parameters that can be retrieved or set by a key encapsulation algorithm using
  133. \&\fBEVP_PKEY_CTX_get_params\fR\|(3) and \fBEVP_PKEY_CTX_set_params\fR\|(3).
  134. .SH "RETURN VALUES"
  135. .IX Header "RETURN VALUES"
  136. \&\fBEVP_KEM_fetch()\fR returns a pointer to an \fBEVP_KEM\fR for success or \fBNULL\fR for
  137. failure.
  138. .PP
  139. \&\fBEVP_KEM_up_ref()\fR returns 1 for success or 0 otherwise.
  140. .PP
  141. \&\fBEVP_KEM_names_do_all()\fR returns 1 if the callback was called for all names. A
  142. return value of 0 means that the callback was not called for any names.
  143. .PP
  144. \&\fBEVP_KEM_gettable_ctx_params()\fR and \fBEVP_KEM_settable_ctx_params()\fR return
  145. a constant \fBOSSL_PARAM\fR\|(3) array or NULL on error.
  146. .SH "SEE ALSO"
  147. .IX Header "SEE ALSO"
  148. "ALGORITHM FETCHING" in \fBcrypto\fR\|(7), \fBOSSL_PROVIDER\fR\|(3)
  149. .SH HISTORY
  150. .IX Header "HISTORY"
  151. The functions described here were added in OpenSSL 3.0.
  152. .SH COPYRIGHT
  153. .IX Header "COPYRIGHT"
  154. Copyright 2020\-2024 The OpenSSL Project Authors. All Rights Reserved.
  155. .PP
  156. Licensed under the Apache License 2.0 (the "License"). You may not use
  157. this file except in compliance with the License. You can obtain a copy
  158. in the file LICENSE in the source distribution or at
  159. <https://www.openssl.org/source/license.html>.