Loading keymaster/4.0/support/Keymaster.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,19 @@ std::vector<std::unique_ptr<Keymaster>> enumerateDevices( return result; } void Keymaster::logIfKeymasterVendorError(ErrorCode ec) const { static constexpr int32_t k_keymaster_vendor_error_code_range_max = -10000; if (static_cast<int32_t>(ec) <= k_keymaster_vendor_error_code_range_max) { const auto& versionInfo = halVersion(); LOG(ERROR) << "Keymaster reported error: " << static_cast<int32_t>(ec) << "\n" << "NOTE: This is an error in the vendor specific error range.\n" << " Refer to the vendor of the implementation for details.\n" << " Implementation name: " << versionInfo.keymasterName << "\n" << " Vendor name: " << versionInfo.authorName << "\n" << " MajorVersion: " << versionInfo.majorVersion; } } Keymaster::KeymasterSet Keymaster::enumerateAvailableDevices() { auto serviceManager = IServiceManager::getService(); CHECK(serviceManager) << "Could not retrieve ServiceManager"; Loading keymaster/4.0/support/include/keymasterV4_0/Keymaster.h +6 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,12 @@ class Keymaster : public IKeymasterDevice { const hidl_string& descriptor() const { return descriptor_; } const hidl_string& instanceName() const { return instanceName_; } /** * If ec is in the vendor error code range (<-10000), logs the fact to logcat. * There are no side effects otherwise. */ void logIfKeymasterVendorError(ErrorCode ec) const; /** * Returns all available Keymaster3 and Keymaster4 instances, in order of most secure to least * secure (as defined by VersionResult::operator<). Loading Loading
keymaster/4.0/support/Keymaster.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,19 @@ std::vector<std::unique_ptr<Keymaster>> enumerateDevices( return result; } void Keymaster::logIfKeymasterVendorError(ErrorCode ec) const { static constexpr int32_t k_keymaster_vendor_error_code_range_max = -10000; if (static_cast<int32_t>(ec) <= k_keymaster_vendor_error_code_range_max) { const auto& versionInfo = halVersion(); LOG(ERROR) << "Keymaster reported error: " << static_cast<int32_t>(ec) << "\n" << "NOTE: This is an error in the vendor specific error range.\n" << " Refer to the vendor of the implementation for details.\n" << " Implementation name: " << versionInfo.keymasterName << "\n" << " Vendor name: " << versionInfo.authorName << "\n" << " MajorVersion: " << versionInfo.majorVersion; } } Keymaster::KeymasterSet Keymaster::enumerateAvailableDevices() { auto serviceManager = IServiceManager::getService(); CHECK(serviceManager) << "Could not retrieve ServiceManager"; Loading
keymaster/4.0/support/include/keymasterV4_0/Keymaster.h +6 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,12 @@ class Keymaster : public IKeymasterDevice { const hidl_string& descriptor() const { return descriptor_; } const hidl_string& instanceName() const { return instanceName_; } /** * If ec is in the vendor error code range (<-10000), logs the fact to logcat. * There are no side effects otherwise. */ void logIfKeymasterVendorError(ErrorCode ec) const; /** * Returns all available Keymaster3 and Keymaster4 instances, in order of most secure to least * secure (as defined by VersionResult::operator<). Loading