1.\" $OpenBSD: SSL_get_ciphers.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ 2.\" full merge up to: OpenSSL c3e64028 Mar 30 11:50:14 2005 +0000 3.\" selective merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 4.\" 5.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>, 6.\" Nick Mathewson <nickm@torproject.org>, and Kazuki Yamaguchi <k@rhe.jp>. 7.\" Copyright (c) 2000, 2005, 2015, 2016 The OpenSSL Project. 8.\" All rights reserved. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 14.\" 1. Redistributions of source code must retain the above copyright 15.\" notice, this list of conditions and the following disclaimer. 16.\" 17.\" 2. Redistributions in binary form must reproduce the above copyright 18.\" notice, this list of conditions and the following disclaimer in 19.\" the documentation and/or other materials provided with the 20.\" distribution. 21.\" 22.\" 3. All advertising materials mentioning features or use of this 23.\" software must display the following acknowledgment: 24.\" "This product includes software developed by the OpenSSL Project 25.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 26.\" 27.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 28.\" endorse or promote products derived from this software without 29.\" prior written permission. For written permission, please contact 30.\" openssl-core@openssl.org. 31.\" 32.\" 5. Products derived from this software may not be called "OpenSSL" 33.\" nor may "OpenSSL" appear in their names without prior written 34.\" permission of the OpenSSL Project. 35.\" 36.\" 6. Redistributions of any form whatsoever must retain the following 37.\" acknowledgment: 38.\" "This product includes software developed by the OpenSSL Project 39.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 40.\" 41.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 42.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 44.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 45.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 46.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 47.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 48.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 49.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 50.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 53.\" 54.Dd $Mdocdate: March 27 2018 $ 55.Dt SSL_GET_CIPHERS 3 56.Os 57.Sh NAME 58.Nm SSL_get_ciphers , 59.Nm SSL_CTX_get_ciphers , 60.Nm SSL_get_cipher_list 61.Nd get list of available SSL_CIPHERs 62.Sh SYNOPSIS 63.In openssl/ssl.h 64.Ft STACK_OF(SSL_CIPHER) * 65.Fn SSL_get_ciphers "const SSL *ssl" 66.Ft STACK_OF(SSL_CIPHER) * 67.Fn SSL_CTX_get_ciphers "const SSL_CTX *ctx" 68.Ft const char * 69.Fn SSL_get_cipher_list "const SSL *ssl" "int priority" 70.Sh DESCRIPTION 71.Fn SSL_get_ciphers 72returns the stack of available 73.Vt SSL_CIPHER Ns s 74for 75.Fa ssl , 76sorted by preference. 77If 78.Fa ssl 79is 80.Dv NULL 81or no ciphers are available, 82.Dv NULL 83is returned. 84.Pp 85.Fn SSL_CTX_get_ciphers 86returns the stack of available 87.Vt SSL_CIPHER Ns s 88for 89.Fa ctx . 90.Pp 91.Fn SSL_get_ciphers 92and 93.Fn SSL_CTX_get_ciphers 94return pointers to internal cipher stacks, which will be freed 95later on when the 96.Vt SSL 97or 98.Vt SSL_CTX 99object is freed. 100Therefore, the calling code must not free the return value itself. 101.Pp 102The details of the ciphers obtained by 103.Fn SSL_get_ciphers 104and 105.Fn SSL_CTX_get_ciphers 106can be obtained using the 107.Xr SSL_CIPHER_get_name 3 108family of functions. 109.Pp 110.Fn SSL_get_cipher_list 111returns a pointer to the name of the 112.Vt SSL_CIPHER 113listed for 114.Fa ssl 115with 116.Fa priority . 117If 118.Fa ssl 119is 120.Dv NULL , 121no ciphers are available, or there are fewer ciphers than 122.Fa priority 123available, 124.Dv NULL 125is returned. 126.Pp 127Call 128.Fn SSL_get_cipher_list 129with 130.Fa priority 131starting from 0 to obtain the sorted list of available ciphers, until 132.Dv NULL 133is returned. 134.Sh SEE ALSO 135.Xr ssl 3 , 136.Xr SSL_CIPHER_get_name 3 , 137.Xr SSL_CTX_set_cipher_list 3 138.Sh HISTORY 139.Fn SSL_get_cipher_list 140first appeared in SSLeay 0.5.2. 141.Fn SSL_get_ciphers 142first appeared in SSLeay 0.8.0. 143Both functions have been available since 144.Ox 2.4 . 145.Pp 146.Fn SSL_CTX_get_ciphers 147first appeared in OpenSSL 1.1.0 and has been available since 148.Ox 6.3 . 149