From 8deddb4da07bfb901b90860bdf67f8dd84e05ec3 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Thu, 3 Jan 2019 09:33:59 -0500 Subject: Casts to avoid MSVC warnings --- src/cli/tss.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cli/tss.cpp b/src/cli/tss.cpp index 60149ee29..0756616b2 100644 --- a/src/cli/tss.cpp +++ b/src/cli/tss.cpp @@ -42,8 +42,14 @@ class TSS_Split final : public Command const size_t N = get_arg_sz("N"); const size_t M = get_arg_sz("M"); + if(M <= 1 || N <= 1 || M > N || N >= 255) + throw CLI_Usage_Error("Invalid N/M parameters for secret splitting"); + Botan::secure_vector secret = slurp_file_lvec(input); + if(secret.size() > 0xFFFF) + throw CLI_Usage_Error("Secret is too large for this TSS format"); + std::vector id = Botan::hex_decode(id_str); if(id.empty()) @@ -53,7 +59,9 @@ class TSS_Split final : public Command } std::vector shares = - Botan::RTSS_Share::split(M, N, secret.data(), secret.size(), id, hash_algo, rng()); + Botan::RTSS_Share::split(static_cast(M), static_cast(N), + secret.data(), static_cast(secret.size()), + id, hash_algo, rng()); for(size_t i = 0; i != shares.size(); ++i) { -- cgit v1.2.3