Clarify some confusing casts involving |size_t|.
Change-Id: I7af2c87fe6e7513aa2603d5e845a4db87ab14fcc
Reviewed-on: https://boringssl-review.googlesource.com/7101
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/crypto/cipher/cipher_test.cc b/crypto/cipher/cipher_test.cc
index 1cbfae9..7b4944c 100644
--- a/crypto/cipher/cipher_test.cc
+++ b/crypto/cipher/cipher_test.cc
@@ -138,7 +138,7 @@
iv.size(), 0)) {
return false;
}
- } else if (iv.size() != (size_t)EVP_CIPHER_CTX_iv_length(ctx.get())) {
+ } else if (iv.size() != EVP_CIPHER_CTX_iv_length(ctx.get())) {
t->PrintLine("Bad IV length.");
return false;
}
diff --git a/crypto/cipher/e_aes.c b/crypto/cipher/e_aes.c
index e5104b4..f7b6fa3 100644
--- a/crypto/cipher/e_aes.c
+++ b/crypto/cipher/e_aes.c
@@ -384,7 +384,7 @@
static int aes_ctr_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in,
size_t len) {
- unsigned int num = ctx->num;
+ unsigned num = (unsigned)ctx->num;
EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data;
if (dat->stream.ctr) {
@@ -394,7 +394,7 @@
CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, ctx->iv, ctx->buf, &num,
dat->block);
}
- ctx->num = (size_t)num;
+ ctx->num = (int)num;
return 1;
}
diff --git a/crypto/rsa/padding.c b/crypto/rsa/padding.c
index 032df2e..128950a 100644
--- a/crypto/rsa/padding.c
+++ b/crypto/rsa/padding.c
@@ -95,7 +95,7 @@
memset(p, 0xff, j);
p += j;
*(p++) = 0;
- memcpy(p, from, (unsigned int)from_len);
+ memcpy(p, from, from_len);
return 1;
}
@@ -189,7 +189,7 @@
*(p++) = 0;
- memcpy(p, from, (unsigned int)from_len);
+ memcpy(p, from, from_len);
return 1;
}
@@ -271,7 +271,7 @@
return 0;
}
- memcpy(to, from, (unsigned int)from_len);
+ memcpy(to, from, from_len);
return 1;
}