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

Commit 0d50297

Browse files
committed
Merge branch 'dev'
2 parents 32f7e74 + b7769ee commit 0d50297

File tree

141 files changed

+5434
-3380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+5434
-3380
lines changed

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77

88
# CMSIS and CMSIS_RTX
99
/CMSIS/CMSIS/
10-
/CMSIS/CMSIS_RTX/*
1110
/CMSIS/Device/*
1211
/CMSIS/ARM.CMSIS.pdsc
13-
!/CMSIS/CMSIS_RTX/dotNetMF.proj
12+
!/CMSIS/CMSIS/RTOS/RTX/dotNetMF.proj
1413

1514
# Visual Studio
1615
*.aps
@@ -31,6 +30,8 @@
3130
[Oo]bj/
3231
ipch/
3332

33+
!/tools/bin/
34+
3435
#uVision
3536
*.uvguix*
3637
Listings/
@@ -40,3 +41,4 @@ Listings/
4041
/DeviceCode/Targets/OS/Win32/DeviceCode/WinPcap_Eth/Dependencies/WpdPack/
4142

4243
*.axfdump
44+
/crypto/lib

Application/TinyBooter/Commands.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,17 @@ bool Loader_Engine::Monitor_CheckSignature( WP_Message* msg )
14521452
return true;
14531453
}
14541454

1455+
#ifdef DEBUG
1456+
// dumps binary block in a form useable as C code constants for isolated testing and verification
1457+
void DumpBlockDeclaration( char const* name, UINT8 const* pBlock, size_t len )
1458+
{
1459+
debug_printf( "const char %s[] = {", name );
1460+
for( int i = 0; i < len; ++i )
1461+
debug_printf( "%c%d", i == 0 ? ' ' : ',', pBlock[ i ] );
1462+
debug_printf( "};\n" );
1463+
}
1464+
#endif
1465+
14551466
bool Loader_Engine::Monitor_SignatureKeyUpdate( WP_Message* msg )
14561467
{
14571468
bool fSuccess = false;
@@ -1486,13 +1497,23 @@ bool Loader_Engine::Monitor_SignatureKeyUpdate( WP_Message* msg )
14861497
ASSERT(0);
14871498
fSuccess = true;
14881499
}
1500+
else
1501+
{
1502+
#ifdef DEBUG
1503+
debug_printf( "Failed cert check for new key:\n");
1504+
DumpBlockDeclaration( "newKey", cmd->m_newKey, sizeof(RSAKey) );
1505+
DumpBlockDeclaration( "newKeySig", cmd->m_newKeySignature, sizeof( cmd->m_newKeySignature ) );
1506+
DumpBlockDeclaration( "currentKey", g_PrimaryConfigManager.GetDeploymentKeys( cmd->m_keyIndex ), sizeof(RSAKey) );
1507+
#endif
1508+
fSuccess = false;
1509+
}
14891510
}
14901511
}
14911512
}
14921513

14931514
ReplyToCommand( msg, fSuccess, false );
14941515

1495-
return true;
1516+
return true;
14961517
}
14971518

14981519
bool Loader_Engine::Monitor_FlashSectorMap( WP_Message* msg )

Application/TinyBooter/ConfigurationManager.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ void ConfigurationSectorManager::LocateConfigurationSector( UINT32 BlockUsage )
6868

6969
void ConfigurationSectorManager::LoadConfiguration()
7070
{
71-
if (m_device ==NULL) return;
71+
if (m_device ==NULL)
72+
return;
73+
7274
if (m_fSupportsXIP)
7375
{
7476
// Get the real address
@@ -91,7 +93,8 @@ void ConfigurationSectorManager::WriteConfiguration( UINT32 writeOffset, BYTE *d
9193
BOOL eraseWrite = FALSE;
9294
UINT32 writeLengthInBytes ;
9395

94-
if (m_device ==NULL) return ;
96+
if (m_device ==NULL)
97+
return ;
9598

9699
LoadConfiguration();
97100

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

180183
BOOL ConfigurationSectorManager::IsBootLoaderRequired( INT32 &bootModeTimeout )
181184
{
182-
const UINT32 c_Empty = 0xFFFFFFFF;
185+
const UINT32 c_Empty = 0xFFFFFFFF;
183186

184-
if(m_device == NULL) return FALSE;
187+
if(m_device == NULL)
188+
return FALSE;
185189

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

Application/TinyBooter/CryptoInterface.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,9 @@
44

55
#include "CryptoInterface.h"
66
#include "ConfigurationManager.h"
7-
//--//
87

98
extern UINT8* g_ConfigBuffer;
10-
extern int g_ConfigBufferLength;
11-
12-
13-
//--//
14-
9+
extern int g_ConfigBufferLength;
1510

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

4844

4945
switch(m_sectorType)
5046
{
5147
case BlockRange::BLOCKTYPE_DEPLOYMENT:
5248
// backwards compatibility
53-
if(g_PrimaryConfigManager.GetTinyBooterVersion() != ConfigurationSector::c_CurrentVersionTinyBooter) return true;
49+
if(g_PrimaryConfigManager.GetTinyBooterVersion() != ConfigurationSector::c_CurrentVersionTinyBooter)
50+
return true;
5451

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

76-
if(g_ConfigBuffer == NULL || g_ConfigBufferLength <= 0) return false;
73+
if(g_ConfigBuffer == NULL || g_ConfigBufferLength <= 0)
74+
return false;
7775

7876
// the g_ConfigBuffer contains the new configuration data
79-
const ConfigurationSector* pNewCfg = (const ConfigurationSector*)g_ConfigBuffer;
77+
const ConfigurationSector* pNewCfg = (const ConfigurationSector*)g_ConfigBuffer;
8078

8179
bool fCanWrite = false;
8280
bool fRet = false;
@@ -125,7 +123,8 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
125123
// backwards compatibility
126124

127125

128-
if(g_PrimaryConfigManager.GetTinyBooterVersion() != ConfigurationSector::c_CurrentVersionTinyBooter) return true;
126+
if(g_PrimaryConfigManager.GetTinyBooterVersion() != ConfigurationSector::c_CurrentVersionTinyBooter)
127+
return true;
129128

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

138137
break;
139-
140138
};
141139

142140
if(key == NULL)
@@ -151,7 +149,7 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
151149
{
152150
m_res = ::Crypto_StepRSAOperation( &m_handle );
153151
}
154-
152+
155153
return m_res == CRYPTO_SUCCESS;
156154
}
157155

CLR/Core/CLR_RT_UnicodeHelper.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ int CLR_RT_UnicodeHelper::CountNumberOfBytes( int max )
103103
if(ch >= LOW_SURROGATE_START && ch <= LOW_SURROGATE_END)
104104
{
105105
num += 4;
106+
max--;
106107
}
107108
else
108109
{
@@ -375,6 +376,8 @@ bool CLR_RT_UnicodeHelper::ConvertToUTF8( int iMaxChars, bool fJustMove )
375376
outputUTF8 += 4;
376377
outputUTF8_size -= 4;
377378
}
379+
380+
iMaxChars -= 2;
378381
}
379382
else
380383
{

CLR/Core/Execution.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ bool CLR_RT_ExecutionEngine::SpawnStaticConstructorHelper( CLR_RT_AppDomain* app
840840
CLR_RT_MethodDef_Index idxNext;
841841

842842
_ASSERTE(m_cctorThread != NULL);
843-
_ASSERTE(m_cctorThread->CanThreadBeReused());
843+
//_ASSERTE(m_cctorThread->CanThreadBeReused());
844844

845845
idxNext.m_data = idx.m_data;
846846

CLR/Core/ParseOptions_Win32.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ void CLR_RT_ParseOptions::Usage()
293293

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

299299
for(it2 = cmd->m_params.begin(); it2 != cmd->m_params.end(); it2++)

0 commit comments

Comments
 (0)