edhoc 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (659) hide show
  1. package/binding.gyp +64 -0
  2. package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_decode.h +35 -0
  3. package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_encode.h +35 -0
  4. package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_types.h +34 -0
  5. package/external/libedhoc/backends/cbor/include/backend_cbor_ead_decode.h +35 -0
  6. package/external/libedhoc/backends/cbor/include/backend_cbor_ead_encode.h +35 -0
  7. package/external/libedhoc/backends/cbor/include/backend_cbor_edhoc_types.h +97 -0
  8. package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_decode.h +35 -0
  9. package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_encode.h +35 -0
  10. package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_types.h +37 -0
  11. package/external/libedhoc/backends/cbor/include/backend_cbor_id_cred_x_decode.h +35 -0
  12. package/external/libedhoc/backends/cbor/include/backend_cbor_id_cred_x_encode.h +35 -0
  13. package/external/libedhoc/backends/cbor/include/backend_cbor_info_decode.h +35 -0
  14. package/external/libedhoc/backends/cbor/include/backend_cbor_info_encode.h +35 -0
  15. package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_decode.h +35 -0
  16. package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_encode.h +35 -0
  17. package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_types.h +34 -0
  18. package/external/libedhoc/backends/cbor/include/backend_cbor_message_1_decode.h +35 -0
  19. package/external/libedhoc/backends/cbor/include/backend_cbor_message_1_encode.h +35 -0
  20. package/external/libedhoc/backends/cbor/include/backend_cbor_message_2_decode.h +35 -0
  21. package/external/libedhoc/backends/cbor/include/backend_cbor_message_2_encode.h +35 -0
  22. package/external/libedhoc/backends/cbor/include/backend_cbor_message_3_decode.h +35 -0
  23. package/external/libedhoc/backends/cbor/include/backend_cbor_message_3_encode.h +35 -0
  24. package/external/libedhoc/backends/cbor/include/backend_cbor_message_4_decode.h +35 -0
  25. package/external/libedhoc/backends/cbor/include/backend_cbor_message_4_encode.h +35 -0
  26. package/external/libedhoc/backends/cbor/include/backend_cbor_message_error_decode.h +35 -0
  27. package/external/libedhoc/backends/cbor/include/backend_cbor_message_error_encode.h +35 -0
  28. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_2_decode.h +35 -0
  29. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_2_encode.h +35 -0
  30. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_3_decode.h +35 -0
  31. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_3_encode.h +35 -0
  32. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_4_decode.h +35 -0
  33. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_4_encode.h +35 -0
  34. package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_decode.h +35 -0
  35. package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_encode.h +35 -0
  36. package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_types.h +38 -0
  37. package/external/libedhoc/backends/cbor/include/backend_cbor_x509_types.h +170 -0
  38. package/external/libedhoc/backends/cbor/src/backend_cbor_bstr_type_decode.c +59 -0
  39. package/external/libedhoc/backends/cbor/src/backend_cbor_bstr_type_encode.c +59 -0
  40. package/external/libedhoc/backends/cbor/src/backend_cbor_ead_decode.c +74 -0
  41. package/external/libedhoc/backends/cbor/src/backend_cbor_ead_encode.c +74 -0
  42. package/external/libedhoc/backends/cbor/src/backend_cbor_enc_structure_decode.c +62 -0
  43. package/external/libedhoc/backends/cbor/src/backend_cbor_enc_structure_encode.c +62 -0
  44. package/external/libedhoc/backends/cbor/src/backend_cbor_id_cred_x_decode.c +141 -0
  45. package/external/libedhoc/backends/cbor/src/backend_cbor_id_cred_x_encode.c +141 -0
  46. package/external/libedhoc/backends/cbor/src/backend_cbor_info_decode.c +61 -0
  47. package/external/libedhoc/backends/cbor/src/backend_cbor_info_encode.c +61 -0
  48. package/external/libedhoc/backends/cbor/src/backend_cbor_int_type_decode.c +59 -0
  49. package/external/libedhoc/backends/cbor/src/backend_cbor_int_type_encode.c +59 -0
  50. package/external/libedhoc/backends/cbor/src/backend_cbor_message_1_decode.c +112 -0
  51. package/external/libedhoc/backends/cbor/src/backend_cbor_message_1_encode.c +112 -0
  52. package/external/libedhoc/backends/cbor/src/backend_cbor_message_2_decode.c +59 -0
  53. package/external/libedhoc/backends/cbor/src/backend_cbor_message_2_encode.c +59 -0
  54. package/external/libedhoc/backends/cbor/src/backend_cbor_message_3_decode.c +59 -0
  55. package/external/libedhoc/backends/cbor/src/backend_cbor_message_3_encode.c +59 -0
  56. package/external/libedhoc/backends/cbor/src/backend_cbor_message_4_decode.c +59 -0
  57. package/external/libedhoc/backends/cbor/src/backend_cbor_message_4_encode.c +59 -0
  58. package/external/libedhoc/backends/cbor/src/backend_cbor_message_error_decode.c +93 -0
  59. package/external/libedhoc/backends/cbor/src/backend_cbor_message_error_encode.c +93 -0
  60. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_2_decode.c +193 -0
  61. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_2_encode.c +194 -0
  62. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_3_decode.c +189 -0
  63. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_3_encode.c +189 -0
  64. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_4_decode.c +88 -0
  65. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_4_encode.c +88 -0
  66. package/external/libedhoc/backends/cbor/src/backend_cbor_sig_structure_decode.c +63 -0
  67. package/external/libedhoc/backends/cbor/src/backend_cbor_sig_structure_encode.c +63 -0
  68. package/external/libedhoc/externals/compact25519/src/c25519/c25519.c +126 -0
  69. package/external/libedhoc/externals/compact25519/src/c25519/c25519.h +49 -0
  70. package/external/libedhoc/externals/compact25519/src/c25519/ed25519.c +323 -0
  71. package/external/libedhoc/externals/compact25519/src/c25519/ed25519.h +84 -0
  72. package/external/libedhoc/externals/compact25519/src/c25519/edsign.c +171 -0
  73. package/external/libedhoc/externals/compact25519/src/c25519/edsign.h +53 -0
  74. package/external/libedhoc/externals/compact25519/src/c25519/f25519.c +330 -0
  75. package/external/libedhoc/externals/compact25519/src/c25519/f25519.h +98 -0
  76. package/external/libedhoc/externals/compact25519/src/c25519/fprime.c +226 -0
  77. package/external/libedhoc/externals/compact25519/src/c25519/fprime.h +81 -0
  78. package/external/libedhoc/externals/compact25519/src/c25519/sha512.c +230 -0
  79. package/external/libedhoc/externals/compact25519/src/c25519/sha512.h +54 -0
  80. package/external/libedhoc/externals/compact25519/src/compact_ed25519.c +46 -0
  81. package/external/libedhoc/externals/compact25519/src/compact_ed25519.h +110 -0
  82. package/external/libedhoc/externals/compact25519/src/compact_wipe.c +12 -0
  83. package/external/libedhoc/externals/compact25519/src/compact_wipe.h +14 -0
  84. package/external/libedhoc/externals/compact25519/src/compact_x25519.c +68 -0
  85. package/external/libedhoc/externals/compact25519/src/compact_x25519.h +101 -0
  86. package/external/libedhoc/externals/compact25519/test/pcg_random.h +25 -0
  87. package/external/libedhoc/externals/compact25519/test/run-all.c +178 -0
  88. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/Hacl_Curve25519.h +21 -0
  89. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/everest.h +234 -0
  90. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlib/FStar_UInt128.h +124 -0
  91. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlib/FStar_UInt64_FStar_UInt32_FStar_UInt16_FStar_UInt8.h +280 -0
  92. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlib.h +29 -0
  93. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/c_endianness.h +204 -0
  94. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/builtin.h +16 -0
  95. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/callconv.h +46 -0
  96. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/compat.h +34 -0
  97. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/debug.h +57 -0
  98. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/target.h +102 -0
  99. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/types.h +61 -0
  100. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/wasmsupport.h +5 -0
  101. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/vs2013/Hacl_Curve25519.h +21 -0
  102. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/vs2013/inttypes.h +36 -0
  103. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/vs2013/stdbool.h +31 -0
  104. package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/x25519.h +190 -0
  105. package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/Hacl_Curve25519.c +760 -0
  106. package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/Hacl_Curve25519_joined.c +50 -0
  107. package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/everest.c +102 -0
  108. package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/kremlib/FStar_UInt128_extracted.c +413 -0
  109. package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/kremlib/FStar_UInt64_FStar_UInt32_FStar_UInt16_FStar_UInt8.c +100 -0
  110. package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/legacy/Hacl_Curve25519.c +805 -0
  111. package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/x25519.c +186 -0
  112. package/external/libedhoc/externals/mbedtls/3rdparty/p256-m/p256-m/p256-m.c +1514 -0
  113. package/external/libedhoc/externals/mbedtls/3rdparty/p256-m/p256-m/p256-m.h +135 -0
  114. package/external/libedhoc/externals/mbedtls/3rdparty/p256-m/p256-m_driver_entrypoints.c +312 -0
  115. package/external/libedhoc/externals/mbedtls/3rdparty/p256-m/p256-m_driver_entrypoints.h +219 -0
  116. package/external/libedhoc/externals/mbedtls/configs/config-ccm-psk-dtls1_2.h +92 -0
  117. package/external/libedhoc/externals/mbedtls/configs/config-ccm-psk-tls1_2.h +83 -0
  118. package/external/libedhoc/externals/mbedtls/configs/config-no-entropy.h +73 -0
  119. package/external/libedhoc/externals/mbedtls/configs/config-suite-b.h +106 -0
  120. package/external/libedhoc/externals/mbedtls/configs/config-symmetric-only.h +77 -0
  121. package/external/libedhoc/externals/mbedtls/configs/config-thread.h +76 -0
  122. package/external/libedhoc/externals/mbedtls/configs/crypto-config-ccm-aes-sha256.h +25 -0
  123. package/external/libedhoc/externals/mbedtls/configs/crypto_config_profile_medium.h +136 -0
  124. package/external/libedhoc/externals/mbedtls/configs/tfm_mbedcrypto_config_profile_medium.h +609 -0
  125. package/external/libedhoc/externals/mbedtls/doxygen/input/doc_encdec.h +54 -0
  126. package/external/libedhoc/externals/mbedtls/doxygen/input/doc_hashing.h +30 -0
  127. package/external/libedhoc/externals/mbedtls/doxygen/input/doc_mainpage.h +19 -0
  128. package/external/libedhoc/externals/mbedtls/doxygen/input/doc_rng.h +27 -0
  129. package/external/libedhoc/externals/mbedtls/doxygen/input/doc_ssltls.h +37 -0
  130. package/external/libedhoc/externals/mbedtls/doxygen/input/doc_tcpip.h +32 -0
  131. package/external/libedhoc/externals/mbedtls/doxygen/input/doc_x509.h +31 -0
  132. package/external/libedhoc/externals/mbedtls/include/mbedtls/aes.h +627 -0
  133. package/external/libedhoc/externals/mbedtls/include/mbedtls/aria.h +341 -0
  134. package/external/libedhoc/externals/mbedtls/include/mbedtls/asn1.h +641 -0
  135. package/external/libedhoc/externals/mbedtls/include/mbedtls/asn1write.h +389 -0
  136. package/external/libedhoc/externals/mbedtls/include/mbedtls/base64.h +82 -0
  137. package/external/libedhoc/externals/mbedtls/include/mbedtls/bignum.h +1084 -0
  138. package/external/libedhoc/externals/mbedtls/include/mbedtls/build_info.h +146 -0
  139. package/external/libedhoc/externals/mbedtls/include/mbedtls/camellia.h +303 -0
  140. package/external/libedhoc/externals/mbedtls/include/mbedtls/ccm.h +518 -0
  141. package/external/libedhoc/externals/mbedtls/include/mbedtls/chacha20.h +202 -0
  142. package/external/libedhoc/externals/mbedtls/include/mbedtls/chachapoly.h +342 -0
  143. package/external/libedhoc/externals/mbedtls/include/mbedtls/check_config.h +1206 -0
  144. package/external/libedhoc/externals/mbedtls/include/mbedtls/cipher.h +1183 -0
  145. package/external/libedhoc/externals/mbedtls/include/mbedtls/cmac.h +246 -0
  146. package/external/libedhoc/externals/mbedtls/include/mbedtls/compat-2.x.h +46 -0
  147. package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_legacy_crypto.h +183 -0
  148. package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_legacy_from_psa.h +877 -0
  149. package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_psa_from_legacy.h +334 -0
  150. package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_psa_superset_legacy.h +142 -0
  151. package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_ssl.h +76 -0
  152. package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_x509.h +25 -0
  153. package/external/libedhoc/externals/mbedtls/include/mbedtls/config_psa.h +55 -0
  154. package/external/libedhoc/externals/mbedtls/include/mbedtls/constant_time.h +36 -0
  155. package/external/libedhoc/externals/mbedtls/include/mbedtls/ctr_drbg.h +564 -0
  156. package/external/libedhoc/externals/mbedtls/include/mbedtls/debug.h +308 -0
  157. package/external/libedhoc/externals/mbedtls/include/mbedtls/des.h +385 -0
  158. package/external/libedhoc/externals/mbedtls/include/mbedtls/dhm.h +972 -0
  159. package/external/libedhoc/externals/mbedtls/include/mbedtls/ecdh.h +441 -0
  160. package/external/libedhoc/externals/mbedtls/include/mbedtls/ecdsa.h +671 -0
  161. package/external/libedhoc/externals/mbedtls/include/mbedtls/ecjpake.h +298 -0
  162. package/external/libedhoc/externals/mbedtls/include/mbedtls/ecp.h +1362 -0
  163. package/external/libedhoc/externals/mbedtls/include/mbedtls/entropy.h +273 -0
  164. package/external/libedhoc/externals/mbedtls/include/mbedtls/error.h +201 -0
  165. package/external/libedhoc/externals/mbedtls/include/mbedtls/gcm.h +370 -0
  166. package/external/libedhoc/externals/mbedtls/include/mbedtls/hkdf.h +124 -0
  167. package/external/libedhoc/externals/mbedtls/include/mbedtls/hmac_drbg.h +434 -0
  168. package/external/libedhoc/externals/mbedtls/include/mbedtls/lms.h +440 -0
  169. package/external/libedhoc/externals/mbedtls/include/mbedtls/mbedtls_config.h +4116 -0
  170. package/external/libedhoc/externals/mbedtls/include/mbedtls/md.h +640 -0
  171. package/external/libedhoc/externals/mbedtls/include/mbedtls/md5.h +190 -0
  172. package/external/libedhoc/externals/mbedtls/include/mbedtls/memory_buffer_alloc.h +142 -0
  173. package/external/libedhoc/externals/mbedtls/include/mbedtls/net_sockets.h +299 -0
  174. package/external/libedhoc/externals/mbedtls/include/mbedtls/nist_kw.h +166 -0
  175. package/external/libedhoc/externals/mbedtls/include/mbedtls/oid.h +722 -0
  176. package/external/libedhoc/externals/mbedtls/include/mbedtls/pem.h +160 -0
  177. package/external/libedhoc/externals/mbedtls/include/mbedtls/pk.h +1091 -0
  178. package/external/libedhoc/externals/mbedtls/include/mbedtls/pkcs12.h +186 -0
  179. package/external/libedhoc/externals/mbedtls/include/mbedtls/pkcs5.h +197 -0
  180. package/external/libedhoc/externals/mbedtls/include/mbedtls/pkcs7.h +241 -0
  181. package/external/libedhoc/externals/mbedtls/include/mbedtls/platform.h +485 -0
  182. package/external/libedhoc/externals/mbedtls/include/mbedtls/platform_time.h +79 -0
  183. package/external/libedhoc/externals/mbedtls/include/mbedtls/platform_util.h +201 -0
  184. package/external/libedhoc/externals/mbedtls/include/mbedtls/poly1305.h +168 -0
  185. package/external/libedhoc/externals/mbedtls/include/mbedtls/private_access.h +20 -0
  186. package/external/libedhoc/externals/mbedtls/include/mbedtls/psa_util.h +104 -0
  187. package/external/libedhoc/externals/mbedtls/include/mbedtls/ripemd160.h +136 -0
  188. package/external/libedhoc/externals/mbedtls/include/mbedtls/rsa.h +1143 -0
  189. package/external/libedhoc/externals/mbedtls/include/mbedtls/sha1.h +219 -0
  190. package/external/libedhoc/externals/mbedtls/include/mbedtls/sha256.h +198 -0
  191. package/external/libedhoc/externals/mbedtls/include/mbedtls/sha3.h +172 -0
  192. package/external/libedhoc/externals/mbedtls/include/mbedtls/sha512.h +208 -0
  193. package/external/libedhoc/externals/mbedtls/include/mbedtls/ssl.h +5369 -0
  194. package/external/libedhoc/externals/mbedtls/include/mbedtls/ssl_cache.h +187 -0
  195. package/external/libedhoc/externals/mbedtls/include/mbedtls/ssl_ciphersuites.h +616 -0
  196. package/external/libedhoc/externals/mbedtls/include/mbedtls/ssl_cookie.h +106 -0
  197. package/external/libedhoc/externals/mbedtls/include/mbedtls/ssl_ticket.h +181 -0
  198. package/external/libedhoc/externals/mbedtls/include/mbedtls/threading.h +105 -0
  199. package/external/libedhoc/externals/mbedtls/include/mbedtls/timing.h +94 -0
  200. package/external/libedhoc/externals/mbedtls/include/mbedtls/version.h +78 -0
  201. package/external/libedhoc/externals/mbedtls/include/mbedtls/x509.h +550 -0
  202. package/external/libedhoc/externals/mbedtls/include/mbedtls/x509_crl.h +184 -0
  203. package/external/libedhoc/externals/mbedtls/include/mbedtls/x509_crt.h +1196 -0
  204. package/external/libedhoc/externals/mbedtls/include/mbedtls/x509_csr.h +319 -0
  205. package/external/libedhoc/externals/mbedtls/include/psa/build_info.h +20 -0
  206. package/external/libedhoc/externals/mbedtls/include/psa/crypto.h +4685 -0
  207. package/external/libedhoc/externals/mbedtls/include/psa/crypto_adjust_auto_enabled.h +21 -0
  208. package/external/libedhoc/externals/mbedtls/include/psa/crypto_adjust_config_key_pair_types.h +91 -0
  209. package/external/libedhoc/externals/mbedtls/include/psa/crypto_adjust_config_synonyms.h +45 -0
  210. package/external/libedhoc/externals/mbedtls/include/psa/crypto_builtin_composites.h +210 -0
  211. package/external/libedhoc/externals/mbedtls/include/psa/crypto_builtin_key_derivation.h +118 -0
  212. package/external/libedhoc/externals/mbedtls/include/psa/crypto_builtin_primitives.h +114 -0
  213. package/external/libedhoc/externals/mbedtls/include/psa/crypto_compat.h +153 -0
  214. package/external/libedhoc/externals/mbedtls/include/psa/crypto_config.h +153 -0
  215. package/external/libedhoc/externals/mbedtls/include/psa/crypto_driver_common.h +44 -0
  216. package/external/libedhoc/externals/mbedtls/include/psa/crypto_driver_contexts_composites.h +151 -0
  217. package/external/libedhoc/externals/mbedtls/include/psa/crypto_driver_contexts_key_derivation.h +52 -0
  218. package/external/libedhoc/externals/mbedtls/include/psa/crypto_driver_contexts_primitives.h +105 -0
  219. package/external/libedhoc/externals/mbedtls/include/psa/crypto_extra.h +2064 -0
  220. package/external/libedhoc/externals/mbedtls/include/psa/crypto_legacy.h +88 -0
  221. package/external/libedhoc/externals/mbedtls/include/psa/crypto_platform.h +92 -0
  222. package/external/libedhoc/externals/mbedtls/include/psa/crypto_se_driver.h +1383 -0
  223. package/external/libedhoc/externals/mbedtls/include/psa/crypto_sizes.h +1282 -0
  224. package/external/libedhoc/externals/mbedtls/include/psa/crypto_struct.h +460 -0
  225. package/external/libedhoc/externals/mbedtls/include/psa/crypto_types.h +453 -0
  226. package/external/libedhoc/externals/mbedtls/include/psa/crypto_values.h +2756 -0
  227. package/external/libedhoc/externals/mbedtls/library/aes.c +2315 -0
  228. package/external/libedhoc/externals/mbedtls/library/aesce.c +503 -0
  229. package/external/libedhoc/externals/mbedtls/library/aesce.h +121 -0
  230. package/external/libedhoc/externals/mbedtls/library/aesni.c +802 -0
  231. package/external/libedhoc/externals/mbedtls/library/aesni.h +158 -0
  232. package/external/libedhoc/externals/mbedtls/library/alignment.h +509 -0
  233. package/external/libedhoc/externals/mbedtls/library/aria.c +991 -0
  234. package/external/libedhoc/externals/mbedtls/library/asn1parse.c +467 -0
  235. package/external/libedhoc/externals/mbedtls/library/asn1write.c +436 -0
  236. package/external/libedhoc/externals/mbedtls/library/base64.c +299 -0
  237. package/external/libedhoc/externals/mbedtls/library/base64_internal.h +45 -0
  238. package/external/libedhoc/externals/mbedtls/library/bignum.c +2806 -0
  239. package/external/libedhoc/externals/mbedtls/library/bignum_core.c +894 -0
  240. package/external/libedhoc/externals/mbedtls/library/bignum_core.h +763 -0
  241. package/external/libedhoc/externals/mbedtls/library/bignum_mod.c +394 -0
  242. package/external/libedhoc/externals/mbedtls/library/bignum_mod.h +452 -0
  243. package/external/libedhoc/externals/mbedtls/library/bignum_mod_raw.c +276 -0
  244. package/external/libedhoc/externals/mbedtls/library/bignum_mod_raw.h +416 -0
  245. package/external/libedhoc/externals/mbedtls/library/bignum_mod_raw_invasive.h +34 -0
  246. package/external/libedhoc/externals/mbedtls/library/bn_mul.h +1094 -0
  247. package/external/libedhoc/externals/mbedtls/library/camellia.c +1044 -0
  248. package/external/libedhoc/externals/mbedtls/library/ccm.c +712 -0
  249. package/external/libedhoc/externals/mbedtls/library/chacha20.c +497 -0
  250. package/external/libedhoc/externals/mbedtls/library/chachapoly.c +478 -0
  251. package/external/libedhoc/externals/mbedtls/library/check_crypto_config.h +141 -0
  252. package/external/libedhoc/externals/mbedtls/library/cipher.c +1664 -0
  253. package/external/libedhoc/externals/mbedtls/library/cipher_wrap.c +2422 -0
  254. package/external/libedhoc/externals/mbedtls/library/cipher_wrap.h +132 -0
  255. package/external/libedhoc/externals/mbedtls/library/cmac.c +1067 -0
  256. package/external/libedhoc/externals/mbedtls/library/common.h +325 -0
  257. package/external/libedhoc/externals/mbedtls/library/constant_time.c +261 -0
  258. package/external/libedhoc/externals/mbedtls/library/constant_time_impl.h +554 -0
  259. package/external/libedhoc/externals/mbedtls/library/constant_time_internal.h +579 -0
  260. package/external/libedhoc/externals/mbedtls/library/ctr_drbg.c +881 -0
  261. package/external/libedhoc/externals/mbedtls/library/debug.c +465 -0
  262. package/external/libedhoc/externals/mbedtls/library/des.c +1042 -0
  263. package/external/libedhoc/externals/mbedtls/library/dhm.c +712 -0
  264. package/external/libedhoc/externals/mbedtls/library/ecdh.c +685 -0
  265. package/external/libedhoc/externals/mbedtls/library/ecdsa.c +867 -0
  266. package/external/libedhoc/externals/mbedtls/library/ecjpake.c +1216 -0
  267. package/external/libedhoc/externals/mbedtls/library/ecp.c +3631 -0
  268. package/external/libedhoc/externals/mbedtls/library/ecp_curves.c +5467 -0
  269. package/external/libedhoc/externals/mbedtls/library/ecp_curves_new.c +6043 -0
  270. package/external/libedhoc/externals/mbedtls/library/ecp_internal_alt.h +287 -0
  271. package/external/libedhoc/externals/mbedtls/library/ecp_invasive.h +325 -0
  272. package/external/libedhoc/externals/mbedtls/library/entropy.c +676 -0
  273. package/external/libedhoc/externals/mbedtls/library/entropy_poll.c +229 -0
  274. package/external/libedhoc/externals/mbedtls/library/entropy_poll.h +64 -0
  275. package/external/libedhoc/externals/mbedtls/library/error.c +878 -0
  276. package/external/libedhoc/externals/mbedtls/library/gcm.c +1168 -0
  277. package/external/libedhoc/externals/mbedtls/library/hkdf.c +161 -0
  278. package/external/libedhoc/externals/mbedtls/library/hmac_drbg.c +633 -0
  279. package/external/libedhoc/externals/mbedtls/library/lmots.c +821 -0
  280. package/external/libedhoc/externals/mbedtls/library/lmots.h +311 -0
  281. package/external/libedhoc/externals/mbedtls/library/lms.c +779 -0
  282. package/external/libedhoc/externals/mbedtls/library/md.c +1108 -0
  283. package/external/libedhoc/externals/mbedtls/library/md5.c +426 -0
  284. package/external/libedhoc/externals/mbedtls/library/md_psa.h +63 -0
  285. package/external/libedhoc/externals/mbedtls/library/md_wrap.h +46 -0
  286. package/external/libedhoc/externals/mbedtls/library/memory_buffer_alloc.c +745 -0
  287. package/external/libedhoc/externals/mbedtls/library/mps_common.h +181 -0
  288. package/external/libedhoc/externals/mbedtls/library/mps_error.h +89 -0
  289. package/external/libedhoc/externals/mbedtls/library/mps_reader.c +538 -0
  290. package/external/libedhoc/externals/mbedtls/library/mps_reader.h +366 -0
  291. package/external/libedhoc/externals/mbedtls/library/mps_trace.c +112 -0
  292. package/external/libedhoc/externals/mbedtls/library/mps_trace.h +154 -0
  293. package/external/libedhoc/externals/mbedtls/library/net_sockets.c +696 -0
  294. package/external/libedhoc/externals/mbedtls/library/nist_kw.c +725 -0
  295. package/external/libedhoc/externals/mbedtls/library/oid.c +1154 -0
  296. package/external/libedhoc/externals/mbedtls/library/padlock.c +155 -0
  297. package/external/libedhoc/externals/mbedtls/library/padlock.h +111 -0
  298. package/external/libedhoc/externals/mbedtls/library/pem.c +520 -0
  299. package/external/libedhoc/externals/mbedtls/library/pk.c +970 -0
  300. package/external/libedhoc/externals/mbedtls/library/pk_internal.h +118 -0
  301. package/external/libedhoc/externals/mbedtls/library/pk_wrap.c +1834 -0
  302. package/external/libedhoc/externals/mbedtls/library/pk_wrap.h +156 -0
  303. package/external/libedhoc/externals/mbedtls/library/pkcs12.c +447 -0
  304. package/external/libedhoc/externals/mbedtls/library/pkcs5.c +496 -0
  305. package/external/libedhoc/externals/mbedtls/library/pkcs7.c +773 -0
  306. package/external/libedhoc/externals/mbedtls/library/pkparse.c +1845 -0
  307. package/external/libedhoc/externals/mbedtls/library/pkwrite.c +836 -0
  308. package/external/libedhoc/externals/mbedtls/library/pkwrite.h +112 -0
  309. package/external/libedhoc/externals/mbedtls/library/platform.c +402 -0
  310. package/external/libedhoc/externals/mbedtls/library/platform_util.c +285 -0
  311. package/external/libedhoc/externals/mbedtls/library/poly1305.c +492 -0
  312. package/external/libedhoc/externals/mbedtls/library/psa_crypto.c +8432 -0
  313. package/external/libedhoc/externals/mbedtls/library/psa_crypto_aead.c +653 -0
  314. package/external/libedhoc/externals/mbedtls/library/psa_crypto_aead.h +499 -0
  315. package/external/libedhoc/externals/mbedtls/library/psa_crypto_cipher.c +590 -0
  316. package/external/libedhoc/externals/mbedtls/library/psa_crypto_cipher.h +293 -0
  317. package/external/libedhoc/externals/mbedtls/library/psa_crypto_client.c +67 -0
  318. package/external/libedhoc/externals/mbedtls/library/psa_crypto_core.h +838 -0
  319. package/external/libedhoc/externals/mbedtls/library/psa_crypto_core_common.h +52 -0
  320. package/external/libedhoc/externals/mbedtls/library/psa_crypto_driver_wrappers.h +2871 -0
  321. package/external/libedhoc/externals/mbedtls/library/psa_crypto_driver_wrappers_no_static.c +256 -0
  322. package/external/libedhoc/externals/mbedtls/library/psa_crypto_driver_wrappers_no_static.h +31 -0
  323. package/external/libedhoc/externals/mbedtls/library/psa_crypto_ecp.c +561 -0
  324. package/external/libedhoc/externals/mbedtls/library/psa_crypto_ecp.h +267 -0
  325. package/external/libedhoc/externals/mbedtls/library/psa_crypto_ffdh.c +295 -0
  326. package/external/libedhoc/externals/mbedtls/library/psa_crypto_ffdh.h +132 -0
  327. package/external/libedhoc/externals/mbedtls/library/psa_crypto_hash.c +470 -0
  328. package/external/libedhoc/externals/mbedtls/library/psa_crypto_hash.h +211 -0
  329. package/external/libedhoc/externals/mbedtls/library/psa_crypto_invasive.h +70 -0
  330. package/external/libedhoc/externals/mbedtls/library/psa_crypto_its.h +131 -0
  331. package/external/libedhoc/externals/mbedtls/library/psa_crypto_mac.c +496 -0
  332. package/external/libedhoc/externals/mbedtls/library/psa_crypto_mac.h +264 -0
  333. package/external/libedhoc/externals/mbedtls/library/psa_crypto_pake.c +571 -0
  334. package/external/libedhoc/externals/mbedtls/library/psa_crypto_pake.h +159 -0
  335. package/external/libedhoc/externals/mbedtls/library/psa_crypto_random_impl.h +192 -0
  336. package/external/libedhoc/externals/mbedtls/library/psa_crypto_rsa.c +727 -0
  337. package/external/libedhoc/externals/mbedtls/library/psa_crypto_rsa.h +317 -0
  338. package/external/libedhoc/externals/mbedtls/library/psa_crypto_se.c +373 -0
  339. package/external/libedhoc/externals/mbedtls/library/psa_crypto_se.h +185 -0
  340. package/external/libedhoc/externals/mbedtls/library/psa_crypto_slot_management.c +559 -0
  341. package/external/libedhoc/externals/mbedtls/library/psa_crypto_slot_management.h +213 -0
  342. package/external/libedhoc/externals/mbedtls/library/psa_crypto_storage.c +481 -0
  343. package/external/libedhoc/externals/mbedtls/library/psa_crypto_storage.h +384 -0
  344. package/external/libedhoc/externals/mbedtls/library/psa_its_file.c +259 -0
  345. package/external/libedhoc/externals/mbedtls/library/psa_util.c +160 -0
  346. package/external/libedhoc/externals/mbedtls/library/psa_util_internal.h +96 -0
  347. package/external/libedhoc/externals/mbedtls/library/ripemd160.c +490 -0
  348. package/external/libedhoc/externals/mbedtls/library/rsa.c +2640 -0
  349. package/external/libedhoc/externals/mbedtls/library/rsa_alt_helpers.c +447 -0
  350. package/external/libedhoc/externals/mbedtls/library/rsa_alt_helpers.h +208 -0
  351. package/external/libedhoc/externals/mbedtls/library/sha1.c +480 -0
  352. package/external/libedhoc/externals/mbedtls/library/sha256.c +946 -0
  353. package/external/libedhoc/externals/mbedtls/library/sha3.c +626 -0
  354. package/external/libedhoc/externals/mbedtls/library/sha512.c +1111 -0
  355. package/external/libedhoc/externals/mbedtls/library/ssl_cache.c +410 -0
  356. package/external/libedhoc/externals/mbedtls/library/ssl_ciphersuites.c +2050 -0
  357. package/external/libedhoc/externals/mbedtls/library/ssl_client.c +1017 -0
  358. package/external/libedhoc/externals/mbedtls/library/ssl_client.h +22 -0
  359. package/external/libedhoc/externals/mbedtls/library/ssl_cookie.c +380 -0
  360. package/external/libedhoc/externals/mbedtls/library/ssl_debug_helpers.h +78 -0
  361. package/external/libedhoc/externals/mbedtls/library/ssl_debug_helpers_generated.c +234 -0
  362. package/external/libedhoc/externals/mbedtls/library/ssl_misc.h +2847 -0
  363. package/external/libedhoc/externals/mbedtls/library/ssl_msg.c +6155 -0
  364. package/external/libedhoc/externals/mbedtls/library/ssl_ticket.c +540 -0
  365. package/external/libedhoc/externals/mbedtls/library/ssl_tls.c +9577 -0
  366. package/external/libedhoc/externals/mbedtls/library/ssl_tls12_client.c +3607 -0
  367. package/external/libedhoc/externals/mbedtls/library/ssl_tls12_server.c +4403 -0
  368. package/external/libedhoc/externals/mbedtls/library/ssl_tls13_client.c +3046 -0
  369. package/external/libedhoc/externals/mbedtls/library/ssl_tls13_generic.c +1740 -0
  370. package/external/libedhoc/externals/mbedtls/library/ssl_tls13_invasive.h +23 -0
  371. package/external/libedhoc/externals/mbedtls/library/ssl_tls13_keys.c +1897 -0
  372. package/external/libedhoc/externals/mbedtls/library/ssl_tls13_keys.h +651 -0
  373. package/external/libedhoc/externals/mbedtls/library/ssl_tls13_server.c +3146 -0
  374. package/external/libedhoc/externals/mbedtls/library/threading.c +181 -0
  375. package/external/libedhoc/externals/mbedtls/library/timing.c +154 -0
  376. package/external/libedhoc/externals/mbedtls/library/version.c +32 -0
  377. package/external/libedhoc/externals/mbedtls/library/version_features.c +826 -0
  378. package/external/libedhoc/externals/mbedtls/library/x509.c +1776 -0
  379. package/external/libedhoc/externals/mbedtls/library/x509_create.c +557 -0
  380. package/external/libedhoc/externals/mbedtls/library/x509_crl.c +712 -0
  381. package/external/libedhoc/externals/mbedtls/library/x509_crt.c +3292 -0
  382. package/external/libedhoc/externals/mbedtls/library/x509_csr.c +574 -0
  383. package/external/libedhoc/externals/mbedtls/library/x509write.c +174 -0
  384. package/external/libedhoc/externals/mbedtls/library/x509write_crt.c +681 -0
  385. package/external/libedhoc/externals/mbedtls/library/x509write_csr.c +331 -0
  386. package/external/libedhoc/externals/mbedtls/programs/aes/crypt_and_hash.c +573 -0
  387. package/external/libedhoc/externals/mbedtls/programs/cipher/cipher_aead_demo.c +259 -0
  388. package/external/libedhoc/externals/mbedtls/programs/fuzz/common.c +105 -0
  389. package/external/libedhoc/externals/mbedtls/programs/fuzz/common.h +25 -0
  390. package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_client.c +195 -0
  391. package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_dtlsclient.c +138 -0
  392. package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_dtlsserver.c +183 -0
  393. package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_pkcs7.c +20 -0
  394. package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_privkey.c +106 -0
  395. package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_pubkey.c +86 -0
  396. package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_server.c +218 -0
  397. package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_x509crl.c +41 -0
  398. package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_x509crt.c +41 -0
  399. package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_x509csr.c +41 -0
  400. package/external/libedhoc/externals/mbedtls/programs/fuzz/onefile.c +69 -0
  401. package/external/libedhoc/externals/mbedtls/programs/hash/generic_sum.c +209 -0
  402. package/external/libedhoc/externals/mbedtls/programs/hash/hello.c +45 -0
  403. package/external/libedhoc/externals/mbedtls/programs/hash/md_hmac_demo.c +136 -0
  404. package/external/libedhoc/externals/mbedtls/programs/pkey/dh_client.c +274 -0
  405. package/external/libedhoc/externals/mbedtls/programs/pkey/dh_genprime.c +161 -0
  406. package/external/libedhoc/externals/mbedtls/programs/pkey/dh_server.c +296 -0
  407. package/external/libedhoc/externals/mbedtls/programs/pkey/ecdh_curve25519.c +189 -0
  408. package/external/libedhoc/externals/mbedtls/programs/pkey/ecdsa.c +217 -0
  409. package/external/libedhoc/externals/mbedtls/programs/pkey/gen_key.c +419 -0
  410. package/external/libedhoc/externals/mbedtls/programs/pkey/key_app.c +316 -0
  411. package/external/libedhoc/externals/mbedtls/programs/pkey/key_app_writer.c +435 -0
  412. package/external/libedhoc/externals/mbedtls/programs/pkey/mpi_demo.c +84 -0
  413. package/external/libedhoc/externals/mbedtls/programs/pkey/pk_decrypt.c +153 -0
  414. package/external/libedhoc/externals/mbedtls/programs/pkey/pk_encrypt.c +154 -0
  415. package/external/libedhoc/externals/mbedtls/programs/pkey/pk_sign.c +155 -0
  416. package/external/libedhoc/externals/mbedtls/programs/pkey/pk_verify.c +128 -0
  417. package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_decrypt.c +172 -0
  418. package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_encrypt.c +149 -0
  419. package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_genkey.c +141 -0
  420. package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_sign.c +155 -0
  421. package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_sign_pss.c +161 -0
  422. package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_verify.c +131 -0
  423. package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_verify_pss.c +136 -0
  424. package/external/libedhoc/externals/mbedtls/programs/psa/aead_demo.c +281 -0
  425. package/external/libedhoc/externals/mbedtls/programs/psa/crypto_examples.c +321 -0
  426. package/external/libedhoc/externals/mbedtls/programs/psa/hmac_demo.c +159 -0
  427. package/external/libedhoc/externals/mbedtls/programs/psa/key_ladder_demo.c +691 -0
  428. package/external/libedhoc/externals/mbedtls/programs/psa/psa_constant_names.c +310 -0
  429. package/external/libedhoc/externals/mbedtls/programs/psa/psa_constant_names_generated.c +474 -0
  430. package/external/libedhoc/externals/mbedtls/programs/random/gen_entropy.c +75 -0
  431. package/external/libedhoc/externals/mbedtls/programs/random/gen_random_ctr_drbg.c +107 -0
  432. package/external/libedhoc/externals/mbedtls/programs/ssl/dtls_client.c +342 -0
  433. package/external/libedhoc/externals/mbedtls/programs/ssl/dtls_server.c +408 -0
  434. package/external/libedhoc/externals/mbedtls/programs/ssl/mini_client.c +274 -0
  435. package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_client1.c +288 -0
  436. package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_client2.c +3118 -0
  437. package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_context_info.c +1009 -0
  438. package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_fork_server.c +381 -0
  439. package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_mail_client.c +804 -0
  440. package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_pthread_server.c +489 -0
  441. package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_server.c +362 -0
  442. package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_server2.c +4268 -0
  443. package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_test_common_source.c +375 -0
  444. package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_test_lib.c +601 -0
  445. package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_test_lib.h +306 -0
  446. package/external/libedhoc/externals/mbedtls/programs/test/benchmark.c +1284 -0
  447. package/external/libedhoc/externals/mbedtls/programs/test/cmake_package/cmake_package.c +27 -0
  448. package/external/libedhoc/externals/mbedtls/programs/test/cmake_package_install/cmake_package_install.c +28 -0
  449. package/external/libedhoc/externals/mbedtls/programs/test/cmake_subproject/cmake_subproject.c +28 -0
  450. package/external/libedhoc/externals/mbedtls/programs/test/dlopen.c +92 -0
  451. package/external/libedhoc/externals/mbedtls/programs/test/query_compile_time_config.c +66 -0
  452. package/external/libedhoc/externals/mbedtls/programs/test/query_config.c +5137 -0
  453. package/external/libedhoc/externals/mbedtls/programs/test/query_config.h +34 -0
  454. package/external/libedhoc/externals/mbedtls/programs/test/query_included_headers.c +29 -0
  455. package/external/libedhoc/externals/mbedtls/programs/test/selftest.c +583 -0
  456. package/external/libedhoc/externals/mbedtls/programs/test/udp_proxy.c +967 -0
  457. package/external/libedhoc/externals/mbedtls/programs/test/zeroize.c +72 -0
  458. package/external/libedhoc/externals/mbedtls/programs/util/pem2der.c +265 -0
  459. package/external/libedhoc/externals/mbedtls/programs/util/strerror.c +61 -0
  460. package/external/libedhoc/externals/mbedtls/programs/wince_main.c +31 -0
  461. package/external/libedhoc/externals/mbedtls/programs/x509/cert_app.c +456 -0
  462. package/external/libedhoc/externals/mbedtls/programs/x509/cert_req.c +509 -0
  463. package/external/libedhoc/externals/mbedtls/programs/x509/cert_write.c +1012 -0
  464. package/external/libedhoc/externals/mbedtls/programs/x509/crl_app.c +132 -0
  465. package/external/libedhoc/externals/mbedtls/programs/x509/load_roots.c +165 -0
  466. package/external/libedhoc/externals/mbedtls/programs/x509/req_app.c +132 -0
  467. package/external/libedhoc/externals/mbedtls/tests/configs/tls13-only.h +31 -0
  468. package/external/libedhoc/externals/mbedtls/tests/configs/user-config-for-test.h +89 -0
  469. package/external/libedhoc/externals/mbedtls/tests/configs/user-config-malloc-0-null.h +22 -0
  470. package/external/libedhoc/externals/mbedtls/tests/configs/user-config-zeroize-memset.h +17 -0
  471. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/aes_alt.h +23 -0
  472. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/aria_alt.h +16 -0
  473. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/camellia_alt.h +16 -0
  474. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/ccm_alt.h +16 -0
  475. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/chacha20_alt.h +16 -0
  476. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/chachapoly_alt.h +18 -0
  477. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/cmac_alt.h +15 -0
  478. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/des_alt.h +22 -0
  479. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/dhm_alt.h +16 -0
  480. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/ecjpake_alt.h +15 -0
  481. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/ecp_alt.h +22 -0
  482. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/gcm_alt.h +16 -0
  483. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/md5_alt.h +16 -0
  484. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/nist_kw_alt.h +15 -0
  485. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/platform_alt.h +16 -0
  486. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/poly1305_alt.h +16 -0
  487. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/ripemd160_alt.h +16 -0
  488. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/rsa_alt.h +16 -0
  489. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/sha1_alt.h +16 -0
  490. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/sha256_alt.h +16 -0
  491. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/sha512_alt.h +16 -0
  492. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/threading_alt.h +14 -0
  493. package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/timing_alt.h +19 -0
  494. package/external/libedhoc/externals/mbedtls/tests/include/alt-extra/psa/crypto.h +7 -0
  495. package/external/libedhoc/externals/mbedtls/tests/include/baremetal-override/time.h +6 -0
  496. package/external/libedhoc/externals/mbedtls/tests/include/spe/crypto_spe.h +131 -0
  497. package/external/libedhoc/externals/mbedtls/tests/include/test/arguments.h +26 -0
  498. package/external/libedhoc/externals/mbedtls/tests/include/test/asn1_helpers.h +38 -0
  499. package/external/libedhoc/externals/mbedtls/tests/include/test/bignum_helpers.h +106 -0
  500. package/external/libedhoc/externals/mbedtls/tests/include/test/certs.h +234 -0
  501. package/external/libedhoc/externals/mbedtls/tests/include/test/constant_flow.h +71 -0
  502. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/aead.h +121 -0
  503. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/asymmetric_encryption.h +67 -0
  504. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/cipher.h +130 -0
  505. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/config_test_driver.h +44 -0
  506. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/crypto_config_test_driver_extension.h +430 -0
  507. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/hash.h +64 -0
  508. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/key_agreement.h +62 -0
  509. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/key_management.h +123 -0
  510. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/mac.h +125 -0
  511. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/pake.h +75 -0
  512. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/signature.h +112 -0
  513. package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/test_driver.h +32 -0
  514. package/external/libedhoc/externals/mbedtls/tests/include/test/fake_external_rng_for_test.h +40 -0
  515. package/external/libedhoc/externals/mbedtls/tests/include/test/helpers.h +268 -0
  516. package/external/libedhoc/externals/mbedtls/tests/include/test/macros.h +250 -0
  517. package/external/libedhoc/externals/mbedtls/tests/include/test/psa_crypto_helpers.h +398 -0
  518. package/external/libedhoc/externals/mbedtls/tests/include/test/psa_exercise_key.h +223 -0
  519. package/external/libedhoc/externals/mbedtls/tests/include/test/psa_helpers.h +24 -0
  520. package/external/libedhoc/externals/mbedtls/tests/include/test/random.h +91 -0
  521. package/external/libedhoc/externals/mbedtls/tests/include/test/ssl_helpers.h +628 -0
  522. package/external/libedhoc/externals/mbedtls/tests/src/asn1_helpers.c +62 -0
  523. package/external/libedhoc/externals/mbedtls/tests/src/bignum_helpers.c +145 -0
  524. package/external/libedhoc/externals/mbedtls/tests/src/certs.c +480 -0
  525. package/external/libedhoc/externals/mbedtls/tests/src/drivers/hash.c +199 -0
  526. package/external/libedhoc/externals/mbedtls/tests/src/drivers/platform_builtin_keys.c +78 -0
  527. package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_aead.c +462 -0
  528. package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_asymmetric_encryption.c +151 -0
  529. package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_cipher.c +424 -0
  530. package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_key_agreement.c +147 -0
  531. package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_key_management.c +783 -0
  532. package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_mac.c +422 -0
  533. package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_pake.c +202 -0
  534. package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_signature.c +405 -0
  535. package/external/libedhoc/externals/mbedtls/tests/src/fake_external_rng_for_test.c +45 -0
  536. package/external/libedhoc/externals/mbedtls/tests/src/helpers.c +353 -0
  537. package/external/libedhoc/externals/mbedtls/tests/src/psa_crypto_helpers.c +196 -0
  538. package/external/libedhoc/externals/mbedtls/tests/src/psa_exercise_key.c +989 -0
  539. package/external/libedhoc/externals/mbedtls/tests/src/random.c +136 -0
  540. package/external/libedhoc/externals/mbedtls/tests/src/test_certs.h +1226 -0
  541. package/external/libedhoc/externals/mbedtls/tests/src/test_helpers/ssl_helpers.c +2292 -0
  542. package/external/libedhoc/externals/mbedtls/tests/src/threading_helpers.c +210 -0
  543. package/external/libedhoc/externals/zcbor/include/zcbor_common.h +422 -0
  544. package/external/libedhoc/externals/zcbor/include/zcbor_debug.h +69 -0
  545. package/external/libedhoc/externals/zcbor/include/zcbor_decode.h +358 -0
  546. package/external/libedhoc/externals/zcbor/include/zcbor_encode.h +296 -0
  547. package/external/libedhoc/externals/zcbor/include/zcbor_tags.h +94 -0
  548. package/external/libedhoc/externals/zcbor/samples/hello_world/src/main.c +41 -0
  549. package/external/libedhoc/externals/zcbor/samples/pet/include/pet_decode.h +39 -0
  550. package/external/libedhoc/externals/zcbor/samples/pet/include/pet_encode.h +39 -0
  551. package/external/libedhoc/externals/zcbor/samples/pet/include/pet_types.h +47 -0
  552. package/external/libedhoc/externals/zcbor/samples/pet/src/main.c +128 -0
  553. package/external/libedhoc/externals/zcbor/samples/pet/src/pet_decode.c +69 -0
  554. package/external/libedhoc/externals/zcbor/samples/pet/src/pet_encode.c +70 -0
  555. package/external/libedhoc/externals/zcbor/src/zcbor_common.c +257 -0
  556. package/external/libedhoc/externals/zcbor/src/zcbor_decode.c +1107 -0
  557. package/external/libedhoc/externals/zcbor/src/zcbor_encode.c +722 -0
  558. package/external/libedhoc/externals/zcbor/tests/decode/test1_suit_old_formats/src/main.c +368 -0
  559. package/external/libedhoc/externals/zcbor/tests/decode/test2_suit/src/main.c +189 -0
  560. package/external/libedhoc/externals/zcbor/tests/decode/test3_simple/src/main.c +529 -0
  561. package/external/libedhoc/externals/zcbor/tests/decode/test5_corner_cases/src/main.c +2010 -0
  562. package/external/libedhoc/externals/zcbor/tests/decode/test7_suit9_simple/src/main.c +134 -0
  563. package/external/libedhoc/externals/zcbor/tests/decode/test8_suit12/src/main.c +863 -0
  564. package/external/libedhoc/externals/zcbor/tests/decode/test9_manifest14/src/main.c +364 -0
  565. package/external/libedhoc/externals/zcbor/tests/encode/test1_suit/src/main.c +453 -0
  566. package/external/libedhoc/externals/zcbor/tests/encode/test2_simple/src/main.c +123 -0
  567. package/external/libedhoc/externals/zcbor/tests/encode/test3_corner_cases/src/main.c +1527 -0
  568. package/external/libedhoc/externals/zcbor/tests/encode/test4_senml/src/main.c +66 -0
  569. package/external/libedhoc/externals/zcbor/tests/fuzz/fuzz_manifest12.c +136 -0
  570. package/external/libedhoc/externals/zcbor/tests/fuzz/fuzz_pet.c +12 -0
  571. package/external/libedhoc/externals/zcbor/tests/fuzz/main_entry.c +60 -0
  572. package/external/libedhoc/externals/zcbor/tests/fuzz/main_entry.h +5 -0
  573. package/external/libedhoc/externals/zcbor/tests/unit/test1_unit_tests/src/main.c +1044 -0
  574. package/external/libedhoc/externals/zcbor/tests/unit/test3_float16/src/main.c +202 -0
  575. package/external/libedhoc/include/edhoc.h +393 -0
  576. package/external/libedhoc/include/edhoc_context.h +318 -0
  577. package/external/libedhoc/include/edhoc_credentials.h +217 -0
  578. package/external/libedhoc/include/edhoc_crypto.h +331 -0
  579. package/external/libedhoc/include/edhoc_ead.h +99 -0
  580. package/external/libedhoc/include/edhoc_macros.h +51 -0
  581. package/external/libedhoc/include/edhoc_values.h +181 -0
  582. package/external/libedhoc/library/edhoc.c +219 -0
  583. package/external/libedhoc/library/edhoc_exporter.c +543 -0
  584. package/external/libedhoc/library/edhoc_message_1.c +439 -0
  585. package/external/libedhoc/library/edhoc_message_2.c +2994 -0
  586. package/external/libedhoc/library/edhoc_message_3.c +2658 -0
  587. package/external/libedhoc/library/edhoc_message_4.c +826 -0
  588. package/external/libedhoc/library/edhoc_message_error.c +238 -0
  589. package/external/libedhoc/tests/include/cipher_suite_negotiation/test_edhoc_cipher_suite_negotiation.h +37 -0
  590. package/external/libedhoc/tests/include/cipher_suites/cipher_suite_0.h +134 -0
  591. package/external/libedhoc/tests/include/cipher_suites/cipher_suite_2.h +140 -0
  592. package/external/libedhoc/tests/include/cipher_suites/test_cipher_suite_0.h +48 -0
  593. package/external/libedhoc/tests/include/cipher_suites/test_cipher_suite_2.h +48 -0
  594. package/external/libedhoc/tests/include/edhoc_trace_1/authentication_credentials_1.h +60 -0
  595. package/external/libedhoc/tests/include/edhoc_trace_1/test_edhoc_handshake_1.h +208 -0
  596. package/external/libedhoc/tests/include/edhoc_trace_1/test_edhoc_handshake_ead_1.h +59 -0
  597. package/external/libedhoc/tests/include/edhoc_trace_1/test_vector_1.h +738 -0
  598. package/external/libedhoc/tests/include/edhoc_trace_2/authentication_credentials_2.h +60 -0
  599. package/external/libedhoc/tests/include/edhoc_trace_2/test_edhoc_handshake_2.h +199 -0
  600. package/external/libedhoc/tests/include/edhoc_trace_2/test_vector_2.h +525 -0
  601. package/external/libedhoc/tests/include/error_message/test_edhoc_error_message.h +48 -0
  602. package/external/libedhoc/tests/include/x509_chain_cs_0/authentication_credentials_x5chain_cs_0.h +92 -0
  603. package/external/libedhoc/tests/include/x509_chain_cs_0/test_edhoc_handshake_x5chain_cs_0.h +96 -0
  604. package/external/libedhoc/tests/include/x509_chain_cs_0/test_vector_x5chain_cs_0.h +140 -0
  605. package/external/libedhoc/tests/include/x509_chain_cs_2/authentication_credentials_x5chain_cs_2.h +58 -0
  606. package/external/libedhoc/tests/include/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2.h +56 -0
  607. package/external/libedhoc/tests/include/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2_ead.h +57 -0
  608. package/external/libedhoc/tests/include/x509_chain_cs_2/test_vector_x5chain_cs_2.h +169 -0
  609. package/external/libedhoc/tests/include/x509_chain_cs_2_static_dh/authentication_credentials_x5chain_cs_2_static_dh.h +59 -0
  610. package/external/libedhoc/tests/include/x509_chain_cs_2_static_dh/test_edhoc_handshake_x5chain_cs_2_static_dh_ead.h +57 -0
  611. package/external/libedhoc/tests/include/x509_chain_cs_2_static_dh/test_vector_x5chain_cs_2_static_dh.h +163 -0
  612. package/external/libedhoc/tests/include/x509_hash_cs_2/authentication_credentials_x5t_cs_2.h +60 -0
  613. package/external/libedhoc/tests/include/x509_hash_cs_2/test_edhoc_handshake_x5t_cs_2_ead.h +57 -0
  614. package/external/libedhoc/tests/include/x509_hash_cs_2/test_vector_x5t_cs_2.h +181 -0
  615. package/external/libedhoc/tests/src/cipher_suite_negotiation/test_edhoc_cipher_suite_negotiation.c +544 -0
  616. package/external/libedhoc/tests/src/cipher_suites/cipher_suite_0.c +447 -0
  617. package/external/libedhoc/tests/src/cipher_suites/cipher_suite_2.c +600 -0
  618. package/external/libedhoc/tests/src/cipher_suites/test_cipher_suite_0.c +475 -0
  619. package/external/libedhoc/tests/src/cipher_suites/test_cipher_suite_2.c +473 -0
  620. package/external/libedhoc/tests/src/edhoc_trace_1/authentication_credentials_1.c +252 -0
  621. package/external/libedhoc/tests/src/edhoc_trace_1/test_edhoc_handshake_1.c +1829 -0
  622. package/external/libedhoc/tests/src/edhoc_trace_1/test_edhoc_handshake_ead_1.c +1247 -0
  623. package/external/libedhoc/tests/src/edhoc_trace_2/authentication_credentials_2.c +170 -0
  624. package/external/libedhoc/tests/src/edhoc_trace_2/test_edhoc_handshake_2.c +1783 -0
  625. package/external/libedhoc/tests/src/error_message/test_edhoc_error_message.c +226 -0
  626. package/external/libedhoc/tests/src/tests.c +228 -0
  627. package/external/libedhoc/tests/src/x509_chain_cs_0/authentication_credentials_x5chain_cs_0.c +332 -0
  628. package/external/libedhoc/tests/src/x509_chain_cs_0/test_edhoc_handshake_x5chain_cs_0.c +936 -0
  629. package/external/libedhoc/tests/src/x509_chain_cs_2/authentication_credentials_x5chain_cs_2.c +166 -0
  630. package/external/libedhoc/tests/src/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2.c +587 -0
  631. package/external/libedhoc/tests/src/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2_ead.c +917 -0
  632. package/external/libedhoc/tests/src/x509_chain_cs_2_static_dh/authentication_credentials_x5chain_cs_2_static_dh.c +186 -0
  633. package/external/libedhoc/tests/src/x509_chain_cs_2_static_dh/test_edhoc_handshake_x5chain_cs_2_static_dh_ead.c +743 -0
  634. package/external/libedhoc/tests/src/x509_hash_cs_2/authentication_credentials_x5t_cs_2.c +261 -0
  635. package/external/libedhoc/tests/src/x509_hash_cs_2/test_edhoc_handshake_x5t_cs_2_ead.c +854 -0
  636. package/include/EdhocComposeAsyncWorker.h +61 -0
  637. package/include/EdhocCredentialManager.h +100 -0
  638. package/include/EdhocCryptoManager.h +504 -0
  639. package/include/EdhocEadManager.h +151 -0
  640. package/include/EdhocExportAsyncWorker.h +71 -0
  641. package/include/EdhocProcessAsyncWorker.h +76 -0
  642. package/include/LibEDHOC.h +304 -0
  643. package/include/Suites.h +27 -0
  644. package/include/UserContext.h +79 -0
  645. package/include/Utils.h +110 -0
  646. package/package.json +1 -1
  647. package/prebuilds/darwin-arm64/edhoc.node +0 -0
  648. package/prebuilds/win32-ia32/edhoc.node +0 -0
  649. package/prebuilds/win32-x64/edhoc.node +0 -0
  650. package/src/EdhocComposeAsyncWorker.cpp +88 -0
  651. package/src/EdhocCredentialManager.cpp +360 -0
  652. package/src/EdhocCryptoManager.cpp +967 -0
  653. package/src/EdhocEadManager.cpp +156 -0
  654. package/src/EdhocExportAsyncWorker.cpp +82 -0
  655. package/src/EdhocProcessAsyncWorker.cpp +74 -0
  656. package/src/LibEDHOC.cpp +369 -0
  657. package/src/Suites.cpp +153 -0
  658. package/src/Utils.cpp +115 -0
  659. /package/prebuilds/{darwin-x64+arm64 → darwin-x64}/edhoc.node +0 -0
