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