evp_keymgmt_util_export_to_provider.pod 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. =pod
  2. =head1 NAME
  3. evp_keymgmt_util_export_to_provider,
  4. evp_keymgmt_util_clear_pkey_cache,
  5. evp_keymgmt_util_cache_pkey,
  6. evp_keymgmt_util_fromdata
  7. - internal KEYMGMT utility functions
  8. =head1 SYNOPSIS
  9. #include "crypto/evp.h"
  10. void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt);
  11. void evp_keymgmt_util_clear_pkey_cache(EVP_PKEY *pk);
  12. void evp_keymgmt_util_cache_pkey(EVP_PKEY *pk, size_t index,
  13. EVP_KEYMGMT *keymgmt, void *keydata);
  14. void *evp_keymgmt_util_fromdata(EVP_PKEY *target, EVP_KEYMGMT *keymgmt,
  15. int selection, const OSSL_PARAM params[]);
  16. =head1 DESCRIPTION
  17. evp_keymgmt_util_export_to_provider() exports the key material from
  18. the given key I<pk> to a provider via a B<EVP_KEYMGMT> interface, if
  19. this hasn't already been done.
  20. It maintains a cache of provider key references in I<pk> to keep track
  21. of all such exports.
  22. If I<pk> has an assigned legacy key, a check is done to see if any of
  23. its key material has changed since last export, i.e. the legacy key's
  24. is_dirty() method returns 1.
  25. If it has, the cache of already exported keys is cleared, and a new
  26. export is made with the new key material.
  27. evp_keymgmt_util_clear_pkey_cache() can be used to explicitly clear
  28. the cache of provider key references.
  29. evp_keymgmt_util_cache_pkey() can be used to assign a provider key
  30. object to a specific cache slot in the given I<target>.
  31. I<Use with extreme care>.
  32. evp_keymgmt_util_fromdata() can be used to add key object data to a
  33. given key I<target> via a B<EVP_KEYMGMT> interface. This is used as a
  34. helper for L<EVP_PKEY_fromdata(3)>.
  35. =head1 RETURN VALUES
  36. evp_keymgmt_export_to_provider() and evp_keymgmt_util_fromdata()
  37. return a pointer to the appropriate provider side key (created or
  38. found again), or NULL on error.
  39. =head1 NOTES
  40. "Legacy key" is the term used for any key that has been assigned to an
  41. B<EVP_PKEY> with EVP_PKEY_assign_RSA() and similar functions.
  42. =head1 SEE ALSO
  43. L<EVP_PKEY_ASN1_METHOD(3)>, L<EVP_PKEY_assign_RSA(3)>
  44. =head1 COPYRIGHT
  45. Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
  46. Licensed under the Apache License 2.0 (the "License"). You may not use
  47. this file except in compliance with the License. You can obtain a copy
  48. in the file LICENSE in the source distribution or at
  49. L<https://www.openssl.org/source/license.html>.
  50. =cut