OSSL_DECODER.3ossl 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is >0, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .nr rF 0
  58. .if \n(.g .if rF .nr rF 1
  59. .if (\n(rF:(\n(.g==0)) \{\
  60. . if \nF \{\
  61. . de IX
  62. . tm Index:\\$1\t\\n%\t"\\$2"
  63. ..
  64. . if !\nF==2 \{\
  65. . nr % 0
  66. . nr F 2
  67. . \}
  68. . \}
  69. .\}
  70. .rr rF
  71. .\"
  72. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  73. .\" Fear. Run. Save yourself. No user-serviceable parts.
  74. . \" fudge factors for nroff and troff
  75. .if n \{\
  76. . ds #H 0
  77. . ds #V .8m
  78. . ds #F .3m
  79. . ds #[ \f1
  80. . ds #] \fP
  81. .\}
  82. .if t \{\
  83. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  84. . ds #V .6m
  85. . ds #F 0
  86. . ds #[ \&
  87. . ds #] \&
  88. .\}
  89. . \" simple accents for nroff and troff
  90. .if n \{\
  91. . ds ' \&
  92. . ds ` \&
  93. . ds ^ \&
  94. . ds , \&
  95. . ds ~ ~
  96. . ds /
  97. .\}
  98. .if t \{\
  99. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  100. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  101. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  102. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  103. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  104. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  105. .\}
  106. . \" troff and (daisy-wheel) nroff accents
  107. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  108. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  109. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  110. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  111. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  112. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  113. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  114. .ds ae a\h'-(\w'a'u*4/10)'e
  115. .ds Ae A\h'-(\w'A'u*4/10)'E
  116. . \" corrections for vroff
  117. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  118. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  119. . \" for low resolution devices (crt and lpr)
  120. .if \n(.H>23 .if \n(.V>19 \
  121. \{\
  122. . ds : e
  123. . ds 8 ss
  124. . ds o a
  125. . ds d- d\h'-1'\(ga
  126. . ds D- D\h'-1'\(hy
  127. . ds th \o'bp'
  128. . ds Th \o'LP'
  129. . ds ae ae
  130. . ds Ae AE
  131. .\}
  132. .rm #[ #] #H #V #F C
  133. .\" ========================================================================
  134. .\"
  135. .IX Title "OSSL_DECODER 3ossl"
  136. .TH OSSL_DECODER 3ossl "2024-09-03" "3.3.2" "OpenSSL"
  137. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  138. .\" way too many mistakes in technical documents.
  139. .if n .ad l
  140. .nh
  141. .SH "NAME"
  142. OSSL_DECODER,
  143. OSSL_DECODER_fetch,
  144. OSSL_DECODER_up_ref,
  145. OSSL_DECODER_free,
  146. OSSL_DECODER_get0_provider,
  147. OSSL_DECODER_get0_properties,
  148. OSSL_DECODER_is_a,
  149. OSSL_DECODER_get0_name,
  150. OSSL_DECODER_get0_description,
  151. OSSL_DECODER_do_all_provided,
  152. OSSL_DECODER_names_do_all,
  153. OSSL_DECODER_gettable_params,
  154. OSSL_DECODER_get_params
  155. \&\- Decoder method routines
  156. .SH "SYNOPSIS"
  157. .IX Header "SYNOPSIS"
  158. .Vb 1
  159. \& #include <openssl/decoder.h>
  160. \&
  161. \& typedef struct ossl_decoder_st OSSL_DECODER;
  162. \&
  163. \& OSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *ctx, const char *name,
  164. \& const char *properties);
  165. \& int OSSL_DECODER_up_ref(OSSL_DECODER *decoder);
  166. \& void OSSL_DECODER_free(OSSL_DECODER *decoder);
  167. \& const OSSL_PROVIDER *OSSL_DECODER_get0_provider(const OSSL_DECODER *decoder);
  168. \& const char *OSSL_DECODER_get0_properties(const OSSL_DECODER *decoder);
  169. \& int OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name);
  170. \& const char *OSSL_DECODER_get0_name(const OSSL_DECODER *decoder);
  171. \& const char *OSSL_DECODER_get0_description(const OSSL_DECODER *decoder);
  172. \& void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx,
  173. \& void (*fn)(OSSL_DECODER *decoder, void *arg),
  174. \& void *arg);
  175. \& int OSSL_DECODER_names_do_all(const OSSL_DECODER *decoder,
  176. \& void (*fn)(const char *name, void *data),
  177. \& void *data);
  178. \& const OSSL_PARAM *OSSL_DECODER_gettable_params(OSSL_DECODER *decoder);
  179. \& int OSSL_DECODER_get_params(OSSL_DECODER_CTX *ctx, const OSSL_PARAM params[]);
  180. .Ve
  181. .SH "DESCRIPTION"
  182. .IX Header "DESCRIPTION"
  183. \&\fB\s-1OSSL_DECODER\s0\fR is a method for decoders, which know how to
  184. decode encoded data into an object of some type that the rest
  185. of OpenSSL knows how to handle.
  186. .PP
  187. \&\fBOSSL_DECODER_fetch()\fR looks for an algorithm within the provider that
  188. has been loaded into the \fB\s-1OSSL_LIB_CTX\s0\fR given by \fIctx\fR, having the
  189. name given by \fIname\fR and the properties given by \fIproperties\fR.
  190. The \fIname\fR determines what type of object the fetched decoder
  191. method is expected to be able to decode, and the properties are
  192. used to determine the expected output type.
  193. For known properties and the values they may have, please have a look
  194. in \*(L"Names and properties\*(R" in \fBprovider\-encoder\fR\|(7).
  195. .PP
  196. \&\fBOSSL_DECODER_up_ref()\fR increments the reference count for the given
  197. \&\fIdecoder\fR.
  198. .PP
  199. \&\fBOSSL_DECODER_free()\fR decrements the reference count for the given
  200. \&\fIdecoder\fR, and when the count reaches zero, frees it.
  201. If the argument is \s-1NULL,\s0 nothing is done.
  202. .PP
  203. \&\fBOSSL_DECODER_get0_provider()\fR returns the provider of the given
  204. \&\fIdecoder\fR.
  205. .PP
  206. \&\fBOSSL_DECODER_get0_properties()\fR returns the property definition associated
  207. with the given \fIdecoder\fR.
  208. .PP
  209. \&\fBOSSL_DECODER_is_a()\fR checks if \fIdecoder\fR is an implementation
  210. of an algorithm that's identifiable with \fIname\fR.
  211. .PP
  212. \&\fBOSSL_DECODER_get0_name()\fR returns the name used to fetch the given \fIdecoder\fR.
  213. .PP
  214. \&\fBOSSL_DECODER_get0_description()\fR returns a description of the \fIdecoder\fR, meant
  215. for display and human consumption. The description is at the discretion
  216. of the \fIdecoder\fR implementation.
  217. .PP
  218. \&\fBOSSL_DECODER_names_do_all()\fR traverses all names for the given
  219. \&\fIdecoder\fR, and calls \fIfn\fR with each name and \fIdata\fR as arguments.
  220. .PP
  221. \&\fBOSSL_DECODER_do_all_provided()\fR traverses all decoder
  222. implementations by all activated providers in the library context
  223. \&\fIlibctx\fR, and for each of the implementations, calls \fIfn\fR with the
  224. implementation method and \fIarg\fR as arguments.
  225. .PP
  226. \&\fBOSSL_DECODER_gettable_params()\fR returns an \s-1\fBOSSL_PARAM\s0\fR\|(3)
  227. array of parameter descriptors.
  228. .PP
  229. \&\fBOSSL_DECODER_get_params()\fR attempts to get parameters specified
  230. with an \s-1\fBOSSL_PARAM\s0\fR\|(3) array \fIparams\fR. Parameters that the
  231. implementation doesn't recognise should be ignored.
  232. .SH "RETURN VALUES"
  233. .IX Header "RETURN VALUES"
  234. \&\fBOSSL_DECODER_fetch()\fR returns a pointer to an \s-1OSSL_DECODER\s0 object,
  235. or \s-1NULL\s0 on error.
  236. .PP
  237. \&\fBOSSL_DECODER_up_ref()\fR returns 1 on success, or 0 on error.
  238. .PP
  239. \&\fBOSSL_DECODER_free()\fR doesn't return any value.
  240. .PP
  241. \&\fBOSSL_DECODER_get0_provider()\fR returns a pointer to a provider object, or
  242. \&\s-1NULL\s0 on error.
  243. .PP
  244. \&\fBOSSL_DECODER_get0_properties()\fR returns a pointer to a property
  245. definition string, or \s-1NULL\s0 on error.
  246. .PP
  247. \&\fBOSSL_DECODER_is_a()\fR returns 1 if \fIdecoder\fR was identifiable,
  248. otherwise 0.
  249. .PP
  250. \&\fBOSSL_DECODER_get0_name()\fR returns the algorithm name from the provided
  251. implementation for the given \fIdecoder\fR. Note that the \fIdecoder\fR may have
  252. multiple synonyms associated with it. In this case the first name from the
  253. algorithm definition is returned. Ownership of the returned string is retained
  254. by the \fIdecoder\fR object and should not be freed by the caller.
  255. .PP
  256. \&\fBOSSL_DECODER_get0_description()\fR returns a pointer to a description, or \s-1NULL\s0 if
  257. there isn't one.
  258. .PP
  259. \&\fBOSSL_DECODER_names_do_all()\fR returns 1 if the callback was called for all
  260. names. A return value of 0 means that the callback was not called for any names.
  261. .SH "NOTES"
  262. .IX Header "NOTES"
  263. \&\fBOSSL_DECODER_fetch()\fR may be called implicitly by other fetching
  264. functions, using the same library context and properties.
  265. Any other \s-1API\s0 that uses keys will typically do this.
  266. .SH "EXAMPLES"
  267. .IX Header "EXAMPLES"
  268. To list all decoders in a provider to a bio_out:
  269. .PP
  270. .Vb 3
  271. \& static void collect_decoders(OSSL_DECODER *decoder, void *stack)
  272. \& {
  273. \& STACK_OF(OSSL_DECODER) *decoder_stack = stack;
  274. \&
  275. \& sk_OSSL_DECODER_push(decoder_stack, decoder);
  276. \& OSSL_DECODER_up_ref(decoder);
  277. \& }
  278. \&
  279. \& void print_name(const char *name, void *vdata)
  280. \& {
  281. \& BIO *bio = vdata;
  282. \&
  283. \& BIO_printf(bio, "%s ", name);
  284. \& }
  285. \&
  286. \&
  287. \& STACK_OF(OSSL_DECODER) *decoders;
  288. \& int i;
  289. \&
  290. \& decoders = sk_OSSL_DECODER_new_null();
  291. \&
  292. \& BIO_printf(bio_out, "DECODERs provided by %s:\en", provider);
  293. \& OSSL_DECODER_do_all_provided(NULL, collect_decoders,
  294. \& decoders);
  295. \&
  296. \& for (i = 0; i < sk_OSSL_DECODER_num(decoders); i++) {
  297. \& OSSL_DECODER *decoder = sk_OSSL_DECODER_value(decoders, i);
  298. \&
  299. \& if (strcmp(OSSL_PROVIDER_get0_name(OSSL_DECODER_get0_provider(decoder)),
  300. \& provider) != 0)
  301. \& continue;
  302. \&
  303. \& if (OSSL_DECODER_names_do_all(decoder, print_name, bio_out))
  304. \& BIO_printf(bio_out, "\en");
  305. \& }
  306. \& sk_OSSL_DECODER_pop_free(decoders, OSSL_DECODER_free);
  307. .Ve
  308. .SH "SEE ALSO"
  309. .IX Header "SEE ALSO"
  310. \&\fBprovider\fR\|(7), \s-1\fBOSSL_DECODER_CTX\s0\fR\|(3), \fBOSSL_DECODER_from_bio\fR\|(3),
  311. \&\fBOSSL_DECODER_CTX_new_for_pkey\fR\|(3), \s-1\fBOSSL_LIB_CTX\s0\fR\|(3)
  312. .SH "HISTORY"
  313. .IX Header "HISTORY"
  314. The functions described here were added in OpenSSL 3.0.
  315. .SH "COPYRIGHT"
  316. .IX Header "COPYRIGHT"
  317. Copyright 2020\-2024 The OpenSSL Project Authors. All Rights Reserved.
  318. .PP
  319. Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
  320. this file except in compliance with the License. You can obtain a copy
  321. in the file \s-1LICENSE\s0 in the source distribution or at
  322. <https://www.openssl.org/source/license.html>.