diff options
author | Jooyung Han <jooyung@google.com> | 2020-02-21 21:17:06 +0900 |
---|---|---|
committer | Jooyung Han <jooyung@google.com> | 2020-03-23 16:12:46 +0000 |
commit | 229528a08fcb723af414cf5403b429b8fd617c8a (patch) | |
tree | 3cc80e243fb71c1d4b2ac27196bb3b12b7e4fa3a /rebootescrow | |
parent | 12ec32a8bd39e1fd15af5e8817592aaeeab8ecbc (diff) | |
download | platform_hardware_interfaces-229528a08fcb723af414cf5403b429b8fd617c8a.tar.gz platform_hardware_interfaces-229528a08fcb723af414cf5403b429b8fd617c8a.tar.bz2 platform_hardware_interfaces-229528a08fcb723af414cf5403b429b8fd617c8a.zip |
use vector<uint8_t> for byte[] in AIDL
In native world, byte stream is typically represented in uint8_t[]
or vector<uint8_t>. C++ backend already generates that way. This
change involves NDK backend.
Now NDK backend also uses vector<uint8_t> just like C++ backend.
Bug: 144957764
Test: atest CtsNdkBinderTestCases
Merged-In: I8de348b57cf92dd99b3ee16252f56300ce5f4683
Change-Id: I8de348b57cf92dd99b3ee16252f56300ce5f4683
(cherry picked from commit 9070318462e5e73acf1509cf7e75ac260e51e43a)
Exempt-From-Owner-Approval: cp from master to avoid merge-conflict
Diffstat (limited to 'rebootescrow')
-rw-r--r-- | rebootescrow/aidl/default/RebootEscrow.cpp | 8 | ||||
-rw-r--r-- | rebootescrow/aidl/default/include/rebootescrow-impl/RebootEscrow.h | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/rebootescrow/aidl/default/RebootEscrow.cpp b/rebootescrow/aidl/default/RebootEscrow.cpp index dbc09215b3..8e5e97c80c 100644 --- a/rebootescrow/aidl/default/RebootEscrow.cpp +++ b/rebootescrow/aidl/default/RebootEscrow.cpp @@ -28,7 +28,7 @@ namespace rebootescrow { using ::android::base::unique_fd; -ndk::ScopedAStatus RebootEscrow::storeKey(const std::vector<int8_t>& kek) { +ndk::ScopedAStatus RebootEscrow::storeKey(const std::vector<uint8_t>& ukek) { int rawFd = TEMP_FAILURE_RETRY(::open(devicePath_.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC)); unique_fd fd(rawFd); if (fd.get() < 0) { @@ -36,7 +36,6 @@ ndk::ScopedAStatus RebootEscrow::storeKey(const std::vector<int8_t>& kek) { return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); } - std::vector<uint8_t> ukek(kek.begin(), kek.end()); auto encoded = hadamard::EncodeKey(ukek); if (!::android::base::WriteFully(fd, encoded.data(), encoded.size())) { @@ -47,7 +46,7 @@ ndk::ScopedAStatus RebootEscrow::storeKey(const std::vector<int8_t>& kek) { return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus RebootEscrow::retrieveKey(std::vector<int8_t>* _aidl_return) { +ndk::ScopedAStatus RebootEscrow::retrieveKey(std::vector<uint8_t>* _aidl_return) { int rawFd = TEMP_FAILURE_RETRY(::open(devicePath_.c_str(), O_RDONLY | O_NOFOLLOW | O_CLOEXEC)); unique_fd fd(rawFd); if (fd.get() < 0) { @@ -63,8 +62,7 @@ ndk::ScopedAStatus RebootEscrow::retrieveKey(std::vector<int8_t>* _aidl_return) auto keyBytes = hadamard::DecodeKey(encodedBytes); - std::vector<int8_t> signedKeyBytes(keyBytes.begin(), keyBytes.end()); - *_aidl_return = signedKeyBytes; + *_aidl_return = keyBytes; return ndk::ScopedAStatus::ok(); } diff --git a/rebootescrow/aidl/default/include/rebootescrow-impl/RebootEscrow.h b/rebootescrow/aidl/default/include/rebootescrow-impl/RebootEscrow.h index 00ff16b2ea..cdbeb67eba 100644 --- a/rebootescrow/aidl/default/include/rebootescrow-impl/RebootEscrow.h +++ b/rebootescrow/aidl/default/include/rebootescrow-impl/RebootEscrow.h @@ -26,8 +26,8 @@ namespace rebootescrow { class RebootEscrow : public BnRebootEscrow { public: explicit RebootEscrow(const std::string& devicePath) : devicePath_(devicePath) {} - ndk::ScopedAStatus storeKey(const std::vector<int8_t>& kek) override; - ndk::ScopedAStatus retrieveKey(std::vector<int8_t>* _aidl_return) override; + ndk::ScopedAStatus storeKey(const std::vector<uint8_t>& kek) override; + ndk::ScopedAStatus retrieveKey(std::vector<uint8_t>* _aidl_return) override; private: const std::string devicePath_; |