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>
gugelfrei
Yong Yao 7 years ago committed by Gaurav Sarode
parent 8ad0bef7b5
commit 392c4dbdc1

@ -137,7 +137,7 @@ static bool fill_key(const std::string& key, ext4_encryption_key* ext4_key) {
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();

Loading…
Cancel
Save