OSSL_PROVIDER.3ossl 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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_PROVIDER 3ossl"
  136. .TH OSSL_PROVIDER 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_PROVIDER_set_default_search_path,
  143. OSSL_PROVIDER_get0_default_search_path,
  144. OSSL_PROVIDER, OSSL_PROVIDER_load, OSSL_PROVIDER_try_load, OSSL_PROVIDER_unload,
  145. OSSL_PROVIDER_load_ex, OSSL_PROVIDER_try_load_ex,
  146. OSSL_PROVIDER_available, OSSL_PROVIDER_do_all,
  147. OSSL_PROVIDER_gettable_params, OSSL_PROVIDER_get_params,
  148. OSSL_PROVIDER_query_operation, OSSL_PROVIDER_unquery_operation,
  149. OSSL_PROVIDER_get0_provider_ctx, OSSL_PROVIDER_get0_dispatch,
  150. OSSL_PROVIDER_add_builtin, OSSL_PROVIDER_get0_name, OSSL_PROVIDER_get_capabilities,
  151. OSSL_PROVIDER_self_test
  152. \&\- provider routines
  153. .SH "SYNOPSIS"
  154. .IX Header "SYNOPSIS"
  155. .Vb 1
  156. \& #include <openssl/provider.h>
  157. \&
  158. \& typedef struct ossl_provider_st OSSL_PROVIDER;
  159. \&
  160. \& int OSSL_PROVIDER_set_default_search_path(OSSL_LIB_CTX *libctx,
  161. \& const char *path);
  162. \& const char *OSSL_PROVIDER_get0_default_search_path(OSSL_LIB_CTX *libctx);
  163. \&
  164. \& OSSL_PROVIDER *OSSL_PROVIDER_load(OSSL_LIB_CTX *libctx, const char *name);
  165. \& OSSL_PROVIDER *OSSL_PROVIDER_load_ex(OSSL_LIB_CTX *, const char *name,
  166. \& OSSL_PARAM *params);
  167. \& OSSL_PROVIDER *OSSL_PROVIDER_try_load(OSSL_LIB_CTX *libctx, const char *name,
  168. \& int retain_fallbacks);
  169. \& OSSL_PROVIDER *OSSL_PROVIDER_try_load_ex(OSSL_LIB_CTX *, const char *name,
  170. \& OSSL_PARAM *params,
  171. \& int retain_fallbacks);
  172. \& int OSSL_PROVIDER_unload(OSSL_PROVIDER *prov);
  173. \& int OSSL_PROVIDER_available(OSSL_LIB_CTX *libctx, const char *name);
  174. \& int OSSL_PROVIDER_do_all(OSSL_LIB_CTX *ctx,
  175. \& int (*cb)(OSSL_PROVIDER *provider, void *cbdata),
  176. \& void *cbdata);
  177. \&
  178. \& const OSSL_PARAM *OSSL_PROVIDER_gettable_params(OSSL_PROVIDER *prov);
  179. \& int OSSL_PROVIDER_get_params(OSSL_PROVIDER *prov, OSSL_PARAM params[]);
  180. \&
  181. \& const OSSL_ALGORITHM *OSSL_PROVIDER_query_operation(const OSSL_PROVIDER *prov,
  182. \& int operation_id,
  183. \& int *no_cache);
  184. \& void OSSL_PROVIDER_unquery_operation(const OSSL_PROVIDER *prov,
  185. \& int operation_id,
  186. \& const OSSL_ALGORITHM *algs);
  187. \& void *OSSL_PROVIDER_get0_provider_ctx(const OSSL_PROVIDER *prov);
  188. \& const OSSL_DISPATCH *OSSL_PROVIDER_get0_dispatch(const OSSL_PROVIDER *prov);
  189. \&
  190. \& int OSSL_PROVIDER_add_builtin(OSSL_LIB_CTX *libctx, const char *name,
  191. \& ossl_provider_init_fn *init_fn);
  192. \&
  193. \& const char *OSSL_PROVIDER_get0_name(const OSSL_PROVIDER *prov);
  194. \&
  195. \& int OSSL_PROVIDER_get_capabilities(const OSSL_PROVIDER *prov,
  196. \& const char *capability,
  197. \& OSSL_CALLBACK *cb,
  198. \& void *arg);
  199. \& int OSSL_PROVIDER_self_test(const OSSL_PROVIDER *prov);
  200. .Ve
  201. .SH "DESCRIPTION"
  202. .IX Header "DESCRIPTION"
  203. \&\fB\s-1OSSL_PROVIDER\s0\fR is a type that holds internal information about
  204. implementation providers (see \fBprovider\fR\|(7) for information on what a
  205. provider is).
  206. A provider can be built in to the application or the OpenSSL
  207. libraries, or can be a loadable module.
  208. The functions described here handle both forms.
  209. .PP
  210. Some of these functions operate within a library context, please see
  211. \&\s-1\fBOSSL_LIB_CTX\s0\fR\|(3) for further details.
  212. .SS "Functions"
  213. .IX Subsection "Functions"
  214. \&\fBOSSL_PROVIDER_set_default_search_path()\fR specifies the default search \fIpath\fR
  215. that is to be used for looking for providers in the specified \fIlibctx\fR.
  216. If left unspecified, an environment variable and a fall back default value will
  217. be used instead.
  218. .PP
  219. \&\fBOSSL_PROVIDER_get0_default_search_path()\fR retrieves the default search \fIpath\fR
  220. that is to be used for looking for providers in the specified \fIlibctx\fR.
  221. If successful returns the path or empty string; the path is valid until the
  222. context is released or \fBOSSL_PROVIDER_set_default_search_path()\fR is called.
  223. .PP
  224. \&\fBOSSL_PROVIDER_add_builtin()\fR is used to add a built in provider to
  225. \&\fB\s-1OSSL_PROVIDER\s0\fR store in the given library context, by associating a
  226. provider name with a provider initialization function.
  227. This name can then be used with \fBOSSL_PROVIDER_load()\fR.
  228. .PP
  229. \&\fBOSSL_PROVIDER_load()\fR loads and initializes a provider.
  230. This may simply initialize a provider that was previously added with
  231. \&\fBOSSL_PROVIDER_add_builtin()\fR and run its given initialization function,
  232. or load a provider module with the given name and run its provider
  233. entry point, \f(CW\*(C`OSSL_provider_init\*(C'\fR. The \fIname\fR can be a path
  234. to a provider module, in that case the provider name as returned
  235. by \fBOSSL_PROVIDER_get0_name()\fR will be the path. Interpretation
  236. of relative paths is platform dependent and they are relative
  237. to the configured \*(L"\s-1MODULESDIR\*(R"\s0 directory or the path set in
  238. the environment variable \s-1OPENSSL_MODULES\s0 if set.
  239. .PP
  240. \&\fBOSSL_PROVIDER_try_load()\fR functions like \fBOSSL_PROVIDER_load()\fR, except that
  241. it does not disable the fallback providers if the provider cannot be
  242. loaded and initialized or if \fIretain_fallbacks\fR is nonzero.
  243. If the provider loads successfully and \fIretain_fallbacks\fR is zero, the
  244. fallback providers are disabled.
  245. .PP
  246. \&\fBOSSL_PROVIDER_load_ex()\fR and \fBOSSL_PROVIDER_try_load_ex()\fR are the variants
  247. of the previous functions accepting an \f(CW\*(C`OSSL_PARAM\*(C'\fR array of the parameters
  248. that are passed as the configuration of the loaded provider. The parameters
  249. of any type but \f(CW\*(C`OSSL_PARAM_UTF8_STRING\*(C'\fR are silently ignored. If the
  250. parameters are provided, they replace \fBall\fR the ones specified in the
  251. configuration file.
  252. .PP
  253. \&\fBOSSL_PROVIDER_unload()\fR unloads the given provider.
  254. For a provider added with \fBOSSL_PROVIDER_add_builtin()\fR, this simply
  255. runs its teardown function.
  256. .PP
  257. \&\fBOSSL_PROVIDER_available()\fR checks if a named provider is available
  258. for use.
  259. .PP
  260. \&\fBOSSL_PROVIDER_do_all()\fR iterates over all loaded providers, calling
  261. \&\fIcb\fR for each one, with the current provider in \fIprovider\fR and the
  262. \&\fIcbdata\fR that comes from the caller. If no other provider has been loaded
  263. before calling this function, the default provider is still available as
  264. fallback.
  265. See \fBOSSL_PROVIDER\-default\fR\|(7) for more information on this fallback
  266. behaviour.
  267. .PP
  268. \&\fBOSSL_PROVIDER_gettable_params()\fR is used to get a provider parameter
  269. descriptor set as a constant \s-1\fBOSSL_PARAM\s0\fR\|(3) array.
  270. .PP
  271. \&\fBOSSL_PROVIDER_get_params()\fR is used to get provider parameter values.
  272. The caller must prepare the \s-1\fBOSSL_PARAM\s0\fR\|(3) array before calling this
  273. function, and the variables acting as buffers for this parameter array
  274. should be filled with data when it returns successfully.
  275. .PP
  276. \&\fBOSSL_PROVIDER_self_test()\fR is used to run a provider's self tests on demand.
  277. If the self tests fail then the provider will fail to provide any further
  278. services and algorithms. \fBOSSL_SELF_TEST_set_callback\fR\|(3) may be called
  279. beforehand in order to display diagnostics for the running self tests.
  280. .PP
  281. \&\fBOSSL_PROVIDER_query_operation()\fR calls the provider's \fIquery_operation\fR
  282. function (see \fBprovider\fR\|(7)), if the provider has one. It returns an
  283. array of \fI\s-1OSSL_ALGORITHM\s0\fR for the given \fIoperation_id\fR terminated by an all
  284. \&\s-1NULL OSSL_ALGORITHM\s0 entry. This is considered a low-level function that most
  285. applications should not need to call.
  286. .PP
  287. \&\fBOSSL_PROVIDER_unquery_operation()\fR calls the provider's \fIunquery_operation\fR
  288. function (see \fBprovider\fR\|(7)), if the provider has one. This is considered a
  289. low-level function that most applications should not need to call.
  290. .PP
  291. \&\fBOSSL_PROVIDER_get0_provider_ctx()\fR returns the provider context for the given
  292. provider. The provider context is an opaque handle set by the provider itself
  293. and is passed back to the provider by libcrypto in various function calls.
  294. .PP
  295. \&\fBOSSL_PROVIDER_get0_dispatch()\fR returns the provider's dispatch table as it was
  296. returned in the \fIout\fR parameter from the provider's init function. See
  297. \&\fBprovider\-base\fR\|(7).
  298. .PP
  299. If it is permissible to cache references to this array then \fI*no_store\fR is set
  300. to 0 or 1 otherwise. If the array is not cacheable then it is assumed to
  301. have a short lifetime.
  302. .PP
  303. \&\fBOSSL_PROVIDER_get0_name()\fR returns the name of the given provider.
  304. .PP
  305. \&\fBOSSL_PROVIDER_get_capabilities()\fR provides information about the capabilities
  306. supported by the provider specified in \fIprov\fR with the capability name
  307. \&\fIcapability\fR. For each capability of that name supported by the provider it
  308. will call the callback \fIcb\fR and supply a set of \s-1\fBOSSL_PARAM\s0\fR\|(3)s describing the
  309. capability. It will also pass back the argument \fIarg\fR. For more details about
  310. capabilities and what they can be used for please see
  311. \&\*(L"\s-1CAPABILTIIES\*(R"\s0 in \fBprovider\-base\fR\|(7).
  312. .SH "RETURN VALUES"
  313. .IX Header "RETURN VALUES"
  314. \&\fBOSSL_PROVIDER_set_default_search_path()\fR, \fBOSSL_PROVIDER_add()\fR,
  315. \&\fBOSSL_PROVIDER_unload()\fR, \fBOSSL_PROVIDER_get_params()\fR and
  316. \&\fBOSSL_PROVIDER_get_capabilities()\fR return 1 on success, or 0 on error.
  317. .PP
  318. \&\fBOSSL_PROVIDER_get0_default_search_path()\fR returns a pointer to a path on success,
  319. or \s-1NULL\s0 on error or if the path has not previously been set.
  320. .PP
  321. \&\fBOSSL_PROVIDER_load()\fR and \fBOSSL_PROVIDER_try_load()\fR return a pointer to a
  322. provider object on success, or \s-1NULL\s0 on error.
  323. .PP
  324. \&\fBOSSL_PROVIDER_do_all()\fR returns 1 if the callback \fIcb\fR returns 1 for every
  325. provider it is called with, or 0 if any provider callback invocation returns 0;
  326. callback processing stops at the first callback invocation on a provider
  327. that returns 0.
  328. .PP
  329. \&\fBOSSL_PROVIDER_available()\fR returns 1 if the named provider is available,
  330. otherwise 0.
  331. .PP
  332. \&\fBOSSL_PROVIDER_gettable_params()\fR returns a pointer to an array
  333. of constant \s-1\fBOSSL_PARAM\s0\fR\|(3), or \s-1NULL\s0 if none is provided.
  334. .PP
  335. \&\fBOSSL_PROVIDER_get_params()\fR and returns 1 on success, or 0 on error.
  336. .PP
  337. \&\fBOSSL_PROVIDER_query_operation()\fR returns an array of \s-1OSSL_ALGORITHM\s0 or \s-1NULL\s0 on
  338. error.
  339. .PP
  340. \&\fBOSSL_PROVIDER_self_test()\fR returns 1 if the self tests pass, or 0 on error.
  341. .SH "EXAMPLES"
  342. .IX Header "EXAMPLES"
  343. This demonstrates how to load the provider module \*(L"foo\*(R" and ask for
  344. its build information.
  345. .PP
  346. .Vb 3
  347. \& #include <openssl/params.h>
  348. \& #include <openssl/provider.h>
  349. \& #include <openssl/err.h>
  350. \&
  351. \& OSSL_PROVIDER *prov = NULL;
  352. \& const char *build = NULL;
  353. \& OSSL_PARAM request[] = {
  354. \& { "buildinfo", OSSL_PARAM_UTF8_PTR, &build, 0, 0 },
  355. \& { NULL, 0, NULL, 0, 0 }
  356. \& };
  357. \&
  358. \& if ((prov = OSSL_PROVIDER_load(NULL, "foo")) != NULL
  359. \& && OSSL_PROVIDER_get_params(prov, request))
  360. \& printf("Provider \*(Aqfoo\*(Aq buildinfo: %s\en", build);
  361. \& else
  362. \& ERR_print_errors_fp(stderr);
  363. .Ve
  364. .SH "SEE ALSO"
  365. .IX Header "SEE ALSO"
  366. \&\fBopenssl\-core.h\fR\|(7), \s-1\fBOSSL_LIB_CTX\s0\fR\|(3), \fBprovider\fR\|(7)
  367. .SH "HISTORY"
  368. .IX Header "HISTORY"
  369. The type and functions described here were added in OpenSSL 3.0.
  370. .PP
  371. The \fIOSSL_PROVIDER_load_ex\fR and \fIOSSL_PROVIDER_try_load_ex\fR functions were
  372. added in OpenSSL 3.2.
  373. .SH "COPYRIGHT"
  374. .IX Header "COPYRIGHT"
  375. Copyright 2019\-2023 The OpenSSL Project Authors. All Rights Reserved.
  376. .PP
  377. Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
  378. this file except in compliance with the License. You can obtain a copy
  379. in the file \s-1LICENSE\s0 in the source distribution or at
  380. <https://www.openssl.org/source/license.html>.