EVP_KEM_free.pod 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. =pod
  2. =head1 NAME
  3. EVP_KEM_fetch, EVP_KEM_free, EVP_KEM_up_ref,
  4. EVP_KEM_get0_name, EVP_KEM_is_a, EVP_KEM_get0_provider,
  5. EVP_KEM_do_all_provided, EVP_KEM_names_do_all, EVP_KEM_get0_description,
  6. EVP_KEM_gettable_ctx_params, EVP_KEM_settable_ctx_params
  7. - Functions to manage EVP_KEM algorithm objects
  8. =head1 SYNOPSIS
  9. #include <openssl/evp.h>
  10. EVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
  11. const char *properties);
  12. void EVP_KEM_free(EVP_KEM *kem);
  13. int EVP_KEM_up_ref(EVP_KEM *kem);
  14. const char *EVP_KEM_get0_name(const EVP_KEM *kem);
  15. int EVP_KEM_is_a(const EVP_KEM *kem, const char *name);
  16. OSSL_PROVIDER *EVP_KEM_get0_provider(const EVP_KEM *kem);
  17. void EVP_KEM_do_all_provided(OSSL_LIB_CTX *libctx,
  18. void (*fn)(EVP_KEM *kem, void *arg), void *arg);
  19. int EVP_KEM_names_do_all(const EVP_KEM *kem,
  20. void (*fn)(const char *name, void *data), void *data);
  21. const char *EVP_KEM_get0_description(const EVP_KEM *kem);
  22. const OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem);
  23. const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem);
  24. =head1 DESCRIPTION
  25. EVP_KEM_fetch() fetches the implementation for the given B<algorithm> from any
  26. provider offering it, within the criteria given by the B<properties> and in the
  27. scope of the given library context B<ctx> (see L<OSSL_LIB_CTX(3)>). The algorithm
  28. will be one offering functions for performing asymmetric kem related tasks such
  29. as key encapsulation and decapsulation.
  30. See L<crypto(7)/ALGORITHM FETCHING> for further information.
  31. The returned value must eventually be freed with EVP_KEM_free().
  32. EVP_KEM_free() decrements the reference count for the B<EVP_KEM> structure.
  33. Typically this structure will have been obtained from an earlier call to
  34. EVP_KEM_fetch(). If the reference count drops to 0 then the structure is freed.
  35. If the argument is NULL, nothing is done.
  36. EVP_KEM_up_ref() increments the reference count for an B<EVP_KEM> structure.
  37. EVP_KEM_is_a() returns 1 if I<kem> is an implementation of an
  38. algorithm that's identifiable with I<name>, otherwise 0.
  39. EVP_KEM_get0_provider() returns the provider that I<kem> was fetched from.
  40. EVP_KEM_do_all_provided() traverses all EVP_KEMs implemented by all activated
  41. providers in the given library context I<libctx>, and for each of the
  42. implementations, calls the given function I<fn> with the implementation method
  43. and the given I<arg> as argument.
  44. EVP_KEM_get0_name() returns the algorithm name from the provided
  45. implementation for the given I<kem>. Note that the I<kem> may have
  46. multiple synonyms associated with it. In this case the first name from the
  47. algorithm definition is returned. Ownership of the returned string is retained
  48. by the I<kem> object and should not be freed by the caller.
  49. EVP_KEM_names_do_all() traverses all names for I<kem>, and calls I<fn> with
  50. each name and I<data>.
  51. EVP_KEM_get0_description() returns a description of the I<kem>, meant for
  52. display and human consumption. The description is at the discretion of
  53. the I<kem> implementation.
  54. EVP_KEM_gettable_ctx_params() and EVP_KEM_settable_ctx_params() return
  55. a constant L<OSSL_PARAM(3)> array that describes the names and types of key
  56. parameters that can be retrieved or set by a key encapsulation algorithm using
  57. L<EVP_PKEY_CTX_get_params(3)> and L<EVP_PKEY_CTX_set_params(3)>.
  58. =head1 RETURN VALUES
  59. EVP_KEM_fetch() returns a pointer to an B<EVP_KEM> for success or B<NULL> for
  60. failure.
  61. EVP_KEM_up_ref() returns 1 for success or 0 otherwise.
  62. EVP_KEM_names_do_all() returns 1 if the callback was called for all names. A
  63. return value of 0 means that the callback was not called for any names.
  64. EVP_KEM_gettable_ctx_params() and EVP_KEM_settable_ctx_params() return
  65. a constant L<OSSL_PARAM(3)> array or NULL on error.
  66. =head1 SEE ALSO
  67. L<crypto(7)/ALGORITHM FETCHING>, L<OSSL_PROVIDER(3)>
  68. =head1 HISTORY
  69. The functions described here were added in OpenSSL 3.0.
  70. =head1 COPYRIGHT
  71. Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
  72. Licensed under the Apache License 2.0 (the "License"). You may not use
  73. this file except in compliance with the License. You can obtain a copy
  74. in the file LICENSE in the source distribution or at
  75. L<https://www.openssl.org/source/license.html>.
  76. =cut