Fix memory leak in generate_key wrapper. Other fixes.

- catch errors in looking for the keyring
- static_assert to prevent a buffer overrun
- remove obsolete, misleading comment
- dial down priority of some log messages
- explain why we ignore some errors
- idiomatic C++11

Bug: 27552432
Change-Id: Ic3ee05b41eae45e7c6b571a459b326a483663526
diff --git a/KeyStorage.cpp b/KeyStorage.cpp
index 2338f23..d51fc4f 100644
--- a/KeyStorage.cpp
+++ b/KeyStorage.cpp
@@ -194,7 +194,7 @@
         const std::string &salt, std::string &stretched) {
     if (stretching == kStretch_nopassword) {
         if (!secret.empty()) {
-            LOG(ERROR) << "Password present but stretching is nopasswd";
+            LOG(WARNING) << "Password present but stretching is nopassword";
             // Continue anyway
         }
         stretched.clear();