evp_keymgmt_util_export_to_provider.pod 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. =pod
  2. =head1 NAME
  3. evp_keymgmt_util_export,
  4. evp_keymgmt_util_export_to_provider,
  5. evp_keymgmt_util_find_operation_cache_index,
  6. evp_keymgmt_util_clear_operation_cache,
  7. evp_keymgmt_util_cache_keydata,
  8. evp_keymgmt_util_cache_keyinfo,
  9. evp_keymgmt_util_fromdata
  10. - internal KEYMGMT utility functions
  11. =head1 SYNOPSIS
  12. #include "crypto/evp.h"
  13. int evp_keymgmt_util_export(const EVP_PKEY *pk, int selection,
  14. OSSL_CALLBACK *export_cb, void *export_cbarg);
  15. void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt);
  16. size_t evp_keymgmt_util_find_operation_cache_index(EVP_PKEY *pk,
  17. EVP_KEYMGMT *keymgmt);
  18. void evp_keymgmt_util_clear_operation_cache(EVP_PKEY *pk);
  19. void evp_keymgmt_util_cache_keydata(EVP_PKEY *pk, size_t index,
  20. EVP_KEYMGMT *keymgmt, void *keydata);
  21. void evp_keymgmt_util_cache_keyinfo(EVP_PKEY *pk);
  22. void *evp_keymgmt_util_fromdata(EVP_PKEY *target, EVP_KEYMGMT *keymgmt,
  23. int selection, const OSSL_PARAM params[]);
  24. =head1 DESCRIPTION
  25. evp_keymgmt_util_export() calls L<evp_keymgmt_export(3)> with the
  26. I<keymgmt> and I<keydata> from I<pk>. This is a convenience function.
  27. evp_keymgmt_util_export_to_provider() exports cached key material
  28. (provider side key material) from the given key I<pk> to a provider
  29. via a B<EVP_KEYMGMT> interface, if this hasn't already been done.
  30. It maintains a cache of provider key references in I<pk> to keep track
  31. of all provider side keys.
  32. To export a legacy key, use L<evp_pkey_export_to_provider(3)> instead,
  33. as this function ignores any legacy key data.
  34. evp_keymgmt_util_find_operation_cache_index() finds the location if
  35. I<keymgmt> in I<pk>'s cache of provided keys for operations. If
  36. I<keymgmt> is NULL or couldn't be found in the cache, it finds the
  37. first empty slot instead if there is any.
  38. evp_keymgmt_util_clear_operation_cache() can be used to explicitly
  39. clear the cache of operation key references.
  40. evp_keymgmt_util_cache_keydata() can be used to assign a provider key
  41. object to a specific cache slot in the given I<target>.
  42. I<Use extreme care>.
  43. evp_keymgmt_util_cache_keyinfo() can be used to get all kinds of
  44. information from the provvider "origin" and save it in I<pk>'s
  45. information cache.
  46. evp_keymgmt_util_fromdata() can be used to add key object data to a
  47. given key I<target> via a B<EVP_KEYMGMT> interface. This is used as a
  48. helper for L<EVP_PKEY_fromdata(3)>.
  49. =head1 RETURN VALUES
  50. evp_keymgmt_export_to_provider() and evp_keymgmt_util_fromdata()
  51. return a pointer to the appropriate provider side key (created or
  52. found again), or NULL on error.
  53. evp_keymgmt_util_find_operation_cache_index() returns the index of the
  54. operation cache slot. If I<keymgmt> is NULL, or if there is no slot
  55. with a match for I<keymgmt>, the index of the first empty slot is
  56. returned, or the maximum number of slots if there isn't an empty one.
  57. =head1 NOTES
  58. "Legacy key" is the term used for any key that has been assigned to an
  59. B<EVP_PKEY> with EVP_PKEY_assign_RSA() and similar functions.
  60. =head1 SEE ALSO
  61. L<EVP_PKEY_ASN1_METHOD(3)>, L<EVP_PKEY_assign_RSA(3)>
  62. =head1 COPYRIGHT
  63. Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
  64. Licensed under the Apache License 2.0 (the "License"). You may not use
  65. this file except in compliance with the License. You can obtain a copy
  66. in the file LICENSE in the source distribution or at
  67. L<https://www.openssl.org/source/license.html>.
  68. =cut