aboutsummaryrefslogtreecommitdiff
path: root/fuzz
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2018-06-29 17:46:42 -0400
committerCQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>2018-07-03 22:47:36 +0000
commit2908dd141fa7f654b712330220e5c9ec75e62fb4 (patch)
tree72d8768d6779321584056ade21c3ebaf119cfee1 /fuzz
parent2e74fdaa4a847a6ed2d89f57eaf9936e05bd5169 (diff)
downloadboringssl-2908dd141fa7f654b712330220e5c9ec75e62fb4.zip
boringssl-2908dd141fa7f654b712330220e5c9ec75e62fb4.tar.gz
boringssl-2908dd141fa7f654b712330220e5c9ec75e62fb4.tar.bz2
Add bssl::UpRef.
bssl::UniquePtr and FOO_up_ref do not play well together. Add a helper to simplify this. This allows us to write things like: foo->cert = UpRef(bar->cert); instead of: if (bar->cert) { X509_up_ref(bar->cert.get()); } foo->cert.reset(bar->cert.get()); This also plays well with PushToStack. To append something to a stack while taking a reference, it's just: PushToStack(certs, UpRef(cert)) Change-Id: I99ae8de22b837588a2d8ffb58f86edc1d03ed46a Reviewed-on: https://boringssl-review.googlesource.com/29584 Commit-Queue: David Benjamin <davidben@google.com> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/ssl_ctx_api.cc4
1 files changed, 1 insertions, 3 deletions
diff --git a/fuzz/ssl_ctx_api.cc b/fuzz/ssl_ctx_api.cc
index 316980c..1566e79 100644
--- a/fuzz/ssl_ctx_api.cc
+++ b/fuzz/ssl_ctx_api.cc
@@ -212,10 +212,8 @@ struct GlobalState {
cert_.reset(d2i_X509(NULL, &bufp, sizeof(kCertificateDER)));
assert(cert_.get() != nullptr);
- X509_up_ref(cert_.get());
-
certs_.reset(sk_X509_new_null());
- sk_X509_push(certs_.get(), cert_.get());
+ PushToStack(certs_.get(), UpRef(cert_));
}
bssl::UniquePtr<EVP_PKEY> pkey_;