mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge changes Ic373e0a3,Icb3937d8 into main am: 600b93a0c2
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2960244 Change-Id: Ib48370e9f5daf5a58100d5d12055612bb2a335c8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -51,7 +51,7 @@ class HmacKeySharingTest : public KeymasterHidlTest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
using KeymasterVec = std::vector<sp<IKeymasterDevice>>;
|
using KeymasterVec = std::vector<sp<IKeymasterDevice>>;
|
||||||
using ByteString = std::basic_string<uint8_t>;
|
using ByteString = std::vector<uint8_t>;
|
||||||
// using NonceVec = std::vector<HidlBuf>;
|
// using NonceVec = std::vector<HidlBuf>;
|
||||||
|
|
||||||
GetParamsResult getHmacSharingParameters(IKeymasterDevice& keymaster) {
|
GetParamsResult getHmacSharingParameters(IKeymasterDevice& keymaster) {
|
||||||
@@ -98,7 +98,7 @@ class HmacKeySharingTest : public KeymasterHidlTest {
|
|||||||
std::vector<ByteString> copyNonces(const hidl_vec<HmacSharingParameters>& paramsVec) {
|
std::vector<ByteString> copyNonces(const hidl_vec<HmacSharingParameters>& paramsVec) {
|
||||||
std::vector<ByteString> nonces;
|
std::vector<ByteString> nonces;
|
||||||
for (auto& param : paramsVec) {
|
for (auto& param : paramsVec) {
|
||||||
nonces.emplace_back(param.nonce.data(), param.nonce.size());
|
nonces.emplace_back(param.nonce.data(), param.nonce.data() + param.nonce.size());
|
||||||
}
|
}
|
||||||
return nonces;
|
return nonces;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,20 +14,23 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cppbor.h"
|
|
||||||
#include "keymaster/cppcose/cppcose.h"
|
|
||||||
#include <aidl/android/hardware/security/keymint/RpcHardwareInfo.h>
|
#include <aidl/android/hardware/security/keymint/RpcHardwareInfo.h>
|
||||||
#include <android-base/properties.h>
|
#include <android-base/properties.h>
|
||||||
|
#include <cppbor.h>
|
||||||
#include <cppbor_parse.h>
|
#include <cppbor_parse.h>
|
||||||
#include <cstdint>
|
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <keymaster/android_keymaster_utils.h>
|
#include <keymaster/android_keymaster_utils.h>
|
||||||
|
#include <keymaster/cppcose/cppcose.h>
|
||||||
#include <keymaster/logger.h>
|
#include <keymaster/logger.h>
|
||||||
#include <keymaster/remote_provisioning_utils.h>
|
#include <keymaster/remote_provisioning_utils.h>
|
||||||
#include <openssl/curve25519.h>
|
#include <openssl/curve25519.h>
|
||||||
#include <remote_prov/remote_prov_utils.h>
|
#include <remote_prov/remote_prov_utils.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
namespace aidl::android::hardware::security::keymint::remote_prov {
|
namespace aidl::android::hardware::security::keymint::remote_prov {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -36,7 +39,11 @@ using ::keymaster::kStatusFailed;
|
|||||||
using ::keymaster::kStatusInvalidEek;
|
using ::keymaster::kStatusInvalidEek;
|
||||||
using ::keymaster::StatusOr;
|
using ::keymaster::StatusOr;
|
||||||
using ::testing::ElementsAreArray;
|
using ::testing::ElementsAreArray;
|
||||||
using byte_view = std::basic_string_view<uint8_t>;
|
using byte_view = std::span<const uint8_t>;
|
||||||
|
|
||||||
|
inline bool equal_byte_views(const byte_view& view1, const byte_view& view2) {
|
||||||
|
return std::equal(view1.begin(), view1.end(), view2.begin(), view2.end());
|
||||||
|
}
|
||||||
|
|
||||||
struct KeyInfoEcdsa {
|
struct KeyInfoEcdsa {
|
||||||
CoseKeyCurve curve;
|
CoseKeyCurve curve;
|
||||||
@@ -44,7 +51,8 @@ struct KeyInfoEcdsa {
|
|||||||
byte_view pubKeyY;
|
byte_view pubKeyY;
|
||||||
|
|
||||||
bool operator==(const KeyInfoEcdsa& other) const {
|
bool operator==(const KeyInfoEcdsa& other) const {
|
||||||
return curve == other.curve && pubKeyX == other.pubKeyX && pubKeyY == other.pubKeyY;
|
return curve == other.curve && equal_byte_views(pubKeyX, other.pubKeyX) &&
|
||||||
|
equal_byte_views(pubKeyY, other.pubKeyY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user