diff options
author | xmarvla <vlatko.markovic@seavus.com> | 2011-12-26 11:39:55 +0100 |
---|---|---|
committer | Viktor Mladenovski <viktor.mladenovski@seavus.com> | 2012-05-25 14:40:23 +0200 |
commit | f2be658909048b1050bf66c14324cccce852a931 (patch) | |
tree | 6d706961731e8dd2864581491ae4ca8fc6574359 /source | |
parent | 7500cbd59a6faa7dd69b278d7a02da2c8fa96060 (diff) |
Flash tool cli cannot work with network path
Resolve problems in error handling for process file command
when path to non-existing file is given as input paramter
to LCDriver.
Fix AStyle code formatting.
ST-Ericsson ID: 402761
ST-Ericsson FOSS-OUT ID: NA
Change-Id: Ia6539a7ebab97a078bc0d105b23b6a0545762194
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/43810
Reviewed-by: QABUILD
Tested-by: Aleksandar GASOSKI <aleksandar.gasoski@seavus.com>
Reviewed-by: Vlatko PISTOLOV <vlatko.pistolov@seavus.com>
Tested-by: Vlatko PISTOLOV <vlatko.pistolov@seavus.com>
Diffstat (limited to 'source')
-rw-r--r-- | source/LCDriver.cpp | 1 | ||||
-rw-r--r-- | source/LCDriver.rc | 6 | ||||
-rw-r--r-- | source/LCDriverEntry.cpp | 3 | ||||
-rw-r--r-- | source/LCDriverMethods.cpp | 26 | ||||
-rw-r--r-- | source/LCDriverMethods.h | 2 | ||||
-rw-r--r-- | source/LCM/Hash.cpp | 42 | ||||
-rw-r--r-- | source/LCM/include/t_r15_network_layer.h | 2 | ||||
-rw-r--r-- | source/LcdVersion.cpp | 2 | ||||
-rw-r--r-- | source/LcmInterface.h | 4 | ||||
-rw-r--r-- | source/api_wrappers/linux/CThreadWrapper.cpp | 2 | ||||
-rw-r--r-- | source/api_wrappers/linux/CThreadWrapper.h | 4 | ||||
-rw-r--r-- | source/api_wrappers/linux/OS.h | 2 | ||||
-rw-r--r-- | source/api_wrappers/windows/WinApiWrappers.h | 3 | ||||
-rw-r--r-- | source/config/commands.xml | 2 | ||||
-rw-r--r-- | source/security_algorithms/sha/sha2.cpp | 22 | ||||
-rw-r--r-- | source/utilities/BulkHandler.cpp | 6 |
16 files changed, 78 insertions, 51 deletions
diff --git a/source/LCDriver.cpp b/source/LCDriver.cpp index 9c7643b..0754e5e 100644 --- a/source/LCDriver.cpp +++ b/source/LCDriver.cpp @@ -259,7 +259,6 @@ LCDRIVER_API int __cdecl System_Deauthenticate(LCDContext Context, int iType) VERIFY_CONTEXT_STARTED(Context); return Context->m_pObject->Do_System_Deauthenticate(iType); - } LCDRIVER_API int __cdecl System_GetControlKeys(LCDContext Context, TSIMLockKeys *pSIMLockKeys) diff --git a/source/LCDriver.rc b/source/LCDriver.rc index 7b35aa5..679a33a 100644 --- a/source/LCDriver.rc +++ b/source/LCDriver.rc @@ -81,15 +81,15 @@ BEGIN BEGIN
BLOCK "000904b0"
BEGIN
- VALUE "Comments", "Build date: 2011-12-09"
+ VALUE "Comments", "Build date: 2011-12-26"
VALUE "CompanyName", "STEricsson AB"
VALUE "FileDescription", "LCDriver Dynamic Link Library"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "Loader Communication Driver"
VALUE "LegalCopyright", "Copyright (C) STEricsson AB 2011"
- VALUE "PrivateBuild", "Change-Id: If0926da184dfefefcaad0d4e97080de283b7aabd"
+ VALUE "PrivateBuild", "Change-Id: Ia6539a7ebab97a078bc0d105b23b6a0545762194"
VALUE "ProductName", "CXC 173 0865, LCDriver DLL"
- VALUE "ProductVersion", "PU3"
+ VALUE "ProductVersion", "PU4"
END
END
BLOCK "VarFileInfo"
diff --git a/source/LCDriverEntry.cpp b/source/LCDriverEntry.cpp index 91bd189..46a588f 100644 --- a/source/LCDriverEntry.cpp +++ b/source/LCDriverEntry.cpp @@ -16,10 +16,13 @@ BOOL APIENTRY DllMain(HMODULE hModule, switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: break; + case DLL_THREAD_ATTACH: break; + case DLL_THREAD_DETACH: break; + case DLL_PROCESS_DETACH: destroy(); break; diff --git a/source/LCDriverMethods.cpp b/source/LCDriverMethods.cpp index 2791c3d..9ce1986 100644 --- a/source/LCDriverMethods.cpp +++ b/source/LCDriverMethods.cpp @@ -52,7 +52,7 @@ extern uint32 DevicesNumber; CLCDriverMethods::CLCDriverMethods(const char *pchInterfaceId): m_EventQueue(256) { - m_pchId = new char[strlen(pchInterfaceId)+1]; + m_pchId = new char[strlen(pchInterfaceId) + 1]; strcpy_s(m_pchId, strlen(pchInterfaceId) + 1, pchInterfaceId); m_pCommunicationDevice = new CommunicationDevice_t; @@ -694,8 +694,6 @@ int CLCDriverMethods::Do_System_ExecuteSoftware(const uint32 ExecuteMode, const ReturnValue = INVALID_EXECUTION_MODE; } - //} - ErrorExit: if (iUseBulk) { @@ -757,7 +755,7 @@ int CLCDriverMethods::Do_System_Deauthenticate(int iType) VERIFY_SUCCESS(IsMainThreadAlive()); VERIFY_SUCCESS(m_pLoaderRpcFunctions->DoRPC_System_Deauthenticate(uiSessionOut, iType)); - VERIFY_SUCCESS(WaitForEvent(EVENT_GR_RECEIVED | EVENT_CMD_RECEIVED, GROUP_SYSTEM, COMMAND_SYSTEM_DEAUTHENTICATE)); + VERIFY_SUCCESS(WaitForEvent(EVENT_GR_RECEIVED, GROUP_SYSTEM, COMMAND_SYSTEM_DEAUTHENTICATE)); ErrorExit: return ReturnValue; @@ -1948,7 +1946,7 @@ int CLCDriverMethods::Do_A2_System_LoaderOnLoader(const char *pchPath, int iPLOf NumberOfPackets = PL / PacketSize; - if (NumberOfPackets *PacketSize == PL) { + if (NumberOfPackets * PacketSize == PL) { NumberOfPackets--; } @@ -2144,23 +2142,27 @@ int CLCDriverMethods::Do_SwitchProtocolFamily(TFamily family) strcat_s(strMessage, "Do_SetProtocolFamily(R15_FAMILY)"); m_pMainThread->TimerOn(); break; + case PROTROM_PROTOCOL_FAMILY: m_CurrentProtocolFamily = PROTROM_FAMILY; m_CurrentCEHCallback = static_cast<Do_CEH_Call_t>(CEH_PROTROM_CallbackFunction); strcat_s(strMessage, "Do_SwitchProtocolFamily(PROTROM_FAMILY)"); break; + case Z_PROTOCOL_FAMILY: m_CurrentProtocolFamily = Z_FAMILY; m_CurrentCEHCallback = static_cast<Do_CEH_Call_t>(CEH_Z_CallbackFunction); strcat_s(strMessage, "Do_SwitchProtocolFamily(Z_FAMILY)"); m_pZRpcFunctions->Z_IndataBuffer->Clear(); break; + case A2_PROTOCOL_FAMILY: m_CurrentProtocolFamily = A2_FAMILY; m_CurrentCEHCallback = static_cast<Do_CEH_Call_t>(CEH_A2_CallbackFunction); strcat_s(strMessage, "Do_SwitchProtocolFamily(A2_FAMILY)"); //m_pMainThread->TimerOn(); break; + default: return INVALID_INPUT_PARAMETERS; } @@ -2344,7 +2346,7 @@ int CLCDriverMethods::Do_PROTROM_DownloadLoader(const char *pchPath, int iPLOffs //Download all packet beside one NumberOfPackets = PL / PacketSize; - if (NumberOfPackets *PacketSize == PL) { + if (NumberOfPackets * PacketSize == PL) { NumberOfPackets--; } @@ -2425,18 +2427,22 @@ int CLCDriverMethods::SetInitialProtocolFamily(TFamily family) m_CurrentProtocolFamily = R15_FAMILY; m_CurrentCEHCallback = CEHCallbackFunction; break; + case PROTROM_PROTOCOL_FAMILY: m_CurrentProtocolFamily = PROTROM_FAMILY; m_CurrentCEHCallback = CEH_PROTROM_CallbackFunction; break; + case Z_PROTOCOL_FAMILY: m_CurrentProtocolFamily = Z_FAMILY; m_CurrentCEHCallback = CEH_Z_CallbackFunction; break; + case A2_PROTOCOL_FAMILY: m_CurrentProtocolFamily = A2_FAMILY; m_CurrentCEHCallback = CEH_A2_CallbackFunction; break; + default: return INVALID_INPUT_PARAMETERS; } @@ -2529,7 +2535,7 @@ int CLCDriverMethods::GetPcTimeouts(TR15Timeouts *R15_TOs, TLCDriverTimeouts *LC /// <param name="piSize">Size of data to write.</param> /// <returns> Void.</returns> template <class T, class U> -void CLCDriverMethods::CopyVectorToArray(const vector<T>& Source, U *pDestination, int *piSize) +void CLCDriverMethods::CopyVectorToArray(const vector<T> &Source, U *pDestination, int *piSize) { size_t copyLength = *piSize; @@ -2607,6 +2613,7 @@ int CLCDriverMethods::WaitForEvent(uint32 event, int Group, int Command) } break; + case EVENT_CMD_RECEIVED: if ((receivedEvent->group == Group && receivedEvent->command == Command) || @@ -2619,13 +2626,16 @@ int CLCDriverMethods::WaitForEvent(uint32 event, int Group, int Command) } break; + case EVENT_SPEEDFLASH: m_pLogger->log("WaitForEvent: Speedflash request received."); iResult = 0; break; + case EVENT_ERROR: iResult = receivedEvent->error; break; + default: iResult = UNEXPECTED_EVENT_RECEIVED; break; @@ -2716,8 +2726,10 @@ int CLCDriverMethods::MapLcmError(int error) switch (error) { case E_RETRANSMITION_FAILED: return LCM_RETRANSMISSION_ERROR; + case E_GENERAL_COMMUNICATION_ERROR: return LCM_DEVICE_WRITE_ERROR; + default: return error; } diff --git a/source/LCDriverMethods.h b/source/LCDriverMethods.h index 6e4ae2a..7033be9 100644 --- a/source/LCDriverMethods.h +++ b/source/LCDriverMethods.h @@ -248,7 +248,7 @@ private: // String and vector copy functions. //----------------------------------------- template<class T, class U> - void CopyVectorToArray(const std::vector<T>& Source, U *pDestination, int *piSize); + void CopyVectorToArray(const std::vector<T> &Source, U *pDestination, int *piSize); void CopyStringToArray(std::string &Source, char *pDestination, int *piSize); diff --git a/source/LCM/Hash.cpp b/source/LCM/Hash.cpp index 4f5962c..7836604 100644 --- a/source/LCM/Hash.cpp +++ b/source/LCM/Hash.cpp @@ -23,21 +23,21 @@ **********************************************************************/ const uint32 red[16] = { 0, - (0x1 << 16) ^(0x1021 << 0), \ - (0x2 << 16) ^(0x1021 << 1), \ - (0x3 << 16) ^(0x1021 << 1) ^(0x1021 << 0), \ - (0x4 << 16) ^(0x1021 << 2), \ - (0x5 << 16) ^(0x1021 << 2) ^(0x1021 << 0), \ - (0x6 << 16) ^(0x1021 << 2) ^(0x1021 << 1), \ - (0x7 << 16) ^(0x1021 << 2) ^(0x1021 << 1) ^(0x1021 << 0), \ - (0x8 << 16) ^(0x1021 << 3), \ - (0x9 << 16) ^(0x1021 << 3) ^(0x1021 << 0), \ - (0xa << 16) ^(0x1021 << 3) ^(0x1021 << 1), \ - (0xb << 16) ^(0x1021 << 3) ^(0x1021 << 1) ^(0x1021 << 0), \ - (0xc << 16) ^(0x1021 << 3) ^(0x1021 << 2), \ - (0xd << 16) ^(0x1021 << 3) ^(0x1021 << 2) ^(0x1021 << 0), \ - (0xe << 16) ^(0x1021 << 3) ^(0x1021 << 2) ^(0x1021 << 1), \ - (0xf << 16) ^(0x1021 << 3) ^(0x1021 << 2) ^(0x1021 << 1) ^(0x1021 << 0) + (0x1 << 16) ^ (0x1021 << 0), \ + (0x2 << 16) ^ (0x1021 << 1), \ + (0x3 << 16) ^ (0x1021 << 1) ^ (0x1021 << 0), \ + (0x4 << 16) ^ (0x1021 << 2), \ + (0x5 << 16) ^ (0x1021 << 2) ^ (0x1021 << 0), \ + (0x6 << 16) ^ (0x1021 << 2) ^ (0x1021 << 1), \ + (0x7 << 16) ^ (0x1021 << 2) ^ (0x1021 << 1) ^ (0x1021 << 0), \ + (0x8 << 16) ^ (0x1021 << 3), \ + (0x9 << 16) ^ (0x1021 << 3) ^ (0x1021 << 0), \ + (0xa << 16) ^ (0x1021 << 3) ^ (0x1021 << 1), \ + (0xb << 16) ^ (0x1021 << 3) ^ (0x1021 << 1) ^ (0x1021 << 0), \ + (0xc << 16) ^ (0x1021 << 3) ^ (0x1021 << 2), \ + (0xd << 16) ^ (0x1021 << 3) ^ (0x1021 << 2) ^ (0x1021 << 0), \ + (0xe << 16) ^ (0x1021 << 3) ^ (0x1021 << 2) ^ (0x1021 << 1), \ + (0xf << 16) ^ (0x1021 << 3) ^ (0x1021 << 2) ^ (0x1021 << 1) ^ (0x1021 << 0) }; Hash::Hash() @@ -93,6 +93,7 @@ void *Hash::WorkerThread(void *arg) } break; + case HASH_CRC16: memset(request->Hash_p, 0, CRC16_LENGTH); @@ -102,6 +103,7 @@ void *Hash::WorkerThread(void *arg) } break; + case HASH_SIMPLE_XOR: request->Hash_p[0] = 0; @@ -110,8 +112,10 @@ void *Hash::WorkerThread(void *arg) } break; + case HASH_NONE: break; + default: // unsupported hash type, nothing to do delete request; @@ -184,12 +188,12 @@ uint16 Hash::crc16(const uint8 *p, int count, uint16 crc_in) register uint32 crc = crc_in; while (--count >= 0) { - crc = crc ^(uint8) * p++ << 8; - crc ^= red[crc>>16]; + crc = crc ^ (uint8) * p++ << 8; + crc ^= red[crc >> 16]; crc = (crc << 4); - crc ^= red[crc>>16]; + crc ^= red[crc >> 16]; crc = (crc << 4); - crc ^= red[crc>>16]; + crc ^= red[crc >> 16]; } diff --git a/source/LCM/include/t_r15_network_layer.h b/source/LCM/include/t_r15_network_layer.h index 3d48957..fbf1da1 100644 --- a/source/LCM/include/t_r15_network_layer.h +++ b/source/LCM/include/t_r15_network_layer.h @@ -283,7 +283,7 @@ typedef struct { /** R15 Network context */ typedef struct { - PacketMeta_t *MetaInfoList[COMMAND_BUFFER_COUNT+BULK_BUFFER_COUNT]; + PacketMeta_t *MetaInfoList[COMMAND_BUFFER_COUNT + BULK_BUFFER_COUNT]; /**< List of meta data for used packets. */ RetransmissionContext_t *RetransmissionList[MAX_SIZE_RETRANSMISSION_LIST]; /**< List of packet for retransmission */ diff --git a/source/LcdVersion.cpp b/source/LcdVersion.cpp index ee2bb29..168f0b5 100644 --- a/source/LcdVersion.cpp +++ b/source/LcdVersion.cpp @@ -16,6 +16,6 @@ * var char *LCD_VersionList[] * brief ASCII string list variable holding the LCD version/build time/product number.. */ -char *LCD_VersionList[] = {"PX2", +char *LCD_VersionList[] = {"PX4", NULL }; diff --git a/source/LcmInterface.h b/source/LcmInterface.h index 021559e..be1bc01 100644 --- a/source/LcmInterface.h +++ b/source/LcmInterface.h @@ -24,7 +24,7 @@ typedef ErrorCode_e(*CommunicationSetFamily_t)(Communication_t *Communication_p, typedef ErrorCode_e(*CommunicationSend_t)(Communication_t *Communication_p, void *InputData_p); typedef ErrorCode_e(*CommunicationSetProtocolTimeouts_t)(Communication_t *Communication_p, void *TimeoutData_p); typedef ErrorCode_e(*CommunicationGetProtocolTimeouts_t)(Communication_t *Communication_p, void *TimeoutData_p); -typedef char*(*CommunicationGetVersion_t)(Communication_t *Communication_p); +typedef char *(*CommunicationGetVersion_t)(Communication_t *Communication_p); typedef ErrorCode_e(*CommunicationCancelReceiver_t)(Communication_t *Communication_p, uint8 PacketsBeforeTransferStop); typedef ErrorCode_e(*R15CommandSend_t)(Communication_t *Communication_p, CommandData_t *CmdData_p); @@ -32,7 +32,7 @@ typedef ErrorCode_e(*R15CommandResetSessionCounters_t)(const Communication_t *co typedef ErrorCode_e(*R15BulkStartSession_t)(Communication_t *Communication_p, TL_BulkVectorList_t *BulkVector_p, const uint64 Offset); typedef ErrorCode_e(*R15BulkCloseSession_t)(Communication_t *Communication_p, TL_BulkVectorList_t *BulkVector_p); -typedef TL_BulkVectorList_t*(*R15BulkCreateVector_t)(const Communication_t *const Communication_p, const uint32 BulkVector, uint32 Length, const uint32 BuffSize, TL_BulkVectorList_t *CreatedBulkVector_p); +typedef TL_BulkVectorList_t *(*R15BulkCreateVector_t)(const Communication_t *const Communication_p, const uint32 BulkVector, uint32 Length, const uint32 BuffSize, TL_BulkVectorList_t *CreatedBulkVector_p); typedef TL_BulkSessionState_t (*R15BulkGetStatusSession_t)(const Communication_t *const Communication_p, const TL_BulkVectorList_t *BulkVector_p); typedef uint32(*R15BulkDestroyVector_t)(const Communication_t *const Communication_p, TL_BulkVectorList_t *BulkVector_p, boolean ReqReleaseBuffer); typedef uint32(*R15BulkOpenSession_t)(const Communication_t *const Communication_p, const uint16 SessionId, const TL_SessionMode_t Mode, uint32 Length); diff --git a/source/api_wrappers/linux/CThreadWrapper.cpp b/source/api_wrappers/linux/CThreadWrapper.cpp index 3e95da8..ab3f69b 100644 --- a/source/api_wrappers/linux/CThreadWrapper.cpp +++ b/source/api_wrappers/linux/CThreadWrapper.cpp @@ -30,7 +30,7 @@ // Desc: CEventObject constructor which initializes the class members // Ret: // ****************************************************************************** -CThreadWrapper::CThreadWrapper(void*(*pStartAddress)(void *), void *pArgument) +CThreadWrapper::CThreadWrapper(void * (*pStartAddress)(void *), void *pArgument) { m_pStartAddress = pStartAddress; m_pArgument = pArgument; diff --git a/source/api_wrappers/linux/CThreadWrapper.h b/source/api_wrappers/linux/CThreadWrapper.h index aabadcc..c7bfe01 100644 --- a/source/api_wrappers/linux/CThreadWrapper.h +++ b/source/api_wrappers/linux/CThreadWrapper.h @@ -10,12 +10,12 @@ #include "CEventObject.h" #include <pthread.h> -typedef void*(*StartAddress_t)(void *); +typedef void *(*StartAddress_t)(void *); class CThreadWrapper : public CWaitableObject { public: - CThreadWrapper(void*(* pStartAddress)(void *), void *pArgument); + CThreadWrapper(void * (* pStartAddress)(void *), void *pArgument); ~CThreadWrapper(); void ResumeThread(); void SuspendThread(); diff --git a/source/api_wrappers/linux/OS.h b/source/api_wrappers/linux/OS.h index cd219b9..b79c6ea 100644 --- a/source/api_wrappers/linux/OS.h +++ b/source/api_wrappers/linux/OS.h @@ -79,8 +79,10 @@ int _ultoa_s(unsigned long value, char(&str)[_Size], int radix) switch (radix) { case 10: return sprintf_s(str, "%ul", value); + case 16: return sprintf_s(str, "%ulX", value); + default: return -1; } diff --git a/source/api_wrappers/windows/WinApiWrappers.h b/source/api_wrappers/windows/WinApiWrappers.h index 65fca8b..f3fbfa1 100644 --- a/source/api_wrappers/windows/WinApiWrappers.h +++ b/source/api_wrappers/windows/WinApiWrappers.h @@ -240,13 +240,16 @@ public: switch (::WaitForMultipleObjects(2, m_Handles, FALSE, mSecTimeout)) { case WAIT_OBJECT_0 + 0: return REMOVE_CANCEL; + case WAIT_OBJECT_0 + 1: { CLockCS LocalCSLock(m_CSLock); *ppObject = RemoveFromQueueHead(); // Remove pObject from pObjectQueue head return REMOVE_SUCCESS; } + case WAIT_TIMEOUT: return REMOVE_TIMEOUT; + default: assert(false); return REMOVE_CANCEL; diff --git a/source/config/commands.xml b/source/config/commands.xml index d0c2b24..4c9140a 100644 --- a/source/config/commands.xml +++ b/source/config/commands.xml @@ -387,7 +387,7 @@ </permissions> </command> - <command number="16" name="System Deauthenticate" ADbg="false" source="PC"> supportedcmdtype="longrunning"> + <command number="16" name="System Deauthenticate" ADbg="false" source="PC" supportedcmdtype="longrunning"> <interface type="loader" name="Deauthenticate"/> <documentation> This command is used by the Loader to deauthenticates the ME from prior authentications to prevent unauthorized access. diff --git a/source/security_algorithms/sha/sha2.cpp b/source/security_algorithms/sha/sha2.cpp index 647bf7d..f3986ca 100644 --- a/source/security_algorithms/sha/sha2.cpp +++ b/source/security_algorithms/sha/sha2.cpp @@ -468,8 +468,8 @@ void SHA256_Transform(SHA256_CTX *context, const sha2_word32 *data) /* Apply the SHA-256 compression function to update a..h */ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j]; #else /* BYTE_ORDER == LITTLE_ENDIAN */ -/* Apply the SHA-256 compression function to update a..h with copy */ -T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++); + /* Apply the SHA-256 compression function to update a..h with copy */ + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++); #endif /* BYTE_ORDER == LITTLE_ENDIAN */ T2 = Sigma0_256(a) + Maj(a, b, c); h = g; @@ -486,14 +486,14 @@ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++); do { /* Part of the message block expansion: */ - s0 = W256[(j+1)&0x0f]; + s0 = W256[(j + 1) & 0x0f]; s0 = sigma0_256(s0); - s1 = W256[(j+14)&0x0f]; + s1 = W256[(j + 14) & 0x0f]; s1 = sigma1_256(s1); /* Apply the SHA-256 compression function to update a..h */ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + - (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); + (W256[j & 0x0f] += s1 + W256[(j + 9) & 0x0f] + s0); T2 = Sigma0_256(a) + Maj(a, b, c); h = g; g = f; @@ -810,8 +810,8 @@ void SHA512_Transform(SHA512_CTX *context, const sha2_word64 *data) /* Apply the SHA-512 compression function to update a..h */ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j]; #else /* BYTE_ORDER == LITTLE_ENDIAN */ -/* Apply the SHA-512 compression function to update a..h with copy */ -T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++); + /* Apply the SHA-512 compression function to update a..h with copy */ + T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++); #endif /* BYTE_ORDER == LITTLE_ENDIAN */ T2 = Sigma0_512(a) + Maj(a, b, c); h = g; @@ -828,14 +828,14 @@ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++); do { /* Part of the message block expansion: */ - s0 = W512[(j+1)&0x0f]; + s0 = W512[(j + 1) & 0x0f]; s0 = sigma0_512(s0); - s1 = W512[(j+14)&0x0f]; + s1 = W512[(j + 14) & 0x0f]; s1 = sigma1_512(s1); /* Apply the SHA-512 compression function to update a..h */ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + - (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); + (W512[j & 0x0f] += s1 + W512[(j + 9) & 0x0f] + s0); T2 = Sigma0_512(a) + Maj(a, b, c); h = g; g = f; @@ -957,7 +957,7 @@ void SHA512_Last(SHA512_CTX *context) /* Store the length of input data (in bits): */ *(sha2_word64 *)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; - *(sha2_word64 *)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; + *(sha2_word64 *)&context->buffer[SHA512_SHORT_BLOCK_LENGTH + 8] = context->bitcount[0]; /* Final transform: */ SHA512_Transform(context, (sha2_word64 *)context->buffer); diff --git a/source/utilities/BulkHandler.cpp b/source/utilities/BulkHandler.cpp index eb09fe3..5eebd61 100644 --- a/source/utilities/BulkHandler.cpp +++ b/source/utilities/BulkHandler.cpp @@ -97,7 +97,7 @@ void BulkHandler::Finish(bool ForceFinish) m_State = BULK_INACTIVE; m_ReceiveQueue.SignalEvent(); m_pFileWriteThread->WaitToDie(INFINITE); - } else { + } else if (m_State != BULK_INACTIVE) { m_State = BULK_INACTIVE; if (ForceFinish) { @@ -112,15 +112,19 @@ void BulkHandler::HandleCommandRequest(uint16 session, uint32 chunkSize, uint64 case BULK_WRITE_REQUEST: HandleWriteRequest(session, chunkSize, offset, length); break; + case BULK_READ_REQUEST: HandleReadRequest(session, chunkSize, offset, length); break; + case BULK_RX_SESSION_END: HandleRxSessionEnd(session, chunkSize, offset, length); break; + case BULK_TX_SESSION_END: HandleTxSessionEnd(session, chunkSize, offset, length); break; + default: break; } |