1.\" $OpenBSD: X509_STORE_new.3,v 1.7 2021/11/17 16:08:32 schwarze Exp $ 2.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 3.\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 4.\" 5.\" This file is a derived work. 6.\" The changes are covered by the following Copyright and license: 7.\" 8.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> 9.\" 10.\" Permission to use, copy, modify, and distribute this software for any 11.\" purpose with or without fee is hereby granted, provided that the above 12.\" copyright notice and this permission notice appear in all copies. 13.\" 14.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 15.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 16.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 17.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 18.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 19.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 20.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 21.\" 22.\" The original file was written by 23.\" Alessandro Ghedini <alessandro@ghedini.me>. 24.\" Copyright (c) 2016 The OpenSSL Project. All rights reserved. 25.\" 26.\" Redistribution and use in source and binary forms, with or without 27.\" modification, are permitted provided that the following conditions 28.\" are met: 29.\" 30.\" 1. Redistributions of source code must retain the above copyright 31.\" notice, this list of conditions and the following disclaimer. 32.\" 33.\" 2. Redistributions in binary form must reproduce the above copyright 34.\" notice, this list of conditions and the following disclaimer in 35.\" the documentation and/or other materials provided with the 36.\" distribution. 37.\" 38.\" 3. All advertising materials mentioning features or use of this 39.\" software must display the following acknowledgment: 40.\" "This product includes software developed by the OpenSSL Project 41.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 42.\" 43.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 44.\" endorse or promote products derived from this software without 45.\" prior written permission. For written permission, please contact 46.\" openssl-core@openssl.org. 47.\" 48.\" 5. Products derived from this software may not be called "OpenSSL" 49.\" nor may "OpenSSL" appear in their names without prior written 50.\" permission of the OpenSSL Project. 51.\" 52.\" 6. Redistributions of any form whatsoever must retain the following 53.\" acknowledgment: 54.\" "This product includes software developed by the OpenSSL Project 55.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 56.\" 57.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 58.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 60.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 61.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 62.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 63.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 64.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 65.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 66.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 69.\" 70.Dd $Mdocdate: November 17 2021 $ 71.Dt X509_STORE_NEW 3 72.Os 73.Sh NAME 74.Nm X509_STORE_new , 75.Nm X509_STORE_up_ref , 76.Nm X509_STORE_free 77.Nd allocate and free X.509 certificate stores 78.Sh SYNOPSIS 79.In openssl/x509_vfy.h 80.Ft X509_STORE * 81.Fn X509_STORE_new void 82.Ft int 83.Fo X509_STORE_up_ref 84.Fa "X509_STORE *store" 85.Fc 86.Ft void 87.Fo X509_STORE_free 88.Fa "X509_STORE *store" 89.Fc 90.Sh DESCRIPTION 91.Fn X509_STORE_new 92allocates and initializes an empty X.509 certificate store 93and sets its reference count to 1. 94.Pp 95.Fn X509_STORE_up_ref 96increments the reference count of 97.Fa store 98by 1. 99.Pp 100.Fn X509_STORE_free 101decrements the reference count of 102.Fa store 103by 1. 104If the reference count reaches 0, 105all resources used by the store, including all certificates 106contained in it, are released and 107.Fa store 108itself is freed. 109If 110.Fa store 111is a 112.Dv NULL 113pointer, no action occurs. 114.Sh RETURN VALUES 115.Fn X509_STORE_new 116returns a newly created 117.Vt X509_STORE 118object or 119.Dv NULL 120if an error occurs. 121.Pp 122.Fn X509_STORE_up_ref 123returns 1 for success and 0 for failure. 124.Sh SEE ALSO 125.Xr PKCS7_verify 3 , 126.Xr SSL_CTX_set_cert_store 3 , 127.Xr X509_load_cert_file 3 , 128.Xr X509_LOOKUP_hash_dir 3 , 129.Xr X509_OBJECT_get0_X509 3 , 130.Xr X509_STORE_CTX_new 3 , 131.Xr X509_STORE_get_ex_new_index 3 , 132.Xr X509_STORE_load_locations 3 , 133.Xr X509_STORE_set1_param 3 , 134.Xr X509_STORE_set_verify_cb 3 , 135.Xr X509_verify_cert 3 136.Sh HISTORY 137.Fn X509_STORE_new 138and 139.Fn X509_STORE_free 140first appeared in SSLeay 0.8.0 and have been available since 141.Ox 2.4 . 142.Pp 143.Fn X509_STORE_up_ref 144first appeared in OpenSSL 1.1.0 and has been available since 145.Ox 6.3 . 146