aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli/utils.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-08-31 08:23:30 -0400
committerJack Lloyd <[email protected]>2017-08-31 08:23:30 -0400
commit7fecb1254232311d5f2ca62f9cda1e12a4b2558c (patch)
tree2e2cd8ef8ca016310d4cc9aa6bee7abc96c39e2f /src/cli/utils.cpp
parentdf4287c3c763de14b262ed39d54b3de552adbefb (diff)
More MSVC warnings fixes
Diffstat (limited to 'src/cli/utils.cpp')
-rw-r--r--src/cli/utils.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cli/utils.cpp b/src/cli/utils.cpp
index 2bf03c760..63e0fc7d6 100644
--- a/src/cli/utils.cpp
+++ b/src/cli/utils.cpp
@@ -328,7 +328,15 @@ class Generate_Bcrypt final : public Command
const std::string password = get_arg("password");
const size_t wf = get_arg_sz("work-factor");
- output() << Botan::generate_bcrypt(password, rng(), wf) << "\n";
+ if(wf < 4 || wf > 18)
+ {
+ error_output() << "Invalid bcrypt work factor\n";
+ }
+ else
+ {
+ const uint16_t wf16 = static_cast<uint16_t>(wf);
+ output() << Botan::generate_bcrypt(password, rng(), wf16) << "\n";
+ }
}
};