Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
smaillet-ms committed Oct 20, 2015
2 parents 32f7e74 + b7769ee commit 0d50297
Show file tree
Hide file tree
Showing 141 changed files with 5,434 additions and 3,380 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@

# CMSIS and CMSIS_RTX
/CMSIS/CMSIS/
/CMSIS/CMSIS_RTX/*
/CMSIS/Device/*
/CMSIS/ARM.CMSIS.pdsc
!/CMSIS/CMSIS_RTX/dotNetMF.proj
!/CMSIS/CMSIS/RTOS/RTX/dotNetMF.proj

# Visual Studio
*.aps
Expand All @@ -31,6 +30,8 @@
[Oo]bj/
ipch/

!/tools/bin/

#uVision
*.uvguix*
Listings/
Expand All @@ -40,3 +41,4 @@ Listings/
/DeviceCode/Targets/OS/Win32/DeviceCode/WinPcap_Eth/Dependencies/WpdPack/

*.axfdump
/crypto/lib
23 changes: 22 additions & 1 deletion Application/TinyBooter/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,17 @@ bool Loader_Engine::Monitor_CheckSignature( WP_Message* msg )
return true;
}

#ifdef DEBUG
// dumps binary block in a form useable as C code constants for isolated testing and verification
void DumpBlockDeclaration( char const* name, UINT8 const* pBlock, size_t len )
{
debug_printf( "const char %s[] = {", name );
for( int i = 0; i < len; ++i )
debug_printf( "%c%d", i == 0 ? ' ' : ',', pBlock[ i ] );
debug_printf( "};\n" );
}
#endif

bool Loader_Engine::Monitor_SignatureKeyUpdate( WP_Message* msg )
{
bool fSuccess = false;
Expand Down Expand Up @@ -1486,13 +1497,23 @@ bool Loader_Engine::Monitor_SignatureKeyUpdate( WP_Message* msg )
ASSERT(0);
fSuccess = true;
}
else
{
#ifdef DEBUG
debug_printf( "Failed cert check for new key:\n");
DumpBlockDeclaration( "newKey", cmd->m_newKey, sizeof(RSAKey) );
DumpBlockDeclaration( "newKeySig", cmd->m_newKeySignature, sizeof( cmd->m_newKeySignature ) );
DumpBlockDeclaration( "currentKey", g_PrimaryConfigManager.GetDeploymentKeys( cmd->m_keyIndex ), sizeof(RSAKey) );
#endif
fSuccess = false;
}
}
}
}

ReplyToCommand( msg, fSuccess, false );

return true;
return true;
}

bool Loader_Engine::Monitor_FlashSectorMap( WP_Message* msg )
Expand Down
12 changes: 8 additions & 4 deletions Application/TinyBooter/ConfigurationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ void ConfigurationSectorManager::LocateConfigurationSector( UINT32 BlockUsage )

void ConfigurationSectorManager::LoadConfiguration()
{
if (m_device ==NULL) return;
if (m_device ==NULL)
return;

if (m_fSupportsXIP)
{
// Get the real address
Expand All @@ -91,7 +93,8 @@ void ConfigurationSectorManager::WriteConfiguration( UINT32 writeOffset, BYTE *d
BOOL eraseWrite = FALSE;
UINT32 writeLengthInBytes ;

if (m_device ==NULL) return ;
if (m_device ==NULL)
return ;

LoadConfiguration();

Expand Down Expand Up @@ -179,9 +182,10 @@ void ConfigurationSectorManager::EraseWriteConfigBlock( BYTE * data, UINT32 size

BOOL ConfigurationSectorManager::IsBootLoaderRequired( INT32 &bootModeTimeout )
{
const UINT32 c_Empty = 0xFFFFFFFF;
const UINT32 c_Empty = 0xFFFFFFFF;

if(m_device == NULL) return FALSE;
if(m_device == NULL)
return FALSE;

volatile UINT32* data = (volatile UINT32*)&m_configurationSector->BooterFlagArray[ 0 ];

Expand Down
24 changes: 11 additions & 13 deletions Application/TinyBooter/CryptoInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@

#include "CryptoInterface.h"
#include "ConfigurationManager.h"
//--//

extern UINT8* g_ConfigBuffer;
extern int g_ConfigBufferLength;


//--//

extern int g_ConfigBufferLength;

CryptoState::CryptoState( UINT32 dataAddress, UINT32 dataLength, BYTE* sig, UINT32 sigLength, UINT32 sectorType ) :
#if defined(ARM_V1_2)
Expand Down Expand Up @@ -43,14 +38,16 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
// IF THERE IS NO CONFIG SECTOR IN THE FLASH SECTOR TABLE, THEN WE DON'T HAVE KEYS,
// THEREFORE WE WILL NOT PERFORM SIGNATURE CHECKING.
//
if(g_PrimaryConfigManager.m_device == NULL) return true;
if(g_PrimaryConfigManager.m_device == NULL)
return true;


switch(m_sectorType)
{
case BlockRange::BLOCKTYPE_DEPLOYMENT:
// backwards compatibility
if(g_PrimaryConfigManager.GetTinyBooterVersion() != ConfigurationSector::c_CurrentVersionTinyBooter) return true;
if(g_PrimaryConfigManager.GetTinyBooterVersion() != ConfigurationSector::c_CurrentVersionTinyBooter)
return true;

// if there is no key then we do not need to check the signature for the deployment sectors ONLY
if(g_PrimaryConfigManager.CheckSignatureKeyEmpty( ConfigurationSector::c_DeployKeyDeployment ))
Expand All @@ -73,10 +70,11 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
ASSERT(g_ConfigBufferLength > 0);
ASSERT(g_ConfigBuffer != NULL);

if(g_ConfigBuffer == NULL || g_ConfigBufferLength <= 0) return false;
if(g_ConfigBuffer == NULL || g_ConfigBufferLength <= 0)
return false;

// the g_ConfigBuffer contains the new configuration data
const ConfigurationSector* pNewCfg = (const ConfigurationSector*)g_ConfigBuffer;
const ConfigurationSector* pNewCfg = (const ConfigurationSector*)g_ConfigBuffer;

bool fCanWrite = false;
bool fRet = false;
Expand Down Expand Up @@ -125,7 +123,8 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
// backwards compatibility


if(g_PrimaryConfigManager.GetTinyBooterVersion() != ConfigurationSector::c_CurrentVersionTinyBooter) return true;
if(g_PrimaryConfigManager.GetTinyBooterVersion() != ConfigurationSector::c_CurrentVersionTinyBooter)
return true;

// if there is no key then we do not need to check the signature for the deployment sectors ONLY
if (g_PrimaryConfigManager.CheckSignatureKeyEmpty( keyIndex ))
Expand All @@ -136,7 +135,6 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
key = (RSAKey*)g_PrimaryConfigManager.GetDeploymentKeys( keyIndex );

break;

};

if(key == NULL)
Expand All @@ -151,7 +149,7 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
{
m_res = ::Crypto_StepRSAOperation( &m_handle );
}

return m_res == CRYPTO_SUCCESS;
}

3 changes: 3 additions & 0 deletions CLR/Core/CLR_RT_UnicodeHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ int CLR_RT_UnicodeHelper::CountNumberOfBytes( int max )
if(ch >= LOW_SURROGATE_START && ch <= LOW_SURROGATE_END)
{
num += 4;
max--;
}
else
{
Expand Down Expand Up @@ -375,6 +376,8 @@ bool CLR_RT_UnicodeHelper::ConvertToUTF8( int iMaxChars, bool fJustMove )
outputUTF8 += 4;
outputUTF8_size -= 4;
}

iMaxChars -= 2;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion CLR/Core/Execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ bool CLR_RT_ExecutionEngine::SpawnStaticConstructorHelper( CLR_RT_AppDomain* app
CLR_RT_MethodDef_Index idxNext;

_ASSERTE(m_cctorThread != NULL);
_ASSERTE(m_cctorThread->CanThreadBeReused());
//_ASSERTE(m_cctorThread->CanThreadBeReused());

idxNext.m_data = idx.m_data;

Expand Down
2 changes: 1 addition & 1 deletion CLR/Core/ParseOptions_Win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void CLR_RT_ParseOptions::Usage()

if(m_commands.size() > 1)
{
wprintf( L" %s\n", option.c_str(), cmd->m_szDescription );
wprintf( L" %s\n", option.c_str());
}

for(it2 = cmd->m_params.begin(); it2 != cmd->m_params.end(); it2++)
Expand Down
Loading

0 comments on commit 0d50297

Please sign in to comment.