Merge "Fix -Wshorten-64-to-32 errors in BoringSSL interactions"

This commit is contained in:
TreeHugger Robot
2021-10-06 21:54:09 +00:00
committed by Android (Google) Code Review
6 changed files with 47 additions and 36 deletions

View File

@@ -66,10 +66,10 @@ SSL_CTX* InitSslContext() {
return ctx;
}
static int LogBoringSslError(const char* message, size_t length,
static int LogBoringSslError(const char* message, size_t /* length */,
void* /* user_data */) {
LOGE(" BoringSSL Error: %s", message);
return length;
return 1;
}
bool IsRetryableSslError(int ssl_error) {
@@ -433,7 +433,7 @@ int HttpSocket::Read(char* data, int len, int timeout_in_ms) {
if (secure_connect_) {
read = SSL_read(ssl_, data, to_read);
} else {
read = recv(socket_fd_, data, to_read, 0);
read = static_cast<int>(recv(socket_fd_, data, to_read, 0));
}
if (read > 0) {
@@ -490,10 +490,11 @@ int HttpSocket::Write(const char* data, int len, int timeout_in_ms) {
}
while (to_send > 0) {
int sent;
if (secure_connect_)
if (secure_connect_) {
sent = SSL_write(ssl_, data, to_send);
else
sent = send(socket_fd_, data, to_send, 0);
} else {
sent = static_cast<int>(send(socket_fd_, data, to_send, 0));
}
if (sent > 0) {
to_send -= sent;

View File

@@ -205,7 +205,7 @@ std::string WvCdmTestBase::SignHMAC(const std::string& message,
const std::vector<uint8_t>& key) {
uint8_t signature[SHA256_DIGEST_LENGTH];
unsigned int md_len = SHA256_DIGEST_LENGTH;
HMAC(EVP_sha256(), &key[0], key.size(),
HMAC(EVP_sha256(), &key[0], static_cast<int>(key.size()),
reinterpret_cast<const uint8_t*>(message.data()), message.size(),
signature, &md_len);
std::string result(signature, signature + SHA256_DIGEST_LENGTH);