Lines Matching +full:- +full:x

2  * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
4 * SPDX-License-Identifier: Apache-2.0
16 int __X509_show_info(X509 *x) in __X509_show_info() argument
18 return X509_METHOD_CALL(show_info, x); in __X509_show_info()
27 X509 *x; in __X509_new() local
29 x = ssl_mem_zalloc(sizeof(X509)); in __X509_new()
30 if (!x) { in __X509_new()
31 SSL_DEBUG(SSL_X509_ERROR_LEVEL, "no enough memory > (x)"); in __X509_new()
35 x->ref_counter = 1; in __X509_new()
37 if (ix && ix->method) in __X509_new()
38 x->method = ix->method; in __X509_new()
40 x->method = X509_method(); in __X509_new()
42 ret = X509_METHOD_CALL(new, x, ix); in __X509_new()
48 return x; in __X509_new()
51 ssl_mem_free(x); in __X509_new()
67 void X509_free(X509 *x) in X509_free() argument
69 SSL_ASSERT3(x); in X509_free()
71 if (--x->ref_counter > 0) { in X509_free()
75 X509_METHOD_CALL(free, x); in X509_free()
77 ssl_mem_free(x); in X509_free()
88 X509 *x; in d2i_X509() local
94 x = *cert; in d2i_X509()
96 x = X509_new(); in d2i_X509()
97 if (!x) { in d2i_X509()
104 ret = X509_METHOD_CALL(load, x, buffer, len); in d2i_X509()
110 return x; in d2i_X509()
114 X509_free(x); in d2i_X509()
125 return &ssl->param; in SSL_get0_param()
153 int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x) in SSL_CTX_add_client_CA() argument
156 SSL_ASSERT1(x); in SSL_CTX_add_client_CA()
158 if (ctx->client_CA == x) in SSL_CTX_add_client_CA()
161 X509_free(ctx->client_CA); in SSL_CTX_add_client_CA()
163 ctx->client_CA = x; in SSL_CTX_add_client_CA()
171 int SSL_add_client_CA(SSL *ssl, X509 *x) in SSL_add_client_CA() argument
174 SSL_ASSERT1(x); in SSL_add_client_CA()
176 if (ssl->client_CA == x) in SSL_add_client_CA()
179 X509_free(ssl->client_CA); in SSL_add_client_CA()
181 ssl->client_CA = x; in SSL_add_client_CA()
189 int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) in SSL_CTX_use_certificate() argument
192 SSL_ASSERT1(x); in SSL_CTX_use_certificate()
194 if (ctx->cert->x509 == x) in SSL_CTX_use_certificate()
197 X509_free(ctx->cert->x509); in SSL_CTX_use_certificate()
199 ctx->cert->x509 = x; in SSL_CTX_use_certificate()
200 x->ref_counter++; in SSL_CTX_use_certificate()
208 int SSL_use_certificate(SSL *ssl, X509 *x) in SSL_use_certificate() argument
211 SSL_ASSERT1(x); in SSL_use_certificate()
213 if (ssl->cert->x509 == x) in SSL_use_certificate()
216 X509_free(ssl->cert->x509); in SSL_use_certificate()
218 ssl->cert->x509 = x; in SSL_use_certificate()
223 long SSL_CTX_add_extra_chain_cert(SSL_CTX *ctx, X509 *x) in SSL_CTX_add_extra_chain_cert() argument
225 return SSL_CTX_use_certificate(ctx, x); in SSL_CTX_add_extra_chain_cert()
235 return ssl->cert->x509; in SSL_get_certificate()
245 X509 *x; in SSL_CTX_use_certificate_ASN1() local
247 x = d2i_X509(NULL, d, len); in SSL_CTX_use_certificate_ASN1()
248 if (!x) { in SSL_CTX_use_certificate_ASN1()
253 ret = SSL_CTX_use_certificate(ctx, x); // This uses the "x" so increments ref_count in SSL_CTX_use_certificate_ASN1()
259 X509_free(x); // decrements ref_count, so in case of happy flow doesn't free the "x" in SSL_CTX_use_certificate_ASN1()
263 X509_free(x); in SSL_CTX_use_certificate_ASN1()
275 X509 *x; in SSL_use_certificate_ASN1() local
277 x = d2i_X509(NULL, d, len); in SSL_use_certificate_ASN1()
278 if (!x) { in SSL_use_certificate_ASN1()
283 ret = SSL_use_certificate(ssl, x); in SSL_use_certificate_ASN1()
292 X509_free(x); in SSL_use_certificate_ASN1()
320 return ssl->session->peer; in SSL_get_peer_certificate()
326 int X509_STORE_add_cert(X509_STORE *store, X509 *x) { in X509_STORE_add_cert() argument
328 x->ref_counter++; in X509_STORE_add_cert()
332 SSL_ASSERT1(x); in X509_STORE_add_cert()
334 if (ctx->client_CA == x) { in X509_STORE_add_cert()
338 if (ctx->client_CA!=NULL) { in X509_STORE_add_cert()
339 X509_free(ctx->client_CA); in X509_STORE_add_cert()
342 ctx->client_CA = x; in X509_STORE_add_cert()
355 X509 *x; in PEM_read_bio_X509() local
358 if (bp->data == NULL || bp->dlen == 0) { in PEM_read_bio_X509()
362 x = *cert; in PEM_read_bio_X509()
364 x = X509_new(); in PEM_read_bio_X509()
365 if (!x) { in PEM_read_bio_X509()
372 ret = X509_METHOD_CALL(load, x, bp->data, bp->dlen); in PEM_read_bio_X509()
379 bp->data = NULL; in PEM_read_bio_X509()
380 bp->dlen = 0; in PEM_read_bio_X509()
381 return x; in PEM_read_bio_X509()
385 X509_free(x); in PEM_read_bio_X509()