aboutsummaryrefslogtreecommitdiff
path: root/openssl/agent
diff options
context:
space:
mode:
Diffstat (limited to 'openssl/agent')
-rw-r--r--openssl/agent/pkcs11/agent.cxx16
-rw-r--r--openssl/agent/pkcs11/private-key.cxx10
-rw-r--r--openssl/agent/pkcs11/url.cxx10
3 files changed, 24 insertions, 12 deletions
diff --git a/openssl/agent/pkcs11/agent.cxx b/openssl/agent/pkcs11/agent.cxx
index 8d61208..273414e 100644
--- a/openssl/agent/pkcs11/agent.cxx
+++ b/openssl/agent/pkcs11/agent.cxx
@@ -6,6 +6,20 @@
#include <sys/socket.h>
#include <signal.h> // kill(), sigaction(), sigemptyset(), SIG*
+
+// _NSIG is Linux-specific but *BSD appear to have NSIG/_NSIG.
+//
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+# include <sys/signal.h>
+# ifndef _NSIG
+# ifdef NSIG
+# define _NSIG NSIG
+# else
+# error neither _NSIG nor NSIG defined
+# endif
+# endif
+#endif
+
#include <unistd.h> // fork(), getpid(), dup2(), setsid()
#include <termios.h> // tcgetattr(), tcsetattr()
@@ -235,8 +249,6 @@ namespace openssl
// future versions. Thus, we will provide our own implementation of the
// function that is inspired by the openssh implementation.
//
- // Note: _NSIG is Linux-specic.
- //
static volatile sig_atomic_t received_signals[_NSIG];
extern "C" void
diff --git a/openssl/agent/pkcs11/private-key.cxx b/openssl/agent/pkcs11/private-key.cxx
index ddaf0eb..0f95f72 100644
--- a/openssl/agent/pkcs11/private-key.cxx
+++ b/openssl/agent/pkcs11/private-key.cxx
@@ -212,7 +212,7 @@ namespace openssl
{
string d (API_STRING (si.slotDescription));
return "slot " + to_string (sid) + " (" +
- (!d.empty () ? d : API_STRING (si.manufacturerID)) + ")";
+ (!d.empty () ? d : API_STRING (si.manufacturerID)) + ')';
};
// Match the token information.
@@ -244,9 +244,9 @@ namespace openssl
string l (API_STRING (ti.label));
r += !l.empty ()
- ? "'" + l + "'"
- : "'" + API_STRING (ti.model) + "' by " +
- API_STRING (ti.manufacturerID);
+ ? ('\'' + l + '\'')
+ : ('\'' + API_STRING (ti.model) + "' by " +
+ API_STRING (ti.manufacturerID));
return r;
};
@@ -381,7 +381,7 @@ namespace openssl
&attr,
1 /* ulCount */);
if (r == CKR_OK)
- description += "'" + string (label.data (), label.size ()) +
+ description += '\'' + string (label.data (), label.size ()) +
"' ";
}
}
diff --git a/openssl/agent/pkcs11/url.cxx b/openssl/agent/pkcs11/url.cxx
index 0c946d9..8823480 100644
--- a/openssl/agent/pkcs11/url.cxx
+++ b/openssl/agent/pkcs11/url.cxx
@@ -34,7 +34,7 @@ namespace openssl
return v;
}
- throw invalid_argument (string ("invalid ") + what + " '" + s + "'");
+ throw invalid_argument (string ("invalid ") + what + " '" + s + '\'');
}
// url_traits
@@ -134,7 +134,7 @@ namespace openssl
if (i == e)
throw invalid_argument (
- "no value for attribute '" + string (s, b, n) + "'");
+ "no value for attribute '" + string (s, b, n) + '\'');
string a;
url::decode (s.begin () + b, s.begin () + i, back_inserter (a));
@@ -168,7 +168,7 @@ namespace openssl
auto set = [&an] (auto& attr, auto&& val)
{
if (attr)
- throw invalid_argument ("duplicate attribute '" + an + "'");
+ throw invalid_argument ("duplicate attribute '" + an + '\'');
attr = move (val);
};
@@ -213,7 +213,7 @@ namespace openssl
else if (an == "type")
set (type, move (av));
else
- throw invalid_argument ("unknown attribute '" + an + "'");
+ throw invalid_argument ("unknown attribute '" + an + '\'');
}
}
@@ -240,7 +240,7 @@ namespace openssl
auto set = [&an] (auto& attr, auto&& val)
{
if (attr)
- throw invalid_argument ("duplicate attribute '" + an + "'");
+ throw invalid_argument ("duplicate attribute '" + an + '\'');
attr = move (val);
};