diff --git a/rebootescrow/aidl/default/RebootEscrow.cpp b/rebootescrow/aidl/default/RebootEscrow.cpp index 5ae96f6086..dbc09215b3 100644 --- a/rebootescrow/aidl/default/RebootEscrow.cpp +++ b/rebootescrow/aidl/default/RebootEscrow.cpp @@ -55,13 +55,12 @@ ndk::ScopedAStatus RebootEscrow::retrieveKey(std::vector* _aidl_return) return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); } - std::string encodedString; - if (!::android::base::ReadFdToString(fd, &encodedString)) { - LOG(WARNING) << "Could not read device to string"; + std::vector encodedBytes(hadamard::OUTPUT_SIZE_BYTES); + if (!::android::base::ReadFully(fd, &encodedBytes[0], encodedBytes.size())) { + LOG(WARNING) << "Could not read device"; return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); } - std::vector encodedBytes(encodedString.begin(), encodedString.end()); auto keyBytes = hadamard::DecodeKey(encodedBytes); std::vector signedKeyBytes(keyBytes.begin(), keyBytes.end());