1.\" $OpenBSD: SSL_CTX_set_max_cert_list.3,v 1.6 2019/06/12 09:36:30 schwarze Exp $ 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 3.\" 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 5.\" Copyright (c) 2001 The OpenSSL Project. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in 16.\" the documentation and/or other materials provided with the 17.\" distribution. 18.\" 19.\" 3. All advertising materials mentioning features or use of this 20.\" software must display the following acknowledgment: 21.\" "This product includes software developed by the OpenSSL Project 22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 23.\" 24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 25.\" endorse or promote products derived from this software without 26.\" prior written permission. For written permission, please contact 27.\" openssl-core@openssl.org. 28.\" 29.\" 5. Products derived from this software may not be called "OpenSSL" 30.\" nor may "OpenSSL" appear in their names without prior written 31.\" permission of the OpenSSL Project. 32.\" 33.\" 6. Redistributions of any form whatsoever must retain the following 34.\" acknowledgment: 35.\" "This product includes software developed by the OpenSSL Project 36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 37.\" 38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" 51.Dd $Mdocdate: June 12 2019 $ 52.Dt SSL_CTX_SET_MAX_CERT_LIST 3 53.Os 54.Sh NAME 55.Nm SSL_CTX_set_max_cert_list , 56.Nm SSL_CTX_get_max_cert_list , 57.Nm SSL_set_max_cert_list , 58.Nm SSL_get_max_cert_list 59.Nd manipulate allowed size for the peer's certificate chain 60.Sh SYNOPSIS 61.In openssl/ssl.h 62.Ft long 63.Fn SSL_CTX_set_max_cert_list "SSL_CTX *ctx" "long size" 64.Ft long 65.Fn SSL_CTX_get_max_cert_list "SSL_CTX *ctx" 66.Ft long 67.Fn SSL_set_max_cert_list "SSL *ssl" "long size" 68.Ft long 69.Fn SSL_get_max_cert_list "SSL *ctx" 70.Sh DESCRIPTION 71.Fn SSL_CTX_set_max_cert_list 72sets the maximum size allowed for the peer's certificate chain for all 73.Vt SSL 74objects created from 75.Fa ctx 76to be 77.Fa size 78bytes. 79The 80.Vt SSL 81objects inherit the setting valid for 82.Fa ctx 83at the time 84.Xr SSL_new 3 85is being called. 86.Pp 87.Fn SSL_CTX_get_max_cert_list 88returns the currently set maximum size for 89.Fa ctx . 90.Pp 91.Fn SSL_set_max_cert_list 92sets the maximum size allowed for the peer's certificate chain for 93.Fa ssl 94to be 95.Fa size 96bytes. 97This setting stays valid until a new value is set. 98.Pp 99.Fn SSL_get_max_cert_list 100returns the currently set maximum size for 101.Fa ssl . 102.Pp 103During the handshake process, the peer may send a certificate chain. 104The TLS/SSL standard does not give any maximum size of the certificate chain. 105The OpenSSL library handles incoming data by a dynamically allocated buffer. 106In order to prevent this buffer from growing without bound due to data 107received from a faulty or malicious peer, a maximum size for the certificate 108chain is set. 109.Pp 110The default value for the maximum certificate chain size is 100kB (30kB 111on the 16bit DOS platform). 112This should be sufficient for usual certificate chains 113(OpenSSL's default maximum chain length is 10, see 114.Xr SSL_CTX_set_verify 3 , 115and certificates without special extensions have a typical size of 1-2kB). 116.Pp 117For special applications it can be necessary to extend the maximum certificate 118chain size allowed to be sent by the peer. 119See for example the work on 120.%T "Internet X.509 Public Key Infrastructure Proxy Certificate Profile" 121and 122.%T "TLS Delegation Protocol" 123at 124.Lk https://www.ietf.org/ 125and 126.Lk http://www.globus.org/ . 127.Pp 128Under normal conditions it should never be necessary to set a value smaller 129than the default, as the buffer is handled dynamically and only uses the 130memory actually required by the data sent by the peer. 131.Pp 132If the maximum certificate chain size allowed is exceeded, the handshake will 133fail with a 134.Dv SSL_R_EXCESSIVE_MESSAGE_SIZE 135error. 136.Sh RETURN VALUES 137.Fn SSL_CTX_set_max_cert_list 138and 139.Fn SSL_set_max_cert_list 140return the previously set value. 141.Pp 142.Fn SSL_CTX_get_max_cert_list 143and 144.Fn SSL_get_max_cert_list 145return the currently set value. 146.Sh SEE ALSO 147.Xr ssl 3 , 148.Xr SSL_CTX_ctrl 3 , 149.Xr SSL_CTX_set_verify 3 , 150.Xr SSL_new 3 151.Sh HISTORY 152These functions first appeared in OpenSSL 0.9.7 153and have been available since 154.Ox 3.2 . 155