1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimSSL_CTX_set1_sigalgs, SSL_set1_sigalgs, SSL_CTX_set1_sigalgs_list, 6e71b7053SJung-uk KimSSL_set1_sigalgs_list, SSL_CTX_set1_client_sigalgs, 7e71b7053SJung-uk KimSSL_set1_client_sigalgs, SSL_CTX_set1_client_sigalgs_list, 8e71b7053SJung-uk KimSSL_set1_client_sigalgs_list - set supported signature algorithms 9e71b7053SJung-uk Kim 10e71b7053SJung-uk Kim=head1 SYNOPSIS 11e71b7053SJung-uk Kim 12e71b7053SJung-uk Kim #include <openssl/ssl.h> 13e71b7053SJung-uk Kim 14e71b7053SJung-uk Kim long SSL_CTX_set1_sigalgs(SSL_CTX *ctx, const int *slist, long slistlen); 15e71b7053SJung-uk Kim long SSL_set1_sigalgs(SSL *ssl, const int *slist, long slistlen); 16e71b7053SJung-uk Kim long SSL_CTX_set1_sigalgs_list(SSL_CTX *ctx, const char *str); 17e71b7053SJung-uk Kim long SSL_set1_sigalgs_list(SSL *ssl, const char *str); 18e71b7053SJung-uk Kim 19e71b7053SJung-uk Kim long SSL_CTX_set1_client_sigalgs(SSL_CTX *ctx, const int *slist, long slistlen); 20e71b7053SJung-uk Kim long SSL_set1_client_sigalgs(SSL *ssl, const int *slist, long slistlen); 21e71b7053SJung-uk Kim long SSL_CTX_set1_client_sigalgs_list(SSL_CTX *ctx, const char *str); 22e71b7053SJung-uk Kim long SSL_set1_client_sigalgs_list(SSL *ssl, const char *str); 23e71b7053SJung-uk Kim 24e71b7053SJung-uk Kim=head1 DESCRIPTION 25e71b7053SJung-uk Kim 26e71b7053SJung-uk KimSSL_CTX_set1_sigalgs() and SSL_set1_sigalgs() set the supported signature 27e71b7053SJung-uk Kimalgorithms for B<ctx> or B<ssl>. The array B<slist> of length B<slistlen> 28e71b7053SJung-uk Kimmust consist of pairs of NIDs corresponding to digest and public key 29e71b7053SJung-uk Kimalgorithms. 30e71b7053SJung-uk Kim 31e71b7053SJung-uk KimSSL_CTX_set1_sigalgs_list() and SSL_set1_sigalgs_list() set the supported 32e71b7053SJung-uk Kimsignature algorithms for B<ctx> or B<ssl>. The B<str> parameter 33e71b7053SJung-uk Kimmust be a null terminated string consisting of a colon separated list of 34e71b7053SJung-uk Kimelements, where each element is either a combination of a public key 35e71b7053SJung-uk Kimalgorithm and a digest separated by B<+>, or a TLS 1.3-style named 36e71b7053SJung-uk KimSignatureScheme such as rsa_pss_pss_sha256. 37e71b7053SJung-uk Kim 38e71b7053SJung-uk KimSSL_CTX_set1_client_sigalgs(), SSL_set1_client_sigalgs(), 39e71b7053SJung-uk KimSSL_CTX_set1_client_sigalgs_list() and SSL_set1_client_sigalgs_list() set 40e71b7053SJung-uk Kimsignature algorithms related to client authentication, otherwise they are 41e71b7053SJung-uk Kimidentical to SSL_CTX_set1_sigalgs(), SSL_set1_sigalgs(), 42e71b7053SJung-uk KimSSL_CTX_set1_sigalgs_list() and SSL_set1_sigalgs_list(). 43e71b7053SJung-uk Kim 44e71b7053SJung-uk KimAll these functions are implemented as macros. The signature algorithm 45e71b7053SJung-uk Kimparameter (integer array or string) is not freed: the application should 46e71b7053SJung-uk Kimfree it, if necessary. 47e71b7053SJung-uk Kim 48e71b7053SJung-uk Kim=head1 NOTES 49e71b7053SJung-uk Kim 50e71b7053SJung-uk KimIf an application wishes to allow the setting of signature algorithms 51e71b7053SJung-uk Kimas one of many user configurable options it should consider using the more 52e71b7053SJung-uk Kimflexible SSL_CONF API instead. 53e71b7053SJung-uk Kim 54e71b7053SJung-uk KimThe signature algorithms set by a client are used directly in the supported 55e71b7053SJung-uk Kimsignature algorithm in the client hello message. 56e71b7053SJung-uk Kim 57e71b7053SJung-uk KimThe supported signature algorithms set by a server are not sent to the 58e71b7053SJung-uk Kimclient but are used to determine the set of shared signature algorithms 59e71b7053SJung-uk Kimand (if server preferences are set with SSL_OP_CIPHER_SERVER_PREFERENCE) 60e71b7053SJung-uk Kimtheir order. 61e71b7053SJung-uk Kim 62e71b7053SJung-uk KimThe client authentication signature algorithms set by a server are sent 63e71b7053SJung-uk Kimin a certificate request message if client authentication is enabled, 64e71b7053SJung-uk Kimotherwise they are unused. 65e71b7053SJung-uk Kim 66e71b7053SJung-uk KimSimilarly client authentication signature algorithms set by a client are 67e71b7053SJung-uk Kimused to determined the set of client authentication shared signature 68e71b7053SJung-uk Kimalgorithms. 69e71b7053SJung-uk Kim 70e71b7053SJung-uk KimSignature algorithms will neither be advertised nor used if the security level 71e71b7053SJung-uk Kimprohibits them (for example SHA1 if the security level is 4 or more). 72e71b7053SJung-uk Kim 73e71b7053SJung-uk KimCurrently the NID_md5, NID_sha1, NID_sha224, NID_sha256, NID_sha384 and 74e71b7053SJung-uk KimNID_sha512 digest NIDs are supported and the public key algorithm NIDs 75e71b7053SJung-uk KimEVP_PKEY_RSA, EVP_PKEY_RSA_PSS, EVP_PKEY_DSA and EVP_PKEY_EC. 76e71b7053SJung-uk Kim 77e71b7053SJung-uk KimThe short or long name values for digests can be used in a string (for 78e71b7053SJung-uk Kimexample "MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512") and 79e71b7053SJung-uk Kimthe public key algorithm strings "RSA", "RSA-PSS", "DSA" or "ECDSA". 80e71b7053SJung-uk Kim 81e71b7053SJung-uk KimThe TLS 1.3 signature scheme names (such as "rsa_pss_pss_sha256") can also 82e71b7053SJung-uk Kimbe used with the B<_list> forms of the API. 83e71b7053SJung-uk Kim 84e71b7053SJung-uk KimThe use of MD5 as a digest is strongly discouraged due to security weaknesses. 85e71b7053SJung-uk Kim 86610a21fdSJung-uk Kim=head1 RETURN VALUES 87610a21fdSJung-uk Kim 88610a21fdSJung-uk KimAll these functions return 1 for success and 0 for failure. 89610a21fdSJung-uk Kim 90e71b7053SJung-uk Kim=head1 EXAMPLES 91e71b7053SJung-uk Kim 92e71b7053SJung-uk KimSet supported signature algorithms to SHA256 with ECDSA and SHA256 with RSA 93e71b7053SJung-uk Kimusing an array: 94e71b7053SJung-uk Kim 95e71b7053SJung-uk Kim const int slist[] = {NID_sha256, EVP_PKEY_EC, NID_sha256, EVP_PKEY_RSA}; 96e71b7053SJung-uk Kim 97e71b7053SJung-uk Kim SSL_CTX_set1_sigalgs(ctx, slist, 4); 98e71b7053SJung-uk Kim 99e71b7053SJung-uk KimSet supported signature algorithms to SHA256 with ECDSA and SHA256 with RSA 100e71b7053SJung-uk Kimusing a string: 101e71b7053SJung-uk Kim 102e71b7053SJung-uk Kim SSL_CTX_set1_sigalgs_list(ctx, "ECDSA+SHA256:RSA+SHA256"); 103e71b7053SJung-uk Kim 104e71b7053SJung-uk Kim=head1 SEE ALSO 105e71b7053SJung-uk Kim 106e71b7053SJung-uk KimL<ssl(7)>, L<SSL_get_shared_sigalgs(3)>, 107e71b7053SJung-uk KimL<SSL_CONF_CTX_new(3)> 108e71b7053SJung-uk Kim 109e71b7053SJung-uk Kim=head1 COPYRIGHT 110e71b7053SJung-uk Kim 111*b077aed3SPierre ProncheryCopyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. 112e71b7053SJung-uk Kim 113*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 114e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 115e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 116e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 117e71b7053SJung-uk Kim 118e71b7053SJung-uk Kim=cut 119