Fixing authToken2AidlVec
Problems:
-The mac size was being checked if it was equal to or less than 32
-Host order serialization for authenticator type
-Host order serialization for timestamp
Fixes: 183820299
Test: adb shell locksettings set-pin 1234
Change-Id: Iacfaa956285265379378a1b217882cea265b1d56
diff --git a/ng/KeyMintUtils.cpp b/ng/KeyMintUtils.cpp
index 730e282..80ab1cf 100644
--- a/ng/KeyMintUtils.cpp
+++ b/ng/KeyMintUtils.cpp
@@ -107,7 +107,7 @@
vector<uint8_t> result;
- if (token.mac.size() <= 32) return result;
+ if (token.mac.size() < 32) return result;
result.resize(sizeof(hw_auth_token_t));
auto pos = result.begin();
@@ -115,8 +115,8 @@
pos = copy_bytes_to_iterator(token.challenge, pos);
pos = copy_bytes_to_iterator(token.userId, pos);
pos = copy_bytes_to_iterator(token.authenticatorId, pos);
- pos = copy_bytes_to_iterator(token.authenticatorType, pos);
- pos = copy_bytes_to_iterator(token.timestamp, pos);
+ pos = copy_bytes_to_iterator(hton(static_cast<uint32_t>(token.authenticatorType)), pos);
+ pos = copy_bytes_to_iterator(hton(token.timestamp.milliSeconds), pos);
pos = std::copy(token.mac.data(), token.mac.data() + token.mac.size(), pos);
return result;