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