File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,29 @@ static void init_vfp_nsec(void)
188
188
}
189
189
#endif
190
190
191
+ /*
192
+ * Check for supported Crypto Extensions (ARMv8 aarch32/aarch64)
193
+ * In case one of instructions is not supported false is returned.
194
+ */
195
+ static bool check_cpuid_ce (void )
196
+ {
197
+ uint32_t isar5 = read_isar5 ();
198
+
199
+ if (!(isar5 | ID_ISAR5_AES ))
200
+ return false;
201
+
202
+ if (!(isar5 | ID_ISAR5_SHA1 ))
203
+ return false;
204
+
205
+ if (!(isar5 | ID_ISAR5_SHA2 ))
206
+ return false;
207
+
208
+ if (!(isar5 | ID_ISAR5_CRC32 ))
209
+ return false;
210
+
211
+ return true;
212
+ }
213
+
191
214
#if defined(CFG_WITH_VFP )
192
215
193
216
#ifdef ARM32
@@ -1148,6 +1171,13 @@ static void init_primary(unsigned long pageable_part, unsigned long nsec_entry)
1148
1171
thread_set_exceptions (THREAD_EXCP_ALL );
1149
1172
primary_save_cntfrq ();
1150
1173
init_vfp_sec ();
1174
+
1175
+ if (IS_ENABLED (CFG_CRYPTO_WITH_CE ) && !check_cpuid_ce ()) {
1176
+ EMSG ("OP-TEE is built with CRYPTO_WITH_CE=y" );
1177
+ EMSG ("But CE instructions are not supported by CPU" );
1178
+ panic ();
1179
+ }
1180
+
1151
1181
/*
1152
1182
* Pager: init_runtime() calls thread_kernel_enable_vfp() so we must
1153
1183
* set a current thread right now to avoid a chicken-and-egg problem
You can’t perform that action at this time.
0 commit comments