edhoc 1.0.1 → 1.0.2

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 (657) 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/win32-ia32/edhoc.node +0 -0
  648. package/prebuilds/win32-x64/edhoc.node +0 -0
  649. package/src/EdhocComposeAsyncWorker.cpp +88 -0
  650. package/src/EdhocCredentialManager.cpp +360 -0
  651. package/src/EdhocCryptoManager.cpp +967 -0
  652. package/src/EdhocEadManager.cpp +156 -0
  653. package/src/EdhocExportAsyncWorker.cpp +82 -0
  654. package/src/EdhocProcessAsyncWorker.cpp +74 -0
  655. package/src/LibEDHOC.cpp +369 -0
  656. package/src/Suites.cpp +153 -0
  657. package/src/Utils.cpp +115 -0
@@ -0,0 +1,1282 @@
1
+ /**
2
+ * \file psa/crypto_sizes.h
3
+ *
4
+ * \brief PSA cryptography module: Mbed TLS buffer size macros
5
+ *
6
+ * \note This file may not be included directly. Applications must
7
+ * include psa/crypto.h.
8
+ *
9
+ * This file contains the definitions of macros that are useful to
10
+ * compute buffer sizes. The signatures and semantics of these macros
11
+ * are standardized, but the definitions are not, because they depend on
12
+ * the available algorithms and, in some cases, on permitted tolerances
13
+ * on buffer sizes.
14
+ *
15
+ * In implementations with isolation between the application and the
16
+ * cryptography module, implementers should take care to ensure that
17
+ * the definitions that are exposed to applications match what the
18
+ * module implements.
19
+ *
20
+ * Macros that compute sizes whose values do not depend on the
21
+ * implementation are in crypto.h.
22
+ */
23
+ /*
24
+ * Copyright The Mbed TLS Contributors
25
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
26
+ */
27
+
28
+ #ifndef PSA_CRYPTO_SIZES_H
29
+ #define PSA_CRYPTO_SIZES_H
30
+
31
+ /*
32
+ * Include the build-time configuration information file. Here, we do not
33
+ * include `"mbedtls/build_info.h"` directly but `"psa/build_info.h"`, which
34
+ * is basically just an alias to it. This is to ease the maintenance of the
35
+ * PSA cryptography repository which has a different build system and
36
+ * configuration.
37
+ */
38
+ #include "psa/build_info.h"
39
+
40
+ #define PSA_BITS_TO_BYTES(bits) (((bits) + 7u) / 8u)
41
+ #define PSA_BYTES_TO_BITS(bytes) ((bytes) * 8u)
42
+ #define PSA_MAX_OF_THREE(a, b, c) ((a) <= (b) ? (b) <= (c) ? \
43
+ (c) : (b) : (a) <= (c) ? (c) : (a))
44
+
45
+ #define PSA_ROUND_UP_TO_MULTIPLE(block_size, length) \
46
+ (((length) + (block_size) - 1) / (block_size) * (block_size))
47
+
48
+ /** The size of the output of psa_hash_finish(), in bytes.
49
+ *
50
+ * This is also the hash size that psa_hash_verify() expects.
51
+ *
52
+ * \param alg A hash algorithm (\c PSA_ALG_XXX value such that
53
+ * #PSA_ALG_IS_HASH(\p alg) is true), or an HMAC algorithm
54
+ * (#PSA_ALG_HMAC(\c hash_alg) where \c hash_alg is a
55
+ * hash algorithm).
56
+ *
57
+ * \return The hash size for the specified hash algorithm.
58
+ * If the hash algorithm is not recognized, return 0.
59
+ */
60
+ #define PSA_HASH_LENGTH(alg) \
61
+ ( \
62
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_MD5 ? 16u : \
63
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_RIPEMD160 ? 20u : \
64
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_1 ? 20u : \
65
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_224 ? 28u : \
66
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_256 ? 32u : \
67
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_384 ? 48u : \
68
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_512 ? 64u : \
69
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_512_224 ? 28u : \
70
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_512_256 ? 32u : \
71
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA3_224 ? 28u : \
72
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA3_256 ? 32u : \
73
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA3_384 ? 48u : \
74
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA3_512 ? 64u : \
75
+ 0u)
76
+
77
+ /** The input block size of a hash algorithm, in bytes.
78
+ *
79
+ * Hash algorithms process their input data in blocks. Hash operations will
80
+ * retain any partial blocks until they have enough input to fill the block or
81
+ * until the operation is finished.
82
+ * This affects the output from psa_hash_suspend().
83
+ *
84
+ * \param alg A hash algorithm (\c PSA_ALG_XXX value such that
85
+ * PSA_ALG_IS_HASH(\p alg) is true).
86
+ *
87
+ * \return The block size in bytes for the specified hash algorithm.
88
+ * If the hash algorithm is not recognized, return 0.
89
+ * An implementation can return either 0 or the correct size for a
90
+ * hash algorithm that it recognizes, but does not support.
91
+ */
92
+ #define PSA_HASH_BLOCK_LENGTH(alg) \
93
+ ( \
94
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_MD5 ? 64u : \
95
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_RIPEMD160 ? 64u : \
96
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_1 ? 64u : \
97
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_224 ? 64u : \
98
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_256 ? 64u : \
99
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_384 ? 128u : \
100
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_512 ? 128u : \
101
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_512_224 ? 128u : \
102
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_512_256 ? 128u : \
103
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA3_224 ? 144u : \
104
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA3_256 ? 136u : \
105
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA3_384 ? 104u : \
106
+ PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA3_512 ? 72u : \
107
+ 0u)
108
+
109
+ /** \def PSA_HASH_MAX_SIZE
110
+ *
111
+ * Maximum size of a hash.
112
+ *
113
+ * This macro expands to a compile-time constant integer. This value
114
+ * is the maximum size of a hash in bytes.
115
+ */
116
+ /* Note: for HMAC-SHA-3, the block size is 144 bytes for HMAC-SHA3-224,
117
+ * 136 bytes for HMAC-SHA3-256, 104 bytes for SHA3-384, 72 bytes for
118
+ * HMAC-SHA3-512. */
119
+ /* Note: PSA_HASH_MAX_SIZE should be kept in sync with MBEDTLS_MD_MAX_SIZE,
120
+ * see the note on MBEDTLS_MD_MAX_SIZE for details. */
121
+ #if defined(PSA_WANT_ALG_SHA3_224)
122
+ #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 144u
123
+ #elif defined(PSA_WANT_ALG_SHA3_256)
124
+ #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 136u
125
+ #elif defined(PSA_WANT_ALG_SHA_512)
126
+ #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 128u
127
+ #elif defined(PSA_WANT_ALG_SHA_384)
128
+ #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 128u
129
+ #elif defined(PSA_WANT_ALG_SHA3_384)
130
+ #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 104u
131
+ #elif defined(PSA_WANT_ALG_SHA3_512)
132
+ #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 72u
133
+ #elif defined(PSA_WANT_ALG_SHA_256)
134
+ #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 64u
135
+ #elif defined(PSA_WANT_ALG_SHA_224)
136
+ #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 64u
137
+ #else /* SHA-1 or smaller */
138
+ #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 64u
139
+ #endif
140
+
141
+ #if defined(PSA_WANT_ALG_SHA_512) || defined(PSA_WANT_ALG_SHA3_512)
142
+ #define PSA_HASH_MAX_SIZE 64u
143
+ #elif defined(PSA_WANT_ALG_SHA_384) || defined(PSA_WANT_ALG_SHA3_384)
144
+ #define PSA_HASH_MAX_SIZE 48u
145
+ #elif defined(PSA_WANT_ALG_SHA_256) || defined(PSA_WANT_ALG_SHA3_256)
146
+ #define PSA_HASH_MAX_SIZE 32u
147
+ #elif defined(PSA_WANT_ALG_SHA_224) || defined(PSA_WANT_ALG_SHA3_224)
148
+ #define PSA_HASH_MAX_SIZE 28u
149
+ #else /* SHA-1 or smaller */
150
+ #define PSA_HASH_MAX_SIZE 20u
151
+ #endif
152
+
153
+ /** \def PSA_MAC_MAX_SIZE
154
+ *
155
+ * Maximum size of a MAC.
156
+ *
157
+ * This macro expands to a compile-time constant integer. This value
158
+ * is the maximum size of a MAC in bytes.
159
+ */
160
+ /* All non-HMAC MACs have a maximum size that's smaller than the
161
+ * minimum possible value of PSA_HASH_MAX_SIZE in this implementation. */
162
+ /* Note that the encoding of truncated MAC algorithms limits this value
163
+ * to 64 bytes.
164
+ */
165
+ #define PSA_MAC_MAX_SIZE PSA_HASH_MAX_SIZE
166
+
167
+ /** The length of a tag for an AEAD algorithm, in bytes.
168
+ *
169
+ * This macro can be used to allocate a buffer of sufficient size to store the
170
+ * tag output from psa_aead_finish().
171
+ *
172
+ * See also #PSA_AEAD_TAG_MAX_SIZE.
173
+ *
174
+ * \param key_type The type of the AEAD key.
175
+ * \param key_bits The size of the AEAD key in bits.
176
+ * \param alg An AEAD algorithm
177
+ * (\c PSA_ALG_XXX value such that
178
+ * #PSA_ALG_IS_AEAD(\p alg) is true).
179
+ *
180
+ * \return The tag length for the specified algorithm and key.
181
+ * If the AEAD algorithm does not have an identified
182
+ * tag that can be distinguished from the rest of
183
+ * the ciphertext, return 0.
184
+ * If the key type or AEAD algorithm is not
185
+ * recognized, or the parameters are incompatible,
186
+ * return 0.
187
+ */
188
+ #define PSA_AEAD_TAG_LENGTH(key_type, key_bits, alg) \
189
+ (PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 ? \
190
+ PSA_ALG_AEAD_GET_TAG_LENGTH(alg) : \
191
+ ((void) (key_bits), 0u))
192
+
193
+ /** The maximum tag size for all supported AEAD algorithms, in bytes.
194
+ *
195
+ * See also #PSA_AEAD_TAG_LENGTH(\p key_type, \p key_bits, \p alg).
196
+ */
197
+ #define PSA_AEAD_TAG_MAX_SIZE 16u
198
+
199
+ /* The maximum size of an RSA key on this implementation, in bits.
200
+ * This is a vendor-specific macro.
201
+ *
202
+ * Mbed TLS does not set a hard limit on the size of RSA keys: any key
203
+ * whose parameters fit in a bignum is accepted. However large keys can
204
+ * induce a large memory usage and long computation times. Unlike other
205
+ * auxiliary macros in this file and in crypto.h, which reflect how the
206
+ * library is configured, this macro defines how the library is
207
+ * configured. This implementation refuses to import or generate an
208
+ * RSA key whose size is larger than the value defined here.
209
+ *
210
+ * Note that an implementation may set different size limits for different
211
+ * operations, and does not need to accept all key sizes up to the limit. */
212
+ #define PSA_VENDOR_RSA_MAX_KEY_BITS 4096u
213
+
214
+ /* The minimum size of an RSA key on this implementation, in bits.
215
+ * This is a vendor-specific macro.
216
+ *
217
+ * Limits RSA key generation to a minimum due to avoid accidental misuse.
218
+ * This value cannot be less than 128 bits.
219
+ */
220
+ #if defined(MBEDTLS_RSA_GEN_KEY_MIN_BITS)
221
+ #define PSA_VENDOR_RSA_GENERATE_MIN_KEY_BITS MBEDTLS_RSA_GEN_KEY_MIN_BITS
222
+ #else
223
+ #define PSA_VENDOR_RSA_GENERATE_MIN_KEY_BITS 1024
224
+ #endif
225
+
226
+ /* The maximum size of an DH key on this implementation, in bits.
227
+ *
228
+ * Note that an implementation may set different size limits for different
229
+ * operations, and does not need to accept all key sizes up to the limit. */
230
+ #define PSA_VENDOR_FFDH_MAX_KEY_BITS 8192u
231
+
232
+ /* The maximum size of an ECC key on this implementation, in bits.
233
+ * This is a vendor-specific macro. */
234
+ #if defined(PSA_WANT_ECC_SECP_R1_521)
235
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 521u
236
+ #elif defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512)
237
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 512u
238
+ #elif defined(PSA_WANT_ECC_MONTGOMERY_448)
239
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 448u
240
+ #elif defined(PSA_WANT_ECC_SECP_R1_384)
241
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 384u
242
+ #elif defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384)
243
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 384u
244
+ #elif defined(PSA_WANT_ECC_SECP_R1_256)
245
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 256u
246
+ #elif defined(PSA_WANT_ECC_SECP_K1_256)
247
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 256u
248
+ #elif defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256)
249
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 256u
250
+ #elif defined(PSA_WANT_ECC_MONTGOMERY_255)
251
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 255u
252
+ #elif defined(PSA_WANT_ECC_SECP_R1_224)
253
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 224u
254
+ #elif defined(PSA_WANT_ECC_SECP_K1_224)
255
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 224u
256
+ #elif defined(PSA_WANT_ECC_SECP_R1_192)
257
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 192u
258
+ #elif defined(PSA_WANT_ECC_SECP_K1_192)
259
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 192u
260
+ #else
261
+ #define PSA_VENDOR_ECC_MAX_CURVE_BITS 0u
262
+ #endif
263
+
264
+ /** This macro returns the maximum supported length of the PSK for the
265
+ * TLS-1.2 PSK-to-MS key derivation
266
+ * (#PSA_ALG_TLS12_PSK_TO_MS(\c hash_alg)).
267
+ *
268
+ * The maximum supported length does not depend on the chosen hash algorithm.
269
+ *
270
+ * Quoting RFC 4279, Sect 5.3:
271
+ * TLS implementations supporting these ciphersuites MUST support
272
+ * arbitrary PSK identities up to 128 octets in length, and arbitrary
273
+ * PSKs up to 64 octets in length. Supporting longer identities and
274
+ * keys is RECOMMENDED.
275
+ *
276
+ * Therefore, no implementation should define a value smaller than 64
277
+ * for #PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE.
278
+ */
279
+ #define PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE 128u
280
+
281
+ /* The expected size of input passed to psa_tls12_ecjpake_to_pms_input,
282
+ * which is expected to work with P-256 curve only. */
283
+ #define PSA_TLS12_ECJPAKE_TO_PMS_INPUT_SIZE 65u
284
+
285
+ /* The size of a serialized K.X coordinate to be used in
286
+ * psa_tls12_ecjpake_to_pms_input. This function only accepts the P-256
287
+ * curve. */
288
+ #define PSA_TLS12_ECJPAKE_TO_PMS_DATA_SIZE 32u
289
+
290
+ /* The maximum number of iterations for PBKDF2 on this implementation, in bits.
291
+ * This is a vendor-specific macro. This can be configured if necessary */
292
+ #define PSA_VENDOR_PBKDF2_MAX_ITERATIONS 0xffffffffU
293
+
294
+ /** The maximum size of a block cipher. */
295
+ #define PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE 16u
296
+
297
+ /** The size of the output of psa_mac_sign_finish(), in bytes.
298
+ *
299
+ * This is also the MAC size that psa_mac_verify_finish() expects.
300
+ *
301
+ * \warning This macro may evaluate its arguments multiple times or
302
+ * zero times, so you should not pass arguments that contain
303
+ * side effects.
304
+ *
305
+ * \param key_type The type of the MAC key.
306
+ * \param key_bits The size of the MAC key in bits.
307
+ * \param alg A MAC algorithm (\c PSA_ALG_XXX value such that
308
+ * #PSA_ALG_IS_MAC(\p alg) is true).
309
+ *
310
+ * \return The MAC size for the specified algorithm with
311
+ * the specified key parameters.
312
+ * \return 0 if the MAC algorithm is not recognized.
313
+ * \return Either 0 or the correct size for a MAC algorithm that
314
+ * the implementation recognizes, but does not support.
315
+ * \return Unspecified if the key parameters are not consistent
316
+ * with the algorithm.
317
+ */
318
+ #define PSA_MAC_LENGTH(key_type, key_bits, alg) \
319
+ ((alg) & PSA_ALG_MAC_TRUNCATION_MASK ? PSA_MAC_TRUNCATED_LENGTH(alg) : \
320
+ PSA_ALG_IS_HMAC(alg) ? PSA_HASH_LENGTH(PSA_ALG_HMAC_GET_HASH(alg)) : \
321
+ PSA_ALG_IS_BLOCK_CIPHER_MAC(alg) ? PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) : \
322
+ ((void) (key_type), (void) (key_bits), 0u))
323
+
324
+ /** The maximum size of the output of psa_aead_encrypt(), in bytes.
325
+ *
326
+ * If the size of the ciphertext buffer is at least this large, it is
327
+ * guaranteed that psa_aead_encrypt() will not fail due to an
328
+ * insufficient buffer size. Depending on the algorithm, the actual size of
329
+ * the ciphertext may be smaller.
330
+ *
331
+ * See also #PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(\p plaintext_length).
332
+ *
333
+ * \warning This macro may evaluate its arguments multiple times or
334
+ * zero times, so you should not pass arguments that contain
335
+ * side effects.
336
+ *
337
+ * \param key_type A symmetric key type that is
338
+ * compatible with algorithm \p alg.
339
+ * \param alg An AEAD algorithm
340
+ * (\c PSA_ALG_XXX value such that
341
+ * #PSA_ALG_IS_AEAD(\p alg) is true).
342
+ * \param plaintext_length Size of the plaintext in bytes.
343
+ *
344
+ * \return The AEAD ciphertext size for the specified
345
+ * algorithm.
346
+ * If the key type or AEAD algorithm is not
347
+ * recognized, or the parameters are incompatible,
348
+ * return 0.
349
+ */
350
+ #define PSA_AEAD_ENCRYPT_OUTPUT_SIZE(key_type, alg, plaintext_length) \
351
+ (PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 ? \
352
+ (plaintext_length) + PSA_ALG_AEAD_GET_TAG_LENGTH(alg) : \
353
+ 0u)
354
+
355
+ /** A sufficient output buffer size for psa_aead_encrypt(), for any of the
356
+ * supported key types and AEAD algorithms.
357
+ *
358
+ * If the size of the ciphertext buffer is at least this large, it is guaranteed
359
+ * that psa_aead_encrypt() will not fail due to an insufficient buffer size.
360
+ *
361
+ * \note This macro returns a compile-time constant if its arguments are
362
+ * compile-time constants.
363
+ *
364
+ * See also #PSA_AEAD_ENCRYPT_OUTPUT_SIZE(\p key_type, \p alg,
365
+ * \p plaintext_length).
366
+ *
367
+ * \param plaintext_length Size of the plaintext in bytes.
368
+ *
369
+ * \return A sufficient output buffer size for any of the
370
+ * supported key types and AEAD algorithms.
371
+ *
372
+ */
373
+ #define PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(plaintext_length) \
374
+ ((plaintext_length) + PSA_AEAD_TAG_MAX_SIZE)
375
+
376
+
377
+ /** The maximum size of the output of psa_aead_decrypt(), in bytes.
378
+ *
379
+ * If the size of the plaintext buffer is at least this large, it is
380
+ * guaranteed that psa_aead_decrypt() will not fail due to an
381
+ * insufficient buffer size. Depending on the algorithm, the actual size of
382
+ * the plaintext may be smaller.
383
+ *
384
+ * See also #PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(\p ciphertext_length).
385
+ *
386
+ * \warning This macro may evaluate its arguments multiple times or
387
+ * zero times, so you should not pass arguments that contain
388
+ * side effects.
389
+ *
390
+ * \param key_type A symmetric key type that is
391
+ * compatible with algorithm \p alg.
392
+ * \param alg An AEAD algorithm
393
+ * (\c PSA_ALG_XXX value such that
394
+ * #PSA_ALG_IS_AEAD(\p alg) is true).
395
+ * \param ciphertext_length Size of the plaintext in bytes.
396
+ *
397
+ * \return The AEAD ciphertext size for the specified
398
+ * algorithm.
399
+ * If the key type or AEAD algorithm is not
400
+ * recognized, or the parameters are incompatible,
401
+ * return 0.
402
+ */
403
+ #define PSA_AEAD_DECRYPT_OUTPUT_SIZE(key_type, alg, ciphertext_length) \
404
+ (PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 && \
405
+ (ciphertext_length) > PSA_ALG_AEAD_GET_TAG_LENGTH(alg) ? \
406
+ (ciphertext_length) - PSA_ALG_AEAD_GET_TAG_LENGTH(alg) : \
407
+ 0u)
408
+
409
+ /** A sufficient output buffer size for psa_aead_decrypt(), for any of the
410
+ * supported key types and AEAD algorithms.
411
+ *
412
+ * If the size of the plaintext buffer is at least this large, it is guaranteed
413
+ * that psa_aead_decrypt() will not fail due to an insufficient buffer size.
414
+ *
415
+ * \note This macro returns a compile-time constant if its arguments are
416
+ * compile-time constants.
417
+ *
418
+ * See also #PSA_AEAD_DECRYPT_OUTPUT_SIZE(\p key_type, \p alg,
419
+ * \p ciphertext_length).
420
+ *
421
+ * \param ciphertext_length Size of the ciphertext in bytes.
422
+ *
423
+ * \return A sufficient output buffer size for any of the
424
+ * supported key types and AEAD algorithms.
425
+ *
426
+ */
427
+ #define PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(ciphertext_length) \
428
+ (ciphertext_length)
429
+
430
+ /** The default nonce size for an AEAD algorithm, in bytes.
431
+ *
432
+ * This macro can be used to allocate a buffer of sufficient size to
433
+ * store the nonce output from #psa_aead_generate_nonce().
434
+ *
435
+ * See also #PSA_AEAD_NONCE_MAX_SIZE.
436
+ *
437
+ * \note This is not the maximum size of nonce supported as input to
438
+ * #psa_aead_set_nonce(), #psa_aead_encrypt() or #psa_aead_decrypt(),
439
+ * just the default size that is generated by #psa_aead_generate_nonce().
440
+ *
441
+ * \warning This macro may evaluate its arguments multiple times or
442
+ * zero times, so you should not pass arguments that contain
443
+ * side effects.
444
+ *
445
+ * \param key_type A symmetric key type that is compatible with
446
+ * algorithm \p alg.
447
+ *
448
+ * \param alg An AEAD algorithm (\c PSA_ALG_XXX value such that
449
+ * #PSA_ALG_IS_AEAD(\p alg) is true).
450
+ *
451
+ * \return The default nonce size for the specified key type and algorithm.
452
+ * If the key type or AEAD algorithm is not recognized,
453
+ * or the parameters are incompatible, return 0.
454
+ */
455
+ #define PSA_AEAD_NONCE_LENGTH(key_type, alg) \
456
+ (PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) == 16 ? \
457
+ MBEDTLS_PSA_ALG_AEAD_EQUAL(alg, PSA_ALG_CCM) ? 13u : \
458
+ MBEDTLS_PSA_ALG_AEAD_EQUAL(alg, PSA_ALG_GCM) ? 12u : \
459
+ 0u : \
460
+ (key_type) == PSA_KEY_TYPE_CHACHA20 && \
461
+ MBEDTLS_PSA_ALG_AEAD_EQUAL(alg, PSA_ALG_CHACHA20_POLY1305) ? 12u : \
462
+ 0u)
463
+
464
+ /** The maximum default nonce size among all supported pairs of key types and
465
+ * AEAD algorithms, in bytes.
466
+ *
467
+ * This is equal to or greater than any value that #PSA_AEAD_NONCE_LENGTH()
468
+ * may return.
469
+ *
470
+ * \note This is not the maximum size of nonce supported as input to
471
+ * #psa_aead_set_nonce(), #psa_aead_encrypt() or #psa_aead_decrypt(),
472
+ * just the largest size that may be generated by
473
+ * #psa_aead_generate_nonce().
474
+ */
475
+ #define PSA_AEAD_NONCE_MAX_SIZE 13u
476
+
477
+ /** A sufficient output buffer size for psa_aead_update().
478
+ *
479
+ * If the size of the output buffer is at least this large, it is
480
+ * guaranteed that psa_aead_update() will not fail due to an
481
+ * insufficient buffer size. The actual size of the output may be smaller
482
+ * in any given call.
483
+ *
484
+ * See also #PSA_AEAD_UPDATE_OUTPUT_MAX_SIZE(\p input_length).
485
+ *
486
+ * \warning This macro may evaluate its arguments multiple times or
487
+ * zero times, so you should not pass arguments that contain
488
+ * side effects.
489
+ *
490
+ * \param key_type A symmetric key type that is
491
+ * compatible with algorithm \p alg.
492
+ * \param alg An AEAD algorithm
493
+ * (\c PSA_ALG_XXX value such that
494
+ * #PSA_ALG_IS_AEAD(\p alg) is true).
495
+ * \param input_length Size of the input in bytes.
496
+ *
497
+ * \return A sufficient output buffer size for the specified
498
+ * algorithm.
499
+ * If the key type or AEAD algorithm is not
500
+ * recognized, or the parameters are incompatible,
501
+ * return 0.
502
+ */
503
+ /* For all the AEAD modes defined in this specification, it is possible
504
+ * to emit output without delay. However, hardware may not always be
505
+ * capable of this. So for modes based on a block cipher, allow the
506
+ * implementation to delay the output until it has a full block. */
507
+ #define PSA_AEAD_UPDATE_OUTPUT_SIZE(key_type, alg, input_length) \
508
+ (PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 ? \
509
+ PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) ? \
510
+ PSA_ROUND_UP_TO_MULTIPLE(PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type), (input_length)) : \
511
+ (input_length) : \
512
+ 0u)
513
+
514
+ /** A sufficient output buffer size for psa_aead_update(), for any of the
515
+ * supported key types and AEAD algorithms.
516
+ *
517
+ * If the size of the output buffer is at least this large, it is guaranteed
518
+ * that psa_aead_update() will not fail due to an insufficient buffer size.
519
+ *
520
+ * See also #PSA_AEAD_UPDATE_OUTPUT_SIZE(\p key_type, \p alg, \p input_length).
521
+ *
522
+ * \param input_length Size of the input in bytes.
523
+ */
524
+ #define PSA_AEAD_UPDATE_OUTPUT_MAX_SIZE(input_length) \
525
+ (PSA_ROUND_UP_TO_MULTIPLE(PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE, (input_length)))
526
+
527
+ /** A sufficient ciphertext buffer size for psa_aead_finish().
528
+ *
529
+ * If the size of the ciphertext buffer is at least this large, it is
530
+ * guaranteed that psa_aead_finish() will not fail due to an
531
+ * insufficient ciphertext buffer size. The actual size of the output may
532
+ * be smaller in any given call.
533
+ *
534
+ * See also #PSA_AEAD_FINISH_OUTPUT_MAX_SIZE.
535
+ *
536
+ * \param key_type A symmetric key type that is
537
+ compatible with algorithm \p alg.
538
+ * \param alg An AEAD algorithm
539
+ * (\c PSA_ALG_XXX value such that
540
+ * #PSA_ALG_IS_AEAD(\p alg) is true).
541
+ *
542
+ * \return A sufficient ciphertext buffer size for the
543
+ * specified algorithm.
544
+ * If the key type or AEAD algorithm is not
545
+ * recognized, or the parameters are incompatible,
546
+ * return 0.
547
+ */
548
+ #define PSA_AEAD_FINISH_OUTPUT_SIZE(key_type, alg) \
549
+ (PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 && \
550
+ PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) ? \
551
+ PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) : \
552
+ 0u)
553
+
554
+ /** A sufficient ciphertext buffer size for psa_aead_finish(), for any of the
555
+ * supported key types and AEAD algorithms.
556
+ *
557
+ * See also #PSA_AEAD_FINISH_OUTPUT_SIZE(\p key_type, \p alg).
558
+ */
559
+ #define PSA_AEAD_FINISH_OUTPUT_MAX_SIZE (PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE)
560
+
561
+ /** A sufficient plaintext buffer size for psa_aead_verify().
562
+ *
563
+ * If the size of the plaintext buffer is at least this large, it is
564
+ * guaranteed that psa_aead_verify() will not fail due to an
565
+ * insufficient plaintext buffer size. The actual size of the output may
566
+ * be smaller in any given call.
567
+ *
568
+ * See also #PSA_AEAD_VERIFY_OUTPUT_MAX_SIZE.
569
+ *
570
+ * \param key_type A symmetric key type that is
571
+ * compatible with algorithm \p alg.
572
+ * \param alg An AEAD algorithm
573
+ * (\c PSA_ALG_XXX value such that
574
+ * #PSA_ALG_IS_AEAD(\p alg) is true).
575
+ *
576
+ * \return A sufficient plaintext buffer size for the
577
+ * specified algorithm.
578
+ * If the key type or AEAD algorithm is not
579
+ * recognized, or the parameters are incompatible,
580
+ * return 0.
581
+ */
582
+ #define PSA_AEAD_VERIFY_OUTPUT_SIZE(key_type, alg) \
583
+ (PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 && \
584
+ PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) ? \
585
+ PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) : \
586
+ 0u)
587
+
588
+ /** A sufficient plaintext buffer size for psa_aead_verify(), for any of the
589
+ * supported key types and AEAD algorithms.
590
+ *
591
+ * See also #PSA_AEAD_VERIFY_OUTPUT_SIZE(\p key_type, \p alg).
592
+ */
593
+ #define PSA_AEAD_VERIFY_OUTPUT_MAX_SIZE (PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE)
594
+
595
+ #define PSA_RSA_MINIMUM_PADDING_SIZE(alg) \
596
+ (PSA_ALG_IS_RSA_OAEP(alg) ? \
597
+ 2u * PSA_HASH_LENGTH(PSA_ALG_RSA_OAEP_GET_HASH(alg)) + 1u : \
598
+ 11u /*PKCS#1v1.5*/)
599
+
600
+ /**
601
+ * \brief ECDSA signature size for a given curve bit size
602
+ *
603
+ * \param curve_bits Curve size in bits.
604
+ * \return Signature size in bytes.
605
+ *
606
+ * \note This macro returns a compile-time constant if its argument is one.
607
+ */
608
+ #define PSA_ECDSA_SIGNATURE_SIZE(curve_bits) \
609
+ (PSA_BITS_TO_BYTES(curve_bits) * 2u)
610
+
611
+ /** Sufficient signature buffer size for psa_sign_hash().
612
+ *
613
+ * This macro returns a sufficient buffer size for a signature using a key
614
+ * of the specified type and size, with the specified algorithm.
615
+ * Note that the actual size of the signature may be smaller
616
+ * (some algorithms produce a variable-size signature).
617
+ *
618
+ * \warning This function may call its arguments multiple times or
619
+ * zero times, so you should not pass arguments that contain
620
+ * side effects.
621
+ *
622
+ * \param key_type An asymmetric key type (this may indifferently be a
623
+ * key pair type or a public key type).
624
+ * \param key_bits The size of the key in bits.
625
+ * \param alg The signature algorithm.
626
+ *
627
+ * \return If the parameters are valid and supported, return
628
+ * a buffer size in bytes that guarantees that
629
+ * psa_sign_hash() will not fail with
630
+ * #PSA_ERROR_BUFFER_TOO_SMALL.
631
+ * If the parameters are a valid combination that is not supported,
632
+ * return either a sensible size or 0.
633
+ * If the parameters are not valid, the
634
+ * return value is unspecified.
635
+ */
636
+ #define PSA_SIGN_OUTPUT_SIZE(key_type, key_bits, alg) \
637
+ (PSA_KEY_TYPE_IS_RSA(key_type) ? ((void) alg, PSA_BITS_TO_BYTES(key_bits)) : \
638
+ PSA_KEY_TYPE_IS_ECC(key_type) ? PSA_ECDSA_SIGNATURE_SIZE(key_bits) : \
639
+ ((void) alg, 0u))
640
+
641
+ #define PSA_VENDOR_ECDSA_SIGNATURE_MAX_SIZE \
642
+ PSA_ECDSA_SIGNATURE_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS)
643
+
644
+ /** \def PSA_SIGNATURE_MAX_SIZE
645
+ *
646
+ * Maximum size of an asymmetric signature.
647
+ *
648
+ * This macro expands to a compile-time constant integer. This value
649
+ * is the maximum size of a signature in bytes.
650
+ */
651
+ #define PSA_SIGNATURE_MAX_SIZE 1
652
+
653
+ #if (defined(PSA_WANT_ALG_ECDSA) || defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)) && \
654
+ (PSA_VENDOR_ECDSA_SIGNATURE_MAX_SIZE > PSA_SIGNATURE_MAX_SIZE)
655
+ #undef PSA_SIGNATURE_MAX_SIZE
656
+ #define PSA_SIGNATURE_MAX_SIZE PSA_VENDOR_ECDSA_SIGNATURE_MAX_SIZE
657
+ #endif
658
+ #if (defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) || defined(PSA_WANT_ALG_RSA_PSS)) && \
659
+ (PSA_BITS_TO_BYTES(PSA_VENDOR_RSA_MAX_KEY_BITS) > PSA_SIGNATURE_MAX_SIZE)
660
+ #undef PSA_SIGNATURE_MAX_SIZE
661
+ #define PSA_SIGNATURE_MAX_SIZE PSA_BITS_TO_BYTES(PSA_VENDOR_RSA_MAX_KEY_BITS)
662
+ #endif
663
+
664
+ /** Sufficient output buffer size for psa_asymmetric_encrypt().
665
+ *
666
+ * This macro returns a sufficient buffer size for a ciphertext produced using
667
+ * a key of the specified type and size, with the specified algorithm.
668
+ * Note that the actual size of the ciphertext may be smaller, depending
669
+ * on the algorithm.
670
+ *
671
+ * \warning This function may call its arguments multiple times or
672
+ * zero times, so you should not pass arguments that contain
673
+ * side effects.
674
+ *
675
+ * \param key_type An asymmetric key type (this may indifferently be a
676
+ * key pair type or a public key type).
677
+ * \param key_bits The size of the key in bits.
678
+ * \param alg The asymmetric encryption algorithm.
679
+ *
680
+ * \return If the parameters are valid and supported, return
681
+ * a buffer size in bytes that guarantees that
682
+ * psa_asymmetric_encrypt() will not fail with
683
+ * #PSA_ERROR_BUFFER_TOO_SMALL.
684
+ * If the parameters are a valid combination that is not supported,
685
+ * return either a sensible size or 0.
686
+ * If the parameters are not valid, the
687
+ * return value is unspecified.
688
+ */
689
+ #define PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(key_type, key_bits, alg) \
690
+ (PSA_KEY_TYPE_IS_RSA(key_type) ? \
691
+ ((void) alg, PSA_BITS_TO_BYTES(key_bits)) : \
692
+ 0u)
693
+
694
+ /** A sufficient output buffer size for psa_asymmetric_encrypt(), for any
695
+ * supported asymmetric encryption.
696
+ *
697
+ * See also #PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(\p key_type, \p key_bits, \p alg).
698
+ */
699
+ /* This macro assumes that RSA is the only supported asymmetric encryption. */
700
+ #define PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE \
701
+ (PSA_BITS_TO_BYTES(PSA_VENDOR_RSA_MAX_KEY_BITS))
702
+
703
+ /** Sufficient output buffer size for psa_asymmetric_decrypt().
704
+ *
705
+ * This macro returns a sufficient buffer size for a plaintext produced using
706
+ * a key of the specified type and size, with the specified algorithm.
707
+ * Note that the actual size of the plaintext may be smaller, depending
708
+ * on the algorithm.
709
+ *
710
+ * \warning This function may call its arguments multiple times or
711
+ * zero times, so you should not pass arguments that contain
712
+ * side effects.
713
+ *
714
+ * \param key_type An asymmetric key type (this may indifferently be a
715
+ * key pair type or a public key type).
716
+ * \param key_bits The size of the key in bits.
717
+ * \param alg The asymmetric encryption algorithm.
718
+ *
719
+ * \return If the parameters are valid and supported, return
720
+ * a buffer size in bytes that guarantees that
721
+ * psa_asymmetric_decrypt() will not fail with
722
+ * #PSA_ERROR_BUFFER_TOO_SMALL.
723
+ * If the parameters are a valid combination that is not supported,
724
+ * return either a sensible size or 0.
725
+ * If the parameters are not valid, the
726
+ * return value is unspecified.
727
+ */
728
+ #define PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(key_type, key_bits, alg) \
729
+ (PSA_KEY_TYPE_IS_RSA(key_type) ? \
730
+ PSA_BITS_TO_BYTES(key_bits) - PSA_RSA_MINIMUM_PADDING_SIZE(alg) : \
731
+ 0u)
732
+
733
+ /** A sufficient output buffer size for psa_asymmetric_decrypt(), for any
734
+ * supported asymmetric decryption.
735
+ *
736
+ * This macro assumes that RSA is the only supported asymmetric encryption.
737
+ *
738
+ * See also #PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(\p key_type, \p key_bits, \p alg).
739
+ */
740
+ #define PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE \
741
+ (PSA_BITS_TO_BYTES(PSA_VENDOR_RSA_MAX_KEY_BITS))
742
+
743
+ /* Maximum size of the ASN.1 encoding of an INTEGER with the specified
744
+ * number of bits.
745
+ *
746
+ * This definition assumes that bits <= 2^19 - 9 so that the length field
747
+ * is at most 3 bytes. The length of the encoding is the length of the
748
+ * bit string padded to a whole number of bytes plus:
749
+ * - 1 type byte;
750
+ * - 1 to 3 length bytes;
751
+ * - 0 to 1 bytes of leading 0 due to the sign bit.
752
+ */
753
+ #define PSA_KEY_EXPORT_ASN1_INTEGER_MAX_SIZE(bits) \
754
+ ((bits) / 8u + 5u)
755
+
756
+ /* Maximum size of the export encoding of an RSA public key.
757
+ * Assumes that the public exponent is less than 2^32.
758
+ *
759
+ * RSAPublicKey ::= SEQUENCE {
760
+ * modulus INTEGER, -- n
761
+ * publicExponent INTEGER } -- e
762
+ *
763
+ * - 4 bytes of SEQUENCE overhead;
764
+ * - n : INTEGER;
765
+ * - 7 bytes for the public exponent.
766
+ */
767
+ #define PSA_KEY_EXPORT_RSA_PUBLIC_KEY_MAX_SIZE(key_bits) \
768
+ (PSA_KEY_EXPORT_ASN1_INTEGER_MAX_SIZE(key_bits) + 11u)
769
+
770
+ /* Maximum size of the export encoding of an RSA key pair.
771
+ * Assumes that the public exponent is less than 2^32 and that the size
772
+ * difference between the two primes is at most 1 bit.
773
+ *
774
+ * RSAPrivateKey ::= SEQUENCE {
775
+ * version Version, -- 0
776
+ * modulus INTEGER, -- N-bit
777
+ * publicExponent INTEGER, -- 32-bit
778
+ * privateExponent INTEGER, -- N-bit
779
+ * prime1 INTEGER, -- N/2-bit
780
+ * prime2 INTEGER, -- N/2-bit
781
+ * exponent1 INTEGER, -- N/2-bit
782
+ * exponent2 INTEGER, -- N/2-bit
783
+ * coefficient INTEGER, -- N/2-bit
784
+ * }
785
+ *
786
+ * - 4 bytes of SEQUENCE overhead;
787
+ * - 3 bytes of version;
788
+ * - 7 half-size INTEGERs plus 2 full-size INTEGERs,
789
+ * overapproximated as 9 half-size INTEGERS;
790
+ * - 7 bytes for the public exponent.
791
+ */
792
+ #define PSA_KEY_EXPORT_RSA_KEY_PAIR_MAX_SIZE(key_bits) \
793
+ (9u * PSA_KEY_EXPORT_ASN1_INTEGER_MAX_SIZE((key_bits) / 2u + 1u) + 14u)
794
+
795
+ /* Maximum size of the export encoding of a DSA public key.
796
+ *
797
+ * SubjectPublicKeyInfo ::= SEQUENCE {
798
+ * algorithm AlgorithmIdentifier,
799
+ * subjectPublicKey BIT STRING } -- contains DSAPublicKey
800
+ * AlgorithmIdentifier ::= SEQUENCE {
801
+ * algorithm OBJECT IDENTIFIER,
802
+ * parameters Dss-Params } -- SEQUENCE of 3 INTEGERs
803
+ * DSAPublicKey ::= INTEGER -- public key, Y
804
+ *
805
+ * - 3 * 4 bytes of SEQUENCE overhead;
806
+ * - 1 + 1 + 7 bytes of algorithm (DSA OID);
807
+ * - 4 bytes of BIT STRING overhead;
808
+ * - 3 full-size INTEGERs (p, g, y);
809
+ * - 1 + 1 + 32 bytes for 1 sub-size INTEGER (q <= 256 bits).
810
+ */
811
+ #define PSA_KEY_EXPORT_DSA_PUBLIC_KEY_MAX_SIZE(key_bits) \
812
+ (PSA_KEY_EXPORT_ASN1_INTEGER_MAX_SIZE(key_bits) * 3u + 59u)
813
+
814
+ /* Maximum size of the export encoding of a DSA key pair.
815
+ *
816
+ * DSAPrivateKey ::= SEQUENCE {
817
+ * version Version, -- 0
818
+ * prime INTEGER, -- p
819
+ * subprime INTEGER, -- q
820
+ * generator INTEGER, -- g
821
+ * public INTEGER, -- y
822
+ * private INTEGER, -- x
823
+ * }
824
+ *
825
+ * - 4 bytes of SEQUENCE overhead;
826
+ * - 3 bytes of version;
827
+ * - 3 full-size INTEGERs (p, g, y);
828
+ * - 2 * (1 + 1 + 32) bytes for 2 sub-size INTEGERs (q, x <= 256 bits).
829
+ */
830
+ #define PSA_KEY_EXPORT_DSA_KEY_PAIR_MAX_SIZE(key_bits) \
831
+ (PSA_KEY_EXPORT_ASN1_INTEGER_MAX_SIZE(key_bits) * 3u + 75u)
832
+
833
+ /* Maximum size of the export encoding of an ECC public key.
834
+ *
835
+ * The representation of an ECC public key is:
836
+ * - The byte 0x04;
837
+ * - `x_P` as a `ceiling(m/8)`-byte string, big-endian;
838
+ * - `y_P` as a `ceiling(m/8)`-byte string, big-endian;
839
+ * - where m is the bit size associated with the curve.
840
+ *
841
+ * - 1 byte + 2 * point size.
842
+ */
843
+ #define PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(key_bits) \
844
+ (2u * PSA_BITS_TO_BYTES(key_bits) + 1u)
845
+
846
+ /* Maximum size of the export encoding of an ECC key pair.
847
+ *
848
+ * An ECC key pair is represented by the secret value.
849
+ */
850
+ #define PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE(key_bits) \
851
+ (PSA_BITS_TO_BYTES(key_bits))
852
+
853
+ /* Maximum size of the export encoding of an DH key pair.
854
+ *
855
+ * An DH key pair is represented by the secret value.
856
+ */
857
+ #define PSA_KEY_EXPORT_FFDH_KEY_PAIR_MAX_SIZE(key_bits) \
858
+ (PSA_BITS_TO_BYTES(key_bits))
859
+
860
+ /* Maximum size of the export encoding of an DH public key.
861
+ */
862
+ #define PSA_KEY_EXPORT_FFDH_PUBLIC_KEY_MAX_SIZE(key_bits) \
863
+ (PSA_BITS_TO_BYTES(key_bits))
864
+
865
+ /** Sufficient output buffer size for psa_export_key() or
866
+ * psa_export_public_key().
867
+ *
868
+ * This macro returns a compile-time constant if its arguments are
869
+ * compile-time constants.
870
+ *
871
+ * \warning This macro may evaluate its arguments multiple times or
872
+ * zero times, so you should not pass arguments that contain
873
+ * side effects.
874
+ *
875
+ * The following code illustrates how to allocate enough memory to export
876
+ * a key by querying the key type and size at runtime.
877
+ * \code{c}
878
+ * psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
879
+ * psa_status_t status;
880
+ * status = psa_get_key_attributes(key, &attributes);
881
+ * if (status != PSA_SUCCESS) handle_error(...);
882
+ * psa_key_type_t key_type = psa_get_key_type(&attributes);
883
+ * size_t key_bits = psa_get_key_bits(&attributes);
884
+ * size_t buffer_size = PSA_EXPORT_KEY_OUTPUT_SIZE(key_type, key_bits);
885
+ * psa_reset_key_attributes(&attributes);
886
+ * uint8_t *buffer = malloc(buffer_size);
887
+ * if (buffer == NULL) handle_error(...);
888
+ * size_t buffer_length;
889
+ * status = psa_export_key(key, buffer, buffer_size, &buffer_length);
890
+ * if (status != PSA_SUCCESS) handle_error(...);
891
+ * \endcode
892
+ *
893
+ * \param key_type A supported key type.
894
+ * \param key_bits The size of the key in bits.
895
+ *
896
+ * \return If the parameters are valid and supported, return
897
+ * a buffer size in bytes that guarantees that
898
+ * psa_export_key() or psa_export_public_key() will not fail with
899
+ * #PSA_ERROR_BUFFER_TOO_SMALL.
900
+ * If the parameters are a valid combination that is not supported,
901
+ * return either a sensible size or 0.
902
+ * If the parameters are not valid, the return value is unspecified.
903
+ */
904
+ #define PSA_EXPORT_KEY_OUTPUT_SIZE(key_type, key_bits) \
905
+ (PSA_KEY_TYPE_IS_UNSTRUCTURED(key_type) ? PSA_BITS_TO_BYTES(key_bits) : \
906
+ PSA_KEY_TYPE_IS_DH(key_type) ? PSA_BITS_TO_BYTES(key_bits) : \
907
+ (key_type) == PSA_KEY_TYPE_RSA_KEY_PAIR ? PSA_KEY_EXPORT_RSA_KEY_PAIR_MAX_SIZE(key_bits) : \
908
+ (key_type) == PSA_KEY_TYPE_RSA_PUBLIC_KEY ? PSA_KEY_EXPORT_RSA_PUBLIC_KEY_MAX_SIZE(key_bits) : \
909
+ (key_type) == PSA_KEY_TYPE_DSA_KEY_PAIR ? PSA_KEY_EXPORT_DSA_KEY_PAIR_MAX_SIZE(key_bits) : \
910
+ (key_type) == PSA_KEY_TYPE_DSA_PUBLIC_KEY ? PSA_KEY_EXPORT_DSA_PUBLIC_KEY_MAX_SIZE(key_bits) : \
911
+ PSA_KEY_TYPE_IS_ECC_KEY_PAIR(key_type) ? PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE(key_bits) : \
912
+ PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(key_type) ? PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(key_bits) : \
913
+ 0u)
914
+
915
+ /** Sufficient output buffer size for psa_export_public_key().
916
+ *
917
+ * This macro returns a compile-time constant if its arguments are
918
+ * compile-time constants.
919
+ *
920
+ * \warning This macro may evaluate its arguments multiple times or
921
+ * zero times, so you should not pass arguments that contain
922
+ * side effects.
923
+ *
924
+ * The following code illustrates how to allocate enough memory to export
925
+ * a public key by querying the key type and size at runtime.
926
+ * \code{c}
927
+ * psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
928
+ * psa_status_t status;
929
+ * status = psa_get_key_attributes(key, &attributes);
930
+ * if (status != PSA_SUCCESS) handle_error(...);
931
+ * psa_key_type_t key_type = psa_get_key_type(&attributes);
932
+ * size_t key_bits = psa_get_key_bits(&attributes);
933
+ * size_t buffer_size = PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(key_type, key_bits);
934
+ * psa_reset_key_attributes(&attributes);
935
+ * uint8_t *buffer = malloc(buffer_size);
936
+ * if (buffer == NULL) handle_error(...);
937
+ * size_t buffer_length;
938
+ * status = psa_export_public_key(key, buffer, buffer_size, &buffer_length);
939
+ * if (status != PSA_SUCCESS) handle_error(...);
940
+ * \endcode
941
+ *
942
+ * \param key_type A public key or key pair key type.
943
+ * \param key_bits The size of the key in bits.
944
+ *
945
+ * \return If the parameters are valid and supported, return
946
+ * a buffer size in bytes that guarantees that
947
+ * psa_export_public_key() will not fail with
948
+ * #PSA_ERROR_BUFFER_TOO_SMALL.
949
+ * If the parameters are a valid combination that is not
950
+ * supported, return either a sensible size or 0.
951
+ * If the parameters are not valid,
952
+ * the return value is unspecified.
953
+ *
954
+ * If the parameters are valid and supported,
955
+ * return the same result as
956
+ * #PSA_EXPORT_KEY_OUTPUT_SIZE(
957
+ * \p #PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(\p key_type),
958
+ * \p key_bits).
959
+ */
960
+ #define PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(key_type, key_bits) \
961
+ (PSA_KEY_TYPE_IS_RSA(key_type) ? PSA_KEY_EXPORT_RSA_PUBLIC_KEY_MAX_SIZE(key_bits) : \
962
+ PSA_KEY_TYPE_IS_ECC(key_type) ? PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(key_bits) : \
963
+ PSA_KEY_TYPE_IS_DH(key_type) ? PSA_BITS_TO_BYTES(key_bits) : \
964
+ 0u)
965
+
966
+ /** Sufficient buffer size for exporting any asymmetric key pair.
967
+ *
968
+ * This macro expands to a compile-time constant integer. This value is
969
+ * a sufficient buffer size when calling psa_export_key() to export any
970
+ * asymmetric key pair, regardless of the exact key type and key size.
971
+ *
972
+ * See also #PSA_EXPORT_KEY_OUTPUT_SIZE(\p key_type, \p key_bits).
973
+ */
974
+ #define PSA_EXPORT_KEY_PAIR_MAX_SIZE 1
975
+
976
+ #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC) && \
977
+ (PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS) > \
978
+ PSA_EXPORT_KEY_PAIR_MAX_SIZE)
979
+ #undef PSA_EXPORT_KEY_PAIR_MAX_SIZE
980
+ #define PSA_EXPORT_KEY_PAIR_MAX_SIZE \
981
+ PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS)
982
+ #endif
983
+ #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC) && \
984
+ (PSA_KEY_EXPORT_RSA_KEY_PAIR_MAX_SIZE(PSA_VENDOR_RSA_MAX_KEY_BITS) > \
985
+ PSA_EXPORT_KEY_PAIR_MAX_SIZE)
986
+ #undef PSA_EXPORT_KEY_PAIR_MAX_SIZE
987
+ #define PSA_EXPORT_KEY_PAIR_MAX_SIZE \
988
+ PSA_KEY_EXPORT_RSA_KEY_PAIR_MAX_SIZE(PSA_VENDOR_RSA_MAX_KEY_BITS)
989
+ #endif
990
+ #if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC) && \
991
+ (PSA_KEY_EXPORT_FFDH_KEY_PAIR_MAX_SIZE(PSA_VENDOR_FFDH_MAX_KEY_BITS) > \
992
+ PSA_EXPORT_KEY_PAIR_MAX_SIZE)
993
+ #undef PSA_EXPORT_KEY_PAIR_MAX_SIZE
994
+ #define PSA_EXPORT_KEY_PAIR_MAX_SIZE \
995
+ PSA_KEY_EXPORT_FFDH_KEY_PAIR_MAX_SIZE(PSA_VENDOR_FFDH_MAX_KEY_BITS)
996
+ #endif
997
+
998
+ /** Sufficient buffer size for exporting any asymmetric public key.
999
+ *
1000
+ * This macro expands to a compile-time constant integer. This value is
1001
+ * a sufficient buffer size when calling psa_export_key() or
1002
+ * psa_export_public_key() to export any asymmetric public key,
1003
+ * regardless of the exact key type and key size.
1004
+ *
1005
+ * See also #PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(\p key_type, \p key_bits).
1006
+ */
1007
+ #define PSA_EXPORT_PUBLIC_KEY_MAX_SIZE 1
1008
+
1009
+ #if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) && \
1010
+ (PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS) > \
1011
+ PSA_EXPORT_PUBLIC_KEY_MAX_SIZE)
1012
+ #undef PSA_EXPORT_PUBLIC_KEY_MAX_SIZE
1013
+ #define PSA_EXPORT_PUBLIC_KEY_MAX_SIZE \
1014
+ PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS)
1015
+ #endif
1016
+ #if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) && \
1017
+ (PSA_KEY_EXPORT_RSA_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_RSA_MAX_KEY_BITS) > \
1018
+ PSA_EXPORT_PUBLIC_KEY_MAX_SIZE)
1019
+ #undef PSA_EXPORT_PUBLIC_KEY_MAX_SIZE
1020
+ #define PSA_EXPORT_PUBLIC_KEY_MAX_SIZE \
1021
+ PSA_KEY_EXPORT_RSA_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_RSA_MAX_KEY_BITS)
1022
+ #endif
1023
+ #if defined(PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY) && \
1024
+ (PSA_KEY_EXPORT_FFDH_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_FFDH_MAX_KEY_BITS) > \
1025
+ PSA_EXPORT_PUBLIC_KEY_MAX_SIZE)
1026
+ #undef PSA_EXPORT_PUBLIC_KEY_MAX_SIZE
1027
+ #define PSA_EXPORT_PUBLIC_KEY_MAX_SIZE \
1028
+ PSA_KEY_EXPORT_FFDH_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_FFDH_MAX_KEY_BITS)
1029
+ #endif
1030
+
1031
+ /** Sufficient output buffer size for psa_raw_key_agreement().
1032
+ *
1033
+ * This macro returns a compile-time constant if its arguments are
1034
+ * compile-time constants.
1035
+ *
1036
+ * \warning This macro may evaluate its arguments multiple times or
1037
+ * zero times, so you should not pass arguments that contain
1038
+ * side effects.
1039
+ *
1040
+ * See also #PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE.
1041
+ *
1042
+ * \param key_type A supported key type.
1043
+ * \param key_bits The size of the key in bits.
1044
+ *
1045
+ * \return If the parameters are valid and supported, return
1046
+ * a buffer size in bytes that guarantees that
1047
+ * psa_raw_key_agreement() will not fail with
1048
+ * #PSA_ERROR_BUFFER_TOO_SMALL.
1049
+ * If the parameters are a valid combination that
1050
+ * is not supported, return either a sensible size or 0.
1051
+ * If the parameters are not valid,
1052
+ * the return value is unspecified.
1053
+ */
1054
+ #define PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(key_type, key_bits) \
1055
+ ((PSA_KEY_TYPE_IS_ECC_KEY_PAIR(key_type) || \
1056
+ PSA_KEY_TYPE_IS_DH_KEY_PAIR(key_type)) ? PSA_BITS_TO_BYTES(key_bits) : 0u)
1057
+
1058
+ /** Maximum size of the output from psa_raw_key_agreement().
1059
+ *
1060
+ * This macro expands to a compile-time constant integer. This value is the
1061
+ * maximum size of the output any raw key agreement algorithm, in bytes.
1062
+ *
1063
+ * See also #PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(\p key_type, \p key_bits).
1064
+ */
1065
+ #define PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE 1
1066
+
1067
+ #if defined(PSA_WANT_ALG_ECDH) && \
1068
+ (PSA_BITS_TO_BYTES(PSA_VENDOR_ECC_MAX_CURVE_BITS) > PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE)
1069
+ #undef PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE
1070
+ #define PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE PSA_BITS_TO_BYTES(PSA_VENDOR_ECC_MAX_CURVE_BITS)
1071
+ #endif
1072
+ #if defined(PSA_WANT_ALG_FFDH) && \
1073
+ (PSA_BITS_TO_BYTES(PSA_VENDOR_FFDH_MAX_KEY_BITS) > PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE)
1074
+ #undef PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE
1075
+ #define PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE PSA_BITS_TO_BYTES(PSA_VENDOR_FFDH_MAX_KEY_BITS)
1076
+ #endif
1077
+
1078
+ /** The default IV size for a cipher algorithm, in bytes.
1079
+ *
1080
+ * The IV that is generated as part of a call to #psa_cipher_encrypt() is always
1081
+ * the default IV length for the algorithm.
1082
+ *
1083
+ * This macro can be used to allocate a buffer of sufficient size to
1084
+ * store the IV output from #psa_cipher_generate_iv() when using
1085
+ * a multi-part cipher operation.
1086
+ *
1087
+ * See also #PSA_CIPHER_IV_MAX_SIZE.
1088
+ *
1089
+ * \warning This macro may evaluate its arguments multiple times or
1090
+ * zero times, so you should not pass arguments that contain
1091
+ * side effects.
1092
+ *
1093
+ * \param key_type A symmetric key type that is compatible with algorithm \p alg.
1094
+ *
1095
+ * \param alg A cipher algorithm (\c PSA_ALG_XXX value such that #PSA_ALG_IS_CIPHER(\p alg) is true).
1096
+ *
1097
+ * \return The default IV size for the specified key type and algorithm.
1098
+ * If the algorithm does not use an IV, return 0.
1099
+ * If the key type or cipher algorithm is not recognized,
1100
+ * or the parameters are incompatible, return 0.
1101
+ */
1102
+ #define PSA_CIPHER_IV_LENGTH(key_type, alg) \
1103
+ (PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) > 1 && \
1104
+ ((alg) == PSA_ALG_CTR || \
1105
+ (alg) == PSA_ALG_CFB || \
1106
+ (alg) == PSA_ALG_OFB || \
1107
+ (alg) == PSA_ALG_XTS || \
1108
+ (alg) == PSA_ALG_CBC_NO_PADDING || \
1109
+ (alg) == PSA_ALG_CBC_PKCS7) ? PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) : \
1110
+ (key_type) == PSA_KEY_TYPE_CHACHA20 && \
1111
+ (alg) == PSA_ALG_STREAM_CIPHER ? 12u : \
1112
+ (alg) == PSA_ALG_CCM_STAR_NO_TAG ? 13u : \
1113
+ 0u)
1114
+
1115
+ /** The maximum IV size for all supported cipher algorithms, in bytes.
1116
+ *
1117
+ * See also #PSA_CIPHER_IV_LENGTH().
1118
+ */
1119
+ #define PSA_CIPHER_IV_MAX_SIZE 16u
1120
+
1121
+ /** The maximum size of the output of psa_cipher_encrypt(), in bytes.
1122
+ *
1123
+ * If the size of the output buffer is at least this large, it is guaranteed
1124
+ * that psa_cipher_encrypt() will not fail due to an insufficient buffer size.
1125
+ * Depending on the algorithm, the actual size of the output might be smaller.
1126
+ *
1127
+ * See also #PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(\p input_length).
1128
+ *
1129
+ * \warning This macro may evaluate its arguments multiple times or
1130
+ * zero times, so you should not pass arguments that contain
1131
+ * side effects.
1132
+ *
1133
+ * \param key_type A symmetric key type that is compatible with algorithm
1134
+ * alg.
1135
+ * \param alg A cipher algorithm (\c PSA_ALG_XXX value such that
1136
+ * #PSA_ALG_IS_CIPHER(\p alg) is true).
1137
+ * \param input_length Size of the input in bytes.
1138
+ *
1139
+ * \return A sufficient output size for the specified key type and
1140
+ * algorithm. If the key type or cipher algorithm is not
1141
+ * recognized, or the parameters are incompatible,
1142
+ * return 0.
1143
+ */
1144
+ #define PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_length) \
1145
+ (alg == PSA_ALG_CBC_PKCS7 ? \
1146
+ (PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) != 0 ? \
1147
+ PSA_ROUND_UP_TO_MULTIPLE(PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type), \
1148
+ (input_length) + 1u) + \
1149
+ PSA_CIPHER_IV_LENGTH((key_type), (alg)) : 0u) : \
1150
+ (PSA_ALG_IS_CIPHER(alg) ? \
1151
+ (input_length) + PSA_CIPHER_IV_LENGTH((key_type), (alg)) : \
1152
+ 0u))
1153
+
1154
+ /** A sufficient output buffer size for psa_cipher_encrypt(), for any of the
1155
+ * supported key types and cipher algorithms.
1156
+ *
1157
+ * If the size of the output buffer is at least this large, it is guaranteed
1158
+ * that psa_cipher_encrypt() will not fail due to an insufficient buffer size.
1159
+ *
1160
+ * See also #PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(\p key_type, \p alg, \p input_length).
1161
+ *
1162
+ * \param input_length Size of the input in bytes.
1163
+ *
1164
+ */
1165
+ #define PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input_length) \
1166
+ (PSA_ROUND_UP_TO_MULTIPLE(PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE, \
1167
+ (input_length) + 1u) + \
1168
+ PSA_CIPHER_IV_MAX_SIZE)
1169
+
1170
+ /** The maximum size of the output of psa_cipher_decrypt(), in bytes.
1171
+ *
1172
+ * If the size of the output buffer is at least this large, it is guaranteed
1173
+ * that psa_cipher_decrypt() will not fail due to an insufficient buffer size.
1174
+ * Depending on the algorithm, the actual size of the output might be smaller.
1175
+ *
1176
+ * See also #PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(\p input_length).
1177
+ *
1178
+ * \param key_type A symmetric key type that is compatible with algorithm
1179
+ * alg.
1180
+ * \param alg A cipher algorithm (\c PSA_ALG_XXX value such that
1181
+ * #PSA_ALG_IS_CIPHER(\p alg) is true).
1182
+ * \param input_length Size of the input in bytes.
1183
+ *
1184
+ * \return A sufficient output size for the specified key type and
1185
+ * algorithm. If the key type or cipher algorithm is not
1186
+ * recognized, or the parameters are incompatible,
1187
+ * return 0.
1188
+ */
1189
+ #define PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_length) \
1190
+ (PSA_ALG_IS_CIPHER(alg) && \
1191
+ ((key_type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_SYMMETRIC ? \
1192
+ (input_length) : \
1193
+ 0u)
1194
+
1195
+ /** A sufficient output buffer size for psa_cipher_decrypt(), for any of the
1196
+ * supported key types and cipher algorithms.
1197
+ *
1198
+ * If the size of the output buffer is at least this large, it is guaranteed
1199
+ * that psa_cipher_decrypt() will not fail due to an insufficient buffer size.
1200
+ *
1201
+ * See also #PSA_CIPHER_DECRYPT_OUTPUT_SIZE(\p key_type, \p alg, \p input_length).
1202
+ *
1203
+ * \param input_length Size of the input in bytes.
1204
+ */
1205
+ #define PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(input_length) \
1206
+ (input_length)
1207
+
1208
+ /** A sufficient output buffer size for psa_cipher_update().
1209
+ *
1210
+ * If the size of the output buffer is at least this large, it is guaranteed
1211
+ * that psa_cipher_update() will not fail due to an insufficient buffer size.
1212
+ * The actual size of the output might be smaller in any given call.
1213
+ *
1214
+ * See also #PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(\p input_length).
1215
+ *
1216
+ * \param key_type A symmetric key type that is compatible with algorithm
1217
+ * alg.
1218
+ * \param alg A cipher algorithm (PSA_ALG_XXX value such that
1219
+ * #PSA_ALG_IS_CIPHER(\p alg) is true).
1220
+ * \param input_length Size of the input in bytes.
1221
+ *
1222
+ * \return A sufficient output size for the specified key type and
1223
+ * algorithm. If the key type or cipher algorithm is not
1224
+ * recognized, or the parameters are incompatible, return 0.
1225
+ */
1226
+ #define PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input_length) \
1227
+ (PSA_ALG_IS_CIPHER(alg) ? \
1228
+ (PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) != 0 ? \
1229
+ (((alg) == PSA_ALG_CBC_PKCS7 || \
1230
+ (alg) == PSA_ALG_CBC_NO_PADDING || \
1231
+ (alg) == PSA_ALG_ECB_NO_PADDING) ? \
1232
+ PSA_ROUND_UP_TO_MULTIPLE(PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type), \
1233
+ input_length) : \
1234
+ (input_length)) : 0u) : \
1235
+ 0u)
1236
+
1237
+ /** A sufficient output buffer size for psa_cipher_update(), for any of the
1238
+ * supported key types and cipher algorithms.
1239
+ *
1240
+ * If the size of the output buffer is at least this large, it is guaranteed
1241
+ * that psa_cipher_update() will not fail due to an insufficient buffer size.
1242
+ *
1243
+ * See also #PSA_CIPHER_UPDATE_OUTPUT_SIZE(\p key_type, \p alg, \p input_length).
1244
+ *
1245
+ * \param input_length Size of the input in bytes.
1246
+ */
1247
+ #define PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(input_length) \
1248
+ (PSA_ROUND_UP_TO_MULTIPLE(PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE, input_length))
1249
+
1250
+ /** A sufficient ciphertext buffer size for psa_cipher_finish().
1251
+ *
1252
+ * If the size of the ciphertext buffer is at least this large, it is
1253
+ * guaranteed that psa_cipher_finish() will not fail due to an insufficient
1254
+ * ciphertext buffer size. The actual size of the output might be smaller in
1255
+ * any given call.
1256
+ *
1257
+ * See also #PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE().
1258
+ *
1259
+ * \param key_type A symmetric key type that is compatible with algorithm
1260
+ * alg.
1261
+ * \param alg A cipher algorithm (PSA_ALG_XXX value such that
1262
+ * #PSA_ALG_IS_CIPHER(\p alg) is true).
1263
+ * \return A sufficient output size for the specified key type and
1264
+ * algorithm. If the key type or cipher algorithm is not
1265
+ * recognized, or the parameters are incompatible, return 0.
1266
+ */
1267
+ #define PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg) \
1268
+ (PSA_ALG_IS_CIPHER(alg) ? \
1269
+ (alg == PSA_ALG_CBC_PKCS7 ? \
1270
+ PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) : \
1271
+ 0u) : \
1272
+ 0u)
1273
+
1274
+ /** A sufficient ciphertext buffer size for psa_cipher_finish(), for any of the
1275
+ * supported key types and cipher algorithms.
1276
+ *
1277
+ * See also #PSA_CIPHER_FINISH_OUTPUT_SIZE(\p key_type, \p alg).
1278
+ */
1279
+ #define PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE \
1280
+ (PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE)
1281
+
1282
+ #endif /* PSA_CRYPTO_SIZES_H */