xref: /freebsd-src/crypto/openssl/doc/man3/SSL_get_shared_sigalgs.pod (revision e71b70530d95c4f34d8bdbd78d1242df1ba4a945)
1*e71b7053SJung-uk Kim=pod
2*e71b7053SJung-uk Kim
3*e71b7053SJung-uk Kim=head1 NAME
4*e71b7053SJung-uk Kim
5*e71b7053SJung-uk KimSSL_get_shared_sigalgs, SSL_get_sigalgs - get supported signature algorithms
6*e71b7053SJung-uk Kim
7*e71b7053SJung-uk Kim=head1 SYNOPSIS
8*e71b7053SJung-uk Kim
9*e71b7053SJung-uk Kim #include <openssl/ssl.h>
10*e71b7053SJung-uk Kim
11*e71b7053SJung-uk Kim int SSL_get_shared_sigalgs(SSL *s, int idx,
12*e71b7053SJung-uk Kim                            int *psign, int *phash, int *psignhash,
13*e71b7053SJung-uk Kim                            unsigned char *rsig, unsigned char *rhash);
14*e71b7053SJung-uk Kim
15*e71b7053SJung-uk Kim int SSL_get_sigalgs(SSL *s, int idx,
16*e71b7053SJung-uk Kim                     int *psign, int *phash, int *psignhash,
17*e71b7053SJung-uk Kim                     unsigned char *rsig, unsigned char *rhash);
18*e71b7053SJung-uk Kim
19*e71b7053SJung-uk Kim=head1 DESCRIPTION
20*e71b7053SJung-uk Kim
21*e71b7053SJung-uk KimSSL_get_shared_sigalgs() returns information about the shared signature
22*e71b7053SJung-uk Kimalgorithms supported by peer B<s>. The parameter B<idx> indicates the index
23*e71b7053SJung-uk Kimof the shared signature algorithm to return starting from zero. The signature
24*e71b7053SJung-uk Kimalgorithm NID is written to B<*psign>, the hash NID to B<*phash> and the
25*e71b7053SJung-uk Kimsign and hash NID to B<*psignhash>. The raw signature and hash values
26*e71b7053SJung-uk Kimare written to B<*rsig> and B<*rhash>.
27*e71b7053SJung-uk Kim
28*e71b7053SJung-uk KimSSL_get_sigalgs() is similar to SSL_get_shared_sigalgs() except it returns
29*e71b7053SJung-uk Kiminformation about all signature algorithms supported by B<s> in the order
30*e71b7053SJung-uk Kimthey were sent by the peer.
31*e71b7053SJung-uk Kim
32*e71b7053SJung-uk Kim=head1 RETURN VALUES
33*e71b7053SJung-uk Kim
34*e71b7053SJung-uk KimSSL_get_shared_sigalgs() and SSL_get_sigalgs() return the number of
35*e71b7053SJung-uk Kimsignature algorithms or B<0> if the B<idx> parameter is out of range.
36*e71b7053SJung-uk Kim
37*e71b7053SJung-uk Kim=head1 NOTES
38*e71b7053SJung-uk Kim
39*e71b7053SJung-uk KimThese functions are typically called for debugging purposes (to report
40*e71b7053SJung-uk Kimthe peer's preferences) or where an application wants finer control over
41*e71b7053SJung-uk Kimcertificate selection. Most applications will rely on internal handling
42*e71b7053SJung-uk Kimand will not need to call them.
43*e71b7053SJung-uk Kim
44*e71b7053SJung-uk KimIf an application is only interested in the highest preference shared
45*e71b7053SJung-uk Kimsignature algorithm it can just set B<idx> to zero.
46*e71b7053SJung-uk Kim
47*e71b7053SJung-uk KimAny or all of the parameters B<psign>, B<phash>, B<psignhash>, B<rsig> or
48*e71b7053SJung-uk KimB<rhash> can be set to B<NULL> if the value is not required. By setting
49*e71b7053SJung-uk Kimthem all to B<NULL> and setting B<idx> to zero the total number of
50*e71b7053SJung-uk Kimsignature algorithms can be determined: which can be zero.
51*e71b7053SJung-uk Kim
52*e71b7053SJung-uk KimThese functions must be called after the peer has sent a list of supported
53*e71b7053SJung-uk Kimsignature algorithms: after a client hello (for servers) or a certificate
54*e71b7053SJung-uk Kimrequest (for clients). They can (for example) be called in the certificate
55*e71b7053SJung-uk Kimcallback.
56*e71b7053SJung-uk Kim
57*e71b7053SJung-uk KimOnly TLS 1.2, TLS 1.3 and DTLS 1.2 currently support signature algorithms.
58*e71b7053SJung-uk KimIf these
59*e71b7053SJung-uk Kimfunctions are called on an earlier version of TLS or DTLS zero is returned.
60*e71b7053SJung-uk Kim
61*e71b7053SJung-uk KimThe shared signature algorithms returned by SSL_get_shared_sigalgs() are
62*e71b7053SJung-uk Kimordered according to configuration and peer preferences.
63*e71b7053SJung-uk Kim
64*e71b7053SJung-uk KimThe raw values correspond to the on the wire form as defined by RFC5246 et al.
65*e71b7053SJung-uk KimThe NIDs are OpenSSL equivalents. For example if the peer sent sha256(4) and
66*e71b7053SJung-uk Kimrsa(1) then B<*rhash> would be 4, B<*rsign> 1, B<*phash> NID_sha256, B<*psig>
67*e71b7053SJung-uk KimNID_rsaEncryption and B<*psighash> NID_sha256WithRSAEncryption.
68*e71b7053SJung-uk Kim
69*e71b7053SJung-uk KimIf a signature algorithm is not recognised the corresponding NIDs
70*e71b7053SJung-uk Kimwill be set to B<NID_undef>. This may be because the value is not supported,
71*e71b7053SJung-uk Kimis not an appropriate combination (for example MD5 and DSA) or the
72*e71b7053SJung-uk Kimsignature algorithm does not use a hash (for example Ed25519).
73*e71b7053SJung-uk Kim
74*e71b7053SJung-uk Kim=head1 SEE ALSO
75*e71b7053SJung-uk Kim
76*e71b7053SJung-uk KimL<SSL_CTX_set_cert_cb(3)>,
77*e71b7053SJung-uk KimL<ssl(7)>
78*e71b7053SJung-uk Kim
79*e71b7053SJung-uk Kim=head1 COPYRIGHT
80*e71b7053SJung-uk Kim
81*e71b7053SJung-uk KimCopyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
82*e71b7053SJung-uk Kim
83*e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License").  You may not use
84*e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
85*e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
86*e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
87*e71b7053SJung-uk Kim
88*e71b7053SJung-uk Kim=cut
89