4
4
5
5
#include " CryptoInterface.h"
6
6
#include " ConfigurationManager.h"
7
- // --//
8
7
9
8
extern UINT8* g_ConfigBuffer;
10
- extern int g_ConfigBufferLength;
11
-
12
-
13
- // --//
14
-
9
+ extern int g_ConfigBufferLength;
15
10
16
11
CryptoState::CryptoState ( UINT32 dataAddress, UINT32 dataLength, BYTE* sig, UINT32 sigLength, UINT32 sectorType ) :
17
12
#if defined(ARM_V1_2)
@@ -43,14 +38,16 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
43
38
// IF THERE IS NO CONFIG SECTOR IN THE FLASH SECTOR TABLE, THEN WE DON'T HAVE KEYS,
44
39
// THEREFORE WE WILL NOT PERFORM SIGNATURE CHECKING.
45
40
//
46
- if (g_PrimaryConfigManager.m_device == NULL ) return true ;
41
+ if (g_PrimaryConfigManager.m_device == NULL )
42
+ return true ;
47
43
48
44
49
45
switch (m_sectorType)
50
46
{
51
47
case BlockRange::BLOCKTYPE_DEPLOYMENT:
52
48
// backwards compatibility
53
- if (g_PrimaryConfigManager.GetTinyBooterVersion () != ConfigurationSector::c_CurrentVersionTinyBooter) return true ;
49
+ if (g_PrimaryConfigManager.GetTinyBooterVersion () != ConfigurationSector::c_CurrentVersionTinyBooter)
50
+ return true ;
54
51
55
52
// if there is no key then we do not need to check the signature for the deployment sectors ONLY
56
53
if (g_PrimaryConfigManager.CheckSignatureKeyEmpty ( ConfigurationSector::c_DeployKeyDeployment ))
@@ -73,10 +70,11 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
73
70
ASSERT (g_ConfigBufferLength > 0 );
74
71
ASSERT (g_ConfigBuffer != NULL );
75
72
76
- if (g_ConfigBuffer == NULL || g_ConfigBufferLength <= 0 ) return false ;
73
+ if (g_ConfigBuffer == NULL || g_ConfigBufferLength <= 0 )
74
+ return false ;
77
75
78
76
// the g_ConfigBuffer contains the new configuration data
79
- const ConfigurationSector* pNewCfg = (const ConfigurationSector*)g_ConfigBuffer;
77
+ const ConfigurationSector* pNewCfg = (const ConfigurationSector*)g_ConfigBuffer;
80
78
81
79
bool fCanWrite = false ;
82
80
bool fRet = false ;
@@ -125,7 +123,8 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
125
123
// backwards compatibility
126
124
127
125
128
- if (g_PrimaryConfigManager.GetTinyBooterVersion () != ConfigurationSector::c_CurrentVersionTinyBooter) return true ;
126
+ if (g_PrimaryConfigManager.GetTinyBooterVersion () != ConfigurationSector::c_CurrentVersionTinyBooter)
127
+ return true ;
129
128
130
129
// if there is no key then we do not need to check the signature for the deployment sectors ONLY
131
130
if (g_PrimaryConfigManager.CheckSignatureKeyEmpty ( keyIndex ))
@@ -136,7 +135,6 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
136
135
key = (RSAKey*)g_PrimaryConfigManager.GetDeploymentKeys ( keyIndex );
137
136
138
137
break ;
139
-
140
138
};
141
139
142
140
if (key == NULL )
@@ -151,7 +149,7 @@ bool CryptoState::VerifySignature( UINT32 keyIndex )
151
149
{
152
150
m_res = ::Crypto_StepRSAOperation ( &m_handle );
153
151
}
154
-
152
+
155
153
return m_res == CRYPTO_SUCCESS;
156
154
}
157
155
0 commit comments