Revert "Merge latest oemcrypto-v17 change"

This reverts commit 642965c678.

Reason for revert: Droidfood Blocking Bug: 217145027

Change-Id: I669b72fcd91c62e28883b5f55eb36af274d85806
(cherry picked from commit 8dbea15e5da05b371572297041454569dc166c90)
Merged-In:I669b72fcd91c62e28883b5f55eb36af274d85806
This commit is contained in:
Daniel Chapin
2022-01-31 19:21:18 +00:00
committed by Android Build Coastguard Worker
parent 1397b61f87
commit d69b488be1
176 changed files with 296842 additions and 301106 deletions

View File

@@ -12,10 +12,6 @@
#include "log.h"
using wvutil::a2b_hex;
using wvutil::b2a_hex;
using wvutil::FileSystem;
namespace wvcdm {
FileSystem* RebootTest::file_system_;
@@ -33,11 +29,11 @@ std::string EncodeString(const std::string& data) {
// If there are any unprintable characters, except whitespace, or if we
// close a brace before we open it, then just use hex.
if (!printable || braces_count < 0) {
return "0x" + b2a_hex(data) + ",";
return "0x" + wvcdm::b2a_hex(data) + ",";
}
}
// If we left any braces open, then use hex.
if (braces_count != 0) return "0x" + b2a_hex(data) + ",";
if (braces_count != 0) return "0x" + wvcdm::b2a_hex(data) + ",";
return "{" + data + "},";
}
@@ -51,12 +47,12 @@ std::string EncodeKey(const std::string& data) {
}
// When decoding, we assume that a key starting with "0x" is in hex. So we
// can't have any keys that start with "0x".
if (data.substr(0, 2) == "0x") return "0x" + b2a_hex(data) + ":";
if (data.substr(0, 2) == "0x") return "0x" + wvcdm::b2a_hex(data) + ":";
// If the key is just is not printable, or if it has unmatched braces, then
// we use hex. Otherwise, we surround the whole string with braces.
for (size_t i = 0; i < data.length(); i++) {
if (!isprint(data[i]) || (data[i] == ':')) {
return "0x" + b2a_hex(data) + ":";
return "0x" + wvcdm::b2a_hex(data) + ":";
}
}
return data + ":";
@@ -111,7 +107,8 @@ std::string DecodeString(const std::string& encoded, size_t* index) {
while (*index < encoded.length()) {
if (encoded[*index] == ',') {
size_t end = *index;
std::vector<uint8_t> result = a2b_hex(encoded.substr(start, end - start));
std::vector<uint8_t> result =
wvcdm::a2b_hex(encoded.substr(start, end - start));
(*index)++; // absorb the comma.
return std::string(result.begin(), result.end());
}
@@ -137,7 +134,8 @@ std::string DecodeKey(const std::string& encoded, size_t* index) {
size_t start = *index + 2;
while (*index < encoded.length() && encoded[*index] != ':') (*index)++;
size_t end = *index;
std::vector<uint8_t> result = a2b_hex(encoded.substr(start, end - start));
std::vector<uint8_t> result =
wvcdm::a2b_hex(encoded.substr(start, end - start));
(*index)++; // skip the colon.
return std::string(result.begin(), result.end());
}