nrf_crypto_ecc_backend.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. /**
  2. * Copyright (c) 2018 - 2019, 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. #include "optiga_backend_ecc.h"
  56. #ifdef __cplusplus
  57. extern "C" {
  58. #endif
  59. // Make sure that all required defines are defined
  60. #if !defined(NRF_CRYPTO_ECC_SECP160R1_ENABLED)
  61. #define NRF_CRYPTO_ECC_SECP160R1_ENABLED 0
  62. #endif
  63. #if !defined(NRF_CRYPTO_ECC_SECP160R2_ENABLED)
  64. #define NRF_CRYPTO_ECC_SECP160R2_ENABLED 0
  65. #endif
  66. #if !defined(NRF_CRYPTO_ECC_SECP192R1_ENABLED)
  67. #define NRF_CRYPTO_ECC_SECP192R1_ENABLED 0
  68. #endif
  69. #if !defined(NRF_CRYPTO_ECC_SECP224R1_ENABLED)
  70. #define NRF_CRYPTO_ECC_SECP224R1_ENABLED 0
  71. #endif
  72. #if !defined(NRF_CRYPTO_ECC_SECP256R1_ENABLED)
  73. #define NRF_CRYPTO_ECC_SECP256R1_ENABLED 0
  74. #endif
  75. #if !defined(NRF_CRYPTO_ECC_SECP384R1_ENABLED)
  76. #define NRF_CRYPTO_ECC_SECP384R1_ENABLED 0
  77. #endif
  78. #if !defined(NRF_CRYPTO_ECC_SECP521R1_ENABLED)
  79. #define NRF_CRYPTO_ECC_SECP521R1_ENABLED 0
  80. #endif
  81. #if !defined(NRF_CRYPTO_ECC_SECP160K1_ENABLED)
  82. #define NRF_CRYPTO_ECC_SECP160K1_ENABLED 0
  83. #endif
  84. #if !defined(NRF_CRYPTO_ECC_SECP192K1_ENABLED)
  85. #define NRF_CRYPTO_ECC_SECP192K1_ENABLED 0
  86. #endif
  87. #if !defined(NRF_CRYPTO_ECC_SECP224K1_ENABLED)
  88. #define NRF_CRYPTO_ECC_SECP224K1_ENABLED 0
  89. #endif
  90. #if !defined(NRF_CRYPTO_ECC_SECP256K1_ENABLED)
  91. #define NRF_CRYPTO_ECC_SECP256K1_ENABLED 0
  92. #endif
  93. #if !defined(NRF_CRYPTO_ECC_BP256R1_ENABLED)
  94. #define NRF_CRYPTO_ECC_BP256R1_ENABLED 0
  95. #endif
  96. #if !defined(NRF_CRYPTO_ECC_BP384R1_ENABLED)
  97. #define NRF_CRYPTO_ECC_BP384R1_ENABLED 0
  98. #endif
  99. #if !defined(NRF_CRYPTO_ECC_BP512R1_ENABLED)
  100. #define NRF_CRYPTO_ECC_BP512R1_ENABLED 0
  101. #endif
  102. #if !defined(NRF_CRYPTO_ECC_CURVE25519_ENABLED)
  103. #define NRF_CRYPTO_ECC_CURVE25519_ENABLED 0
  104. #endif
  105. #if !defined(NRF_CRYPTO_ECC_ED25519_ENABLED)
  106. #define NRF_CRYPTO_ECC_ED25519_ENABLED 0
  107. #endif
  108. /** @internal @brief Definition to detect if ECC submodule is enabled. It will be enabled if any
  109. * curve of any of the backends is enabled.
  110. */
  111. #define NRF_CRYPTO_ECC_ENABLED ( \
  112. NRF_MODULE_ENABLED(NRF_CRYPTO) && ( \
  113. NRF_CRYPTO_ECC_SECP160R1_ENABLED | \
  114. NRF_CRYPTO_ECC_SECP160R2_ENABLED | \
  115. NRF_CRYPTO_ECC_SECP192R1_ENABLED | \
  116. NRF_CRYPTO_ECC_SECP224R1_ENABLED | \
  117. NRF_CRYPTO_ECC_SECP256R1_ENABLED | \
  118. NRF_CRYPTO_ECC_SECP384R1_ENABLED | \
  119. NRF_CRYPTO_ECC_SECP521R1_ENABLED | \
  120. NRF_CRYPTO_ECC_SECP160K1_ENABLED | \
  121. NRF_CRYPTO_ECC_SECP192K1_ENABLED | \
  122. NRF_CRYPTO_ECC_SECP224K1_ENABLED | \
  123. NRF_CRYPTO_ECC_SECP256K1_ENABLED | \
  124. NRF_CRYPTO_ECC_BP256R1_ENABLED | \
  125. NRF_CRYPTO_ECC_BP384R1_ENABLED | \
  126. NRF_CRYPTO_ECC_BP512R1_ENABLED | \
  127. NRF_CRYPTO_ECC_CURVE25519_ENABLED | \
  128. NRF_CRYPTO_ECC_ED25519_ENABLED))
  129. /** @internal @brief Definition containing number of enabled curves.
  130. */
  131. #define NRF_CRYPTO_ECC_IMPLEMENTED_CURVES_COUNT ( \
  132. NRF_CRYPTO_ECC_SECP160R1_ENABLED + \
  133. NRF_CRYPTO_ECC_SECP160R2_ENABLED + \
  134. NRF_CRYPTO_ECC_SECP192R1_ENABLED + \
  135. NRF_CRYPTO_ECC_SECP224R1_ENABLED + \
  136. NRF_CRYPTO_ECC_SECP256R1_ENABLED + \
  137. NRF_CRYPTO_ECC_SECP384R1_ENABLED + \
  138. NRF_CRYPTO_ECC_SECP521R1_ENABLED + \
  139. NRF_CRYPTO_ECC_SECP160K1_ENABLED + \
  140. NRF_CRYPTO_ECC_SECP192K1_ENABLED + \
  141. NRF_CRYPTO_ECC_SECP224K1_ENABLED + \
  142. NRF_CRYPTO_ECC_SECP256K1_ENABLED + \
  143. NRF_CRYPTO_ECC_BP256R1_ENABLED + \
  144. NRF_CRYPTO_ECC_BP384R1_ENABLED + \
  145. NRF_CRYPTO_ECC_BP512R1_ENABLED + \
  146. NRF_CRYPTO_ECC_CURVE25519_ENABLED + \
  147. NRF_CRYPTO_ECC_ED25519_ENABLED)
  148. #if !NRF_CRYPTO_ECC_SECP160R1_ENABLED
  149. // Dummy typedefs for disabled contexts
  150. typedef uint32_t nrf_crypto_backend_secp160r1_key_pair_generate_context_t;
  151. typedef uint32_t nrf_crypto_backend_secp160r1_public_key_calculate_context_t;
  152. // Dummy typedefs for disabled keys
  153. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160r1_private_key_t;
  154. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160r1_public_key_t;
  155. #endif
  156. #if !NRF_CRYPTO_ECC_SECP160R2_ENABLED
  157. // Dummy typedefs for disabled contexts
  158. typedef uint32_t nrf_crypto_backend_secp160r2_key_pair_generate_context_t;
  159. typedef uint32_t nrf_crypto_backend_secp160r2_public_key_calculate_context_t;
  160. // Dummy typedefs for disabled keys
  161. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160r2_private_key_t;
  162. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160r2_public_key_t;
  163. #endif
  164. #if !NRF_CRYPTO_ECC_SECP192R1_ENABLED
  165. // Dummy typedefs for disabled contexts
  166. typedef uint32_t nrf_crypto_backend_secp192r1_key_pair_generate_context_t;
  167. typedef uint32_t nrf_crypto_backend_secp192r1_public_key_calculate_context_t;
  168. // Dummy typedefs for disabled keys
  169. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp192r1_private_key_t;
  170. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp192r1_public_key_t;
  171. #endif
  172. #if !NRF_CRYPTO_ECC_SECP224R1_ENABLED
  173. // Dummy typedefs for disabled contexts
  174. typedef uint32_t nrf_crypto_backend_secp224r1_key_pair_generate_context_t;
  175. typedef uint32_t nrf_crypto_backend_secp224r1_public_key_calculate_context_t;
  176. // Dummy typedefs for disabled keys
  177. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp224r1_private_key_t;
  178. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp224r1_public_key_t;
  179. #endif
  180. #if !NRF_CRYPTO_ECC_SECP256R1_ENABLED
  181. // Dummy typedefs for disabled contexts
  182. typedef uint32_t nrf_crypto_backend_secp256r1_key_pair_generate_context_t;
  183. typedef uint32_t nrf_crypto_backend_secp256r1_public_key_calculate_context_t;
  184. // Dummy typedefs for disabled keys
  185. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp256r1_private_key_t;
  186. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp256r1_public_key_t;
  187. #endif
  188. #if !NRF_CRYPTO_ECC_SECP384R1_ENABLED
  189. // Dummy typedefs for disabled contexts
  190. typedef uint32_t nrf_crypto_backend_secp384r1_key_pair_generate_context_t;
  191. typedef uint32_t nrf_crypto_backend_secp384r1_public_key_calculate_context_t;
  192. // Dummy typedefs for disabled keys
  193. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp384r1_private_key_t;
  194. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp384r1_public_key_t;
  195. #endif
  196. #if !NRF_CRYPTO_ECC_SECP521R1_ENABLED
  197. // Dummy typedefs for disabled contexts
  198. typedef uint32_t nrf_crypto_backend_secp521r1_key_pair_generate_context_t;
  199. typedef uint32_t nrf_crypto_backend_secp521r1_public_key_calculate_context_t;
  200. // Dummy typedefs for disabled keys
  201. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp521r1_private_key_t;
  202. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp521r1_public_key_t;
  203. #endif
  204. #if !NRF_CRYPTO_ECC_SECP160K1_ENABLED
  205. // Dummy typedefs for disabled contexts
  206. typedef uint32_t nrf_crypto_backend_secp160k1_key_pair_generate_context_t;
  207. typedef uint32_t nrf_crypto_backend_secp160k1_public_key_calculate_context_t;
  208. // Dummy typedefs for disabled keys
  209. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160k1_private_key_t;
  210. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp160k1_public_key_t;
  211. #endif
  212. #if !NRF_CRYPTO_ECC_SECP192K1_ENABLED
  213. // Dummy typedefs for disabled contexts
  214. typedef uint32_t nrf_crypto_backend_secp192k1_key_pair_generate_context_t;
  215. typedef uint32_t nrf_crypto_backend_secp192k1_public_key_calculate_context_t;
  216. // Dummy typedefs for disabled keys
  217. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp192k1_private_key_t;
  218. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp192k1_public_key_t;
  219. #endif
  220. #if !NRF_CRYPTO_ECC_SECP224K1_ENABLED
  221. // Dummy typedefs for disabled contexts
  222. typedef uint32_t nrf_crypto_backend_secp224k1_key_pair_generate_context_t;
  223. typedef uint32_t nrf_crypto_backend_secp224k1_public_key_calculate_context_t;
  224. // Dummy typedefs for disabled keys
  225. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp224k1_private_key_t;
  226. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp224k1_public_key_t;
  227. #endif
  228. #if !NRF_CRYPTO_ECC_SECP256K1_ENABLED
  229. // Dummy typedefs for disabled contexts
  230. typedef uint32_t nrf_crypto_backend_secp256k1_key_pair_generate_context_t;
  231. typedef uint32_t nrf_crypto_backend_secp256k1_public_key_calculate_context_t;
  232. // Dummy typedefs for disabled keys
  233. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp256k1_private_key_t;
  234. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_secp256k1_public_key_t;
  235. #endif
  236. #if !NRF_CRYPTO_ECC_BP256R1_ENABLED
  237. // Dummy typedefs for disabled contexts
  238. typedef uint32_t nrf_crypto_backend_bp256r1_key_pair_generate_context_t;
  239. typedef uint32_t nrf_crypto_backend_bp256r1_public_key_calculate_context_t;
  240. // Dummy typedefs for disabled keys
  241. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp256r1_private_key_t;
  242. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp256r1_public_key_t;
  243. #endif
  244. #if !NRF_CRYPTO_ECC_BP384R1_ENABLED
  245. // Dummy typedefs for disabled contexts
  246. typedef uint32_t nrf_crypto_backend_bp384r1_key_pair_generate_context_t;
  247. typedef uint32_t nrf_crypto_backend_bp384r1_public_key_calculate_context_t;
  248. // Dummy typedefs for disabled keys
  249. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp384r1_private_key_t;
  250. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp384r1_public_key_t;
  251. #endif
  252. #if !NRF_CRYPTO_ECC_BP512R1_ENABLED
  253. // Dummy typedefs for disabled contexts
  254. typedef uint32_t nrf_crypto_backend_bp512r1_key_pair_generate_context_t;
  255. typedef uint32_t nrf_crypto_backend_bp512r1_public_key_calculate_context_t;
  256. // Dummy typedefs for disabled keys
  257. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp512r1_private_key_t;
  258. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_bp512r1_public_key_t;
  259. #endif
  260. #if !NRF_CRYPTO_ECC_CURVE25519_ENABLED
  261. // Dummy typedefs for disabled contexts
  262. typedef uint32_t nrf_crypto_backend_curve25519_key_pair_generate_context_t;
  263. typedef uint32_t nrf_crypto_backend_curve25519_public_key_calculate_context_t;
  264. // Dummy typedefs for disabled keys
  265. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_curve25519_private_key_t;
  266. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_curve25519_public_key_t;
  267. #endif
  268. #if !NRF_CRYPTO_ECC_ED25519_ENABLED
  269. // Dummy typedefs for disabled contexts
  270. typedef uint32_t nrf_crypto_backend_ed25519_key_pair_generate_context_t;
  271. typedef uint32_t nrf_crypto_backend_ed25519_public_key_calculate_context_t;
  272. // Dummy typedefs for disabled keys
  273. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_ed25519_private_key_t;
  274. typedef nrf_crypto_internal_ecc_key_header_t nrf_crypto_backend_ed25519_public_key_t;
  275. #endif
  276. // Find biggest raw private and public key size that is currently enabled
  277. #if NRF_CRYPTO_ECC_SECP521R1_ENABLED
  278. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (66)
  279. #elif NRF_CRYPTO_ECC_BP512R1_ENABLED
  280. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (64)
  281. #elif NRF_CRYPTO_ECC_BP384R1_ENABLED || NRF_CRYPTO_ECC_SECP384R1_ENABLED
  282. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (48)
  283. #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
  284. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (32)
  285. #elif NRF_CRYPTO_ECC_SECP224K1_ENABLED || NRF_CRYPTO_ECC_SECP224R1_ENABLED
  286. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (28)
  287. #elif NRF_CRYPTO_ECC_SECP192K1_ENABLED || NRF_CRYPTO_ECC_SECP192R1_ENABLED
  288. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (24)
  289. #elif NRF_CRYPTO_ECC_SECP160K1_ENABLED || NRF_CRYPTO_ECC_SECP160R1_ENABLED || NRF_CRYPTO_ECC_SECP160R2_ENABLED
  290. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (20)
  291. #else
  292. # define NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE (1)
  293. #endif
  294. #if NRF_CRYPTO_ECC_SECP521R1_ENABLED
  295. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 66)
  296. #elif NRF_CRYPTO_ECC_BP512R1_ENABLED
  297. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 64)
  298. #elif NRF_CRYPTO_ECC_BP384R1_ENABLED || NRF_CRYPTO_ECC_SECP384R1_ENABLED
  299. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 48)
  300. #elif NRF_CRYPTO_ECC_BP256R1_ENABLED || NRF_CRYPTO_ECC_SECP256K1_ENABLED || NRF_CRYPTO_ECC_SECP256R1_ENABLED
  301. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 32)
  302. #elif NRF_CRYPTO_ECC_SECP224K1_ENABLED || NRF_CRYPTO_ECC_SECP224R1_ENABLED
  303. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 28)
  304. #elif NRF_CRYPTO_ECC_SECP192K1_ENABLED || NRF_CRYPTO_ECC_SECP192R1_ENABLED
  305. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 24)
  306. #elif NRF_CRYPTO_ECC_SECP160K1_ENABLED || NRF_CRYPTO_ECC_SECP160R1_ENABLED || NRF_CRYPTO_ECC_SECP160R2_ENABLED
  307. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (2 * 20)
  308. #elif NRF_CRYPTO_ECC_CURVE25519_ENABLED || NRF_CRYPTO_ECC_ED25519_ENABLED
  309. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (32)
  310. #else
  311. # define NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE (1)
  312. #endif
  313. #if NRF_CRYPTO_ECC_CURVE25519_ENABLED && !defined(NRF_CRYPTO_CURVE25519_BIG_ENDIAN_ENABLED)
  314. #warning "NRF_CRYPTO_CURVE25519_BIG_ENDIAN_ENABLED not defined. Please define it to choose the endianness of Curve25519 parameters."
  315. #endif
  316. #ifdef __cplusplus
  317. }
  318. #endif
  319. #endif // !defined(__SDK_DOXYGEN__)
  320. #endif // NRF_CRYPTO_ECC_BACKEND_H__