SSL_CTX_set1_curves.pod 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_set1_curves, SSL_CTX_set1_curves_list, SSL_set1_curves,
  4. SSL_set1_curves_list, SSL_get1_curves, SSL_get_shared_curve,
  5. SSL_CTX_set_ecdh_auto, SSL_set_ecdh_auto - EC supported curve functions
  6. =head1 SYNOPSIS
  7. #include <openssl/ssl.h>
  8. int SSL_CTX_set1_curves(SSL_CTX *ctx, int *clist, int clistlen);
  9. int SSL_CTX_set1_curves_list(SSL_CTX *ctx, char *list);
  10. int SSL_set1_curves(SSL *ssl, int *clist, int clistlen);
  11. int SSL_set1_curves_list(SSL *ssl, char *list);
  12. int SSL_get1_curves(SSL *ssl, int *curves);
  13. int SSL_get_shared_curve(SSL *s, int n);
  14. int SSL_CTX_set_ecdh_auto(SSL_CTX *ctx, int onoff);
  15. int SSL_set_ecdh_auto(SSL *s, int onoff);
  16. =head1 DESCRIPTION
  17. SSL_CTX_set1_curves() sets the supported curves for B<ctx> to B<clistlen>
  18. curves in the array B<clist>. The array consist of all NIDs of curves in
  19. preference order. For a TLS client the curves are used directly in the
  20. supported curves extension. For a TLS server the curves are used to
  21. determine the set of shared curves.
  22. SSL_CTX_set1_curves_list() sets the supported curves for B<ctx> to
  23. string B<list>. The string is a colon separated list of curve NIDs or
  24. names, for example "P-521:P-384:P-256".
  25. SSL_set1_curves() and SSL_set1_curves_list() are similar except they set
  26. supported curves for the SSL structure B<ssl>.
  27. SSL_get1_curves() returns the set of supported curves sent by a client
  28. in the supported curves extension. It returns the total number of
  29. supported curves. The B<curves> parameter can be B<NULL> to simply
  30. return the number of curves for memory allocation purposes. The
  31. B<curves> array is in the form of a set of curve NIDs in preference
  32. order. It can return zero if the client did not send a supported curves
  33. extension.
  34. SSL_get_shared_curve() returns shared curve B<n> for a server-side
  35. SSL B<ssl>. If B<n> is -1 then the total number of shared curves is
  36. returned, which may be zero. Other than for diagnostic purposes,
  37. most applications will only be interested in the first shared curve
  38. so B<n> is normally set to zero. If the value B<n> is out of range,
  39. NID_undef is returned.
  40. SSL_CTX_set_ecdh_auto() and SSL_set_ecdh_auto() set automatic curve
  41. selection for server B<ctx> or B<ssl> to B<onoff>. If B<onoff> is 1 then
  42. the highest preference curve is automatically used for ECDH temporary
  43. keys used during key exchange.
  44. All these functions are implemented as macros.
  45. =head1 NOTES
  46. If an application wishes to make use of several of these functions for
  47. configuration purposes either on a command line or in a file it should
  48. consider using the SSL_CONF interface instead of manually parsing options.
  49. The functions SSL_CTX_set_ecdh_auto() and SSL_set_ecdh_auto() can be used to
  50. make a server always choose the most appropriate curve for a client. If set
  51. it will override any temporary ECDH parameters set by a server. Previous
  52. versions of OpenSSL could effectively only use a single ECDH curve set
  53. using a function such as SSL_CTX_set_ecdh_tmp(). Newer applications should
  54. just call:
  55. SSL_CTX_set_ecdh_auto(ctx, 1);
  56. and they will automatically support ECDH using the most appropriate shared
  57. curve.
  58. =head1 RETURN VALUES
  59. SSL_CTX_set1_curves(), SSL_CTX_set1_curves_list(), SSL_set1_curves(),
  60. SSL_set1_curves_list(), SSL_CTX_set_ecdh_auto() and SSL_set_ecdh_auto()
  61. return 1 for success and 0 for failure.
  62. SSL_get1_curves() returns the number of curves, which may be zero.
  63. SSL_get_shared_curve() returns the NID of shared curve B<n> or NID_undef if there
  64. is no shared curve B<n>; or the total number of shared curves if B<n>
  65. is -1.
  66. When called on a client B<ssl>, SSL_get_shared_curve() has no meaning and
  67. returns -1.
  68. =head1 SEE ALSO
  69. L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>
  70. =head1 HISTORY
  71. These functions were first added to OpenSSL 1.0.2.
  72. =cut