aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/prov/pkcs11/p11.h38
-rw-r--r--src/lib/pubkey/ed25519/ed25519_fe.cpp40
-rw-r--r--src/lib/pubkey/ed25519/ge.cpp4
-rw-r--r--src/lib/utils/parsing.cpp5
4 files changed, 56 insertions, 31 deletions
diff --git a/src/lib/prov/pkcs11/p11.h b/src/lib/prov/pkcs11/p11.h
index dfd89bb0f..597a8e125 100644
--- a/src/lib/prov/pkcs11/p11.h
+++ b/src/lib/prov/pkcs11/p11.h
@@ -1204,7 +1204,10 @@ class BOTAN_PUBLIC_API(2,0) LowLevel
const std::vector<uint8_t, TAlloc>& pin,
ReturnValue* return_value = ThrowException) const
{
- return C_InitPIN(session, reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(pin.data())), pin.size(), return_value);
+ return C_InitPIN(session,
+ reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(pin.data())),
+ static_cast<Ulong>(pin.size()),
+ return_value);
}
/**
@@ -1814,7 +1817,10 @@ class BOTAN_PUBLIC_API(2,0) LowLevel
}
encrypted_data.resize(encrypted_size);
- return C_Encrypt(session, const_cast<Byte*>(plaintext_data.data()), plaintext_data.size(), encrypted_data.data(),
+ return C_Encrypt(session,
+ const_cast<Byte*>(plaintext_data.data()),
+ static_cast<Ulong>(plaintext_data.size()),
+ encrypted_data.data(),
&encrypted_size, return_value);
}
@@ -1944,7 +1950,10 @@ class BOTAN_PUBLIC_API(2,0) LowLevel
}
decrypted_data.resize(decrypted_size);
- return C_Decrypt(session, const_cast<Byte*>(encrypted_data.data()), encrypted_data.size(), decrypted_data.data(),
+ return C_Decrypt(session,
+ const_cast<Byte*>(encrypted_data.data()),
+ static_cast<Ulong>(encrypted_data.size()),
+ decrypted_data.data(),
&decrypted_size, return_value);
}
@@ -2169,13 +2178,23 @@ class BOTAN_PUBLIC_API(2,0) LowLevel
ReturnValue* return_value = ThrowException) const
{
Ulong signature_size = 0;
- if(!C_Sign(session, const_cast<Byte*>((data.data())), data.size(), nullptr, &signature_size, return_value))
+ if(!C_Sign(session,
+ const_cast<Byte*>((data.data())),
+ static_cast<Ulong>(data.size()),
+ nullptr,
+ &signature_size,
+ return_value))
{
return false;
}
signature.resize(signature_size);
- return C_Sign(session, const_cast<Byte*>(data.data()), data.size(), signature.data(), &signature_size, return_value);
+ return C_Sign(session,
+ const_cast<Byte*>(data.data()),
+ static_cast<Ulong>(data.size()),
+ signature.data(),
+ &signature_size,
+ return_value);
}
/**
@@ -2392,7 +2411,12 @@ class BOTAN_PUBLIC_API(2,0) LowLevel
std::vector<uint8_t, TAllocB>& signature,
ReturnValue* return_value = ThrowException) const
{
- return C_Verify(session, const_cast<Byte*>(data.data()), data.size(), signature.data(), signature.size(), return_value);
+ return C_Verify(session,
+ const_cast<Byte*>(data.data()),
+ static_cast<Ulong>(data.size()),
+ signature.data(),
+ static_cast<Ulong>(signature.size()),
+ return_value);
}
/**
@@ -2434,7 +2458,7 @@ class BOTAN_PUBLIC_API(2,0) LowLevel
std::vector<uint8_t, TAlloc> part,
ReturnValue* return_value = ThrowException) const
{
- return C_VerifyUpdate(session, part.data(), part.size(), return_value);
+ return C_VerifyUpdate(session, part.data(), static_cast<Ulong>(part.size()), return_value);
}
/**
diff --git a/src/lib/pubkey/ed25519/ed25519_fe.cpp b/src/lib/pubkey/ed25519/ed25519_fe.cpp
index 3eef1bb80..d442d89a7 100644
--- a/src/lib/pubkey/ed25519/ed25519_fe.cpp
+++ b/src/lib/pubkey/ed25519/ed25519_fe.cpp
@@ -445,16 +445,16 @@ FE_25519 FE_25519::sqr_iter(const FE_25519& f, size_t iter)
carry<25,19>(h9, h0);
carry<26>(h0, h1);
- f0 = h0;
- f1 = h1;
- f2 = h2;
- f3 = h3;
- f4 = h4;
- f5 = h5;
- f6 = h6;
- f7 = h7;
- f8 = h8;
- f9 = h9;
+ f0 = static_cast<int32_t>(h0);
+ f1 = static_cast<int32_t>(h1);
+ f2 = static_cast<int32_t>(h2);
+ f3 = static_cast<int32_t>(h3);
+ f4 = static_cast<int32_t>(h4);
+ f5 = static_cast<int32_t>(h5);
+ f6 = static_cast<int32_t>(h6);
+ f7 = static_cast<int32_t>(h7);
+ f8 = static_cast<int32_t>(h8);
+ f9 = static_cast<int32_t>(h9);
}
return FE_25519(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
@@ -627,16 +627,16 @@ void FE_25519::from_bytes(const uint8_t s[32])
carry<26>(h6, h7);
carry<26>(h8, h9);
- m_fe[0] = h0;
- m_fe[1] = h1;
- m_fe[2] = h2;
- m_fe[3] = h3;
- m_fe[4] = h4;
- m_fe[5] = h5;
- m_fe[6] = h6;
- m_fe[7] = h7;
- m_fe[8] = h8;
- m_fe[9] = h9;
+ m_fe[0] = static_cast<int32_t>(h0);
+ m_fe[1] = static_cast<int32_t>(h1);
+ m_fe[2] = static_cast<int32_t>(h2);
+ m_fe[3] = static_cast<int32_t>(h3);
+ m_fe[4] = static_cast<int32_t>(h4);
+ m_fe[5] = static_cast<int32_t>(h5);
+ m_fe[6] = static_cast<int32_t>(h6);
+ m_fe[7] = static_cast<int32_t>(h7);
+ m_fe[8] = static_cast<int32_t>(h8);
+ m_fe[9] = static_cast<int32_t>(h9);
}
/*
diff --git a/src/lib/pubkey/ed25519/ge.cpp b/src/lib/pubkey/ed25519/ge.cpp
index ec22fa179..7d3fae2fb 100644
--- a/src/lib/pubkey/ed25519/ge.cpp
+++ b/src/lib/pubkey/ed25519/ge.cpp
@@ -2002,7 +2002,7 @@ inline uint8_t equal(int8_t b, int8_t c)
uint32_t y = x; /* 0: yes; 1..255: no */
y -= 1; /* 4294967295: yes; 0..254: no */
y >>= 31; /* 1: yes; 0: no */
- return y;
+ return static_cast<uint8_t>(y);
}
inline int32_t equal32(int8_t b, int8_t c)
@@ -2014,7 +2014,7 @@ inline uint8_t negative(int8_t b)
{
uint64_t x = b; /* 18446744073709551361..18446744073709551615: yes; 0..255: no */
x >>= 63; /* 1: yes; 0: no */
- return x;
+ return static_cast<uint8_t>(x);
}
inline void ge_precomp_0(ge_precomp* h)
diff --git a/src/lib/utils/parsing.cpp b/src/lib/utils/parsing.cpp
index 8bf96c1ee..8e62c6e03 100644
--- a/src/lib/utils/parsing.cpp
+++ b/src/lib/utils/parsing.cpp
@@ -347,8 +347,9 @@ std::string tolower_string(const std::string& in)
std::string s = in;
for(size_t i = 0; i != s.size(); ++i)
{
- if(std::isalpha(static_cast<unsigned char>(s[i])))
- s[i] = std::tolower(static_cast<unsigned char>(s[i]));
+ const int cu = static_cast<unsigned char>(s[i]);
+ if(std::isalpha(cu))
+ s[i] = static_cast<char>(std::tolower(cu));
}
return s;
}