44
55#include " CryptoInterface.h"
66#include " ConfigurationManager.h"
7- // --//
87
98extern UINT8* g_ConfigBuffer;
10- extern int g_ConfigBufferLength;
11-
12-
13- // --//
14-
9+ extern int g_ConfigBufferLength;
1510
1611CryptoState::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
0 commit comments