Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2015-11-08 02:32:39 +0300
committerAdam Langley <agl@google.com>2015-11-10 02:05:20 +0300
commitf606f9831b648907514ff358b89fc120aa9c1c4f (patch)
tree2c818dafa9d98817453b2dd5d61d407ad6e0c1bf /tool/pkcs12.cc
parente348ff4a729749a9144b99ca880e5cd8348f29d1 (diff)
bssl pkcs12 shouldn't crash on missing key.
PKCS#12 files may not necessarily include keys. Change-Id: Ibb43b609783b02aa9cbb192fea377081169666ff Reviewed-on: https://boringssl-review.googlesource.com/6456 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'tool/pkcs12.cc')
-rw-r--r--tool/pkcs12.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/tool/pkcs12.cc b/tool/pkcs12.cc
index c191531f..fe830d66 100644
--- a/tool/pkcs12.cc
+++ b/tool/pkcs12.cc
@@ -128,8 +128,10 @@ bool DoPKCS12(const std::vector<std::string> &args) {
return false;
}
- PEM_write_PrivateKey(stdout, key, NULL, NULL, 0, NULL, NULL);
- EVP_PKEY_free(key);
+ if (key != NULL) {
+ PEM_write_PrivateKey(stdout, key, NULL, NULL, 0, NULL, NULL);
+ EVP_PKEY_free(key);
+ }
for (size_t i = 0; i < sk_X509_num(certs); i++) {
PEM_write_X509(stdout, sk_X509_value(certs, i));