aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorHannes Rantzsch <[email protected]>2020-02-17 16:12:38 +0700
committerHannes Rantzsch <[email protected]>2020-02-18 14:49:22 +0700
commit88967ef754260947864d618fdbd86a873f6050d9 (patch)
tree72c302e33bff98a55707799fff00c25da0bbbf78 /src/lib
parent426bfee0725d509ae78f7993a28dae72fa54dcef (diff)
use bind rather than a lambda
This avoids crashing due to a bug in Clang 8.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/pubkey/pkcs8.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/pubkey/pkcs8.cpp b/src/lib/pubkey/pkcs8.cpp
index 0238491dc..abb488af1 100644
--- a/src/lib/pubkey/pkcs8.cpp
+++ b/src/lib/pubkey/pkcs8.cpp
@@ -375,7 +375,9 @@ std::unique_ptr<Private_Key> load_key(DataSource& source,
std::unique_ptr<Private_Key> load_key(DataSource& source,
const std::string& pass)
{
- return load_key(source, [pass]() { return pass; }, true);
+ // We need to use bind rather than a lambda capturing `pass` here in order to avoid a Clang 8 bug.
+ // See https://github.com/randombit/botan/issues/2255.
+ return load_key(source, std::bind([](const std::string pass) { return pass; }, pass), true);
}
/*
@@ -454,7 +456,9 @@ Private_Key* load_key(const std::string& fsname,
{
BOTAN_UNUSED(rng);
DataSource_Stream in(fsname);
- return PKCS8::load_key(in, [pass]() { return pass; }).release();
+ // We need to use bind rather than a lambda capturing `pass` here in order to avoid a Clang 8 bug.
+ // See https://github.com/randombit/botan/issues/2255.
+ return PKCS8::load_key(in, std::bind([](const std::string pass) { return pass; }, pass)).release();
}
/*