]>
Commit | Line | Data |
---|---|---|
b305452f RL |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
655f73ce | 5 | evp_keymgmt_util_export, |
b305452f | 6 | evp_keymgmt_util_export_to_provider, |
64954e2f | 7 | evp_keymgmt_util_find_operation_cache, |
e32c608e RL |
8 | evp_keymgmt_util_clear_operation_cache, |
9 | evp_keymgmt_util_cache_keydata, | |
10 | evp_keymgmt_util_cache_keyinfo, | |
64954e2f P |
11 | evp_keymgmt_util_fromdata, |
12 | OP_CACHE_ELEM | |
b305452f RL |
13 | - internal KEYMGMT utility functions |
14 | ||
15 | =head1 SYNOPSIS | |
16 | ||
17 | #include "crypto/evp.h" | |
18 | ||
64954e2f P |
19 | typedef struct OP_CACHE_ELEM; |
20 | ||
655f73ce RL |
21 | int evp_keymgmt_util_export(const EVP_PKEY *pk, int selection, |
22 | OSSL_CALLBACK *export_cb, void *export_cbarg); | |
b305452f | 23 | void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt); |
64954e2f P |
24 | OP_CACHE_ELEM *evp_keymgmt_util_find_operation_cache(EVP_PKEY *pk, |
25 | EVP_KEYMGMT *keymgmt); | |
0b07db6f | 26 | int evp_keymgmt_util_clear_operation_cache(EVP_PKEY *pk, int locking); |
64954e2f | 27 | int evp_keymgmt_util_cache_keydata(EVP_PKEY *pk, |
0b07db6f | 28 | EVP_KEYMGMT *keymgmt, void *keydata); |
e32c608e | 29 | void evp_keymgmt_util_cache_keyinfo(EVP_PKEY *pk); |
b305452f RL |
30 | void *evp_keymgmt_util_fromdata(EVP_PKEY *target, EVP_KEYMGMT *keymgmt, |
31 | int selection, const OSSL_PARAM params[]); | |
32 | ||
33 | =head1 DESCRIPTION | |
34 | ||
655f73ce RL |
35 | evp_keymgmt_util_export() calls L<evp_keymgmt_export(3)> with the |
36 | I<keymgmt> and I<keydata> from I<pk>. This is a convenience function. | |
37 | ||
3f7ce7f1 RL |
38 | evp_keymgmt_util_export_to_provider() exports cached key material |
39 | (provider side key material) from the given key I<pk> to a provider | |
40 | via a B<EVP_KEYMGMT> interface, if this hasn't already been done. | |
b305452f | 41 | It maintains a cache of provider key references in I<pk> to keep track |
3f7ce7f1 | 42 | of all provider side keys. |
b305452f | 43 | |
e32c608e RL |
44 | To export a legacy key, use L<evp_pkey_export_to_provider(3)> instead, |
45 | as this function ignores any legacy key data. | |
b305452f | 46 | |
64954e2f P |
47 | evp_keymgmt_util_find_operation_cache() finds |
48 | I<keymgmt> in I<pk>'s cache of provided keys for operations. | |
49 | It should only be called while holding I<pk>'s lock (read or write). | |
b305452f | 50 | |
e32c608e | 51 | evp_keymgmt_util_clear_operation_cache() can be used to explicitly |
0b07db6f MC |
52 | clear the cache of operation key references. If I<locking> is set to 1 then |
53 | then I<pk>'s lock will be obtained while doing the clear. Otherwise it will be | |
54 | assumed that the lock has already been obtained or is not required. | |
e32c608e | 55 | |
64954e2f P |
56 | evp_keymgmt_util_cache_keydata() can be used to add a provider key |
57 | object to a B<PKEY>. | |
e32c608e RL |
58 | |
59 | evp_keymgmt_util_cache_keyinfo() can be used to get all kinds of | |
60 | information from the provvider "origin" and save it in I<pk>'s | |
61 | information cache. | |
b305452f RL |
62 | |
63 | evp_keymgmt_util_fromdata() can be used to add key object data to a | |
64 | given key I<target> via a B<EVP_KEYMGMT> interface. This is used as a | |
65 | helper for L<EVP_PKEY_fromdata(3)>. | |
66 | ||
67 | =head1 RETURN VALUES | |
68 | ||
69 | evp_keymgmt_export_to_provider() and evp_keymgmt_util_fromdata() | |
70 | return a pointer to the appropriate provider side key (created or | |
71 | found again), or NULL on error. | |
72 | ||
64954e2f | 73 | evp_keymgmt_util_find_operation_cache() returns a pointer to the |
e32c608e | 74 | operation cache slot. If I<keymgmt> is NULL, or if there is no slot |
64954e2f | 75 | with a match for I<keymgmt>, NULL is returned. |
e32c608e | 76 | |
0b07db6f MC |
77 | evp_keymgmt_util_cache_keydata() and evp_keymgmt_util_clear_operation_cache() |
78 | return 1 on success or 0 otherwise. | |
79 | ||
b305452f RL |
80 | =head1 NOTES |
81 | ||
82 | "Legacy key" is the term used for any key that has been assigned to an | |
83 | B<EVP_PKEY> with EVP_PKEY_assign_RSA() and similar functions. | |
84 | ||
85 | =head1 SEE ALSO | |
86 | ||
87 | L<EVP_PKEY_ASN1_METHOD(3)>, L<EVP_PKEY_assign_RSA(3)> | |
88 | ||
89 | =head1 COPYRIGHT | |
90 | ||
33388b44 | 91 | Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved. |
b305452f RL |
92 | |
93 | Licensed under the Apache License 2.0 (the "License"). You may not use | |
94 | this file except in compliance with the License. You can obtain a copy | |
95 | in the file LICENSE in the source distribution or at | |
96 | L<https://www.openssl.org/source/license.html>. | |
97 | ||
98 | =cut |