DH_set_method.pod 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. =pod
  2. =head1 NAME
  3. DH_set_default_method, DH_get_default_method,
  4. DH_set_method, DH_new_method, DH_OpenSSL - select DH method
  5. =head1 SYNOPSIS
  6. #include <openssl/dh.h>
  7. void DH_set_default_method(const DH_METHOD *meth);
  8. const DH_METHOD *DH_get_default_method(void);
  9. int DH_set_method(DH *dh, const DH_METHOD *meth);
  10. DH *DH_new_method(ENGINE *engine);
  11. const DH_METHOD *DH_OpenSSL(void);
  12. =head1 DESCRIPTION
  13. A B<DH_METHOD> specifies the functions that OpenSSL uses for Diffie-Hellman
  14. operations. By modifying the method, alternative implementations
  15. such as hardware accelerators may be used. IMPORTANT: See the NOTES section for
  16. important information about how these DH API functions are affected by the use
  17. of B<ENGINE> API calls.
  18. Initially, the default DH_METHOD is the OpenSSL internal implementation, as
  19. returned by DH_OpenSSL().
  20. DH_set_default_method() makes B<meth> the default method for all DH
  21. structures created later.
  22. B<NB>: This is true only whilst no ENGINE has been set
  23. as a default for DH, so this function is no longer recommended.
  24. This function is not thread-safe and should not be called at the same time
  25. as other OpenSSL functions.
  26. DH_get_default_method() returns a pointer to the current default DH_METHOD.
  27. However, the meaningfulness of this result is dependent on whether the ENGINE
  28. API is being used, so this function is no longer recommended.
  29. DH_set_method() selects B<meth> to perform all operations using the key B<dh>.
  30. This will replace the DH_METHOD used by the DH key and if the previous method
  31. was supplied by an ENGINE, the handle to that ENGINE will be released during the
  32. change. It is possible to have DH keys that only work with certain DH_METHOD
  33. implementations (eg. from an ENGINE module that supports embedded
  34. hardware-protected keys), and in such cases attempting to change the DH_METHOD
  35. for the key can have unexpected results.
  36. DH_new_method() allocates and initializes a DH structure so that B<engine> will
  37. be used for the DH operations. If B<engine> is NULL, the default ENGINE for DH
  38. operations is used, and if no default ENGINE is set, the DH_METHOD controlled by
  39. DH_set_default_method() is used.
  40. A new DH_METHOD object may be constructed using DH_meth_new() (see
  41. L<DH_meth_new(3)>).
  42. =head1 RETURN VALUES
  43. DH_OpenSSL() and DH_get_default_method() return pointers to the respective
  44. B<DH_METHOD>s.
  45. DH_set_default_method() returns no value.
  46. DH_set_method() returns non-zero if the provided B<meth> was successfully set as
  47. the method for B<dh> (including unloading the ENGINE handle if the previous
  48. method was supplied by an ENGINE).
  49. DH_new_method() returns NULL and sets an error code that can be obtained by
  50. L<ERR_get_error(3)> if the allocation fails. Otherwise it
  51. returns a pointer to the newly allocated structure.
  52. =head1 SEE ALSO
  53. L<DH_new(3)>, L<DH_new(3)>, L<DH_meth_new(3)>
  54. =head1 COPYRIGHT
  55. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  56. Licensed under the Apache License 2.0 (the "License"). You may not use
  57. this file except in compliance with the License. You can obtain a copy
  58. in the file LICENSE in the source distribution or at
  59. L<https://www.openssl.org/source/license.html>.
  60. =cut