summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2021-06-21 02:12:18 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-06-21 02:12:18 +0000
commit7bd90714b659a78c5d52f55cfba1ae6d1f8e5876 (patch)
treeb2809cfa3b4ec23bb8baa1a7971221a1441a442e
parent351da8db2ec3e3df050a0b8b00bc972e8ff0763c (diff)
parent7cccfb4ce0b9c981d563922345d9c041225081c7 (diff)
downloadkeymaster-7bd90714b659a78c5d52f55cfba1ae6d1f8e5876.tar.gz
Merge "Fixing comparison types." into sc-dev
-rw-r--r--android_keymaster/remote_provisioning_utils.cpp4
-rw-r--r--cppcose/cppcose.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/android_keymaster/remote_provisioning_utils.cpp b/android_keymaster/remote_provisioning_utils.cpp
index 926188f..c882b21 100644
--- a/android_keymaster/remote_provisioning_utils.cpp
+++ b/android_keymaster/remote_provisioning_utils.cpp
@@ -57,7 +57,7 @@ validateAndExtractEekPubAndId(bool testMode, const KeymasterBlob& endpointEncryp
const cppbor::Array* certArr = item->asArray();
std::vector<uint8_t> lastPubKey;
- for (int i = 0; i < certArr->size(); ++i) {
+ for (size_t i = 0; i < certArr->size(); ++i) {
auto cosePubKey =
verifyAndParseCoseSign1(testMode, certArr->get(i)->asArray(), lastPubKey, {} /* AAD */);
if (!cosePubKey) {
@@ -89,7 +89,7 @@ StatusOr<std::vector<uint8_t> /* pubkeys */>
validateAndExtractPubkeys(bool testMode, uint32_t numKeys, KeymasterBlob* keysToSign,
cppcose::HmacSha256Function macFunction) {
auto pubKeysToMac = cppbor::Array();
- for (int i = 0; i < numKeys; i++) {
+ for (size_t i = 0; i < numKeys; i++) {
auto [macedKeyItem, _, coseMacErrMsg] =
cppbor::parse(keysToSign[i].begin(), keysToSign[i].end());
if (!macedKeyItem || !macedKeyItem->asArray() ||
diff --git a/cppcose/cppcose.cpp b/cppcose/cppcose.cpp
index 2d8652e..b37900e 100644
--- a/cppcose/cppcose.cpp
+++ b/cppcose/cppcose.cpp
@@ -419,7 +419,7 @@ ErrMsgOr<bytevec> aesGcmEncrypt(const bytevec& key, const bytevec& nonce, const
plaintext.size())) {
return "Failed to encrypt plaintext";
}
- assert(plaintext.size() == outlen);
+ assert(plaintext.size() == static_cast<uint64_t>(outlen));
if (!EVP_CipherFinal_ex(ctx->get(), ciphertext.data() + outlen, &outlen)) {
return "Failed to finalize encryption";
@@ -447,7 +447,7 @@ ErrMsgOr<bytevec> aesGcmDecrypt(const bytevec& key, const bytevec& nonce, const
ciphertextWithTag.size() - kAesGcmTagSize)) {
return "Failed to decrypt plaintext";
}
- assert(plaintext.size() == outlen);
+ assert(plaintext.size() == static_cast<uint64_t>(outlen));
bytevec tag(ciphertextWithTag.end() - kAesGcmTagSize, ciphertextWithTag.end());
if (!EVP_CIPHER_CTX_ctrl(ctx->get(), EVP_CTRL_GCM_SET_TAG, kAesGcmTagSize, tag.data())) {