Merge "Fix -Wshorten-64-to-32 errors in BoringSSL interactions"
This commit is contained in:
committed by
Android (Google) Code Review
commit
fdea46d325
@@ -29,7 +29,7 @@ const int kRsaPkcs1OaepPaddingLength = 41;
|
||||
|
||||
RSA* GetKey(const std::string& serialized_key) {
|
||||
BIO* bio = BIO_new_mem_buf(const_cast<char*>(serialized_key.data()),
|
||||
serialized_key.size());
|
||||
static_cast<int>(serialized_key.size()));
|
||||
if (bio == nullptr) {
|
||||
LOGE("BIO_new_mem_buf failed: returned null");
|
||||
return nullptr;
|
||||
@@ -123,11 +123,11 @@ bool AesCbcKey::Encrypt(const std::string& in, std::string* out,
|
||||
}
|
||||
|
||||
out->resize(in.size() + AES_BLOCK_SIZE);
|
||||
int out_length = out->size();
|
||||
int out_length = static_cast<int>(out->size());
|
||||
if (EVP_EncryptUpdate(
|
||||
evp_cipher_ctx, reinterpret_cast<uint8_t*>(&(*out)[0]), &out_length,
|
||||
reinterpret_cast<uint8_t*>(const_cast<char*>(in.data())),
|
||||
in.size()) == 0) {
|
||||
static_cast<int>(in.size())) == 0) {
|
||||
LOGE("AES CBC encryption failure: %s",
|
||||
ERR_error_string(ERR_get_error(), nullptr));
|
||||
EVP_CIPHER_CTX_free(evp_cipher_ctx);
|
||||
@@ -195,7 +195,7 @@ bool RsaPublicKey::Encrypt(const std::string& clear_message,
|
||||
|
||||
encrypted_message->assign(rsa_size, 0);
|
||||
if (RSA_public_encrypt(
|
||||
clear_message.size(),
|
||||
static_cast<int>(clear_message.size()),
|
||||
const_cast<unsigned char*>(
|
||||
reinterpret_cast<const unsigned char*>(clear_message.data())),
|
||||
reinterpret_cast<unsigned char*>(&(*encrypted_message)[0]), key,
|
||||
@@ -212,9 +212,9 @@ bool RsaPublicKey::Encrypt(const std::string& clear_message,
|
||||
|
||||
// LogBoringSSLError is a callback from BoringSSL which is called with each
|
||||
// error in the thread's error queue.
|
||||
static int LogBoringSSLError(const char* msg, size_t /* len */,
|
||||
void* /* ctx */) {
|
||||
LOGE(" %s", msg);
|
||||
static int LogBoringSSLError(const char* msg, size_t /* length */,
|
||||
void* /* user_data */) {
|
||||
LOGE(" BoringSSL Error: %s", msg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -345,7 +345,8 @@ bool ExtractExtensionValueFromCertificate(const std::string& cert,
|
||||
return false;
|
||||
}
|
||||
|
||||
X509* const intermediate_cert = sk_X509_value(certs, cert_index);
|
||||
X509* const intermediate_cert =
|
||||
sk_X509_value(certs, static_cast<int>(cert_index));
|
||||
if (intermediate_cert == nullptr) {
|
||||
LOGE("Unable to get intermediate cert");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user