From: tb Date: Sat, 23 Oct 2021 16:11:30 +0000 (+0000) Subject: Unhandroll X509_up_ref() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=526e23522a02a0cb01f162e91517249dba033786;p=openbsd Unhandroll X509_up_ref() ok beck jsing --- diff --git a/lib/libssl/ssl_cert.c b/lib/libssl/ssl_cert.c index b7c3718ef5d..a711b5db5c1 100644 --- a/lib/libssl/ssl_cert.c +++ b/lib/libssl/ssl_cert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_cert.c,v 1.84 2021/10/23 13:14:38 tb Exp $ */ +/* $OpenBSD: ssl_cert.c,v 1.85 2021/10/23 16:11:30 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -224,8 +224,7 @@ ssl_cert_dup(CERT *cert) for (i = 0; i < SSL_PKEY_NUM; i++) { if (cert->pkeys[i].x509 != NULL) { ret->pkeys[i].x509 = cert->pkeys[i].x509; - CRYPTO_add(&ret->pkeys[i].x509->references, 1, - CRYPTO_LOCK_X509); + X509_up_ref(ret->pkeys[i].x509); } if (cert->pkeys[i].privatekey != NULL) { diff --git a/lib/libssl/ssl_clnt.c b/lib/libssl/ssl_clnt.c index 2e7047eb55c..ea502e6a330 100644 --- a/lib/libssl/ssl_clnt.c +++ b/lib/libssl/ssl_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_clnt.c,v 1.115 2021/10/23 14:40:54 jsing Exp $ */ +/* $OpenBSD: ssl_clnt.c,v 1.116 2021/10/23 16:11:30 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1187,7 +1187,7 @@ ssl3_get_server_certificate(SSL *s) } sc->peer_cert_type = i; - CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509); + X509_up_ref(x); /* * Why would the following ever happen? * We just created sc a couple of lines ago. @@ -1197,7 +1197,7 @@ ssl3_get_server_certificate(SSL *s) sc->peer_key = &(sc->peer_pkeys[i]); X509_free(s->session->peer); - CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509); + X509_up_ref(x); s->session->peer = x; s->session->verify_result = s->verify_result; diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c index 1363cd64fd8..c48cee33b29 100644 --- a/lib/libssl/ssl_lib.c +++ b/lib/libssl/ssl_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_lib.c,v 1.272 2021/10/23 15:30:44 beck Exp $ */ +/* $OpenBSD: ssl_lib.c,v 1.273 2021/10/23 16:11:30 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -847,7 +847,7 @@ SSL_get_peer_certificate(const SSL *s) if (r == NULL) return (r); - CRYPTO_add(&r->references, 1, CRYPTO_LOCK_X509); + X509_up_ref(r); return (r); } diff --git a/lib/libssl/ssl_rsa.c b/lib/libssl/ssl_rsa.c index e3a1e5dc4ba..1d2f5fc9b40 100644 --- a/lib/libssl/ssl_rsa.c +++ b/lib/libssl/ssl_rsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_rsa.c,v 1.34 2021/06/11 11:13:53 jsing Exp $ */ +/* $OpenBSD: ssl_rsa.c,v 1.35 2021/10/23 16:11:30 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -392,7 +392,7 @@ ssl_set_cert(CERT *c, X509 *x) EVP_PKEY_free(pkey); X509_free(c->pkeys[i].x509); - CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509); + X509_up_ref(x); c->pkeys[i].x509 = x; c->key = &(c->pkeys[i]);