throw std::runtime_error("BIO_new: " + getErrors());
}
- int written = BIO_write(bio.get(), cert.data(), cert.size());
+ int written = BIO_write(bio.get(), cert.data(), int(cert.size()));
if (written <= 0 || static_cast<unsigned>(written) != cert.size()) {
throw std::runtime_error("BIO_write: " + getErrors());
}
throw std::runtime_error("BIO_new: " + getErrors());
}
- int written = BIO_write(bio.get(), pkey.data(), pkey.size());
+ int written = BIO_write(bio.get(), pkey.data(), int(pkey.size()));
if (written <= 0 || static_cast<unsigned>(written) != pkey.size()) {
throw std::runtime_error("BIO_write: " + getErrors());
}
advertised_item.length = 0;
for (const auto& proto : item.protocols) {
++advertised_item.length;
- unsigned protoLength = proto.length();
+ auto protoLength = proto.length();
if (protoLength >= 256) {
deleteNextProtocolsStrings();
return false;
}
- advertised_item.length += protoLength;
+ advertised_item.length += unsigned(protoLength);
}
advertised_item.protocols = new unsigned char[advertised_item.length];
if (!advertised_item.protocols) {
}
unsigned char* dst = advertised_item.protocols;
for (auto& proto : item.protocols) {
- unsigned protoLength = proto.length();
+ uint8_t protoLength = uint8_t(proto.length());
*dst++ = (unsigned char)protoLength;
memcpy(dst, proto.data(), protoLength);
dst += protoLength;
std::string userPassword;
// call user defined password collector to get password
context->passwordCollector()->getPassword(userPassword, size);
- int length = userPassword.size();
+ auto length = int(userPassword.size());
if (length > size) {
length = size;
}
void hash_init(const EVP_MD* md, ByteRange key) {
md_ = md;
check_libssl_result(
- 1, HMAC_Init_ex(&ctx_, key.data(), key.size(), md_, nullptr));
+ 1, HMAC_Init_ex(&ctx_, key.data(), int(key.size()), md_, nullptr));
}
void hash_update(ByteRange data) {
check_libssl_result(1, HMAC_Update(&ctx_, data.data(), data.size()));
check_out_size(size, out);
unsigned int len = 0;
check_libssl_result(1, HMAC_Final(&ctx_, out.data(), &len));
- check_libssl_result(size, len);
+ check_libssl_result(size, int(len));
md_ = nullptr;
}
private:
SSLSessionImpl::SSLSessionImpl(const std::string& serializedSession) {
auto sessionData =
reinterpret_cast<const unsigned char*>(serializedSession.data());
- if ((session_ = d2i_SSL_SESSION(
- nullptr, &sessionData, serializedSession.length())) == nullptr) {
+ auto longLen = long(serializedSession.length());
+ if ((session_ = d2i_SSL_SESSION(nullptr, &sessionData, longLen)) == nullptr) {
throw std::runtime_error("Cannot deserialize SSLSession string");
}
}