Fix keyname generation issue
The keyname binded to keyring return a wrong string when there are binary char larger than 127,
the sign extension will introduce unexpect FFFFFF string to the keyname.
Bug: 36975893
Test: local build
Change-Id: Iba2f6ef95aeacd08c8d6c72b71e7b92e956ec3fc
Signed-off-by: Ai, Ting A <ting.a.ai@intel.com>
diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp
index 88bedd0..83141d1 100644
--- a/Ext4Crypt.cpp
+++ b/Ext4Crypt.cpp
@@ -137,7 +137,7 @@
static std::string keyname(const std::string& raw_ref) {
std::ostringstream o;
o << "ext4:";
- for (auto i : raw_ref) {
+ for (unsigned char i : raw_ref) {
o << std::hex << std::setw(2) << std::setfill('0') << (int)i;
}
return o.str();