From 50cc2ab94fa18b70c9dcc536c953d15ae6d1c7b0 Mon Sep 17 00:00:00 2001 From: Subrahmanyaman Date: Tue, 13 Sep 2022 03:37:00 +0000 Subject: [PATCH] 1. Ignore SIGPIPE signal and receive EPIPE error code from send call. 2. Updated the gold fish sample json file. --- HAL/SocketTransport.cpp | 4 ++-- ProvisioningTool/include/cppbor/cppbor.h | 4 ++-- ProvisioningTool/sample_json_keymint_gf.txt | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/HAL/SocketTransport.cpp b/HAL/SocketTransport.cpp index 76b50c34..663b9edf 100644 --- a/HAL/SocketTransport.cpp +++ b/HAL/SocketTransport.cpp @@ -79,9 +79,9 @@ keymaster_error_t SocketTransport::sendData(const vector& inData, vecto inDataPrependedLength.push_back(static_cast(inData.size() & 0xFF)); inDataPrependedLength.insert(inDataPrependedLength.end(), inData.begin(), inData.end()); - if (0 > send(mSocket, inDataPrependedLength.data(), inDataPrependedLength.size(), 0)) { + if (0 > send(mSocket, inDataPrependedLength.data(), inDataPrependedLength.size(), MSG_NOSIGNAL)) { static int connectionResetCnt = 0; /* To avoid loop */ - if (ECONNRESET == errno && connectionResetCnt == 0) { + if ((ECONNRESET == errno || EPIPE == errno) && connectionResetCnt == 0) { // Connection reset. Try open socket and then sendData. socketStatus = false; connectionResetCnt++; diff --git a/ProvisioningTool/include/cppbor/cppbor.h b/ProvisioningTool/include/cppbor/cppbor.h index 45ae67cf..5761bca0 100644 --- a/ProvisioningTool/include/cppbor/cppbor.h +++ b/ProvisioningTool/include/cppbor/cppbor.h @@ -700,12 +700,12 @@ class Map : public Item { * * If the searched-for `key` is not present, returns `nullptr`. * - * Note that if the map is canonicalized (sorted), Map::get() peforms a binary search. If your + * Note that if the map is canonicalized (sorted), Map::get() performs a binary search. If your * map is large and you're searching in it many times, it may be worthwhile to canonicalize it * to make Map::get() faster. Any use of a method that might modify the map disables the * speedup. */ - template + template const std::unique_ptr& get(Key key) const; // Note that use of non-const operator[] marks the map as not canonicalized. diff --git a/ProvisioningTool/sample_json_keymint_gf.txt b/ProvisioningTool/sample_json_keymint_gf.txt index 26c6c4d0..dadb3b25 100644 --- a/ProvisioningTool/sample_json_keymint_gf.txt +++ b/ProvisioningTool/sample_json_keymint_gf.txt @@ -1,13 +1,13 @@ { "attest_ids": { "brand": "Android", - "device": "generic_x86_64", - "product": "aosp_x86_64", + "device": "emulator_x86_64", + "product": "sdk_phone_x86_64", "serial": "", "imei": "000000000000000", "meid": "000000000000000", "manufacturer": "unknown", - "model": "AOSP on x86_64" + "model": "Android SDK built for x86_64" }, "shared_secret": "0000000000000000000000000000000000000000000000000000000000000000", "set_boot_params": {