nrf_crypto_ecc_backend.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. /**
  2. * Copyright (c) 2018, Nordic Semiconductor ASA
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Nordic
  13. * Semiconductor ASA integrated circuit in a product or a software update for
  14. * such product, must reproduce the above copyright notice, this list of
  15. * conditions and the following disclaimer in the documentation and/or other
  16. * materials provided with the distribution.
  17. *
  18. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * 4. This software, with or without modification, must only be used with a
  23. * Nordic Semiconductor ASA integrated circuit.
  24. *
  25. * 5. Any software provided in binary form under this license must not be reverse
  26. * engineered, decompiled, modified and/or disassembled.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  29. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  32. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. #ifndef NRF_CRYPTO_ECC_BACKEND_H__
  41. #define NRF_CRYPTO_ECC_BACKEND_H__
  42. #if !defined(__SDK_DOXYGEN__)
  43. #include <stdint.h>
  44. #include <stddef.h>
  45. #include "sdk_config.h"
  46. #include "nordic_common.h"
  47. #include "nrf_crypto_error.h"
  48. #include "nrf_crypto_ecc_shared.h"
  49. // Include all backends
  50. #include "cc310_backend_ecc.h"
  51. #include "cc310_bl_backend_ecc.h"
  52. #include "mbedtls_backend_ecc.h"
  53. #include "oberon_backend_ecc.h"
  54. #include "micro_ecc_backend_ecc.h"
  55. #ifdef __cplusplus
  56. extern "C" {
  57. #endif
  58. // Make sure that all required defines are defined
  59. #if !defined(NRF_CRYPTO_ECC_SECP160R1_ENABLED)
  60. #define NRF_CRYPTO_ECC_SECP160R1_ENABLED 0
  61. #endif
  62. #if !defined(NRF_CRYPTO_ECC_SECP160R2_ENABLED)
  63. #define NRF_CRYPTO_ECC_SECP160R2_ENABLED 0
  64. #endif
  65. #if !defined(NRF_CRYPTO_ECC_SECP192R1_ENABLED)
  66. #define NRF_CRYPTO_ECC_SECP192R1_ENABLED 0
  67. #endif
  68. #if !defined(NRF_CRYPTO_ECC_SECP224R1_ENABLED)
  69. #define NRF_CRYPTO_ECC_SECP224R1_ENABLED 0
  70. #endif
  71. #if !defined(NRF_CRYPTO_ECC_SECP256R1_ENABLED)
  72. #define NRF_CRYPTO_ECC_SECP256R1_ENABLED 0
  73. #endif
  74. #if !defined(NRF_CRYPTO_ECC_SECP384R1_ENABLED)
  75. #define NRF_CRYPTO_ECC_SECP384R1_ENABLED 0
  76. #endif
  77. #if !defined(NRF_CRYPTO_ECC_SECP521R1_ENABLED)
  78. #define NRF_CRYPTO_ECC_SECP521R1_ENABLED 0
  79. #endif
  80. #if !defined(NRF_CRYPTO_ECC_SECP160K1_ENABLED)
  81. #define NRF_CRYPTO_ECC_SECP160K1_ENABLED 0
  82. #endif
  83. #if !defined(NRF_CRYPTO_ECC_SECP192K1_ENABLED)
  84. #define NRF_CRYPTO_ECC_SECP192K1_ENABLED 0
  85. #endif
  86. #if !defined(NRF_CRYPTO_ECC_SECP224K1_ENABLED)
  87. #define NRF_CRYPTO_ECC_SECP224K1_ENABLED 0
  88. #endif
  89. #if !defined(NRF_CRYPTO_ECC_SECP256K1_ENABLED)
  90. #define NRF_CRYPTO_ECC_SECP256K1_ENABLED 0
  91. #endif
  92. #if !defined(NRF_CRYPTO_ECC_BP256R1_ENABLED)
  93. #define NRF_CRYPTO_ECC_BP256R1_ENABLED 0
  94. #endif
  95. #if !defined(NRF_CRYPTO_ECC_BP384R1_ENABLED)
  96. #define NRF_CRYPTO_ECC_BP384R1_ENABLED 0
  97. #endif
  98. #if !defined(NRF_CRYPTO_ECC_BP512R1_ENABLED)
  99. #define NRF_CRYPTO_ECC_BP512R1_ENABLED 0
  100. #endif
  101. #if !defined(NRF_CRYPTO_ECC_CURVE25519_ENABLED)
  102. #define NRF_CRYPTO_ECC_CURVE25519_ENABLED 0
  103. #endif
  104. #if !defined(NRF_CRYPTO_ECC_ED25519_ENABLED)
  105. #define NRF_CRYPTO_ECC_ED25519_ENABLED 0
  106. #endif
  107. /** @internal @brief Definition to detect if ECC submodule is enabled. It will be enabled if any
  108. * curve of any of the backends is enabled.
  109. */
  110. #define NRF_CRYPTO_ECC_ENABLED ( \
  111. NRF_MODULE_ENABLED(NRF_CRYPTO) && ( \
  112. NRF_CRYPTO_ECC_SECP160R1_ENABLED | \
  113. NRF_CRYPTO_ECC_SECP160R2_ENABLED | \
  114. NRF_CRYPTO_ECC_SECP192R1_ENABLED | \
  115. NRF_CRYPTO_ECC_SECP224R1_ENABLED | \
  116. NRF_CRYPTO_ECC_SECP256R1_ENABLED | \
  117. NRF_CRYPTO_ECC_SECP384R1_ENABLED | \
  118. NRF_CRYPTO_ECC_SECP521R1_ENABLED | \
  119. NRF_CRYPTO_ECC_SECP160K1_ENABLED | \
  120. NRF_CRYPTO_ECC_SECP192K1_ENABLED | \
  121. NRF_CRYPTO_ECC_SECP224K1_ENABLED | \
  122. NRF_CRYPTO_ECC_SECP256K1_ENABLED | \
  123. NRF_CRYPTO_ECC_BP256R1_ENABLED | \
  124. NRF_CRYPTO_ECC_BP384R1_ENABLED | \
  125. NRF_CRYPTO_ECC_BP512R1_ENABLED | \
  126. NRF_CRYPTO_ECC_CURVE25519_ENABLED | \
  127. NRF_CRYPTO_ECC_ED25519_ENABLED))
  128. /** @internal @brief Definition containing number of enabled curves.
  129. */
  130. #define NRF_CRYPTO_ECC_IMPLEMENTED_CURVES_COUNT ( \
  131. NRF_CRYPTO_ECC_SECP160R1_ENABLED + \
  132. NRF_CRYPTO_ECC_SECP160R2_ENABLED + \
  133. NRF_CRYPTO_ECC_SECP192R1_ENABLED + \
  134. NRF_CRYPTO_ECC_SECP224R1_ENABLED + \
  135. NRF_CRYPTO_ECC_SECP256R1_ENABLED + \
  136. NRF_CRYPTO_ECC_SECP384R1_ENABLED + \
  137. NRF_CRYPTO_ECC_SECP521R1_ENABLED + \
  138. NRF_CRYPTO_ECC_SECP160K1_ENABLED + \
  139. NRF_CRYPTO_ECC_SECP192K1_ENABLED + \
  140. NRF_CRYPTO_ECC_SECP224K1_ENABLED + \
  141. NRF_CRYPTO_ECC_SECP256K1_ENABLED + \
  142. NRF_CRYPTO_ECC_BP256R1_ENABLED + \
  143. NRF_CRYPTO_ECC_BP384R1_ENABLED + \
  144. NRF_CRYPTO_ECC_BP512R1_ENABLED + \
  145. NRF_CRYPTO_ECC_CURVE25519_ENABLED + \
  146. NRF_CRYPTO_ECC_ED25519_ENABLED)
  147. #if !NRF_CRYPTO_ECC_SECP160R1_ENABLED
  148. // Dummy typedefs for disabled contexts
  149. typedef uint32_t nrf_crypto_backend_secp160r1_key_pair_generate_context_t;
  150. typedef uint32_t nrf_crypto_backend_secp160r1_public_key_calculate_context_t;
  151. // Dummy typedefs for disabled keys
  152. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160r1_private_key_t;
  153. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160r1_public_key_t;
  154. #endif
  155. #if !NRF_CRYPTO_ECC_SECP160R2_ENABLED
  156. // Dummy typedefs for disabled contexts
  157. typedef uint32_t nrf_crypto_backend_secp160r2_key_pair_generate_context_t;
  158. typedef uint32_t nrf_crypto_backend_secp160r2_public_key_calculate_context_t;
  159. // Dummy typedefs for disabled keys
  160. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160r2_private_key_t;
  161. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160r2_public_key_t;
  162. #endif
  163. #if !NRF_CRYPTO_ECC_SECP192R1_ENABLED
  164. // Dummy typedefs for disabled contexts
  165. typedef uint32_t nrf_crypto_backend_secp192r1_key_pair_generate_context_t;
  166. typedef uint32_t nrf_crypto_backend_secp192r1_public_key_calculate_context_t;
  167. // Dummy typedefs for disabled keys
  168. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp192r1_private_key_t;
  169. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp192r1_public_key_t;
  170. #endif
  171. #if !NRF_CRYPTO_ECC_SECP224R1_ENABLED
  172. // Dummy typedefs for disabled contexts
  173. typedef uint32_t nrf_crypto_backend_secp224r1_key_pair_generate_context_t;
  174. typedef uint32_t nrf_crypto_backend_secp224r1_public_key_calculate_context_t;
  175. // Dummy typedefs for disabled keys
  176. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp224r1_private_key_t;
  177. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp224r1_public_key_t;
  178. #endif
  179. #if !NRF_CRYPTO_ECC_SECP256R1_ENABLED
  180. // Dummy typedefs for disabled contexts
  181. typedef uint32_t nrf_crypto_backend_secp256r1_key_pair_generate_context_t;
  182. typedef uint32_t nrf_crypto_backend_secp256r1_public_key_calculate_context_t;
  183. // Dummy typedefs for disabled keys
  184. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp256r1_private_key_t;
  185. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp256r1_public_key_t;
  186. #endif
  187. #if !NRF_CRYPTO_ECC_SECP384R1_ENABLED
  188. // Dummy typedefs for disabled contexts
  189. typedef uint32_t nrf_crypto_backend_secp384r1_key_pair_generate_context_t;
  190. typedef uint32_t nrf_crypto_backend_secp384r1_public_key_calculate_context_t;
  191. // Dummy typedefs for disabled keys
  192. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp384r1_private_key_t;
  193. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp384r1_public_key_t;
  194. #endif
  195. #if !NRF_CRYPTO_ECC_SECP521R1_ENABLED
  196. // Dummy typedefs for disabled contexts
  197. typedef uint32_t nrf_crypto_backend_secp521r1_key_pair_generate_context_t;
  198. typedef uint32_t nrf_crypto_backend_secp521r1_public_key_calculate_context_t;
  199. // Dummy typedefs for disabled keys
  200. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp521r1_private_key_t;
  201. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp521r1_public_key_t;
  202. #endif
  203. #if !NRF_CRYPTO_ECC_SECP160K1_ENABLED
  204. // Dummy typedefs for disabled contexts
  205. typedef uint32_t nrf_crypto_backend_secp160k1_key_pair_generate_context_t;
  206. typedef uint32_t nrf_crypto_backend_secp160k1_public_key_calculate_context_t;
  207. // Dummy typedefs for disabled keys
  208. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160k1_private_key_t;
  209. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160k1_public_key_t;
  210. #endif
  211. #if !NRF_CRYPTO_ECC_SECP192K1_ENABLED
  212. // Dummy typedefs for disabled contexts
  213. typedef uint32_t nrf_crypto_backend_secp192k1_key_pair_generate_context_t;
  214. typedef uint32_t nrf_crypto_backend_secp192k1_public_key_calculate_context_t;
  215. // Dummy typedefs for disabled keys
  216. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp192k1_private_key_t;
  217. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp192k1_public_key_t;
  218. #endif
  219. #if !NRF_CRYPTO_ECC_SECP224K1_ENABLED
  220. // Dummy typedefs for disabled contexts
  221. typedef uint32_t nrf_crypto_backend_secp224k1_key_pair_generate_context_t;
  222. typedef uint32_t nrf_crypto_backend_secp224k1_public_key_calculate_context_t;
  223. // Dummy typedefs for disabled keys
  224. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp224k1_private_key_t;
  225. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp224k1_public_key_t;
  226. #endif
  227. #if !NRF_CRYPTO_ECC_SECP256K1_ENABLED
  228. // Dummy typedefs for disabled contexts
  229. typedef uint32_t nrf_crypto_backend_secp256k1_key_pair_generate_context_t;
  230. typedef uint32_t nrf_crypto_backend_secp256k1_public_key_calculate_context_t;
  231. // Dummy typedefs for disabled keys
  232. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp256k1_private_key_t;
  233. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp256k1_public_key_t;
  234. #endif
  235. #if !NRF_CRYPTO_ECC_BP256R1_ENABLED
  236. // Dummy typedefs for disabled contexts
  237. typedef uint32_t nrf_crypto_backend_bp256r1_key_pair_generate_context_t;
  238. typedef uint32_t nrf_crypto_backend_bp256r1_public_key_calculate_context_t;
  239. // Dummy typedefs for disabled keys
  240. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp256r1_private_key_t;
  241. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp256r1_public_key_t;
  242. #endif
  243. #if !NRF_CRYPTO_ECC_BP384R1_ENABLED
  244. // Dummy typedefs for disabled contexts
  245. typedef uint32_t nrf_crypto_backend_bp384r1_key_pair_generate_context_t;
  246. typedef uint32_t nrf_crypto_backend_bp384r1_public_key_calculate_context_t;
  247. // Dummy typedefs for disabled keys
  248. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp384r1_private_key_t;
  249. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp384r1_public_key_t;
  250. #endif
  251. #if !NRF_CRYPTO_ECC_BP512R1_ENABLED
  252. // Dummy typedefs for disabled contexts
  253. typedef uint32_t nrf_crypto_backend_bp512r1_key_pair_generate_context_t;
  254. typedef uint32_t nrf_crypto_backend_bp512r1_public_key_calculate_context_t;
  255. // Dummy typedefs for disabled keys
  256. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp512r1_private_key_t;
  257. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp512r1_public_key_t;
  258. #endif
  259. #if !NRF_CRYPTO_ECC_CURVE25519_ENABLED
  260. // Dummy typedefs for disabled contexts
  261. typedef uint32_t nrf_crypto_backend_curve25519_key_pair_generate_context_t;
  262. typedef uint32_t nrf_crypto_backend_curve25519_public_key_calculate_context_t;
  263. // Dummy typedefs for disabled keys
  264. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_curve25519_private_key_t;
  265. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_curve25519_public_key_t;
  266. #endif
  267. #if !NRF_CRYPTO_ECC_ED25519_ENABLED
  268. // Dummy typedefs for disabled contexts
  269. typedef uint32_t nrf_crypto_backend_ed25519_key_pair_generate_context_t;
  270. typedef uint32_t nrf_crypto_backend_ed25519_public_key_calculate_context_t;
  271. // Dummy typedefs for disabled keys
  272. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_ed25519_private_key_t;
  273. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_ed25519_public_key_t;
  274. #endif
  275. // Find biggest raw private and public key size that is currently enabled
  276. #if NRF_CRYPTO_ECC_SECP521R1_ENABLED
  277. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (66)
  278. #elif NRF_CRYPTO_ECC_BP512R1_ENABLED
  279. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (64)
  280. #elif NRF_CRYPTO_ECC_BP384R1_ENABLED || NRF_CRYPTO_ECC_SECP384R1_ENABLED
  281. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (48)
  282. #elif NRF_CRYPTO_ECC_BP256R1_ENABLED || NRF_CRYPTO_ECC_SECP256K1_ENABLED || NRF_CRYPTO_ECC_CURVE25519_ENABLED || NRF_CRYPTO_ECC_ED25519_ENABLED || NRF_CRYPTO_ECC_SECP256R1_ENABLED
  283. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (32)
  284. #elif NRF_CRYPTO_ECC_SECP224K1_ENABLED || NRF_CRYPTO_ECC_SECP224R1_ENABLED
  285. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (28)
  286. #elif NRF_CRYPTO_ECC_SECP192K1_ENABLED || NRF_CRYPTO_ECC_SECP192R1_ENABLED
  287. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (24)
  288. #elif NRF_CRYPTO_ECC_SECP160K1_ENABLED || NRF_CRYPTO_ECC_SECP160R1_ENABLED || NRF_CRYPTO_ECC_SECP160R2_ENABLED
  289. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (20)
  290. #else
  291. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (1)
  292. #endif
  293. #if NRF_CRYPTO_ECC_SECP521R1_ENABLED
  294. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 66)
  295. #elif NRF_CRYPTO_ECC_BP512R1_ENABLED
  296. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 64)
  297. #elif NRF_CRYPTO_ECC_BP384R1_ENABLED || NRF_CRYPTO_ECC_SECP384R1_ENABLED
  298. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 48)
  299. #elif NRF_CRYPTO_ECC_BP256R1_ENABLED || NRF_CRYPTO_ECC_SECP256K1_ENABLED || NRF_CRYPTO_ECC_SECP256R1_ENABLED
  300. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 32)
  301. #elif NRF_CRYPTO_ECC_SECP224K1_ENABLED || NRF_CRYPTO_ECC_SECP224R1_ENABLED
  302. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 28)
  303. #elif NRF_CRYPTO_ECC_SECP192K1_ENABLED || NRF_CRYPTO_ECC_SECP192R1_ENABLED
  304. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 24)
  305. #elif NRF_CRYPTO_ECC_SECP160K1_ENABLED || NRF_CRYPTO_ECC_SECP160R1_ENABLED || NRF_CRYPTO_ECC_SECP160R2_ENABLED
  306. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 20)
  307. #elif NRF_CRYPTO_ECC_CURVE25519_ENABLED || NRF_CRYPTO_ECC_ED25519_ENABLED
  308. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (32)
  309. #else
  310. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (1)
  311. #endif
  312. #if NRF_CRYPTO_ECC_CURVE25519_ENABLED && !defined(NRF_CRYPTO_CURVE25519_BIG_ENDIAN_ENABLED)
  313. #warning "NRF_CRYPTO_CURVE25519_BIG_ENDIAN_ENABLED not defined. Please define it to choose the endianness of Curve25519 parameters."
  314. #endif
  315. #ifdef __cplusplus
  316. }
  317. #endif
  318. #endif // !defined(__SDK_DOXYGEN__)
  319. #endif // NRF_CRYPTO_ECC_BACKEND_H__