@@ -0,0 +1,1362 @@
1
+ /**
2
+ * \file ecp.h
3
+ *
4
+ * \brief This file provides an API for Elliptic Curves over GF(P) (ECP).
5
+ *
6
+ * The use of ECP in cryptography and TLS is defined in
7
+ * <em>Standards for Efficient Cryptography Group (SECG): SEC1
8
+ * Elliptic Curve Cryptography</em> and
9
+ * <em>RFC-4492: Elliptic Curve Cryptography (ECC) Cipher Suites
10
+ * for Transport Layer Security (TLS)</em>.
11
+ *
12
+ * <em>RFC-2409: The Internet Key Exchange (IKE)</em> defines ECP
13
+ * group types.
14
+ *
15
+ */
16
+
17
+ /*
18
+ * Copyright The Mbed TLS Contributors
19
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
20
+ */
21
+
22
+ #ifndef MBEDTLS_ECP_H
23
+ #define MBEDTLS_ECP_H
24
+ #include "mbedtls/private_access.h"
25
+
26
+ #include "mbedtls/build_info.h"
27
+
28
+ #include "mbedtls/bignum.h"
29
+
30
+ /*
31
+ * ECP error codes
32
+ */
33
+ /** Bad input parameters to function. */
34
+ #define MBEDTLS_ERR_ECP_BAD_INPUT_DATA -0x4F80
35
+ /** The buffer is too small to write to. */
36
+ #define MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL -0x4F00
37
+ /** The requested feature is not available, for example, the requested curve is not supported. */
38
+ #define MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE -0x4E80
39
+ /** The signature is not valid. */
40
+ #define MBEDTLS_ERR_ECP_VERIFY_FAILED -0x4E00
41
+ /** Memory allocation failed. */
42
+ #define MBEDTLS_ERR_ECP_ALLOC_FAILED -0x4D80
43
+ /** Generation of random value, such as ephemeral key, failed. */
44
+ #define MBEDTLS_ERR_ECP_RANDOM_FAILED -0x4D00
45
+ /** Invalid private or public key. */
46
+ #define MBEDTLS_ERR_ECP_INVALID_KEY -0x4C80
47
+ /** The buffer contains a valid signature followed by more data. */
48
+ #define MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH -0x4C00
49
+ /** Operation in progress, call again with the same parameters to continue. */
50
+ #define MBEDTLS_ERR_ECP_IN_PROGRESS -0x4B00
51
+
52
+ /* Flags indicating whether to include code that is specific to certain
53
+ * types of curves. These flags are for internal library use only. */
54
+ #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \
55
+ defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \
56
+ defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \
57
+ defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \
58
+ defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \
59
+ defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \
60
+ defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \
61
+ defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) || \
62
+ defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \
63
+ defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \
64
+ defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
65
+ #define MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED
66
+ #endif
67
+ #if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) || \
68
+ defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
69
+ #define MBEDTLS_ECP_MONTGOMERY_ENABLED
70
+ #endif
71
+
72
+ #ifdef __cplusplus
73
+ extern "C" {
74
+ #endif
75
+
76
+ /**
77
+ * Domain-parameter identifiers: curve, subgroup, and generator.
78
+ *
79
+ * \note Only curves over prime fields are supported.
80
+ *
81
+ * \warning This library does not support validation of arbitrary domain
82
+ * parameters. Therefore, only standardized domain parameters from trusted
83
+ * sources should be used. See mbedtls_ecp_group_load().
84
+ */
85
+ /* Note: when adding a new curve:
86
+ * - Add it at the end of this enum, otherwise you'll break the ABI by
87
+ * changing the numerical value for existing curves.
88
+ * - Increment MBEDTLS_ECP_DP_MAX below if needed.
89
+ * - Update the calculation of MBEDTLS_ECP_MAX_BITS below.
90
+ * - Add the corresponding MBEDTLS_ECP_DP_xxx_ENABLED macro definition to
91
+ * mbedtls_config.h.
92
+ * - List the curve as a dependency of MBEDTLS_ECP_C and
93
+ * MBEDTLS_ECDSA_C if supported in check_config.h.
94
+ * - Add the curve to the appropriate curve type macro
95
+ * MBEDTLS_ECP_yyy_ENABLED above.
96
+ * - Add the necessary definitions to ecp_curves.c.
97
+ * - Add the curve to the ecp_supported_curves array in ecp.c.
98
+ * - Add the curve to applicable profiles in x509_crt.c.
99
+ * - Add the curve to applicable presets in ssl_tls.c.
100
+ */
101
+ typedef enum {
102
+ MBEDTLS_ECP_DP_NONE = 0, /*!< Curve not defined. */
103
+ MBEDTLS_ECP_DP_SECP192R1, /*!< Domain parameters for the 192-bit curve defined by FIPS 186-4 and SEC1. */
104
+ MBEDTLS_ECP_DP_SECP224R1, /*!< Domain parameters for the 224-bit curve defined by FIPS 186-4 and SEC1. */
105
+ MBEDTLS_ECP_DP_SECP256R1, /*!< Domain parameters for the 256-bit curve defined by FIPS 186-4 and SEC1. */
106
+ MBEDTLS_ECP_DP_SECP384R1, /*!< Domain parameters for the 384-bit curve defined by FIPS 186-4 and SEC1. */
107
+ MBEDTLS_ECP_DP_SECP521R1, /*!< Domain parameters for the 521-bit curve defined by FIPS 186-4 and SEC1. */
108
+ MBEDTLS_ECP_DP_BP256R1, /*!< Domain parameters for 256-bit Brainpool curve. */
109
+ MBEDTLS_ECP_DP_BP384R1, /*!< Domain parameters for 384-bit Brainpool curve. */
110
+ MBEDTLS_ECP_DP_BP512R1, /*!< Domain parameters for 512-bit Brainpool curve. */
111
+ MBEDTLS_ECP_DP_CURVE25519, /*!< Domain parameters for Curve25519. */
112
+ MBEDTLS_ECP_DP_SECP192K1, /*!< Domain parameters for 192-bit "Koblitz" curve. */
113
+ MBEDTLS_ECP_DP_SECP224K1, /*!< Domain parameters for 224-bit "Koblitz" curve. */
114
+ MBEDTLS_ECP_DP_SECP256K1, /*!< Domain parameters for 256-bit "Koblitz" curve. */
115
+ MBEDTLS_ECP_DP_CURVE448, /*!< Domain parameters for Curve448. */
116
+ } mbedtls_ecp_group_id;
117
+
118
+ /**
119
+ * The number of supported curves, plus one for #MBEDTLS_ECP_DP_NONE.
120
+ */
121
+ #define MBEDTLS_ECP_DP_MAX 14
122
+
123
+ /*
124
+ * Curve types
125
+ */
126
+ typedef enum {
127
+ MBEDTLS_ECP_TYPE_NONE = 0,
128
+ MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS, /* y^2 = x^3 + a x + b */
129
+ MBEDTLS_ECP_TYPE_MONTGOMERY, /* y^2 = x^3 + a x^2 + x */
130
+ } mbedtls_ecp_curve_type;
131
+
132
+ /**
133
+ * Curve information, for use by other modules.
134
+ *
135
+ * The fields of this structure are part of the public API and can be
136
+ * accessed directly by applications. Future versions of the library may
137
+ * add extra fields or reorder existing fields.
138
+ */
139
+ typedef struct mbedtls_ecp_curve_info {
140
+ mbedtls_ecp_group_id grp_id; /*!< An internal identifier. */
141
+ uint16_t tls_id; /*!< The TLS NamedCurve identifier. */
142
+ uint16_t bit_size; /*!< The curve size in bits. */
143
+ const char *name; /*!< A human-friendly name. */
144
+ } mbedtls_ecp_curve_info;
145
+
146
+ /**
147
+ * \brief The ECP point structure, in Jacobian coordinates.
148
+ *
149
+ * \note All functions expect and return points satisfying
150
+ * the following condition: <code>Z == 0</code> or
151
+ * <code>Z == 1</code>. Other values of \p Z are
152
+ * used only by internal functions.
153
+ * The point is zero, or "at infinity", if <code>Z == 0</code>.
154
+ * Otherwise, \p X and \p Y are its standard (affine)
155
+ * coordinates.
156
+ */
157
+ typedef struct mbedtls_ecp_point {
158
+ mbedtls_mpi MBEDTLS_PRIVATE(X); /*!< The X coordinate of the ECP point. */
159
+ mbedtls_mpi MBEDTLS_PRIVATE(Y); /*!< The Y coordinate of the ECP point. */
160
+ mbedtls_mpi MBEDTLS_PRIVATE(Z); /*!< The Z coordinate of the ECP point. */
161
+ }
162
+ mbedtls_ecp_point;
163
+
164
+ #if !defined(MBEDTLS_ECP_ALT)
165
+ /*
166
+ * default Mbed TLS elliptic curve arithmetic implementation
167
+ *
168
+ * (in case MBEDTLS_ECP_ALT is defined then the developer has to provide an
169
+ * alternative implementation for the whole module and it will replace this
170
+ * one.)
171
+ */
172
+
173
+ /**
174
+ * \brief The ECP group structure.
175
+ *
176
+ * We consider two types of curve equations:
177
+ * <ul><li>Short Weierstrass: <code>y^2 = x^3 + A x + B mod P</code>
178
+ * (SEC1 + RFC-4492)</li>
179
+ * <li>Montgomery: <code>y^2 = x^3 + A x^2 + x mod P</code> (Curve25519,
180
+ * Curve448)</li></ul>
181
+ * In both cases, the generator (\p G) for a prime-order subgroup is fixed.
182
+ *
183
+ * For Short Weierstrass, this subgroup is the whole curve, and its
184
+ * cardinality is denoted by \p N. Our code requires that \p N is an
185
+ * odd prime as mbedtls_ecp_mul() requires an odd number, and
186
+ * mbedtls_ecdsa_sign() requires that it is prime for blinding purposes.
187
+ *
188
+ * The default implementation only initializes \p A without setting it to the
189
+ * authentic value for curves with <code>A = -3</code>(SECP256R1, etc), in which
190
+ * case you need to load \p A by yourself when using domain parameters directly,
191
+ * for example:
192
+ * \code
193
+ * mbedtls_mpi_init(&A);
194
+ * mbedtls_ecp_group_init(&grp);
195
+ * CHECK_RETURN(mbedtls_ecp_group_load(&grp, grp_id));
196
+ * if (mbedtls_ecp_group_a_is_minus_3(&grp)) {
197
+ * CHECK_RETURN(mbedtls_mpi_sub_int(&A, &grp.P, 3));
198
+ * } else {
199
+ * CHECK_RETURN(mbedtls_mpi_copy(&A, &grp.A));
200
+ * }
201
+ *
202
+ * do_something_with_a(&A);
203
+ *
204
+ * cleanup:
205
+ * mbedtls_mpi_free(&A);
206
+ * mbedtls_ecp_group_free(&grp);
207
+ * \endcode
208
+ *
209
+ * For Montgomery curves, we do not store \p A, but <code>(A + 2) / 4</code>,
210
+ * which is the quantity used in the formulas. Additionally, \p nbits is
211
+ * not the size of \p N but the required size for private keys.
212
+ *
213
+ * If \p modp is NULL, reduction modulo \p P is done using a generic algorithm.
214
+ * Otherwise, \p modp must point to a function that takes an \p mbedtls_mpi in the
215
+ * range of <code>0..2^(2*pbits)-1</code>, and transforms it in-place to an integer
216
+ * which is congruent mod \p P to the given MPI, and is close enough to \p pbits
217
+ * in size, so that it may be efficiently brought in the 0..P-1 range by a few
218
+ * additions or subtractions. Therefore, it is only an approximative modular
219
+ * reduction. It must return 0 on success and non-zero on failure.
220
+ *
221
+ * \note Alternative implementations of the ECP module must obey the
222
+ * following constraints.
223
+ * * Group IDs must be distinct: if two group structures have
224
+ * the same ID, then they must be identical.
225
+ * * The fields \c id, \c P, \c A, \c B, \c G, \c N,
226
+ * \c pbits and \c nbits must have the same type and semantics
227
+ * as in the built-in implementation.
228
+ * They must be available for reading, but direct modification
229
+ * of these fields does not need to be supported.
230
+ * They do not need to be at the same offset in the structure.
231
+ */
232
+ typedef struct mbedtls_ecp_group {
233
+ mbedtls_ecp_group_id id; /*!< An internal group identifier. */
234
+ mbedtls_mpi P; /*!< The prime modulus of the base field. */
235
+ mbedtls_mpi A; /*!< For Short Weierstrass: \p A in the equation. Note that
236
+ \p A is not set to the authentic value in some cases.
237
+ Refer to detailed description of ::mbedtls_ecp_group if
238
+ using domain parameters in the structure.
239
+ For Montgomery curves: <code>(A + 2) / 4</code>. */
240
+ mbedtls_mpi B; /*!< For Short Weierstrass: \p B in the equation.
241
+ For Montgomery curves: unused. */
242
+ mbedtls_ecp_point G; /*!< The generator of the subgroup used. */
243
+ mbedtls_mpi N; /*!< The order of \p G. */
244
+ size_t pbits; /*!< The number of bits in \p P.*/
245
+ size_t nbits; /*!< For Short Weierstrass: The number of bits in \p P.
246
+ For Montgomery curves: the number of bits in the
247
+ private keys. */
248
+ /* End of public fields */
249
+
250
+ unsigned int MBEDTLS_PRIVATE(h); /*!< \internal 1 if the constants are static. */
251
+ int(*MBEDTLS_PRIVATE(modp))(mbedtls_mpi *); /*!< The function for fast pseudo-reduction
252
+ mod \p P (see above).*/
253
+ int(*MBEDTLS_PRIVATE(t_pre))(mbedtls_ecp_point *, void *); /*!< Unused. */
254
+ int(*MBEDTLS_PRIVATE(t_post))(mbedtls_ecp_point *, void *); /*!< Unused. */
255
+ void *MBEDTLS_PRIVATE(t_data); /*!< Unused. */
256
+ mbedtls_ecp_point *MBEDTLS_PRIVATE(T); /*!< Pre-computed points for ecp_mul_comb(). */
257
+ size_t MBEDTLS_PRIVATE(T_size); /*!< The number of dynamic allocated pre-computed points. */
258
+ }
259
+ mbedtls_ecp_group;
260
+
261
+ /**
262
+ * \name SECTION: Module settings
263
+ *
264
+ * The configuration options you can set for this module are in this section.
265
+ * Either change them in mbedtls_config.h, or define them using the compiler command line.
266
+ * \{
267
+ */
268
+
269
+ #if !defined(MBEDTLS_ECP_WINDOW_SIZE)
270
+ /*
271
+ * Maximum "window" size used for point multiplication.
272
+ * Default: a point where higher memory usage yields diminishing performance
273
+ * returns.
274
+ * Minimum value: 2. Maximum value: 7.
275
+ *
276
+ * Result is an array of at most ( 1 << ( MBEDTLS_ECP_WINDOW_SIZE - 1 ) )
277
+ * points used for point multiplication. This value is directly tied to EC
278
+ * peak memory usage, so decreasing it by one should roughly cut memory usage
279
+ * by two (if large curves are in use).
280
+ *
281
+ * Reduction in size may reduce speed, but larger curves are impacted first.
282
+ * Sample performances (in ECDHE handshakes/s, with FIXED_POINT_OPTIM = 1):
283
+ * w-size: 6 5 4 3 2
284
+ * 521 145 141 135 120 97
285
+ * 384 214 209 198 177 146
286
+ * 256 320 320 303 262 226
287
+ * 224 475 475 453 398 342
288
+ * 192 640 640 633 587 476
289
+ */
290
+ #define MBEDTLS_ECP_WINDOW_SIZE 4 /**< The maximum window size used. */
291
+ #endif /* MBEDTLS_ECP_WINDOW_SIZE */
292
+
293
+ #if !defined(MBEDTLS_ECP_FIXED_POINT_OPTIM)
294
+ /*
295
+ * Trade code size for speed on fixed-point multiplication.
296
+ *
297
+ * This speeds up repeated multiplication of the generator (that is, the
298
+ * multiplication in ECDSA signatures, and half of the multiplications in
299
+ * ECDSA verification and ECDHE) by a factor roughly 3 to 4.
300
+ *
301
+ * For each n-bit Short Weierstrass curve that is enabled, this adds 4n bytes
302
+ * of code size if n < 384 and 8n otherwise.
303
+ *
304
+ * Change this value to 0 to reduce code size.
305
+ */
306
+ #define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up. */
307
+ #endif /* MBEDTLS_ECP_FIXED_POINT_OPTIM */
308
+
309
+ /** \} name SECTION: Module settings */
310
+
311
+ #else /* MBEDTLS_ECP_ALT */
312
+ #include "ecp_alt.h"
313
+ #endif /* MBEDTLS_ECP_ALT */
314
+
315
+ /**
316
+ * The maximum size of the groups, that is, of \c N and \c P.
317
+ */
318
+ #if !defined(MBEDTLS_ECP_LIGHT)
319
+ /* Dummy definition to help code that has optional ECP support and
320
+ * defines an MBEDTLS_ECP_MAX_BYTES-sized array unconditionally. */
321
+ #define MBEDTLS_ECP_MAX_BITS 1
322
+ /* Note: the curves must be listed in DECREASING size! */
323
+ #elif defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
324
+ #define MBEDTLS_ECP_MAX_BITS 521
325
+ #elif defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
326
+ #define MBEDTLS_ECP_MAX_BITS 512
327
+ #elif defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
328
+ #define MBEDTLS_ECP_MAX_BITS 448
329
+ #elif defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
330
+ #define MBEDTLS_ECP_MAX_BITS 384
331
+ #elif defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
332
+ #define MBEDTLS_ECP_MAX_BITS 384
333
+ #elif defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
334
+ #define MBEDTLS_ECP_MAX_BITS 256
335
+ #elif defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
336
+ #define MBEDTLS_ECP_MAX_BITS 256
337
+ #elif defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
338
+ #define MBEDTLS_ECP_MAX_BITS 256
339
+ #elif defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
340
+ #define MBEDTLS_ECP_MAX_BITS 255
341
+ #elif defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
342
+ #define MBEDTLS_ECP_MAX_BITS 225 // n is slightly above 2^224
343
+ #elif defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
344
+ #define MBEDTLS_ECP_MAX_BITS 224
345
+ #elif defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
346
+ #define MBEDTLS_ECP_MAX_BITS 192
347
+ #elif defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
348
+ #define MBEDTLS_ECP_MAX_BITS 192
349
+ #else /* !MBEDTLS_ECP_LIGHT */
350
+ #error "Missing definition of MBEDTLS_ECP_MAX_BITS"
351
+ #endif /* !MBEDTLS_ECP_LIGHT */
352
+
353
+ #define MBEDTLS_ECP_MAX_BYTES ((MBEDTLS_ECP_MAX_BITS + 7) / 8)
354
+ #define MBEDTLS_ECP_MAX_PT_LEN (2 * MBEDTLS_ECP_MAX_BYTES + 1)
355
+
356
+ #if defined(MBEDTLS_ECP_RESTARTABLE)
357
+
358
+ /**
359
+ * \brief Internal restart context for multiplication
360
+ *
361
+ * \note Opaque struct
362
+ */
363
+ typedef struct mbedtls_ecp_restart_mul mbedtls_ecp_restart_mul_ctx;
364
+
365
+ /**
366
+ * \brief Internal restart context for ecp_muladd()
367
+ *
368
+ * \note Opaque struct
369
+ */
370
+ typedef struct mbedtls_ecp_restart_muladd mbedtls_ecp_restart_muladd_ctx;
371
+
372
+ /**
373
+ * \brief General context for resuming ECC operations
374
+ */
375
+ typedef struct {
376
+ unsigned MBEDTLS_PRIVATE(ops_done); /*!< current ops count */
377
+ unsigned MBEDTLS_PRIVATE(depth); /*!< call depth (0 = top-level) */
378
+ mbedtls_ecp_restart_mul_ctx *MBEDTLS_PRIVATE(rsm); /*!< ecp_mul_comb() sub-context */
379
+ mbedtls_ecp_restart_muladd_ctx *MBEDTLS_PRIVATE(ma); /*!< ecp_muladd() sub-context */
380
+ } mbedtls_ecp_restart_ctx;
381
+
382
+ /*
383
+ * Operation counts for restartable functions
384
+ */
385
+ #define MBEDTLS_ECP_OPS_CHK 3 /*!< basic ops count for ecp_check_pubkey() */
386
+ #define MBEDTLS_ECP_OPS_DBL 8 /*!< basic ops count for ecp_double_jac() */
387
+ #define MBEDTLS_ECP_OPS_ADD 11 /*!< basic ops count for see ecp_add_mixed() */
388
+ #define MBEDTLS_ECP_OPS_INV 120 /*!< empirical equivalent for mpi_mod_inv() */
389
+
390
+ /**
391
+ * \brief Internal; for restartable functions in other modules.
392
+ * Check and update basic ops budget.
393
+ *
394
+ * \param grp Group structure
395
+ * \param rs_ctx Restart context
396
+ * \param ops Number of basic ops to do
397
+ *
398
+ * \return \c 0 if doing \p ops basic ops is still allowed,
399
+ * \return #MBEDTLS_ERR_ECP_IN_PROGRESS otherwise.
400
+ */
401
+ int mbedtls_ecp_check_budget(const mbedtls_ecp_group *grp,
402
+ mbedtls_ecp_restart_ctx *rs_ctx,
403
+ unsigned ops);
404
+
405
+ /* Utility macro for checking and updating ops budget */
406
+ #define MBEDTLS_ECP_BUDGET(ops) \
407
+ MBEDTLS_MPI_CHK(mbedtls_ecp_check_budget(grp, rs_ctx, \
408
+ (unsigned) (ops)));
409
+
410
+ #else /* MBEDTLS_ECP_RESTARTABLE */
411
+
412
+ #define MBEDTLS_ECP_BUDGET(ops) /* no-op; for compatibility */
413
+
414
+ /* We want to declare restartable versions of existing functions anyway */
415
+ typedef void mbedtls_ecp_restart_ctx;
416
+
417
+ #endif /* MBEDTLS_ECP_RESTARTABLE */
418
+
419
+ /**
420
+ * \brief The ECP key-pair structure.
421
+ *
422
+ * A generic key-pair that may be used for ECDSA and fixed ECDH, for example.
423
+ *
424
+ * \note Members are deliberately in the same order as in the
425
+ * ::mbedtls_ecdsa_context structure.
426
+ */
427
+ typedef struct mbedtls_ecp_keypair {
428
+ mbedtls_ecp_group MBEDTLS_PRIVATE(grp); /*!< Elliptic curve and base point */
429
+ mbedtls_mpi MBEDTLS_PRIVATE(d); /*!< our secret value */
430
+ mbedtls_ecp_point MBEDTLS_PRIVATE(Q); /*!< our public value */
431
+ }
432
+ mbedtls_ecp_keypair;
433
+
434
+ /**
435
+ * The uncompressed point format for Short Weierstrass curves
436
+ * (MBEDTLS_ECP_DP_SECP_XXX and MBEDTLS_ECP_DP_BP_XXX).
437
+ */
438
+ #define MBEDTLS_ECP_PF_UNCOMPRESSED 0
439
+ /**
440
+ * The compressed point format for Short Weierstrass curves
441
+ * (MBEDTLS_ECP_DP_SECP_XXX and MBEDTLS_ECP_DP_BP_XXX).
442
+ *
443
+ * \warning While this format is supported for all concerned curves for
444
+ * writing, when it comes to parsing, it is not supported for all
445
+ * curves. Specifically, parsing compressed points on
446
+ * MBEDTLS_ECP_DP_SECP224R1 and MBEDTLS_ECP_DP_SECP224K1 is not
447
+ * supported.
448
+ */
449
+ #define MBEDTLS_ECP_PF_COMPRESSED 1
450
+
451
+ /*
452
+ * Some other constants from RFC 4492
453
+ */
454
+ #define MBEDTLS_ECP_TLS_NAMED_CURVE 3 /**< The named_curve of ECCurveType. */
455
+
456
+ #if defined(MBEDTLS_ECP_RESTARTABLE)
457
+ /**
458
+ * \brief Set the maximum number of basic operations done in a row.
459
+ *
460
+ * If more operations are needed to complete a computation,
461
+ * #MBEDTLS_ERR_ECP_IN_PROGRESS will be returned by the
462
+ * function performing the computation. It is then the
463
+ * caller's responsibility to either call again with the same
464
+ * parameters until it returns 0 or an error code; or to free
465
+ * the restart context if the operation is to be aborted.
466
+ *
467
+ * It is strictly required that all input parameters and the
468
+ * restart context be the same on successive calls for the
469
+ * same operation, but output parameters need not be the
470
+ * same; they must not be used until the function finally
471
+ * returns 0.
472
+ *
473
+ * This only applies to functions whose documentation
474
+ * mentions they may return #MBEDTLS_ERR_ECP_IN_PROGRESS (or
475
+ * #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS for functions in the
476
+ * SSL module). For functions that accept a "restart context"
477
+ * argument, passing NULL disables restart and makes the
478
+ * function equivalent to the function with the same name
479
+ * with \c _restartable removed. For functions in the ECDH
480
+ * module, restart is disabled unless the function accepts
481
+ * an "ECDH context" argument and
482
+ * mbedtls_ecdh_enable_restart() was previously called on
483
+ * that context. For function in the SSL module, restart is
484
+ * only enabled for specific sides and key exchanges
485
+ * (currently only for clients and ECDHE-ECDSA).
486
+ *
487
+ * \warning Using the PSA interruptible interfaces with keys in local
488
+ * storage and no accelerator driver will also call this
489
+ * function to set the values specified via those interfaces,
490
+ * overwriting values previously set. Care should be taken if
491
+ * mixing these two interfaces.
492
+ *
493
+ * \param max_ops Maximum number of basic operations done in a row.
494
+ * Default: 0 (unlimited).
495
+ * Lower (non-zero) values mean ECC functions will block for
496
+ * a lesser maximum amount of time.
497
+ *
498
+ * \note A "basic operation" is defined as a rough equivalent of a
499
+ * multiplication in GF(p) for the NIST P-256 curve.
500
+ * As an indication, with default settings, a scalar
501
+ * multiplication (full run of \c mbedtls_ecp_mul()) is:
502
+ * - about 3300 basic operations for P-256
503
+ * - about 9400 basic operations for P-384
504
+ *
505
+ * \note Very low values are not always respected: sometimes
506
+ * functions need to block for a minimum number of
507
+ * operations, and will do so even if max_ops is set to a
508
+ * lower value. That minimum depends on the curve size, and
509
+ * can be made lower by decreasing the value of
510
+ * \c MBEDTLS_ECP_WINDOW_SIZE. As an indication, here is the
511
+ * lowest effective value for various curves and values of
512
+ * that parameter (w for short):
513
+ * w=6 w=5 w=4 w=3 w=2
514
+ * P-256 208 208 160 136 124
515
+ * P-384 682 416 320 272 248
516
+ * P-521 1364 832 640 544 496
517
+ *
518
+ * \note This setting is currently ignored by Curve25519.
519
+ */
520
+ void mbedtls_ecp_set_max_ops(unsigned max_ops);
521
+
522
+ /**
523
+ * \brief Check if restart is enabled (max_ops != 0)
524
+ *
525
+ * \return \c 0 if \c max_ops == 0 (restart disabled)
526
+ * \return \c 1 otherwise (restart enabled)
527
+ */
528
+ int mbedtls_ecp_restart_is_enabled(void);
529
+ #endif /* MBEDTLS_ECP_RESTARTABLE */
530
+
531
+ /*
532
+ * Get the type of a curve
533
+ */
534
+ mbedtls_ecp_curve_type mbedtls_ecp_get_type(const mbedtls_ecp_group *grp);
535
+
536
+ /**
537
+ * \brief This function retrieves the information defined in
538
+ * mbedtls_ecp_curve_info() for all supported curves.
539
+ *
540
+ * \note This function returns information about all curves
541
+ * supported by the library. Some curves may not be
542
+ * supported for all algorithms. Call mbedtls_ecdh_can_do()
543
+ * or mbedtls_ecdsa_can_do() to check if a curve is
544
+ * supported for ECDH or ECDSA.
545
+ *
546
+ * \return A statically allocated array. The last entry is 0.
547
+ */
548
+ const mbedtls_ecp_curve_info *mbedtls_ecp_curve_list(void);
549
+
550
+ /**
551
+ * \brief This function retrieves the list of internal group
552
+ * identifiers of all supported curves in the order of
553
+ * preference.
554
+ *
555
+ * \note This function returns information about all curves
556
+ * supported by the library. Some curves may not be
557
+ * supported for all algorithms. Call mbedtls_ecdh_can_do()
558
+ * or mbedtls_ecdsa_can_do() to check if a curve is
559
+ * supported for ECDH or ECDSA.
560
+ *
561
+ * \return A statically allocated array,
562
+ * terminated with MBEDTLS_ECP_DP_NONE.
563
+ */
564
+ const mbedtls_ecp_group_id *mbedtls_ecp_grp_id_list(void);
565
+
566
+ /**
567
+ * \brief This function retrieves curve information from an internal
568
+ * group identifier.
569
+ *
570
+ * \param grp_id An \c MBEDTLS_ECP_DP_XXX value.
571
+ *
572
+ * \return The associated curve information on success.
573
+ * \return NULL on failure.
574
+ */
575
+ const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_grp_id(mbedtls_ecp_group_id grp_id);
576
+
577
+ /**
578
+ * \brief This function retrieves curve information from a TLS
579
+ * NamedCurve value.
580
+ *
581
+ * \param tls_id An \c MBEDTLS_ECP_DP_XXX value.
582
+ *
583
+ * \return The associated curve information on success.
584
+ * \return NULL on failure.
585
+ */
586
+ const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_tls_id(uint16_t tls_id);
587
+
588
+ /**
589
+ * \brief This function retrieves curve information from a
590
+ * human-readable name.
591
+ *
592
+ * \param name The human-readable name.
593
+ *
594
+ * \return The associated curve information on success.
595
+ * \return NULL on failure.
596
+ */
597
+ const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_name(const char *name);
598
+
599
+ /**
600
+ * \brief This function initializes a point as zero.
601
+ *
602
+ * \param pt The point to initialize.
603
+ */
604
+ void mbedtls_ecp_point_init(mbedtls_ecp_point *pt);
605
+
606
+ /**
607
+ * \brief This function initializes an ECP group context
608
+ * without loading any domain parameters.
609
+ *
610
+ * \note After this function is called, domain parameters
611
+ * for various ECP groups can be loaded through the
612
+ * mbedtls_ecp_group_load() or mbedtls_ecp_tls_read_group()
613
+ * functions.
614
+ */
615
+ void mbedtls_ecp_group_init(mbedtls_ecp_group *grp);
616
+
617
+ /**
618
+ * \brief This function initializes a key pair as an invalid one.
619
+ *
620
+ * \param key The key pair to initialize.
621
+ */
622
+ void mbedtls_ecp_keypair_init(mbedtls_ecp_keypair *key);
623
+
624
+ /**
625
+ * \brief This function frees the components of a point.
626
+ *
627
+ * \param pt The point to free.
628
+ */
629
+ void mbedtls_ecp_point_free(mbedtls_ecp_point *pt);
630
+
631
+ /**
632
+ * \brief This function frees the components of an ECP group.
633
+ *
634
+ * \param grp The group to free. This may be \c NULL, in which
635
+ * case this function returns immediately. If it is not
636
+ * \c NULL, it must point to an initialized ECP group.
637
+ */
638
+ void mbedtls_ecp_group_free(mbedtls_ecp_group *grp);
639
+
640
+ /**
641
+ * \brief This function frees the components of a key pair.
642
+ *
643
+ * \param key The key pair to free. This may be \c NULL, in which
644
+ * case this function returns immediately. If it is not
645
+ * \c NULL, it must point to an initialized ECP key pair.
646
+ */
647
+ void mbedtls_ecp_keypair_free(mbedtls_ecp_keypair *key);
648
+
649
+ #if defined(MBEDTLS_ECP_RESTARTABLE)
650
+ /**
651
+ * \brief Initialize a restart context.
652
+ *
653
+ * \param ctx The restart context to initialize. This must
654
+ * not be \c NULL.
655
+ */
656
+ void mbedtls_ecp_restart_init(mbedtls_ecp_restart_ctx *ctx);
657
+
658
+ /**
659
+ * \brief Free the components of a restart context.
660
+ *
661
+ * \param ctx The restart context to free. This may be \c NULL, in which
662
+ * case this function returns immediately. If it is not
663
+ * \c NULL, it must point to an initialized restart context.
664
+ */
665
+ void mbedtls_ecp_restart_free(mbedtls_ecp_restart_ctx *ctx);
666
+ #endif /* MBEDTLS_ECP_RESTARTABLE */
667
+
668
+ /**
669
+ * \brief This function copies the contents of point \p Q into
670
+ * point \p P.
671
+ *
672
+ * \param P The destination point. This must be initialized.
673
+ * \param Q The source point. This must be initialized.
674
+ *
675
+ * \return \c 0 on success.
676
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED on memory-allocation failure.
677
+ * \return Another negative error code for other kinds of failure.
678
+ */
679
+ int mbedtls_ecp_copy(mbedtls_ecp_point *P, const mbedtls_ecp_point *Q);
680
+
681
+ /**
682
+ * \brief This function copies the contents of group \p src into
683
+ * group \p dst.
684
+ *
685
+ * \param dst The destination group. This must be initialized.
686
+ * \param src The source group. This must be initialized.
687
+ *
688
+ * \return \c 0 on success.
689
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED on memory-allocation failure.
690
+ * \return Another negative error code on other kinds of failure.
691
+ */
692
+ int mbedtls_ecp_group_copy(mbedtls_ecp_group *dst,
693
+ const mbedtls_ecp_group *src);
694
+
695
+ /**
696
+ * \brief This function sets a point to the point at infinity.
697
+ *
698
+ * \param pt The point to set. This must be initialized.
699
+ *
700
+ * \return \c 0 on success.
701
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED on memory-allocation failure.
702
+ * \return Another negative error code on other kinds of failure.
703
+ */
704
+ int mbedtls_ecp_set_zero(mbedtls_ecp_point *pt);
705
+
706
+ /**
707
+ * \brief This function checks if a point is the point at infinity.
708
+ *
709
+ * \param pt The point to test. This must be initialized.
710
+ *
711
+ * \return \c 1 if the point is zero.
712
+ * \return \c 0 if the point is non-zero.
713
+ * \return A negative error code on failure.
714
+ */
715
+ int mbedtls_ecp_is_zero(mbedtls_ecp_point *pt);
716
+
717
+ /**
718
+ * \brief This function compares two points.
719
+ *
720
+ * \note This assumes that the points are normalized. Otherwise,
721
+ * they may compare as "not equal" even if they are.
722
+ *
723
+ * \param P The first point to compare. This must be initialized.
724
+ * \param Q The second point to compare. This must be initialized.
725
+ *
726
+ * \return \c 0 if the points are equal.
727
+ * \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if the points are not equal.
728
+ */
729
+ int mbedtls_ecp_point_cmp(const mbedtls_ecp_point *P,
730
+ const mbedtls_ecp_point *Q);
731
+
732
+ /**
733
+ * \brief This function imports a non-zero point from two ASCII
734
+ * strings.
735
+ *
736
+ * \param P The destination point. This must be initialized.
737
+ * \param radix The numeric base of the input.
738
+ * \param x The first affine coordinate, as a null-terminated string.
739
+ * \param y The second affine coordinate, as a null-terminated string.
740
+ *
741
+ * \return \c 0 on success.
742
+ * \return An \c MBEDTLS_ERR_MPI_XXX error code on failure.
743
+ */
744
+ int mbedtls_ecp_point_read_string(mbedtls_ecp_point *P, int radix,
745
+ const char *x, const char *y);
746
+
747
+ /**
748
+ * \brief This function exports a point into unsigned binary data.
749
+ *
750
+ * \param grp The group to which the point should belong.
751
+ * This must be initialized and have group parameters
752
+ * set, for example through mbedtls_ecp_group_load().
753
+ * \param P The point to export. This must be initialized.
754
+ * \param format The point format. This must be either
755
+ * #MBEDTLS_ECP_PF_COMPRESSED or #MBEDTLS_ECP_PF_UNCOMPRESSED.
756
+ * (For groups without these formats, this parameter is
757
+ * ignored. But it still has to be either of the above
758
+ * values.)
759
+ * \param olen The address at which to store the length of
760
+ * the output in Bytes. This must not be \c NULL.
761
+ * \param buf The output buffer. This must be a writable buffer
762
+ * of length \p buflen Bytes.
763
+ * \param buflen The length of the output buffer \p buf in Bytes.
764
+ *
765
+ * \return \c 0 on success.
766
+ * \return #MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL if the output buffer
767
+ * is too small to hold the point.
768
+ * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the point format
769
+ * or the export for the given group is not implemented.
770
+ * \return Another negative error code on other kinds of failure.
771
+ */
772
+ int mbedtls_ecp_point_write_binary(const mbedtls_ecp_group *grp,
773
+ const mbedtls_ecp_point *P,
774
+ int format, size_t *olen,
775
+ unsigned char *buf, size_t buflen);
776
+
777
+ /**
778
+ * \brief This function imports a point from unsigned binary data.
779
+ *
780
+ * \note This function does not check that the point actually
781
+ * belongs to the given group, see mbedtls_ecp_check_pubkey()
782
+ * for that.
783
+ *
784
+ * \note For compressed points, see #MBEDTLS_ECP_PF_COMPRESSED for
785
+ * limitations.
786
+ *
787
+ * \param grp The group to which the point should belong.
788
+ * This must be initialized and have group parameters
789
+ * set, for example through mbedtls_ecp_group_load().
790
+ * \param P The destination context to import the point to.
791
+ * This must be initialized.
792
+ * \param buf The input buffer. This must be a readable buffer
793
+ * of length \p ilen Bytes.
794
+ * \param ilen The length of the input buffer \p buf in Bytes.
795
+ *
796
+ * \return \c 0 on success.
797
+ * \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if the input is invalid.
798
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED on memory-allocation failure.
799
+ * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the import for the
800
+ * given group is not implemented.
801
+ */
802
+ int mbedtls_ecp_point_read_binary(const mbedtls_ecp_group *grp,
803
+ mbedtls_ecp_point *P,
804
+ const unsigned char *buf, size_t ilen);
805
+
806
+ /**
807
+ * \brief This function imports a point from a TLS ECPoint record.
808
+ *
809
+ * \note On function return, \p *buf is updated to point immediately
810
+ * after the ECPoint record.
811
+ *
812
+ * \param grp The ECP group to use.
813
+ * This must be initialized and have group parameters
814
+ * set, for example through mbedtls_ecp_group_load().
815
+ * \param pt The destination point.
816
+ * \param buf The address of the pointer to the start of the input buffer.
817
+ * \param len The length of the buffer.
818
+ *
819
+ * \return \c 0 on success.
820
+ * \return An \c MBEDTLS_ERR_MPI_XXX error code on initialization
821
+ * failure.
822
+ * \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid.
823
+ */
824
+ int mbedtls_ecp_tls_read_point(const mbedtls_ecp_group *grp,
825
+ mbedtls_ecp_point *pt,
826
+ const unsigned char **buf, size_t len);
827
+
828
+ /**
829
+ * \brief This function exports a point as a TLS ECPoint record
830
+ * defined in RFC 4492, Section 5.4.
831
+ *
832
+ * \param grp The ECP group to use.
833
+ * This must be initialized and have group parameters
834
+ * set, for example through mbedtls_ecp_group_load().
835
+ * \param pt The point to be exported. This must be initialized.
836
+ * \param format The point format to use. This must be either
837
+ * #MBEDTLS_ECP_PF_COMPRESSED or #MBEDTLS_ECP_PF_UNCOMPRESSED.
838
+ * \param olen The address at which to store the length in Bytes
839
+ * of the data written.
840
+ * \param buf The target buffer. This must be a writable buffer of
841
+ * length \p blen Bytes.
842
+ * \param blen The length of the target buffer \p buf in Bytes.
843
+ *
844
+ * \return \c 0 on success.
845
+ * \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if the input is invalid.
846
+ * \return #MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL if the target buffer
847
+ * is too small to hold the exported point.
848
+ * \return Another negative error code on other kinds of failure.
849
+ */
850
+ int mbedtls_ecp_tls_write_point(const mbedtls_ecp_group *grp,
851
+ const mbedtls_ecp_point *pt,
852
+ int format, size_t *olen,
853
+ unsigned char *buf, size_t blen);
854
+
855
+ /**
856
+ * \brief This function sets up an ECP group context
857
+ * from a standardized set of domain parameters.
858
+ *
859
+ * \note The index should be a value of the NamedCurve enum,
860
+ * as defined in <em>RFC-4492: Elliptic Curve Cryptography
861
+ * (ECC) Cipher Suites for Transport Layer Security (TLS)</em>,
862
+ * usually in the form of an \c MBEDTLS_ECP_DP_XXX macro.
863
+ *
864
+ * \param grp The group context to setup. This must be initialized.
865
+ * \param id The identifier of the domain parameter set to load.
866
+ *
867
+ * \return \c 0 on success.
868
+ * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if \p id doesn't
869
+ * correspond to a known group.
870
+ * \return Another negative error code on other kinds of failure.
871
+ */
872
+ int mbedtls_ecp_group_load(mbedtls_ecp_group *grp, mbedtls_ecp_group_id id);
873
+
874
+ /**
875
+ * \brief This function sets up an ECP group context from a TLS
876
+ * ECParameters record as defined in RFC 4492, Section 5.4.
877
+ *
878
+ * \note The read pointer \p buf is updated to point right after
879
+ * the ECParameters record on exit.
880
+ *
881
+ * \param grp The group context to setup. This must be initialized.
882
+ * \param buf The address of the pointer to the start of the input buffer.
883
+ * \param len The length of the input buffer \c *buf in Bytes.
884
+ *
885
+ * \return \c 0 on success.
886
+ * \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid.
887
+ * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the group is not
888
+ * recognized.
889
+ * \return Another negative error code on other kinds of failure.
890
+ */
891
+ int mbedtls_ecp_tls_read_group(mbedtls_ecp_group *grp,
892
+ const unsigned char **buf, size_t len);
893
+
894
+ /**
895
+ * \brief This function extracts an elliptic curve group ID from a
896
+ * TLS ECParameters record as defined in RFC 4492, Section 5.4.
897
+ *
898
+ * \note The read pointer \p buf is updated to point right after
899
+ * the ECParameters record on exit.
900
+ *
901
+ * \param grp The address at which to store the group id.
902
+ * This must not be \c NULL.
903
+ * \param buf The address of the pointer to the start of the input buffer.
904
+ * \param len The length of the input buffer \c *buf in Bytes.
905
+ *
906
+ * \return \c 0 on success.
907
+ * \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid.
908
+ * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the group is not
909
+ * recognized.
910
+ * \return Another negative error code on other kinds of failure.
911
+ */
912
+ int mbedtls_ecp_tls_read_group_id(mbedtls_ecp_group_id *grp,
913
+ const unsigned char **buf,
914
+ size_t len);
915
+ /**
916
+ * \brief This function exports an elliptic curve as a TLS
917
+ * ECParameters record as defined in RFC 4492, Section 5.4.
918
+ *
919
+ * \param grp The ECP group to be exported.
920
+ * This must be initialized and have group parameters
921
+ * set, for example through mbedtls_ecp_group_load().
922
+ * \param olen The address at which to store the number of Bytes written.
923
+ * This must not be \c NULL.
924
+ * \param buf The buffer to write to. This must be a writable buffer
925
+ * of length \p blen Bytes.
926
+ * \param blen The length of the output buffer \p buf in Bytes.
927
+ *
928
+ * \return \c 0 on success.
929
+ * \return #MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL if the output
930
+ * buffer is too small to hold the exported group.
931
+ * \return Another negative error code on other kinds of failure.
932
+ */
933
+ int mbedtls_ecp_tls_write_group(const mbedtls_ecp_group *grp,
934
+ size_t *olen,
935
+ unsigned char *buf, size_t blen);
936
+
937
+ /**
938
+ * \brief This function performs a scalar multiplication of a point
939
+ * by an integer: \p R = \p m * \p P.
940
+ *
941
+ * It is not thread-safe to use same group in multiple threads.
942
+ *
943
+ * \note To prevent timing attacks, this function
944
+ * executes the exact same sequence of base-field
945
+ * operations for any valid \p m. It avoids any if-branch or
946
+ * array index depending on the value of \p m. It also uses
947
+ * \p f_rng to randomize some intermediate results.
948
+ *
949
+ * \param grp The ECP group to use.
950
+ * This must be initialized and have group parameters
951
+ * set, for example through mbedtls_ecp_group_load().
952
+ * \param R The point in which to store the result of the calculation.
953
+ * This must be initialized.
954
+ * \param m The integer by which to multiply. This must be initialized.
955
+ * \param P The point to multiply. This must be initialized.
956
+ * \param f_rng The RNG function. This must not be \c NULL.
957
+ * \param p_rng The RNG context to be passed to \p f_rng. This may be \c
958
+ * NULL if \p f_rng doesn't need a context.
959
+ *
960
+ * \return \c 0 on success.
961
+ * \return #MBEDTLS_ERR_ECP_INVALID_KEY if \p m is not a valid private
962
+ * key, or \p P is not a valid public key.
963
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED on memory-allocation failure.
964
+ * \return Another negative error code on other kinds of failure.
965
+ */
966
+ int mbedtls_ecp_mul(mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
967
+ const mbedtls_mpi *m, const mbedtls_ecp_point *P,
968
+ int (*f_rng)(void *, unsigned char *, size_t), void *p_rng);
969
+
970
+ /**
971
+ * \brief This function performs multiplication of a point by
972
+ * an integer: \p R = \p m * \p P in a restartable way.
973
+ *
974
+ * \see mbedtls_ecp_mul()
975
+ *
976
+ * \note This function does the same as \c mbedtls_ecp_mul(), but
977
+ * it can return early and restart according to the limit set
978
+ * with \c mbedtls_ecp_set_max_ops() to reduce blocking.
979
+ *
980
+ * \param grp The ECP group to use.
981
+ * This must be initialized and have group parameters
982
+ * set, for example through mbedtls_ecp_group_load().
983
+ * \param R The point in which to store the result of the calculation.
984
+ * This must be initialized.
985
+ * \param m The integer by which to multiply. This must be initialized.
986
+ * \param P The point to multiply. This must be initialized.
987
+ * \param f_rng The RNG function. This must not be \c NULL.
988
+ * \param p_rng The RNG context to be passed to \p f_rng. This may be \c
989
+ * NULL if \p f_rng doesn't need a context.
990
+ * \param rs_ctx The restart context (NULL disables restart).
991
+ *
992
+ * \return \c 0 on success.
993
+ * \return #MBEDTLS_ERR_ECP_INVALID_KEY if \p m is not a valid private
994
+ * key, or \p P is not a valid public key.
995
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED on memory-allocation failure.
996
+ * \return #MBEDTLS_ERR_ECP_IN_PROGRESS if maximum number of
997
+ * operations was reached: see \c mbedtls_ecp_set_max_ops().
998
+ * \return Another negative error code on other kinds of failure.
999
+ */
1000
+ int mbedtls_ecp_mul_restartable(mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
1001
+ const mbedtls_mpi *m, const mbedtls_ecp_point *P,
1002
+ int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
1003
+ mbedtls_ecp_restart_ctx *rs_ctx);
1004
+
1005
+ #if defined(MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED)
1006
+ /**
1007
+ * \brief This function checks if domain parameter A of the curve is
1008
+ * \c -3.
1009
+ *
1010
+ * \note This function is only defined for short Weierstrass curves.
1011
+ * It may not be included in builds without any short
1012
+ * Weierstrass curve.
1013
+ *
1014
+ * \param grp The ECP group to use.
1015
+ * This must be initialized and have group parameters
1016
+ * set, for example through mbedtls_ecp_group_load().
1017
+ *
1018
+ * \return \c 1 if <code>A = -3</code>.
1019
+ * \return \c 0 Otherwise.
1020
+ */
1021
+ static inline int mbedtls_ecp_group_a_is_minus_3(const mbedtls_ecp_group *grp)
1022
+ {
1023
+ return grp->A.MBEDTLS_PRIVATE(p) == NULL;
1024
+ }
1025
+
1026
+ /**
1027
+ * \brief This function performs multiplication and addition of two
1028
+ * points by integers: \p R = \p m * \p P + \p n * \p Q
1029
+ *
1030
+ * It is not thread-safe to use same group in multiple threads.
1031
+ *
1032
+ * \note In contrast to mbedtls_ecp_mul(), this function does not
1033
+ * guarantee a constant execution flow and timing.
1034
+ *
1035
+ * \note This function is only defined for short Weierstrass curves.
1036
+ * It may not be included in builds without any short
1037
+ * Weierstrass curve.
1038
+ *
1039
+ * \param grp The ECP group to use.
1040
+ * This must be initialized and have group parameters
1041
+ * set, for example through mbedtls_ecp_group_load().
1042
+ * \param R The point in which to store the result of the calculation.
1043
+ * This must be initialized.
1044
+ * \param m The integer by which to multiply \p P.
1045
+ * This must be initialized.
1046
+ * \param P The point to multiply by \p m. This must be initialized.
1047
+ * \param n The integer by which to multiply \p Q.
1048
+ * This must be initialized.
1049
+ * \param Q The point to be multiplied by \p n.
1050
+ * This must be initialized.
1051
+ *
1052
+ * \return \c 0 on success.
1053
+ * \return #MBEDTLS_ERR_ECP_INVALID_KEY if \p m or \p n are not
1054
+ * valid private keys, or \p P or \p Q are not valid public
1055
+ * keys.
1056
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED on memory-allocation failure.
1057
+ * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if \p grp does not
1058
+ * designate a short Weierstrass curve.
1059
+ * \return Another negative error code on other kinds of failure.
1060
+ */
1061
+ int mbedtls_ecp_muladd(mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
1062
+ const mbedtls_mpi *m, const mbedtls_ecp_point *P,
1063
+ const mbedtls_mpi *n, const mbedtls_ecp_point *Q);
1064
+
1065
+ /**
1066
+ * \brief This function performs multiplication and addition of two
1067
+ * points by integers: \p R = \p m * \p P + \p n * \p Q in a
1068
+ * restartable way.
1069
+ *
1070
+ * \see \c mbedtls_ecp_muladd()
1071
+ *
1072
+ * \note This function works the same as \c mbedtls_ecp_muladd(),
1073
+ * but it can return early and restart according to the limit
1074
+ * set with \c mbedtls_ecp_set_max_ops() to reduce blocking.
1075
+ *
1076
+ * \note This function is only defined for short Weierstrass curves.
1077
+ * It may not be included in builds without any short
1078
+ * Weierstrass curve.
1079
+ *
1080
+ * \param grp The ECP group to use.
1081
+ * This must be initialized and have group parameters
1082
+ * set, for example through mbedtls_ecp_group_load().
1083
+ * \param R The point in which to store the result of the calculation.
1084
+ * This must be initialized.
1085
+ * \param m The integer by which to multiply \p P.
1086
+ * This must be initialized.
1087
+ * \param P The point to multiply by \p m. This must be initialized.
1088
+ * \param n The integer by which to multiply \p Q.
1089
+ * This must be initialized.
1090
+ * \param Q The point to be multiplied by \p n.
1091
+ * This must be initialized.
1092
+ * \param rs_ctx The restart context (NULL disables restart).
1093
+ *
1094
+ * \return \c 0 on success.
1095
+ * \return #MBEDTLS_ERR_ECP_INVALID_KEY if \p m or \p n are not
1096
+ * valid private keys, or \p P or \p Q are not valid public
1097
+ * keys.
1098
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED on memory-allocation failure.
1099
+ * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if \p grp does not
1100
+ * designate a short Weierstrass curve.
1101
+ * \return #MBEDTLS_ERR_ECP_IN_PROGRESS if maximum number of
1102
+ * operations was reached: see \c mbedtls_ecp_set_max_ops().
1103
+ * \return Another negative error code on other kinds of failure.
1104
+ */
1105
+ int mbedtls_ecp_muladd_restartable(
1106
+ mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
1107
+ const mbedtls_mpi *m, const mbedtls_ecp_point *P,
1108
+ const mbedtls_mpi *n, const mbedtls_ecp_point *Q,
1109
+ mbedtls_ecp_restart_ctx *rs_ctx);
1110
+ #endif /* MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED */
1111
+
1112
+ /**
1113
+ * \brief This function checks that a point is a valid public key
1114
+ * on this curve.
1115
+ *
1116
+ * It only checks that the point is non-zero, has
1117
+ * valid coordinates and lies on the curve. It does not verify
1118
+ * that it is indeed a multiple of \c G. This additional
1119
+ * check is computationally more expensive, is not required
1120
+ * by standards, and should not be necessary if the group
1121
+ * used has a small cofactor. In particular, it is useless for
1122
+ * the NIST groups which all have a cofactor of 1.
1123
+ *
1124
+ * \note This function uses bare components rather than an
1125
+ * ::mbedtls_ecp_keypair structure, to ease use with other
1126
+ * structures, such as ::mbedtls_ecdh_context or
1127
+ * ::mbedtls_ecdsa_context.
1128
+ *
1129
+ * \param grp The ECP group the point should belong to.
1130
+ * This must be initialized and have group parameters
1131
+ * set, for example through mbedtls_ecp_group_load().
1132
+ * \param pt The point to check. This must be initialized.
1133
+ *
1134
+ * \return \c 0 if the point is a valid public key.
1135
+ * \return #MBEDTLS_ERR_ECP_INVALID_KEY if the point is not
1136
+ * a valid public key for the given curve.
1137
+ * \return Another negative error code on other kinds of failure.
1138
+ */
1139
+ int mbedtls_ecp_check_pubkey(const mbedtls_ecp_group *grp,
1140
+ const mbedtls_ecp_point *pt);
1141
+
1142
+ /**
1143
+ * \brief This function checks that an \c mbedtls_mpi is a
1144
+ * valid private key for this curve.
1145
+ *
1146
+ * \note This function uses bare components rather than an
1147
+ * ::mbedtls_ecp_keypair structure to ease use with other
1148
+ * structures, such as ::mbedtls_ecdh_context or
1149
+ * ::mbedtls_ecdsa_context.
1150
+ *
1151
+ * \param grp The ECP group the private key should belong to.
1152
+ * This must be initialized and have group parameters
1153
+ * set, for example through mbedtls_ecp_group_load().
1154
+ * \param d The integer to check. This must be initialized.
1155
+ *
1156
+ * \return \c 0 if the point is a valid private key.
1157
+ * \return #MBEDTLS_ERR_ECP_INVALID_KEY if the point is not a valid
1158
+ * private key for the given curve.
1159
+ * \return Another negative error code on other kinds of failure.
1160
+ */
1161
+ int mbedtls_ecp_check_privkey(const mbedtls_ecp_group *grp,
1162
+ const mbedtls_mpi *d);
1163
+
1164
+ /**
1165
+ * \brief This function generates a private key.
1166
+ *
1167
+ * \param grp The ECP group to generate a private key for.
1168
+ * This must be initialized and have group parameters
1169
+ * set, for example through mbedtls_ecp_group_load().
1170
+ * \param d The destination MPI (secret part). This must be initialized.
1171
+ * \param f_rng The RNG function. This must not be \c NULL.
1172
+ * \param p_rng The RNG parameter to be passed to \p f_rng. This may be
1173
+ * \c NULL if \p f_rng doesn't need a context argument.
1174
+ *
1175
+ * \return \c 0 on success.
1176
+ * \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_MPI_XXX error code
1177
+ * on failure.
1178
+ */
1179
+ int mbedtls_ecp_gen_privkey(const mbedtls_ecp_group *grp,
1180
+ mbedtls_mpi *d,
1181
+ int (*f_rng)(void *, unsigned char *, size_t),
1182
+ void *p_rng);
1183
+
1184
+ /**
1185
+ * \brief This function generates a keypair with a configurable base
1186
+ * point.
1187
+ *
1188
+ * \note This function uses bare components rather than an
1189
+ * ::mbedtls_ecp_keypair structure to ease use with other
1190
+ * structures, such as ::mbedtls_ecdh_context or
1191
+ * ::mbedtls_ecdsa_context.
1192
+ *
1193
+ * \param grp The ECP group to generate a key pair for.
1194
+ * This must be initialized and have group parameters
1195
+ * set, for example through mbedtls_ecp_group_load().
1196
+ * \param G The base point to use. This must be initialized
1197
+ * and belong to \p grp. It replaces the default base
1198
+ * point \c grp->G used by mbedtls_ecp_gen_keypair().
1199
+ * \param d The destination MPI (secret part).
1200
+ * This must be initialized.
1201
+ * \param Q The destination point (public part).
1202
+ * This must be initialized.
1203
+ * \param f_rng The RNG function. This must not be \c NULL.
1204
+ * \param p_rng The RNG context to be passed to \p f_rng. This may
1205
+ * be \c NULL if \p f_rng doesn't need a context argument.
1206
+ *
1207
+ * \return \c 0 on success.
1208
+ * \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_MPI_XXX error code
1209
+ * on failure.
1210
+ */
1211
+ int mbedtls_ecp_gen_keypair_base(mbedtls_ecp_group *grp,
1212
+ const mbedtls_ecp_point *G,
1213
+ mbedtls_mpi *d, mbedtls_ecp_point *Q,
1214
+ int (*f_rng)(void *, unsigned char *, size_t),
1215
+ void *p_rng);
1216
+
1217
+ /**
1218
+ * \brief This function generates an ECP keypair.
1219
+ *
1220
+ * \note This function uses bare components rather than an
1221
+ * ::mbedtls_ecp_keypair structure to ease use with other
1222
+ * structures, such as ::mbedtls_ecdh_context or
1223
+ * ::mbedtls_ecdsa_context.
1224
+ *
1225
+ * \param grp The ECP group to generate a key pair for.
1226
+ * This must be initialized and have group parameters
1227
+ * set, for example through mbedtls_ecp_group_load().
1228
+ * \param d The destination MPI (secret part).
1229
+ * This must be initialized.
1230
+ * \param Q The destination point (public part).
1231
+ * This must be initialized.
1232
+ * \param f_rng The RNG function. This must not be \c NULL.
1233
+ * \param p_rng The RNG context to be passed to \p f_rng. This may
1234
+ * be \c NULL if \p f_rng doesn't need a context argument.
1235
+ *
1236
+ * \return \c 0 on success.
1237
+ * \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_MPI_XXX error code
1238
+ * on failure.
1239
+ */
1240
+ int mbedtls_ecp_gen_keypair(mbedtls_ecp_group *grp, mbedtls_mpi *d,
1241
+ mbedtls_ecp_point *Q,
1242
+ int (*f_rng)(void *, unsigned char *, size_t),
1243
+ void *p_rng);
1244
+
1245
+ /**
1246
+ * \brief This function generates an ECP key.
1247
+ *
1248
+ * \param grp_id The ECP group identifier.
1249
+ * \param key The destination key. This must be initialized.
1250
+ * \param f_rng The RNG function to use. This must not be \c NULL.
1251
+ * \param p_rng The RNG context to be passed to \p f_rng. This may
1252
+ * be \c NULL if \p f_rng doesn't need a context argument.
1253
+ *
1254
+ * \return \c 0 on success.
1255
+ * \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_MPI_XXX error code
1256
+ * on failure.
1257
+ */
1258
+ int mbedtls_ecp_gen_key(mbedtls_ecp_group_id grp_id, mbedtls_ecp_keypair *key,
1259
+ int (*f_rng)(void *, unsigned char *, size_t),
1260
+ void *p_rng);
1261
+
1262
+ /**
1263
+ * \brief This function reads an elliptic curve private key.
1264
+ *
1265
+ * \param grp_id The ECP group identifier.
1266
+ * \param key The destination key.
1267
+ * \param buf The buffer containing the binary representation of the
1268
+ * key. (Big endian integer for Weierstrass curves, byte
1269
+ * string for Montgomery curves.)
1270
+ * \param buflen The length of the buffer in bytes.
1271
+ *
1272
+ * \return \c 0 on success.
1273
+ * \return #MBEDTLS_ERR_ECP_INVALID_KEY error if the key is
1274
+ * invalid.
1275
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed.
1276
+ * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the operation for
1277
+ * the group is not implemented.
1278
+ * \return Another negative error code on different kinds of failure.
1279
+ */
1280
+ int mbedtls_ecp_read_key(mbedtls_ecp_group_id grp_id, mbedtls_ecp_keypair *key,
1281
+ const unsigned char *buf, size_t buflen);
1282
+
1283
+ /**
1284
+ * \brief This function exports an elliptic curve private key.
1285
+ *
1286
+ * \param key The private key.
1287
+ * \param buf The output buffer for containing the binary representation
1288
+ * of the key. (Big endian integer for Weierstrass curves, byte
1289
+ * string for Montgomery curves.)
1290
+ * \param buflen The total length of the buffer in bytes.
1291
+ *
1292
+ * \return \c 0 on success.
1293
+ * \return #MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL if the \p key
1294
+ representation is larger than the available space in \p buf.
1295
+ * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the operation for
1296
+ * the group is not implemented.
1297
+ * \return Another negative error code on different kinds of failure.
1298
+ */
1299
+ int mbedtls_ecp_write_key(mbedtls_ecp_keypair *key,
1300
+ unsigned char *buf, size_t buflen);
1301
+
1302
+ /**
1303
+ * \brief This function checks that the keypair objects
1304
+ * \p pub and \p prv have the same group and the
1305
+ * same public point, and that the private key in
1306
+ * \p prv is consistent with the public key.
1307
+ *
1308
+ * \param pub The keypair structure holding the public key. This
1309
+ * must be initialized. If it contains a private key, that
1310
+ * part is ignored.
1311
+ * \param prv The keypair structure holding the full keypair.
1312
+ * This must be initialized.
1313
+ * \param f_rng The RNG function. This must not be \c NULL.
1314
+ * \param p_rng The RNG context to be passed to \p f_rng. This may be \c
1315
+ * NULL if \p f_rng doesn't need a context.
1316
+ *
1317
+ * \return \c 0 on success, meaning that the keys are valid and match.
1318
+ * \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if the keys are invalid or do not match.
1319
+ * \return An \c MBEDTLS_ERR_ECP_XXX or an \c MBEDTLS_ERR_MPI_XXX
1320
+ * error code on calculation failure.
1321
+ */
1322
+ int mbedtls_ecp_check_pub_priv(
1323
+ const mbedtls_ecp_keypair *pub, const mbedtls_ecp_keypair *prv,
1324
+ int (*f_rng)(void *, unsigned char *, size_t), void *p_rng);
1325
+
1326
+ /**
1327
+ * \brief This function exports generic key-pair parameters.
1328
+ *
1329
+ * \param key The key pair to export from.
1330
+ * \param grp Slot for exported ECP group.
1331
+ * It must point to an initialized ECP group.
1332
+ * \param d Slot for the exported secret value.
1333
+ * It must point to an initialized mpi.
1334
+ * \param Q Slot for the exported public value.
1335
+ * It must point to an initialized ECP point.
1336
+ *
1337
+ * \return \c 0 on success,
1338
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED on memory-allocation failure.
1339
+ * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if key id doesn't
1340
+ * correspond to a known group.
1341
+ * \return Another negative error code on other kinds of failure.
1342
+ */
1343
+ int mbedtls_ecp_export(const mbedtls_ecp_keypair *key, mbedtls_ecp_group *grp,
1344
+ mbedtls_mpi *d, mbedtls_ecp_point *Q);
1345
+
1346
+ #if defined(MBEDTLS_SELF_TEST)
1347
+
1348
+ /**
1349
+ * \brief The ECP checkup routine.
1350
+ *
1351
+ * \return \c 0 on success.
1352
+ * \return \c 1 on failure.
1353
+ */
1354
+ int mbedtls_ecp_self_test(int verbose);
1355
+
1356
+ #endif /* MBEDTLS_SELF_TEST */
1357
+
1358
+ #ifdef __cplusplus
1359
+ }
1360
+ #endif
1361
+
1362
+ #endif /* ecp.h */