test_ecc.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. /*
  2. * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: CC0-1.0
  5. */
  6. #include <stdio.h>
  7. #include <stdbool.h>
  8. #include <string.h>
  9. #include "sdkconfig.h"
  10. #include "esp_private/esp_crypto_lock_internal.h"
  11. #include "esp_log.h"
  12. #include "ecc_params.h"
  13. #include "soc/soc_caps.h"
  14. #include "hal/ecc_hal.h"
  15. #include "hal/ecc_ll.h"
  16. #include "memory_checks.h"
  17. #include "unity_fixture.h"
  18. #define _DEBUG_ 0
  19. #define SOC_ECC_SUPPORT_POINT_MULT 1
  20. #define SOC_ECC_SUPPORT_POINT_VERIFY 1
  21. #if SOC_ECC_EXTENDED_MODES_SUPPORTED
  22. #define SOC_ECC_SUPPORT_POINT_DIVISION 1
  23. #define SOC_ECC_SUPPORT_JACOB_POINT_MULT 1
  24. #define SOC_ECC_SUPPORT_JACOB_POINT_VERIFY 1
  25. #define SOC_ECC_SUPPORT_POINT_ADDITION 1
  26. #define SOC_ECC_SUPPORT_MOD_ADD 1
  27. #define SOC_ECC_SUPPORT_MOD_SUB 1
  28. #define SOC_ECC_SUPPORT_MOD_MUL 1
  29. #endif
  30. static void ecc_be_to_le(const uint8_t* be_point, uint8_t *le_point, uint8_t len)
  31. {
  32. /* When the size is 24 bytes, it should be padded with 0 bytes*/
  33. memset(le_point, 0x0, 32);
  34. for (int i = 0; i < len; i++) {
  35. le_point[i] = be_point[len - i - 1];
  36. }
  37. }
  38. static void ecc_enable_and_reset(void)
  39. {
  40. ECC_RCC_ATOMIC() {
  41. ecc_ll_enable_bus_clock(true);
  42. ecc_ll_reset_register();
  43. }
  44. }
  45. static void ecc_disable(void)
  46. {
  47. ECC_RCC_ATOMIC() {
  48. ecc_ll_enable_bus_clock(false);
  49. }
  50. }
  51. TEST_GROUP(ecc);
  52. TEST_SETUP(ecc)
  53. {
  54. test_utils_record_free_mem();
  55. TEST_ESP_OK(test_utils_set_leak_level(0, ESP_LEAK_TYPE_CRITICAL, ESP_COMP_LEAK_GENERAL));
  56. }
  57. TEST_TEAR_DOWN(ecc)
  58. {
  59. test_utils_finish_and_evaluate_leaks(test_utils_get_leak_level(ESP_LEAK_TYPE_WARNING, ESP_COMP_LEAK_ALL),
  60. test_utils_get_leak_level(ESP_LEAK_TYPE_CRITICAL, ESP_COMP_LEAK_ALL));
  61. }
  62. #if SOC_ECC_SUPPORT_POINT_MULT
  63. static void ecc_point_mul(const uint8_t *k_le, const uint8_t *x_le, const uint8_t *y_le, uint8_t len, bool verify_first,
  64. uint8_t *res_x_le, uint8_t *res_y_le)
  65. {
  66. ecc_enable_and_reset();
  67. ecc_hal_write_mul_param(k_le, x_le, y_le, len);
  68. if (verify_first) {
  69. ecc_hal_set_mode(ECC_MODE_VERIFY_THEN_POINT_MUL);
  70. } else {
  71. ecc_hal_set_mode(ECC_MODE_POINT_MUL);
  72. }
  73. ecc_hal_start_calc();
  74. while (!ecc_hal_is_calc_finished()) {
  75. ;
  76. }
  77. ecc_hal_read_mul_result(res_x_le, res_y_le, len);
  78. ecc_disable();
  79. }
  80. static void test_ecc_point_mul_inner(bool verify_first)
  81. {
  82. uint8_t scalar_le[32];
  83. uint8_t x_le[32];
  84. uint8_t y_le[32];
  85. /* P256 */
  86. ecc_be_to_le(ecc_p256_scalar, scalar_le, 32);
  87. ecc_be_to_le(ecc_p256_point_x, x_le, 32);
  88. ecc_be_to_le(ecc_p256_point_y, y_le, 32);
  89. uint8_t x_res_le[32];
  90. uint8_t y_res_le[32];
  91. ecc_point_mul(scalar_le, x_le, y_le, 32, verify_first, x_res_le, y_res_le);
  92. uint8_t x_mul_le[32];
  93. uint8_t y_mul_le[32];
  94. ecc_be_to_le(ecc_p256_mul_res_x, x_mul_le, 32);
  95. ecc_be_to_le(ecc_p256_mul_res_y, y_mul_le, 32);
  96. #if _DEBUG_
  97. ESP_LOG_BUFFER_HEX("Expected X:", x_mul_le, 32);
  98. ESP_LOG_BUFFER_HEX("Got X:", x_res_le, 32);
  99. ESP_LOG_BUFFER_HEX("Expected Y:", y_mul_le, 32);
  100. ESP_LOG_BUFFER_HEX("Got Y:", y_res_le, 32);
  101. #endif
  102. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(x_mul_le, x_res_le, 32, "X coordinate of P256 point multiplication ");
  103. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(y_mul_le, y_res_le, 32, "Y coordinate of P256 point multiplication ");
  104. memset(x_res_le, 0x0, 32);
  105. memset(y_res_le, 0x0, 32);
  106. memset(x_mul_le, 0x0, 32);
  107. memset(y_mul_le, 0x0, 32);
  108. /* P192 */
  109. ecc_be_to_le(ecc_p192_scalar, scalar_le, 24);
  110. ecc_be_to_le(ecc_p192_point_x, x_le, 24);
  111. ecc_be_to_le(ecc_p192_point_y, y_le, 24);
  112. ecc_point_mul(scalar_le, x_le, y_le, 24, verify_first, x_res_le, y_res_le);
  113. ecc_be_to_le(ecc_p192_mul_res_x, x_mul_le, 24);
  114. ecc_be_to_le(ecc_p192_mul_res_y, y_mul_le, 24);
  115. #if _DEBUG_
  116. ESP_LOG_BUFFER_HEX("Expected X:", x_mul_le, 32);
  117. ESP_LOG_BUFFER_HEX("Got X:", x_res_le, 32);
  118. ESP_LOG_BUFFER_HEX("Expected Y:", y_mul_le, 32);
  119. ESP_LOG_BUFFER_HEX("Got Y:", y_res_le, 32);
  120. #endif
  121. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(x_mul_le, x_res_le, 24, "X coordinate of P192 point multiplication ");
  122. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(y_mul_le, y_res_le, 24, "Y coordinate of P192 point multiplication ");
  123. }
  124. TEST(ecc, ecc_point_multiplication_on_SECP192R1_and_SECP256R1)
  125. {
  126. test_ecc_point_mul_inner(false);
  127. }
  128. #endif
  129. #if SOC_ECC_SUPPORT_POINT_VERIFY && !defined(SOC_ECC_SUPPORT_POINT_VERIFY_QUIRK)
  130. static int ecc_point_verify(const uint8_t *x_le, const uint8_t *y_le, uint8_t len)
  131. {
  132. ecc_enable_and_reset();
  133. ecc_hal_write_verify_param(x_le, y_le, len);
  134. ecc_hal_set_mode(ECC_MODE_VERIFY);
  135. ecc_hal_start_calc();
  136. while (!ecc_hal_is_calc_finished()) {
  137. ;
  138. }
  139. int ret = ecc_hal_read_verify_result();
  140. ecc_disable();
  141. return ret;
  142. }
  143. TEST(ecc, ecc_point_verification_on_SECP192R1_and_SECP256R1)
  144. {
  145. int res;
  146. uint8_t x_le[32];
  147. uint8_t y_le[32];
  148. /* P256 */
  149. ecc_be_to_le(ecc_p256_point_x, x_le, 32);
  150. ecc_be_to_le(ecc_p256_point_y, y_le, 32);
  151. // Case 1: Correct point on curve
  152. res = ecc_point_verify(x_le, y_le, 32);
  153. TEST_ASSERT_EQUAL(1, res);
  154. // Case 2: Modify one byte from the point
  155. x_le[6] = x_le[6] ^ 0xFF;
  156. res = ecc_point_verify(x_le, y_le, 32);
  157. TEST_ASSERT_EQUAL(0, res);
  158. /* P192 */
  159. ecc_be_to_le(ecc_p192_point_x, x_le, 24);
  160. ecc_be_to_le(ecc_p192_point_y, y_le, 24);
  161. // Case 1: Correct point on curve
  162. res = ecc_point_verify(x_le, y_le, 24);
  163. TEST_ASSERT_EQUAL(1, res);
  164. // Case 2: Modify one byte from the point
  165. x_le[6] = x_le[6] ^ 0xFF;
  166. res = ecc_point_verify(x_le, y_le, 24);
  167. TEST_ASSERT_EQUAL(0, res);
  168. }
  169. #endif
  170. #if SOC_ECC_SUPPORT_POINT_MULT && SOC_ECC_SUPPORT_POINT_VERIFY && !defined(SOC_ECC_SUPPORT_POINT_VERIFY_QUIRK)
  171. TEST(ecc, ecc_point_verification_and_multiplication_on_SECP192R1_and_SECP256R1)
  172. {
  173. test_ecc_point_mul_inner(true);
  174. }
  175. #endif
  176. #if SOC_ECC_SUPPORT_POINT_DIVISION
  177. static void ecc_point_inv_mul(const uint8_t *num_le, const uint8_t *deno_le, uint8_t len, uint8_t *res_le)
  178. {
  179. ecc_enable_and_reset();
  180. uint8_t zero[32] = {0};
  181. ecc_hal_write_mul_param(zero, num_le, deno_le, len);
  182. ecc_hal_set_mode(ECC_MODE_INVERSE_MUL);
  183. ecc_hal_start_calc();
  184. while (!ecc_hal_is_calc_finished()) {
  185. ;
  186. }
  187. ecc_hal_read_mul_result(zero, res_le, len);
  188. ecc_disable();
  189. }
  190. TEST(ecc, ecc_inverse_multiplication_or_mod_division_using_SECP192R1_and_SECP256R1_order_of_curve)
  191. {
  192. uint8_t res[32] = {0};
  193. ecc_point_inv_mul(ecc256_num, ecc256_den, 32, res);
  194. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc256_inv_mul_res, res, 32, "P256 Inverse multiplication (or Mod division)");
  195. ecc_point_inv_mul(ecc192_num, ecc192_den, 24, res);
  196. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc192_inv_mul_res, res, 24, "P192 Inverse multiplication (or Mod division)");
  197. }
  198. #endif
  199. #if SOC_ECC_SUPPORT_JACOB_POINT_MULT
  200. static void ecc_jacob_mul(uint8_t *k_le, uint8_t *x_le, uint8_t *y_le, uint8_t len, bool verify_first,
  201. uint8_t *res_x_le, uint8_t *res_y_le, uint8_t *res_z_le)
  202. {
  203. ecc_enable_and_reset();
  204. ecc_hal_write_mul_param(k_le, x_le, y_le, len);
  205. if (verify_first) {
  206. ecc_hal_set_mode(ECC_MODE_POINT_VERIFY_JACOBIAN_MUL);
  207. } else {
  208. ecc_hal_set_mode(ECC_MODE_JACOBIAN_POINT_MUL);
  209. }
  210. ecc_hal_start_calc();
  211. while (!ecc_hal_is_calc_finished()) {
  212. ;
  213. }
  214. ecc_hal_read_jacob_mul_result(res_x_le, res_y_le, res_z_le, len);
  215. ecc_disable();
  216. }
  217. static void test_ecc_jacob_mul_inner(bool verify_first)
  218. {
  219. uint8_t scalar_le[32];
  220. uint8_t x_le[32];
  221. uint8_t y_le[32];
  222. /* P256 */
  223. ecc_be_to_le(ecc_p256_scalar, scalar_le, 32);
  224. ecc_be_to_le(ecc_p256_point_x, x_le, 32);
  225. ecc_be_to_le(ecc_p256_point_y, y_le, 32);
  226. uint8_t x_res_le[32];
  227. uint8_t y_res_le[32];
  228. uint8_t z_res_le[32];
  229. ecc_jacob_mul(scalar_le, x_le, y_le, 32, verify_first, x_res_le, y_res_le, z_res_le);
  230. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc_p256_jacob_mul_res_x_le, x_res_le, 32, "X coordinate of P256 point jacobian multiplication ");
  231. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc_p256_jacob_mul_res_y_le, y_res_le, 32, "Y coordinate of P256 point jacobian multiplication ");
  232. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc_p256_jacob_mul_res_z_le, z_res_le, 32, "Z coordinate of P256 point jacobian multiplication ");
  233. memset(x_res_le, 0x0, 32);
  234. memset(y_res_le, 0x0, 32);
  235. memset(z_res_le, 0x0, 32);
  236. /* P192 */
  237. ecc_be_to_le(ecc_p192_scalar, scalar_le, 24);
  238. ecc_be_to_le(ecc_p192_point_x, x_le, 24);
  239. ecc_be_to_le(ecc_p192_point_y, y_le, 24);
  240. ecc_jacob_mul(scalar_le, x_le, y_le, 24, verify_first, x_res_le, y_res_le, z_res_le);
  241. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc_p192_jacob_mul_res_x_le, x_res_le, 24, "X coordinate of P192 point jacobian multiplication ");
  242. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc_p192_jacob_mul_res_y_le, y_res_le, 24, "Y coordinate of P192 point jacobian multiplication ");
  243. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc_p192_jacob_mul_res_z_le, z_res_le, 24, "Z coordinate of P192 point jacobian multiplication ");
  244. }
  245. TEST(ecc, ecc_jacobian_point_multiplication_on_SECP192R1_and_SECP256R1)
  246. {
  247. test_ecc_jacob_mul_inner(false);
  248. }
  249. #endif
  250. #if SOC_ECC_SUPPORT_JACOB_POINT_VERIFY
  251. static int ecc_jacob_verify(const uint8_t *x_le, const uint8_t *y_le, const uint8_t *z_le, uint8_t len)
  252. {
  253. ecc_enable_and_reset();
  254. ecc_hal_write_jacob_verify_param(x_le, y_le, z_le, len);
  255. ecc_hal_set_mode(ECC_MODE_JACOBIAN_POINT_VERIFY);
  256. ecc_hal_start_calc();
  257. while (!ecc_hal_is_calc_finished()) {
  258. ;
  259. }
  260. int ret = ecc_hal_read_verify_result();
  261. ecc_disable();
  262. return ret;
  263. }
  264. TEST(ecc, ecc_jacobian_point_verification_on_SECP192R1_and_SECP256R1)
  265. {
  266. int res;
  267. /* P256 */
  268. res = ecc_jacob_verify(ecc_p256_jacob_mul_res_x_le, ecc_p256_jacob_mul_res_y_le, ecc_p256_jacob_mul_res_z_le, 32);
  269. TEST_ASSERT_EQUAL(1, res);
  270. /* P192 */
  271. res = ecc_jacob_verify(ecc_p192_jacob_mul_res_x_le, ecc_p192_jacob_mul_res_y_le, ecc_p192_jacob_mul_res_z_le, 24);
  272. TEST_ASSERT_EQUAL(1, res);
  273. }
  274. #endif
  275. #if SOC_ECC_SUPPORT_JACOB_POINT_MULT && SOC_ECC_SUPPORT_JACOB_POINT_VERIFY
  276. TEST(ecc, ecc_point_verification_and_jacobian_point_multiplication_on_SECP192R1_and_SECP256R1)
  277. {
  278. test_ecc_jacob_mul_inner(true);
  279. }
  280. #endif
  281. #if SOC_ECC_SUPPORT_POINT_ADDITION
  282. static void ecc_point_addition(uint8_t *px_le, uint8_t *py_le, uint8_t *qx_le, uint8_t *qy_le, uint8_t *qz_le,
  283. uint8_t len, bool jacob_output,
  284. uint8_t *x_res_le, uint8_t *y_res_le, uint8_t *z_res_le)
  285. {
  286. ecc_enable_and_reset();
  287. ecc_hal_write_point_add_param(px_le, py_le, qx_le, qy_le, qz_le, len);
  288. ecc_hal_set_mode(ECC_MODE_POINT_ADD);
  289. ecc_hal_start_calc();
  290. while (!ecc_hal_is_calc_finished()) {
  291. ;
  292. }
  293. ecc_hal_read_point_add_result(x_res_le, y_res_le, z_res_le, len, jacob_output);
  294. ecc_disable();
  295. }
  296. TEST(ecc, ecc_point_addition_on_SECP192R1_and_SECP256R1)
  297. {
  298. uint8_t scalar_le[32] = {0};
  299. uint8_t x_le[32] = {0};
  300. uint8_t y_le[32] = {0};
  301. uint8_t z_le[32] = {0};
  302. /* P256
  303. * R = 2 * P
  304. */
  305. ecc_be_to_le(ecc_p256_point_x, x_le, 32);
  306. ecc_be_to_le(ecc_p256_point_y, y_le, 32);
  307. scalar_le[0] = 0x2;
  308. uint8_t x_res_le[32];
  309. uint8_t y_res_le[32];
  310. uint8_t z_res_le[32];
  311. ecc_jacob_mul(scalar_le, x_le, y_le, 32, 0, x_res_le, y_res_le, z_res_le);
  312. uint8_t x_add_le[32];
  313. uint8_t y_add_le[32];
  314. uint8_t z_add_le[32];
  315. z_le[0] = 0x1;
  316. ecc_point_addition(x_le, y_le, x_le, y_le, z_le, 32, 1, x_add_le, y_add_le, z_add_le);
  317. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(x_add_le, x_res_le, 32, "X coordinate of P256 point addition");
  318. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(y_add_le, y_res_le, 32, "Y coordinate of P256 point addition");
  319. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(z_add_le, z_res_le, 32, "Z coordinate of P256 point addition");
  320. /* P192
  321. * R = 2 * P
  322. */
  323. ecc_be_to_le(ecc_p192_point_x, x_le, 24);
  324. ecc_be_to_le(ecc_p192_point_y, y_le, 24);
  325. scalar_le[0] = 0x2;
  326. ecc_jacob_mul(scalar_le, x_le, y_le, 24, 0, x_res_le, y_res_le, z_res_le);
  327. z_le[0] = 0x1;
  328. ecc_point_addition(x_le, y_le, x_le, y_le, z_le, 24, 1, x_add_le, y_add_le, z_add_le);
  329. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(x_add_le, x_res_le, 24, "X coordinate of P192 point addition");
  330. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(y_add_le, y_res_le, 24, "Y coordinate of P192 point addition");
  331. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(z_add_le, z_res_le, 24, "Z coordinate of P192 point addition");
  332. }
  333. #endif
  334. #if SOC_ECC_SUPPORT_MOD_ADD || SOC_ECC_SUPPORT_MOD_SUB || SOC_ECC_SUPPORT_MOD_MUL
  335. static void ecc_mod_op(ecc_mode_t mode, const uint8_t *a, const uint8_t *b, uint8_t len, uint8_t *res_le)
  336. {
  337. ecc_enable_and_reset();
  338. ecc_hal_write_mod_op_param(a, b, len);
  339. ecc_hal_set_mode(mode);
  340. ecc_hal_start_calc();
  341. while (!ecc_hal_is_calc_finished()) {
  342. ;
  343. }
  344. ecc_hal_read_mod_op_result(res_le, len);
  345. ecc_disable();
  346. }
  347. #endif
  348. #if SOC_ECC_SUPPORT_MOD_ADD
  349. TEST(ecc, ecc_mod_addition_using_SECP192R1_and_SECP256R1_order_of_curve)
  350. {
  351. uint8_t res[32] = {0};
  352. ecc_mod_op(ECC_MODE_MOD_ADD, ecc256_x, ecc256_y, 32, res);
  353. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc256_add_res, res, 32, "P256 mod addition");
  354. ecc_mod_op(ECC_MODE_MOD_ADD, ecc192_x, ecc192_y, 24, res);
  355. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc192_add_res, res, 24, "P192 mod addition");
  356. }
  357. #endif
  358. #if SOC_ECC_SUPPORT_MOD_SUB
  359. TEST(ecc, ecc_mod_subtraction_using_SECP192R1_and_SECP256R1_order_of_curve)
  360. {
  361. uint8_t res[32] = {0};
  362. ecc_mod_op(ECC_MODE_MOD_SUB, ecc256_x, ecc256_y, 32, res);
  363. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc256_sub_res, res, 32, "P256 mod subtraction");
  364. ecc_mod_op(ECC_MODE_MOD_SUB, ecc192_x, ecc192_y, 24, res);
  365. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc192_sub_res, res, 24, "P192 mod subtraction");
  366. }
  367. #endif
  368. #if SOC_ECC_SUPPORT_MOD_MUL
  369. TEST(ecc, ecc_mod_multiplication_using_SECP192R1_and_SECP256R1_order_of_curve)
  370. {
  371. uint8_t res[32] = {0};
  372. ecc_mod_op(ECC_MODE_MOD_MUL, ecc256_x, ecc256_y, 32, res);
  373. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc256_mul_res, res, 32, "P256 mod multiplication");
  374. ecc_mod_op(ECC_MODE_MOD_MUL, ecc192_x, ecc192_y, 24, res);
  375. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(ecc192_mul_res, res, 24, "P192 mod multiplication");
  376. }
  377. #endif
  378. TEST_GROUP_RUNNER(ecc)
  379. {
  380. #if SOC_ECC_SUPPORT_POINT_MULT
  381. RUN_TEST_CASE(ecc, ecc_point_multiplication_on_SECP192R1_and_SECP256R1);
  382. #endif
  383. #if SOC_ECC_SUPPORT_POINT_VERIFY && !defined(SOC_ECC_SUPPORT_POINT_VERIFY_QUIRK)
  384. RUN_TEST_CASE(ecc, ecc_point_verification_on_SECP192R1_and_SECP256R1);
  385. #endif
  386. #if SOC_ECC_SUPPORT_POINT_MULT && SOC_ECC_SUPPORT_POINT_VERIFY && !defined(SOC_ECC_SUPPORT_POINT_VERIFY_QUIRK)
  387. RUN_TEST_CASE(ecc, ecc_point_verification_and_multiplication_on_SECP192R1_and_SECP256R1);
  388. #endif
  389. #if SOC_ECC_SUPPORT_POINT_DIVISION
  390. RUN_TEST_CASE(ecc, ecc_inverse_multiplication_or_mod_division_using_SECP192R1_and_SECP256R1_order_of_curve);
  391. #endif
  392. #if SOC_ECC_SUPPORT_JACOB_POINT_MULT
  393. RUN_TEST_CASE(ecc, ecc_jacobian_point_multiplication_on_SECP192R1_and_SECP256R1);
  394. #endif
  395. #if SOC_ECC_SUPPORT_JACOB_POINT_VERIFY
  396. RUN_TEST_CASE(ecc, ecc_jacobian_point_verification_on_SECP192R1_and_SECP256R1);
  397. #endif
  398. #if SOC_ECC_SUPPORT_JACOB_POINT_MULT && SOC_ECC_SUPPORT_JACOB_POINT_VERIFY
  399. RUN_TEST_CASE(ecc, ecc_point_verification_and_jacobian_point_multiplication_on_SECP192R1_and_SECP256R1);
  400. #endif
  401. #if SOC_ECC_SUPPORT_POINT_ADDITION
  402. RUN_TEST_CASE(ecc, ecc_point_addition_on_SECP192R1_and_SECP256R1);
  403. #endif
  404. #if SOC_ECC_SUPPORT_MOD_ADD
  405. RUN_TEST_CASE(ecc, ecc_mod_addition_using_SECP192R1_and_SECP256R1_order_of_curve);
  406. #endif
  407. #if SOC_ECC_SUPPORT_MOD_SUB
  408. RUN_TEST_CASE(ecc, ecc_mod_subtraction_using_SECP192R1_and_SECP256R1_order_of_curve);
  409. #endif
  410. #if SOC_ECC_SUPPORT_MOD_MUL
  411. RUN_TEST_CASE(ecc, ecc_mod_multiplication_using_SECP192R1_and_SECP256R1_order_of_curve);
  412. #endif
  413. }