edhoc 1.0.4 → 1.1.0

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 (314) hide show
  1. package/README.md +170 -0
  2. package/binding.gyp +13 -11
  3. package/dist/bindings.d.ts +5 -0
  4. package/dist/bindings.d.ts.map +1 -0
  5. package/dist/bindings.js +10 -0
  6. package/dist/crypto.d.ts +29 -0
  7. package/dist/crypto.d.ts.map +1 -0
  8. package/dist/crypto.js +205 -0
  9. package/dist/edhoc.d.ts +368 -0
  10. package/dist/edhoc.d.ts.map +1 -0
  11. package/dist/edhoc.js +76 -0
  12. package/dist/index.d.ts +4 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +19 -0
  15. package/dist/x509credentials.d.ts +20 -0
  16. package/dist/x509credentials.d.ts.map +1 -0
  17. package/dist/x509credentials.js +140 -0
  18. package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_decode.h +1 -1
  19. package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_encode.h +1 -1
  20. package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_types.h +1 -1
  21. package/external/libedhoc/backends/cbor/include/backend_cbor_ead_decode.h +2 -2
  22. package/external/libedhoc/backends/cbor/include/backend_cbor_ead_encode.h +2 -2
  23. package/external/libedhoc/backends/cbor/include/backend_cbor_edhoc_types.h +48 -43
  24. package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_decode.h +1 -1
  25. package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_encode.h +1 -1
  26. package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_types.h +3 -3
  27. package/external/libedhoc/backends/cbor/include/backend_cbor_id_cred_x_decode.h +1 -1
  28. package/external/libedhoc/backends/cbor/include/backend_cbor_id_cred_x_encode.h +1 -1
  29. package/external/libedhoc/backends/cbor/include/backend_cbor_info_decode.h +1 -1
  30. package/external/libedhoc/backends/cbor/include/backend_cbor_info_encode.h +1 -1
  31. package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_decode.h +1 -1
  32. package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_encode.h +1 -1
  33. package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_types.h +1 -1
  34. package/external/libedhoc/backends/cbor/include/backend_cbor_message_1_decode.h +1 -1
  35. package/external/libedhoc/backends/cbor/include/backend_cbor_message_1_encode.h +1 -1
  36. package/external/libedhoc/backends/cbor/include/backend_cbor_message_2_decode.h +1 -1
  37. package/external/libedhoc/backends/cbor/include/backend_cbor_message_2_encode.h +1 -1
  38. package/external/libedhoc/backends/cbor/include/backend_cbor_message_3_decode.h +1 -1
  39. package/external/libedhoc/backends/cbor/include/backend_cbor_message_3_encode.h +1 -1
  40. package/external/libedhoc/backends/cbor/include/backend_cbor_message_4_decode.h +1 -1
  41. package/external/libedhoc/backends/cbor/include/backend_cbor_message_4_encode.h +1 -1
  42. package/external/libedhoc/backends/cbor/include/backend_cbor_message_error_decode.h +1 -1
  43. package/external/libedhoc/backends/cbor/include/backend_cbor_message_error_encode.h +1 -1
  44. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_2_decode.h +1 -1
  45. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_2_encode.h +1 -1
  46. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_3_decode.h +1 -1
  47. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_3_encode.h +1 -1
  48. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_4_decode.h +3 -3
  49. package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_4_encode.h +3 -3
  50. package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_decode.h +1 -1
  51. package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_encode.h +1 -1
  52. package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_types.h +4 -4
  53. package/external/libedhoc/backends/cbor/include/backend_cbor_x509_types.h +93 -83
  54. package/external/libedhoc/backends/cbor/src/backend_cbor_bstr_type_decode.c +11 -20
  55. package/external/libedhoc/backends/cbor/src/backend_cbor_bstr_type_encode.c +11 -20
  56. package/external/libedhoc/backends/cbor/src/backend_cbor_ead_decode.c +27 -32
  57. package/external/libedhoc/backends/cbor/src/backend_cbor_ead_encode.c +27 -32
  58. package/external/libedhoc/backends/cbor/src/backend_cbor_enc_structure_decode.c +14 -23
  59. package/external/libedhoc/backends/cbor/src/backend_cbor_enc_structure_encode.c +14 -23
  60. package/external/libedhoc/backends/cbor/src/backend_cbor_id_cred_x_decode.c +63 -52
  61. package/external/libedhoc/backends/cbor/src/backend_cbor_id_cred_x_encode.c +62 -51
  62. package/external/libedhoc/backends/cbor/src/backend_cbor_info_decode.c +14 -23
  63. package/external/libedhoc/backends/cbor/src/backend_cbor_info_encode.c +14 -23
  64. package/external/libedhoc/backends/cbor/src/backend_cbor_int_type_decode.c +11 -20
  65. package/external/libedhoc/backends/cbor/src/backend_cbor_int_type_encode.c +11 -20
  66. package/external/libedhoc/backends/cbor/src/backend_cbor_message_1_decode.c +54 -51
  67. package/external/libedhoc/backends/cbor/src/backend_cbor_message_1_encode.c +54 -51
  68. package/external/libedhoc/backends/cbor/src/backend_cbor_message_2_decode.c +11 -20
  69. package/external/libedhoc/backends/cbor/src/backend_cbor_message_2_encode.c +11 -20
  70. package/external/libedhoc/backends/cbor/src/backend_cbor_message_3_decode.c +11 -20
  71. package/external/libedhoc/backends/cbor/src/backend_cbor_message_3_encode.c +11 -20
  72. package/external/libedhoc/backends/cbor/src/backend_cbor_message_4_decode.c +11 -20
  73. package/external/libedhoc/backends/cbor/src/backend_cbor_message_4_encode.c +11 -20
  74. package/external/libedhoc/backends/cbor/src/backend_cbor_message_error_decode.c +36 -37
  75. package/external/libedhoc/backends/cbor/src/backend_cbor_message_error_encode.c +36 -37
  76. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_2_decode.c +103 -80
  77. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_2_encode.c +102 -79
  78. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_3_decode.c +99 -76
  79. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_3_encode.c +98 -75
  80. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_4_decode.c +40 -41
  81. package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_4_encode.c +40 -41
  82. package/external/libedhoc/backends/cbor/src/backend_cbor_sig_structure_decode.c +15 -24
  83. package/external/libedhoc/backends/cbor/src/backend_cbor_sig_structure_encode.c +15 -24
  84. package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode.c +31 -0
  85. package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode.h +10 -0
  86. package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode2.c +18 -0
  87. package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode2.h +9 -0
  88. package/external/libedhoc/externals/Unity/examples/example_1/test/TestProductionCode.c +69 -0
  89. package/external/libedhoc/externals/Unity/examples/example_1/test/TestProductionCode2.c +38 -0
  90. package/external/libedhoc/externals/Unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
  91. package/external/libedhoc/externals/Unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
  92. package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode.c +31 -0
  93. package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode.h +10 -0
  94. package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode2.c +18 -0
  95. package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode2.h +9 -0
  96. package/external/libedhoc/externals/Unity/examples/example_2/test/TestProductionCode.c +71 -0
  97. package/external/libedhoc/externals/Unity/examples/example_2/test/TestProductionCode2.c +40 -0
  98. package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +16 -0
  99. package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +18 -0
  100. package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/all_tests.c +19 -0
  101. package/external/libedhoc/externals/Unity/examples/example_3/helper/UnityHelper.c +17 -0
  102. package/external/libedhoc/externals/Unity/examples/example_3/helper/UnityHelper.h +19 -0
  103. package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode.c +31 -0
  104. package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode.h +10 -0
  105. package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode2.c +18 -0
  106. package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode2.h +9 -0
  107. package/external/libedhoc/externals/Unity/examples/example_3/test/TestProductionCode.c +69 -0
  108. package/external/libedhoc/externals/Unity/examples/example_3/test/TestProductionCode2.c +38 -0
  109. package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode.c +31 -0
  110. package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode.h +10 -0
  111. package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode2.c +18 -0
  112. package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode2.h +9 -0
  113. package/external/libedhoc/externals/Unity/examples/example_4/test/TestProductionCode.c +70 -0
  114. package/external/libedhoc/externals/Unity/examples/example_4/test/TestProductionCode2.c +42 -0
  115. package/external/libedhoc/externals/Unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +53 -0
  116. package/external/libedhoc/externals/Unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +57 -0
  117. package/external/libedhoc/externals/Unity/examples/unity_config.h +251 -0
  118. package/external/libedhoc/externals/Unity/extras/bdd/src/unity_bdd.h +44 -0
  119. package/external/libedhoc/externals/Unity/extras/bdd/test/test_bdd.c +129 -0
  120. package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture.c +310 -0
  121. package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture.h +95 -0
  122. package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture_internals.h +51 -0
  123. package/external/libedhoc/externals/Unity/extras/fixture/test/main/AllTests.c +20 -0
  124. package/external/libedhoc/externals/Unity/extras/fixture/test/template_fixture_tests.c +40 -0
  125. package/external/libedhoc/externals/Unity/extras/fixture/test/unity_fixture_Test.c +246 -0
  126. package/external/libedhoc/externals/Unity/extras/fixture/test/unity_fixture_TestRunner.c +33 -0
  127. package/external/libedhoc/externals/Unity/extras/memory/src/unity_memory.c +203 -0
  128. package/external/libedhoc/externals/Unity/extras/memory/src/unity_memory.h +61 -0
  129. package/external/libedhoc/externals/Unity/extras/memory/test/unity_memory_Test.c +326 -0
  130. package/external/libedhoc/externals/Unity/extras/memory/test/unity_memory_TestRunner.c +50 -0
  131. package/external/libedhoc/externals/Unity/extras/memory/test/unity_output_Spy.c +57 -0
  132. package/external/libedhoc/externals/Unity/extras/memory/test/unity_output_Spy.h +17 -0
  133. package/external/libedhoc/externals/Unity/src/unity.c +2501 -0
  134. package/external/libedhoc/externals/Unity/src/unity.h +698 -0
  135. package/external/libedhoc/externals/Unity/src/unity_internals.h +1183 -0
  136. package/external/libedhoc/externals/Unity/test/expectdata/testsample_cmd.c +61 -0
  137. package/external/libedhoc/externals/Unity/test/expectdata/testsample_def.c +57 -0
  138. package/external/libedhoc/externals/Unity/test/expectdata/testsample_head1.c +55 -0
  139. package/external/libedhoc/externals/Unity/test/expectdata/testsample_head1.h +15 -0
  140. package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_cmd.c +80 -0
  141. package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_def.c +76 -0
  142. package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_head1.c +75 -0
  143. package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_head1.h +13 -0
  144. package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_new1.c +89 -0
  145. package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_new2.c +89 -0
  146. package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_param.c +77 -0
  147. package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_run1.c +89 -0
  148. package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_run2.c +89 -0
  149. package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_yaml.c +90 -0
  150. package/external/libedhoc/externals/Unity/test/expectdata/testsample_new1.c +67 -0
  151. package/external/libedhoc/externals/Unity/test/expectdata/testsample_new2.c +70 -0
  152. package/external/libedhoc/externals/Unity/test/expectdata/testsample_param.c +58 -0
  153. package/external/libedhoc/externals/Unity/test/expectdata/testsample_run1.c +67 -0
  154. package/external/libedhoc/externals/Unity/test/expectdata/testsample_run2.c +70 -0
  155. package/external/libedhoc/externals/Unity/test/expectdata/testsample_yaml.c +71 -0
  156. package/external/libedhoc/externals/Unity/test/testdata/CException.h +18 -0
  157. package/external/libedhoc/externals/Unity/test/testdata/Defs.h +16 -0
  158. package/external/libedhoc/externals/Unity/test/testdata/cmock.h +21 -0
  159. package/external/libedhoc/externals/Unity/test/testdata/mockMock.h +20 -0
  160. package/external/libedhoc/externals/Unity/test/testdata/testRunnerGenerator.c +204 -0
  161. package/external/libedhoc/externals/Unity/test/testdata/testRunnerGeneratorSmall.c +73 -0
  162. package/external/libedhoc/externals/Unity/test/testdata/testRunnerGeneratorWithMocks.c +200 -0
  163. package/external/libedhoc/externals/Unity/test/tests/self_assessment_utils.h +151 -0
  164. package/external/libedhoc/externals/Unity/test/tests/test_unity_arrays.c +2941 -0
  165. package/external/libedhoc/externals/Unity/test/tests/test_unity_core.c +375 -0
  166. package/external/libedhoc/externals/Unity/test/tests/test_unity_doubles.c +1285 -0
  167. package/external/libedhoc/externals/Unity/test/tests/test_unity_floats.c +1395 -0
  168. package/external/libedhoc/externals/Unity/test/tests/test_unity_integers.c +2863 -0
  169. package/external/libedhoc/externals/Unity/test/tests/test_unity_integers_64.c +783 -0
  170. package/external/libedhoc/externals/Unity/test/tests/test_unity_memory.c +82 -0
  171. package/external/libedhoc/externals/Unity/test/tests/test_unity_parameterized.c +309 -0
  172. package/external/libedhoc/externals/Unity/test/tests/test_unity_parameterizedDemo.c +28 -0
  173. package/external/libedhoc/externals/Unity/test/tests/test_unity_strings.c +330 -0
  174. package/external/libedhoc/externals/Unity/test/tests/types_for_test.h +21 -0
  175. package/external/libedhoc/externals/zcbor/include/zcbor_common.h +147 -60
  176. package/external/libedhoc/externals/zcbor/include/zcbor_decode.h +291 -202
  177. package/external/libedhoc/externals/zcbor/include/zcbor_encode.h +100 -156
  178. package/external/libedhoc/externals/zcbor/include/zcbor_print.h +165 -0
  179. package/external/libedhoc/externals/zcbor/samples/hello_world/src/main.c +1 -1
  180. package/external/libedhoc/externals/zcbor/samples/pet/include/pet_decode.h +1 -1
  181. package/external/libedhoc/externals/zcbor/samples/pet/include/pet_encode.h +1 -1
  182. package/external/libedhoc/externals/zcbor/samples/pet/include/pet_types.h +4 -4
  183. package/external/libedhoc/externals/zcbor/samples/pet/src/main.c +4 -4
  184. package/external/libedhoc/externals/zcbor/samples/pet/src/pet_decode.c +15 -24
  185. package/external/libedhoc/externals/zcbor/samples/pet/src/pet_encode.c +14 -23
  186. package/external/libedhoc/externals/zcbor/src/zcbor_common.c +202 -29
  187. package/external/libedhoc/externals/zcbor/src/zcbor_decode.c +633 -173
  188. package/external/libedhoc/externals/zcbor/src/zcbor_encode.c +71 -184
  189. package/external/libedhoc/externals/zcbor/tests/decode/test1_suit_old_formats/src/main.c +152 -153
  190. package/external/libedhoc/externals/zcbor/tests/decode/test2_suit/src/main.c +64 -64
  191. package/external/libedhoc/externals/zcbor/tests/decode/test3_simple/src/main.c +15 -16
  192. package/external/libedhoc/externals/zcbor/tests/decode/test5_corner_cases/src/main.c +228 -84
  193. package/external/libedhoc/externals/zcbor/tests/decode/test7_suit9_simple/src/main.c +9 -9
  194. package/external/libedhoc/externals/zcbor/tests/decode/test8_suit12/src/main.c +0 -1
  195. package/external/libedhoc/externals/zcbor/tests/decode/test9_manifest14/src/main.c +172 -173
  196. package/external/libedhoc/externals/zcbor/tests/encode/test1_suit/src/main.c +73 -73
  197. package/external/libedhoc/externals/zcbor/tests/encode/test2_simple/src/main.c +1 -2
  198. package/external/libedhoc/externals/zcbor/tests/encode/test3_corner_cases/src/main.c +83 -56
  199. package/external/libedhoc/externals/zcbor/tests/encode/test4_senml/src/main.c +15 -16
  200. package/external/libedhoc/externals/zcbor/tests/fuzz/fuzz_everything.c +12 -0
  201. package/external/libedhoc/externals/zcbor/tests/fuzz/fuzz_manifest12.c +69 -69
  202. package/external/libedhoc/externals/zcbor/tests/unit/test1_unit_tests/src/main.c +448 -55
  203. package/external/libedhoc/externals/zcbor/tests/unit/test3_float16/src/main.c +49 -48
  204. package/external/libedhoc/include/edhoc.h +348 -54
  205. package/external/libedhoc/include/edhoc_common.h +289 -0
  206. package/external/libedhoc/include/edhoc_context.h +60 -35
  207. package/external/libedhoc/include/edhoc_credentials.h +55 -7
  208. package/external/libedhoc/include/edhoc_crypto.h +10 -10
  209. package/external/libedhoc/include/edhoc_ead.h +13 -10
  210. package/external/libedhoc/include/edhoc_macros.h +20 -11
  211. package/external/libedhoc/include/edhoc_values.h +2 -2
  212. package/external/libedhoc/library/edhoc.c +70 -36
  213. package/external/libedhoc/library/edhoc_common.c +1314 -0
  214. package/external/libedhoc/library/edhoc_exporter.c +45 -46
  215. package/external/libedhoc/library/edhoc_message_1.c +107 -72
  216. package/external/libedhoc/library/edhoc_message_2.c +396 -1693
  217. package/external/libedhoc/library/edhoc_message_3.c +465 -1656
  218. package/external/libedhoc/library/edhoc_message_4.c +93 -91
  219. package/external/libedhoc/library/edhoc_message_error.c +41 -41
  220. package/external/libedhoc/tests/include/{cipher_suites/cipher_suite_0.h → cipher_suite_0.h} +131 -134
  221. package/external/libedhoc/tests/include/{cipher_suites/cipher_suite_2.h → cipher_suite_2.h} +139 -140
  222. package/external/libedhoc/tests/include/{edhoc_trace_1/test_vector_1.h → test_vector_rfc9529_chapter_2.h} +786 -738
  223. package/external/libedhoc/tests/include/{edhoc_trace_2/test_vector_2.h → test_vector_rfc9529_chapter_3.h} +14 -10
  224. package/external/libedhoc/tests/include/{x509_chain_cs_0/test_vector_x5chain_cs_0.h → test_vector_x5chain_sign_keys_suite_0.h} +137 -140
  225. package/external/libedhoc/tests/include/{x509_chain_cs_2/test_vector_x5chain_cs_2.h → test_vector_x5chain_sign_keys_suite_2.h} +7 -8
  226. package/external/libedhoc/tests/include/{x509_chain_cs_2_static_dh/test_vector_x5chain_cs_2_static_dh.h → test_vector_x5chain_static_dh_keys_suite_2.h} +7 -8
  227. package/external/libedhoc/tests/include/{x509_hash_cs_2/test_vector_x5t_cs_2.h → test_vector_x5t_sign_keys_suite_2.h} +6 -7
  228. package/external/libedhoc/tests/src/{cipher_suites/cipher_suite_0.c → cipher_suite_0.c} +445 -447
  229. package/external/libedhoc/tests/src/{cipher_suites/cipher_suite_2.c → cipher_suite_2.c} +600 -600
  230. package/external/libedhoc/tests/src/module_test_api.c +430 -0
  231. package/external/libedhoc/tests/src/module_test_cipher_suite_0.c +395 -0
  232. package/external/libedhoc/tests/src/module_test_cipher_suite_2.c +392 -0
  233. package/external/libedhoc/tests/src/{error_message/test_edhoc_error_message.c → module_test_error_message.c} +94 -69
  234. package/external/libedhoc/tests/src/module_test_main.c +49 -0
  235. package/external/libedhoc/tests/src/{cipher_suite_negotiation/test_edhoc_cipher_suite_negotiation.c → module_test_rfc9528_suites_negotiation.c} +224 -227
  236. package/external/libedhoc/tests/src/module_test_rfc9529_chapter_2.c +2681 -0
  237. package/external/libedhoc/tests/src/module_test_rfc9529_chapter_3.c +1635 -0
  238. package/external/libedhoc/tests/src/module_test_x5chain_sign_keys_suite_0.c +1135 -0
  239. package/external/libedhoc/tests/src/module_test_x5chain_sign_keys_suite_2.c +1249 -0
  240. package/external/libedhoc/tests/src/module_test_x5chain_static_dh_keys_suite_2.c +798 -0
  241. package/external/libedhoc/tests/src/module_test_x5t_sign_keys_suite_2.c +956 -0
  242. package/include/EdhocComposeAsyncWorker.h +8 -6
  243. package/include/EdhocCredentialManager.h +16 -11
  244. package/include/EdhocCryptoManager.h +28 -21
  245. package/include/EdhocEadManager.h +3 -6
  246. package/include/{EdhocExportAsyncWorker.h → EdhocExportOscoreAsyncWorker.h} +20 -17
  247. package/include/EdhocKeyExporterAsyncWorker.h +76 -0
  248. package/include/EdhocKeyUpdateAsyncWorker.h +72 -0
  249. package/include/EdhocProcessAsyncWorker.h +14 -10
  250. package/include/LibEDHOC.h +44 -20
  251. package/include/UserContext.h +7 -9
  252. package/include/Utils.h +31 -27
  253. package/package.json +14 -3
  254. package/prebuilds/android-arm/edhoc.armv7.node +0 -0
  255. package/prebuilds/android-arm64/edhoc.armv8.node +0 -0
  256. package/prebuilds/darwin-arm64/edhoc.node +0 -0
  257. package/prebuilds/darwin-x64/edhoc.node +0 -0
  258. package/prebuilds/linux-arm/edhoc.armv6.node +0 -0
  259. package/prebuilds/linux-arm/edhoc.armv7.node +0 -0
  260. package/prebuilds/linux-arm64/edhoc.armv8.node +0 -0
  261. package/prebuilds/linux-x64/edhoc.glibc.node +0 -0
  262. package/prebuilds/linux-x64/edhoc.musl.node +0 -0
  263. package/prebuilds/win32-ia32/edhoc.node +0 -0
  264. package/prebuilds/win32-x64/edhoc.node +0 -0
  265. package/src/EdhocComposeAsyncWorker.cpp +18 -35
  266. package/src/EdhocCredentialManager.cpp +160 -187
  267. package/src/EdhocCryptoManager.cpp +386 -586
  268. package/src/EdhocEadManager.cpp +10 -18
  269. package/src/EdhocExportOscoreAsyncWorker.cpp +77 -0
  270. package/src/EdhocKeyExporterAsyncWorker.cpp +49 -0
  271. package/src/EdhocKeyUpdateAsyncWorker.cpp +41 -0
  272. package/src/EdhocProcessAsyncWorker.cpp +72 -19
  273. package/src/LibEDHOC.cpp +213 -174
  274. package/src/Suites.cpp +39 -72
  275. package/src/Utils.cpp +32 -56
  276. package/test/basic.test.ts +64 -0
  277. package/test/vectors.test.ts +111 -0
  278. package/external/libedhoc/externals/zcbor/include/zcbor_debug.h +0 -69
  279. package/external/libedhoc/tests/include/cipher_suite_negotiation/test_edhoc_cipher_suite_negotiation.h +0 -37
  280. package/external/libedhoc/tests/include/cipher_suites/test_cipher_suite_0.h +0 -48
  281. package/external/libedhoc/tests/include/cipher_suites/test_cipher_suite_2.h +0 -48
  282. package/external/libedhoc/tests/include/edhoc_trace_1/authentication_credentials_1.h +0 -60
  283. package/external/libedhoc/tests/include/edhoc_trace_1/test_edhoc_handshake_1.h +0 -208
  284. package/external/libedhoc/tests/include/edhoc_trace_1/test_edhoc_handshake_ead_1.h +0 -59
  285. package/external/libedhoc/tests/include/edhoc_trace_2/authentication_credentials_2.h +0 -60
  286. package/external/libedhoc/tests/include/edhoc_trace_2/test_edhoc_handshake_2.h +0 -199
  287. package/external/libedhoc/tests/include/error_message/test_edhoc_error_message.h +0 -48
  288. package/external/libedhoc/tests/include/x509_chain_cs_0/authentication_credentials_x5chain_cs_0.h +0 -92
  289. package/external/libedhoc/tests/include/x509_chain_cs_0/test_edhoc_handshake_x5chain_cs_0.h +0 -96
  290. package/external/libedhoc/tests/include/x509_chain_cs_2/authentication_credentials_x5chain_cs_2.h +0 -58
  291. package/external/libedhoc/tests/include/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2.h +0 -56
  292. package/external/libedhoc/tests/include/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2_ead.h +0 -57
  293. package/external/libedhoc/tests/include/x509_chain_cs_2_static_dh/authentication_credentials_x5chain_cs_2_static_dh.h +0 -59
  294. package/external/libedhoc/tests/include/x509_chain_cs_2_static_dh/test_edhoc_handshake_x5chain_cs_2_static_dh_ead.h +0 -57
  295. package/external/libedhoc/tests/include/x509_hash_cs_2/authentication_credentials_x5t_cs_2.h +0 -60
  296. package/external/libedhoc/tests/include/x509_hash_cs_2/test_edhoc_handshake_x5t_cs_2_ead.h +0 -57
  297. package/external/libedhoc/tests/src/cipher_suites/test_cipher_suite_0.c +0 -475
  298. package/external/libedhoc/tests/src/cipher_suites/test_cipher_suite_2.c +0 -473
  299. package/external/libedhoc/tests/src/edhoc_trace_1/authentication_credentials_1.c +0 -252
  300. package/external/libedhoc/tests/src/edhoc_trace_1/test_edhoc_handshake_1.c +0 -1829
  301. package/external/libedhoc/tests/src/edhoc_trace_1/test_edhoc_handshake_ead_1.c +0 -1247
  302. package/external/libedhoc/tests/src/edhoc_trace_2/authentication_credentials_2.c +0 -170
  303. package/external/libedhoc/tests/src/edhoc_trace_2/test_edhoc_handshake_2.c +0 -1783
  304. package/external/libedhoc/tests/src/tests.c +0 -228
  305. package/external/libedhoc/tests/src/x509_chain_cs_0/authentication_credentials_x5chain_cs_0.c +0 -332
  306. package/external/libedhoc/tests/src/x509_chain_cs_0/test_edhoc_handshake_x5chain_cs_0.c +0 -936
  307. package/external/libedhoc/tests/src/x509_chain_cs_2/authentication_credentials_x5chain_cs_2.c +0 -166
  308. package/external/libedhoc/tests/src/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2.c +0 -587
  309. package/external/libedhoc/tests/src/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2_ead.c +0 -917
  310. package/external/libedhoc/tests/src/x509_chain_cs_2_static_dh/authentication_credentials_x5chain_cs_2_static_dh.c +0 -186
  311. package/external/libedhoc/tests/src/x509_chain_cs_2_static_dh/test_edhoc_handshake_x5chain_cs_2_static_dh_ead.c +0 -743
  312. package/external/libedhoc/tests/src/x509_hash_cs_2/authentication_credentials_x5t_cs_2.c +0 -261
  313. package/external/libedhoc/tests/src/x509_hash_cs_2/test_edhoc_handshake_x5t_cs_2_ead.c +0 -854
  314. package/src/EdhocExportAsyncWorker.cpp +0 -82
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Generated using zcbor version 0.7.0
2
+ * Generated using zcbor version 0.8.1
3
3
  * https://github.com/NordicSemiconductor/zcbor
4
4
  * Generated with a --default-max-qty of 3
5
5
  */
@@ -10,13 +10,14 @@
10
10
  #include <string.h>
11
11
  #include "zcbor_decode.h"
12
12
  #include "backend_cbor_id_cred_x_decode.h"
13
+ #include "zcbor_print.h"
13
14
 
14
15
  #if DEFAULT_MAX_QTY != 3
15
16
  #error "The type file was generated with a different default_max_qty than this file"
16
17
  #endif
17
18
 
18
- static bool decode_repeated_id_cred_x_kid(zcbor_state_t *state, struct id_cred_x_kid_ *result);
19
- static bool decode_COSE_X509(zcbor_state_t *state, struct COSE_X509_ *result);
19
+ static bool decode_repeated_id_cred_x_kid(zcbor_state_t *state, struct id_cred_x_kid_r *result);
20
+ static bool decode_COSE_X509(zcbor_state_t *state, struct COSE_X509_r *result);
20
21
  static bool decode_repeated_id_cred_x_x5chain(zcbor_state_t *state, struct id_cred_x_x5chain *result);
21
22
  static bool decode_COSE_CertHash(zcbor_state_t *state, struct COSE_CertHash *result);
22
23
  static bool decode_repeated_id_cred_x_x5t(zcbor_state_t *state, struct id_cred_x_x5t *result);
@@ -24,32 +25,40 @@ static bool decode_id_cred_x(zcbor_state_t *state, struct id_cred_x *result);
24
25
 
25
26
 
26
27
  static bool decode_repeated_id_cred_x_kid(
27
- zcbor_state_t *state, struct id_cred_x_kid_ *result)
28
+ zcbor_state_t *state, struct id_cred_x_kid_r *result)
28
29
  {
29
- zcbor_print("%s\r\n", __func__);
30
+ zcbor_log("%s\r\n", __func__);
30
31
  bool int_res;
31
32
 
32
33
  bool tmp_result = ((((zcbor_uint32_expect(state, (4))))
33
- && (zcbor_union_start_code(state) && (int_res = ((((zcbor_int32_decode(state, (&(*result)._id_cred_x_kid_int)))) && (((*result)._id_cred_x_kid_choice = _id_cred_x_kid_int), true))
34
- || (((zcbor_bstr_decode(state, (&(*result)._id_cred_x_kid_bstr)))) && (((*result)._id_cred_x_kid_choice = _id_cred_x_kid_bstr), true))), zcbor_union_end_code(state), int_res))));
35
-
36
- if (!tmp_result)
37
- zcbor_trace();
34
+ && (zcbor_union_start_code(state) && (int_res = ((((zcbor_int32_decode(state, (&(*result).id_cred_x_kid_int)))) && (((*result).id_cred_x_kid_choice = id_cred_x_kid_int_c), true))
35
+ || (((zcbor_bstr_decode(state, (&(*result).id_cred_x_kid_bstr)))) && (((*result).id_cred_x_kid_choice = id_cred_x_kid_bstr_c), true))), zcbor_union_end_code(state), int_res))));
36
+
37
+ if (!tmp_result) {
38
+ zcbor_trace_file(state);
39
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
40
+ } else {
41
+ zcbor_log("%s success\r\n", __func__);
42
+ }
38
43
 
39
44
  return tmp_result;
40
45
  }
41
46
 
42
47
  static bool decode_COSE_X509(
43
- zcbor_state_t *state, struct COSE_X509_ *result)
48
+ zcbor_state_t *state, struct COSE_X509_r *result)
44
49
  {
45
- zcbor_print("%s\r\n", __func__);
50
+ zcbor_log("%s\r\n", __func__);
46
51
  bool int_res;
47
52
 
48
- bool tmp_result = (((zcbor_union_start_code(state) && (int_res = ((((zcbor_bstr_decode(state, (&(*result)._COSE_X509_bstr)))) && (((*result)._COSE_X509_choice = _COSE_X509_bstr), true))
49
- || (zcbor_union_elem_code(state) && (((zcbor_list_start_decode(state) && ((zcbor_multi_decode(2, 3, &(*result)._COSE_X509__certs_certs_count, (zcbor_decoder_t *)zcbor_bstr_decode, state, (&(*result)._COSE_X509__certs_certs), sizeof(struct zcbor_string))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state))) && (((*result)._COSE_X509_choice = _COSE_X509__certs), true)))), zcbor_union_end_code(state), int_res))));
53
+ bool tmp_result = (((zcbor_union_start_code(state) && (int_res = ((((zcbor_bstr_decode(state, (&(*result).COSE_X509_bstr)))) && (((*result).COSE_X509_choice = COSE_X509_bstr_c), true))
54
+ || (zcbor_union_elem_code(state) && (((zcbor_list_start_decode(state) && ((zcbor_multi_decode(2, 3, &(*result).COSE_X509_certs_l_certs_count, (zcbor_decoder_t *)zcbor_bstr_decode, state, (&(*result).COSE_X509_certs_l_certs), sizeof(struct zcbor_string))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state))) && (((*result).COSE_X509_choice = COSE_X509_certs_l_c), true)))), zcbor_union_end_code(state), int_res))));
50
55
 
51
- if (!tmp_result)
52
- zcbor_trace();
56
+ if (!tmp_result) {
57
+ zcbor_trace_file(state);
58
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
59
+ } else {
60
+ zcbor_log("%s success\r\n", __func__);
61
+ }
53
62
 
54
63
  return tmp_result;
55
64
  }
@@ -57,13 +66,17 @@ static bool decode_COSE_X509(
57
66
  static bool decode_repeated_id_cred_x_x5chain(
58
67
  zcbor_state_t *state, struct id_cred_x_x5chain *result)
59
68
  {
60
- zcbor_print("%s\r\n", __func__);
69
+ zcbor_log("%s\r\n", __func__);
61
70
 
62
71
  bool tmp_result = ((((zcbor_uint32_expect(state, (33))))
63
- && (decode_COSE_X509(state, (&(*result)._id_cred_x_x5chain)))));
72
+ && (decode_COSE_X509(state, (&(*result).id_cred_x_x5chain)))));
64
73
 
65
- if (!tmp_result)
66
- zcbor_trace();
74
+ if (!tmp_result) {
75
+ zcbor_trace_file(state);
76
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
77
+ } else {
78
+ zcbor_log("%s success\r\n", __func__);
79
+ }
67
80
 
68
81
  return tmp_result;
69
82
  }
@@ -71,15 +84,19 @@ static bool decode_repeated_id_cred_x_x5chain(
71
84
  static bool decode_COSE_CertHash(
72
85
  zcbor_state_t *state, struct COSE_CertHash *result)
73
86
  {
74
- zcbor_print("%s\r\n", __func__);
87
+ zcbor_log("%s\r\n", __func__);
75
88
  bool int_res;
76
89
 
77
- bool tmp_result = (((zcbor_list_start_decode(state) && ((((zcbor_union_start_code(state) && (int_res = ((((zcbor_int32_decode(state, (&(*result)._COSE_CertHash_hashAlg_int)))) && (((*result)._COSE_CertHash_hashAlg_choice = _COSE_CertHash_hashAlg_int), true))
78
- || (((zcbor_tstr_decode(state, (&(*result)._COSE_CertHash_hashAlg_tstr)))) && (((*result)._COSE_CertHash_hashAlg_choice = _COSE_CertHash_hashAlg_tstr), true))), zcbor_union_end_code(state), int_res)))
79
- && ((zcbor_bstr_decode(state, (&(*result)._COSE_CertHash_hashValue))))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state))));
90
+ bool tmp_result = (((zcbor_list_start_decode(state) && ((((zcbor_union_start_code(state) && (int_res = ((((zcbor_int32_decode(state, (&(*result).COSE_CertHash_hashAlg_int)))) && (((*result).COSE_CertHash_hashAlg_choice = COSE_CertHash_hashAlg_int_c), true))
91
+ || (((zcbor_tstr_decode(state, (&(*result).COSE_CertHash_hashAlg_tstr)))) && (((*result).COSE_CertHash_hashAlg_choice = COSE_CertHash_hashAlg_tstr_c), true))), zcbor_union_end_code(state), int_res)))
92
+ && ((zcbor_bstr_decode(state, (&(*result).COSE_CertHash_hashValue))))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state))));
80
93
 
81
- if (!tmp_result)
82
- zcbor_trace();
94
+ if (!tmp_result) {
95
+ zcbor_trace_file(state);
96
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
97
+ } else {
98
+ zcbor_log("%s success\r\n", __func__);
99
+ }
83
100
 
84
101
  return tmp_result;
85
102
  }
@@ -87,13 +104,17 @@ static bool decode_COSE_CertHash(
87
104
  static bool decode_repeated_id_cred_x_x5t(
88
105
  zcbor_state_t *state, struct id_cred_x_x5t *result)
89
106
  {
90
- zcbor_print("%s\r\n", __func__);
107
+ zcbor_log("%s\r\n", __func__);
91
108
 
92
109
  bool tmp_result = ((((zcbor_uint32_expect(state, (34))))
93
- && (decode_COSE_CertHash(state, (&(*result)._id_cred_x_x5t)))));
110
+ && (decode_COSE_CertHash(state, (&(*result).id_cred_x_x5t)))));
94
111
 
95
- if (!tmp_result)
96
- zcbor_trace();
112
+ if (!tmp_result) {
113
+ zcbor_trace_file(state);
114
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
115
+ } else {
116
+ zcbor_log("%s success\r\n", __func__);
117
+ }
97
118
 
98
119
  return tmp_result;
99
120
  }
@@ -101,14 +122,18 @@ static bool decode_repeated_id_cred_x_x5t(
101
122
  static bool decode_id_cred_x(
102
123
  zcbor_state_t *state, struct id_cred_x *result)
103
124
  {
104
- zcbor_print("%s\r\n", __func__);
125
+ zcbor_log("%s\r\n", __func__);
105
126
 
106
- bool tmp_result = (((zcbor_map_start_decode(state) && ((zcbor_present_decode(&((*result)._id_cred_x_kid_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_kid, state, (&(*result)._id_cred_x_kid))
107
- && zcbor_present_decode(&((*result)._id_cred_x_x5chain_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_x5chain, state, (&(*result)._id_cred_x_x5chain))
108
- && zcbor_present_decode(&((*result)._id_cred_x_x5t_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_x5t, state, (&(*result)._id_cred_x_x5t))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state))));
127
+ bool tmp_result = (((zcbor_map_start_decode(state) && ((zcbor_present_decode(&((*result).id_cred_x_kid_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_kid, state, (&(*result).id_cred_x_kid))
128
+ && zcbor_present_decode(&((*result).id_cred_x_x5chain_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_x5chain, state, (&(*result).id_cred_x_x5chain))
129
+ && zcbor_present_decode(&((*result).id_cred_x_x5t_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_x5t, state, (&(*result).id_cred_x_x5t))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state))));
109
130
 
110
- if (!tmp_result)
111
- zcbor_trace();
131
+ if (!tmp_result) {
132
+ zcbor_trace_file(state);
133
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
134
+ } else {
135
+ zcbor_log("%s success\r\n", __func__);
136
+ }
112
137
 
113
138
  return tmp_result;
114
139
  }
@@ -122,20 +147,6 @@ int cbor_decode_id_cred_x(
122
147
  {
123
148
  zcbor_state_t states[5];
124
149
 
125
- zcbor_new_state(states, sizeof(states) / sizeof(zcbor_state_t), payload, payload_len, 1);
126
-
127
- bool ret = decode_id_cred_x(states, result);
128
-
129
- if (ret && (payload_len_out != NULL)) {
130
- *payload_len_out = MIN(payload_len,
131
- (size_t)states[0].payload - (size_t)payload);
132
- }
133
-
134
- if (!ret) {
135
- int err = zcbor_pop_error(states);
136
-
137
- zcbor_print("Return error: %d\r\n", err);
138
- return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
139
- }
140
- return ZCBOR_SUCCESS;
150
+ return zcbor_entry_function(payload, payload_len, (void *)result, payload_len_out, states,
151
+ (zcbor_decoder_t *)decode_id_cred_x, sizeof(states) / sizeof(zcbor_state_t), 1);
141
152
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Generated using zcbor version 0.7.0
2
+ * Generated using zcbor version 0.8.1
3
3
  * https://github.com/NordicSemiconductor/zcbor
4
4
  * Generated with a --default-max-qty of 3
5
5
  */
@@ -10,13 +10,14 @@
10
10
  #include <string.h>
11
11
  #include "zcbor_encode.h"
12
12
  #include "backend_cbor_id_cred_x_encode.h"
13
+ #include "zcbor_print.h"
13
14
 
14
15
  #if DEFAULT_MAX_QTY != 3
15
16
  #error "The type file was generated with a different default_max_qty than this file"
16
17
  #endif
17
18
 
18
- static bool encode_repeated_id_cred_x_kid(zcbor_state_t *state, const struct id_cred_x_kid_ *input);
19
- static bool encode_COSE_X509(zcbor_state_t *state, const struct COSE_X509_ *input);
19
+ static bool encode_repeated_id_cred_x_kid(zcbor_state_t *state, const struct id_cred_x_kid_r *input);
20
+ static bool encode_COSE_X509(zcbor_state_t *state, const struct COSE_X509_r *input);
20
21
  static bool encode_repeated_id_cred_x_x5chain(zcbor_state_t *state, const struct id_cred_x_x5chain *input);
21
22
  static bool encode_COSE_CertHash(zcbor_state_t *state, const struct COSE_CertHash *input);
22
23
  static bool encode_repeated_id_cred_x_x5t(zcbor_state_t *state, const struct id_cred_x_x5t *input);
@@ -24,32 +25,40 @@ static bool encode_id_cred_x(zcbor_state_t *state, const struct id_cred_x *input
24
25
 
25
26
 
26
27
  static bool encode_repeated_id_cred_x_kid(
27
- zcbor_state_t *state, const struct id_cred_x_kid_ *input)
28
+ zcbor_state_t *state, const struct id_cred_x_kid_r *input)
28
29
  {
29
- zcbor_print("%s\r\n", __func__);
30
+ zcbor_log("%s\r\n", __func__);
30
31
 
31
32
  bool tmp_result = ((((zcbor_uint32_put(state, (4))))
32
- && (((*input)._id_cred_x_kid_choice == _id_cred_x_kid_int) ? ((zcbor_int32_encode(state, (&(*input)._id_cred_x_kid_int))))
33
- : (((*input)._id_cred_x_kid_choice == _id_cred_x_kid_bstr) ? ((zcbor_bstr_encode(state, (&(*input)._id_cred_x_kid_bstr))))
33
+ && (((*input).id_cred_x_kid_choice == id_cred_x_kid_int_c) ? ((zcbor_int32_encode(state, (&(*input).id_cred_x_kid_int))))
34
+ : (((*input).id_cred_x_kid_choice == id_cred_x_kid_bstr_c) ? ((zcbor_bstr_encode(state, (&(*input).id_cred_x_kid_bstr))))
34
35
  : false))));
35
36
 
36
- if (!tmp_result)
37
- zcbor_trace();
37
+ if (!tmp_result) {
38
+ zcbor_trace_file(state);
39
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
40
+ } else {
41
+ zcbor_log("%s success\r\n", __func__);
42
+ }
38
43
 
39
44
  return tmp_result;
40
45
  }
41
46
 
42
47
  static bool encode_COSE_X509(
43
- zcbor_state_t *state, const struct COSE_X509_ *input)
48
+ zcbor_state_t *state, const struct COSE_X509_r *input)
44
49
  {
45
- zcbor_print("%s\r\n", __func__);
50
+ zcbor_log("%s\r\n", __func__);
46
51
 
47
- bool tmp_result = (((((*input)._COSE_X509_choice == _COSE_X509_bstr) ? ((zcbor_bstr_encode(state, (&(*input)._COSE_X509_bstr))))
48
- : (((*input)._COSE_X509_choice == _COSE_X509__certs) ? ((zcbor_list_start_encode(state, 3) && ((zcbor_multi_encode_minmax(2, 3, &(*input)._COSE_X509__certs_certs_count, (zcbor_encoder_t *)zcbor_bstr_encode, state, (&(*input)._COSE_X509__certs_certs), sizeof(struct zcbor_string))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 3)))
52
+ bool tmp_result = (((((*input).COSE_X509_choice == COSE_X509_bstr_c) ? ((zcbor_bstr_encode(state, (&(*input).COSE_X509_bstr))))
53
+ : (((*input).COSE_X509_choice == COSE_X509_certs_l_c) ? ((zcbor_list_start_encode(state, 3) && ((zcbor_multi_encode_minmax(2, 3, &(*input).COSE_X509_certs_l_certs_count, (zcbor_encoder_t *)zcbor_bstr_encode, state, (&(*input).COSE_X509_certs_l_certs), sizeof(struct zcbor_string))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 3)))
49
54
  : false))));
50
55
 
51
- if (!tmp_result)
52
- zcbor_trace();
56
+ if (!tmp_result) {
57
+ zcbor_trace_file(state);
58
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
59
+ } else {
60
+ zcbor_log("%s success\r\n", __func__);
61
+ }
53
62
 
54
63
  return tmp_result;
55
64
  }
@@ -57,13 +66,17 @@ static bool encode_COSE_X509(
57
66
  static bool encode_repeated_id_cred_x_x5chain(
58
67
  zcbor_state_t *state, const struct id_cred_x_x5chain *input)
59
68
  {
60
- zcbor_print("%s\r\n", __func__);
69
+ zcbor_log("%s\r\n", __func__);
61
70
 
62
71
  bool tmp_result = ((((zcbor_uint32_put(state, (33))))
63
- && (encode_COSE_X509(state, (&(*input)._id_cred_x_x5chain)))));
72
+ && (encode_COSE_X509(state, (&(*input).id_cred_x_x5chain)))));
64
73
 
65
- if (!tmp_result)
66
- zcbor_trace();
74
+ if (!tmp_result) {
75
+ zcbor_trace_file(state);
76
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
77
+ } else {
78
+ zcbor_log("%s success\r\n", __func__);
79
+ }
67
80
 
68
81
  return tmp_result;
69
82
  }
@@ -71,15 +84,19 @@ static bool encode_repeated_id_cred_x_x5chain(
71
84
  static bool encode_COSE_CertHash(
72
85
  zcbor_state_t *state, const struct COSE_CertHash *input)
73
86
  {
74
- zcbor_print("%s\r\n", __func__);
87
+ zcbor_log("%s\r\n", __func__);
75
88
 
76
- bool tmp_result = (((zcbor_list_start_encode(state, 2) && ((((((*input)._COSE_CertHash_hashAlg_choice == _COSE_CertHash_hashAlg_int) ? ((zcbor_int32_encode(state, (&(*input)._COSE_CertHash_hashAlg_int))))
77
- : (((*input)._COSE_CertHash_hashAlg_choice == _COSE_CertHash_hashAlg_tstr) ? ((zcbor_tstr_encode(state, (&(*input)._COSE_CertHash_hashAlg_tstr))))
89
+ bool tmp_result = (((zcbor_list_start_encode(state, 2) && ((((((*input).COSE_CertHash_hashAlg_choice == COSE_CertHash_hashAlg_int_c) ? ((zcbor_int32_encode(state, (&(*input).COSE_CertHash_hashAlg_int))))
90
+ : (((*input).COSE_CertHash_hashAlg_choice == COSE_CertHash_hashAlg_tstr_c) ? ((zcbor_tstr_encode(state, (&(*input).COSE_CertHash_hashAlg_tstr))))
78
91
  : false)))
79
- && ((zcbor_bstr_encode(state, (&(*input)._COSE_CertHash_hashValue))))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 2))));
92
+ && ((zcbor_bstr_encode(state, (&(*input).COSE_CertHash_hashValue))))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 2))));
80
93
 
81
- if (!tmp_result)
82
- zcbor_trace();
94
+ if (!tmp_result) {
95
+ zcbor_trace_file(state);
96
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
97
+ } else {
98
+ zcbor_log("%s success\r\n", __func__);
99
+ }
83
100
 
84
101
  return tmp_result;
85
102
  }
@@ -87,13 +104,17 @@ static bool encode_COSE_CertHash(
87
104
  static bool encode_repeated_id_cred_x_x5t(
88
105
  zcbor_state_t *state, const struct id_cred_x_x5t *input)
89
106
  {
90
- zcbor_print("%s\r\n", __func__);
107
+ zcbor_log("%s\r\n", __func__);
91
108
 
92
109
  bool tmp_result = ((((zcbor_uint32_put(state, (34))))
93
- && (encode_COSE_CertHash(state, (&(*input)._id_cred_x_x5t)))));
110
+ && (encode_COSE_CertHash(state, (&(*input).id_cred_x_x5t)))));
94
111
 
95
- if (!tmp_result)
96
- zcbor_trace();
112
+ if (!tmp_result) {
113
+ zcbor_trace_file(state);
114
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
115
+ } else {
116
+ zcbor_log("%s success\r\n", __func__);
117
+ }
97
118
 
98
119
  return tmp_result;
99
120
  }
@@ -101,14 +122,18 @@ static bool encode_repeated_id_cred_x_x5t(
101
122
  static bool encode_id_cred_x(
102
123
  zcbor_state_t *state, const struct id_cred_x *input)
103
124
  {
104
- zcbor_print("%s\r\n", __func__);
125
+ zcbor_log("%s\r\n", __func__);
105
126
 
106
- bool tmp_result = (((zcbor_map_start_encode(state, 3) && ((zcbor_present_encode(&((*input)._id_cred_x_kid_present), (zcbor_encoder_t *)encode_repeated_id_cred_x_kid, state, (&(*input)._id_cred_x_kid))
107
- && zcbor_present_encode(&((*input)._id_cred_x_x5chain_present), (zcbor_encoder_t *)encode_repeated_id_cred_x_x5chain, state, (&(*input)._id_cred_x_x5chain))
108
- && zcbor_present_encode(&((*input)._id_cred_x_x5t_present), (zcbor_encoder_t *)encode_repeated_id_cred_x_x5t, state, (&(*input)._id_cred_x_x5t))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_map_end_encode(state, 3))));
127
+ bool tmp_result = (((zcbor_map_start_encode(state, 3) && (((!(*input).id_cred_x_kid_present || encode_repeated_id_cred_x_kid(state, (&(*input).id_cred_x_kid)))
128
+ && (!(*input).id_cred_x_x5chain_present || encode_repeated_id_cred_x_x5chain(state, (&(*input).id_cred_x_x5chain)))
129
+ && (!(*input).id_cred_x_x5t_present || encode_repeated_id_cred_x_x5t(state, (&(*input).id_cred_x_x5t)))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_map_end_encode(state, 3))));
109
130
 
110
- if (!tmp_result)
111
- zcbor_trace();
131
+ if (!tmp_result) {
132
+ zcbor_trace_file(state);
133
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
134
+ } else {
135
+ zcbor_log("%s success\r\n", __func__);
136
+ }
112
137
 
113
138
  return tmp_result;
114
139
  }
@@ -122,20 +147,6 @@ int cbor_encode_id_cred_x(
122
147
  {
123
148
  zcbor_state_t states[5];
124
149
 
125
- zcbor_new_state(states, sizeof(states) / sizeof(zcbor_state_t), payload, payload_len, 1);
126
-
127
- bool ret = encode_id_cred_x(states, input);
128
-
129
- if (ret && (payload_len_out != NULL)) {
130
- *payload_len_out = MIN(payload_len,
131
- (size_t)states[0].payload - (size_t)payload);
132
- }
133
-
134
- if (!ret) {
135
- int err = zcbor_pop_error(states);
136
-
137
- zcbor_print("Return error: %d\r\n", err);
138
- return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
139
- }
140
- return ZCBOR_SUCCESS;
150
+ return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states,
151
+ (zcbor_decoder_t *)encode_id_cred_x, sizeof(states) / sizeof(zcbor_state_t), 1);
141
152
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Generated using zcbor version 0.7.0
2
+ * Generated using zcbor version 0.8.1
3
3
  * https://github.com/NordicSemiconductor/zcbor
4
4
  * Generated with a --default-max-qty of 3
5
5
  */
@@ -10,6 +10,7 @@
10
10
  #include <string.h>
11
11
  #include "zcbor_decode.h"
12
12
  #include "backend_cbor_info_decode.h"
13
+ #include "zcbor_print.h"
13
14
 
14
15
  #if DEFAULT_MAX_QTY != 3
15
16
  #error "The type file was generated with a different default_max_qty than this file"
@@ -21,14 +22,18 @@ static bool decode_info(zcbor_state_t *state, struct info *result);
21
22
  static bool decode_info(
22
23
  zcbor_state_t *state, struct info *result)
23
24
  {
24
- zcbor_print("%s\r\n", __func__);
25
+ zcbor_log("%s\r\n", __func__);
25
26
 
26
- bool tmp_result = (((((zcbor_int32_decode(state, (&(*result)._info_label))))
27
- && ((zcbor_bstr_decode(state, (&(*result)._info_context))))
28
- && ((zcbor_uint32_decode(state, (&(*result)._info_length)))))));
27
+ bool tmp_result = (((((zcbor_int32_decode(state, (&(*result).info_label))))
28
+ && ((zcbor_bstr_decode(state, (&(*result).info_context))))
29
+ && ((zcbor_uint32_decode(state, (&(*result).info_length)))))));
29
30
 
30
- if (!tmp_result)
31
- zcbor_trace();
31
+ if (!tmp_result) {
32
+ zcbor_trace_file(state);
33
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
34
+ } else {
35
+ zcbor_log("%s success\r\n", __func__);
36
+ }
32
37
 
33
38
  return tmp_result;
34
39
  }
@@ -42,20 +47,6 @@ int cbor_decode_info(
42
47
  {
43
48
  zcbor_state_t states[2];
44
49
 
45
- zcbor_new_state(states, sizeof(states) / sizeof(zcbor_state_t), payload, payload_len, 3);
46
-
47
- bool ret = decode_info(states, result);
48
-
49
- if (ret && (payload_len_out != NULL)) {
50
- *payload_len_out = MIN(payload_len,
51
- (size_t)states[0].payload - (size_t)payload);
52
- }
53
-
54
- if (!ret) {
55
- int err = zcbor_pop_error(states);
56
-
57
- zcbor_print("Return error: %d\r\n", err);
58
- return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
59
- }
60
- return ZCBOR_SUCCESS;
50
+ return zcbor_entry_function(payload, payload_len, (void *)result, payload_len_out, states,
51
+ (zcbor_decoder_t *)decode_info, sizeof(states) / sizeof(zcbor_state_t), 3);
61
52
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Generated using zcbor version 0.7.0
2
+ * Generated using zcbor version 0.8.1
3
3
  * https://github.com/NordicSemiconductor/zcbor
4
4
  * Generated with a --default-max-qty of 3
5
5
  */
@@ -10,6 +10,7 @@
10
10
  #include <string.h>
11
11
  #include "zcbor_encode.h"
12
12
  #include "backend_cbor_info_encode.h"
13
+ #include "zcbor_print.h"
13
14
 
14
15
  #if DEFAULT_MAX_QTY != 3
15
16
  #error "The type file was generated with a different default_max_qty than this file"
@@ -21,14 +22,18 @@ static bool encode_info(zcbor_state_t *state, const struct info *input);
21
22
  static bool encode_info(
22
23
  zcbor_state_t *state, const struct info *input)
23
24
  {
24
- zcbor_print("%s\r\n", __func__);
25
+ zcbor_log("%s\r\n", __func__);
25
26
 
26
- bool tmp_result = (((((zcbor_int32_encode(state, (&(*input)._info_label))))
27
- && ((zcbor_bstr_encode(state, (&(*input)._info_context))))
28
- && ((zcbor_uint32_encode(state, (&(*input)._info_length)))))));
27
+ bool tmp_result = (((((zcbor_int32_encode(state, (&(*input).info_label))))
28
+ && ((zcbor_bstr_encode(state, (&(*input).info_context))))
29
+ && ((zcbor_uint32_encode(state, (&(*input).info_length)))))));
29
30
 
30
- if (!tmp_result)
31
- zcbor_trace();
31
+ if (!tmp_result) {
32
+ zcbor_trace_file(state);
33
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
34
+ } else {
35
+ zcbor_log("%s success\r\n", __func__);
36
+ }
32
37
 
33
38
  return tmp_result;
34
39
  }
@@ -42,20 +47,6 @@ int cbor_encode_info(
42
47
  {
43
48
  zcbor_state_t states[2];
44
49
 
45
- zcbor_new_state(states, sizeof(states) / sizeof(zcbor_state_t), payload, payload_len, 3);
46
-
47
- bool ret = encode_info(states, input);
48
-
49
- if (ret && (payload_len_out != NULL)) {
50
- *payload_len_out = MIN(payload_len,
51
- (size_t)states[0].payload - (size_t)payload);
52
- }
53
-
54
- if (!ret) {
55
- int err = zcbor_pop_error(states);
56
-
57
- zcbor_print("Return error: %d\r\n", err);
58
- return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
59
- }
60
- return ZCBOR_SUCCESS;
50
+ return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states,
51
+ (zcbor_decoder_t *)encode_info, sizeof(states) / sizeof(zcbor_state_t), 3);
61
52
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Generated using zcbor version 0.7.0
2
+ * Generated using zcbor version 0.8.1
3
3
  * https://github.com/NordicSemiconductor/zcbor
4
4
  * Generated with a --default-max-qty of 3
5
5
  */
@@ -10,6 +10,7 @@
10
10
  #include <string.h>
11
11
  #include "zcbor_decode.h"
12
12
  #include "backend_cbor_int_type_decode.h"
13
+ #include "zcbor_print.h"
13
14
 
14
15
  #if DEFAULT_MAX_QTY != 3
15
16
  #error "The type file was generated with a different default_max_qty than this file"
@@ -21,12 +22,16 @@ static bool decode_integer_type_int_type(zcbor_state_t *state, int32_t *result);
21
22
  static bool decode_integer_type_int_type(
22
23
  zcbor_state_t *state, int32_t *result)
23
24
  {
24
- zcbor_print("%s\r\n", __func__);
25
+ zcbor_log("%s\r\n", __func__);
25
26
 
26
27
  bool tmp_result = (((zcbor_int32_decode(state, (&(*result))))));
27
28
 
28
- if (!tmp_result)
29
- zcbor_trace();
29
+ if (!tmp_result) {
30
+ zcbor_trace_file(state);
31
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
32
+ } else {
33
+ zcbor_log("%s success\r\n", __func__);
34
+ }
30
35
 
31
36
  return tmp_result;
32
37
  }
@@ -40,20 +45,6 @@ int cbor_decode_integer_type_int_type(
40
45
  {
41
46
  zcbor_state_t states[2];
42
47
 
43
- zcbor_new_state(states, sizeof(states) / sizeof(zcbor_state_t), payload, payload_len, 1);
44
-
45
- bool ret = decode_integer_type_int_type(states, result);
46
-
47
- if (ret && (payload_len_out != NULL)) {
48
- *payload_len_out = MIN(payload_len,
49
- (size_t)states[0].payload - (size_t)payload);
50
- }
51
-
52
- if (!ret) {
53
- int err = zcbor_pop_error(states);
54
-
55
- zcbor_print("Return error: %d\r\n", err);
56
- return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
57
- }
58
- return ZCBOR_SUCCESS;
48
+ return zcbor_entry_function(payload, payload_len, (void *)result, payload_len_out, states,
49
+ (zcbor_decoder_t *)decode_integer_type_int_type, sizeof(states) / sizeof(zcbor_state_t), 1);
59
50
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Generated using zcbor version 0.7.0
2
+ * Generated using zcbor version 0.8.1
3
3
  * https://github.com/NordicSemiconductor/zcbor
4
4
  * Generated with a --default-max-qty of 3
5
5
  */
@@ -10,6 +10,7 @@
10
10
  #include <string.h>
11
11
  #include "zcbor_encode.h"
12
12
  #include "backend_cbor_int_type_encode.h"
13
+ #include "zcbor_print.h"
13
14
 
14
15
  #if DEFAULT_MAX_QTY != 3
15
16
  #error "The type file was generated with a different default_max_qty than this file"
@@ -21,12 +22,16 @@ static bool encode_integer_type_int_type(zcbor_state_t *state, const int32_t *in
21
22
  static bool encode_integer_type_int_type(
22
23
  zcbor_state_t *state, const int32_t *input)
23
24
  {
24
- zcbor_print("%s\r\n", __func__);
25
+ zcbor_log("%s\r\n", __func__);
25
26
 
26
27
  bool tmp_result = (((zcbor_int32_encode(state, (&(*input))))));
27
28
 
28
- if (!tmp_result)
29
- zcbor_trace();
29
+ if (!tmp_result) {
30
+ zcbor_trace_file(state);
31
+ zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
32
+ } else {
33
+ zcbor_log("%s success\r\n", __func__);
34
+ }
30
35
 
31
36
  return tmp_result;
32
37
  }
@@ -40,20 +45,6 @@ int cbor_encode_integer_type_int_type(
40
45
  {
41
46
  zcbor_state_t states[2];
42
47
 
43
- zcbor_new_state(states, sizeof(states) / sizeof(zcbor_state_t), payload, payload_len, 1);
44
-
45
- bool ret = encode_integer_type_int_type(states, input);
46
-
47
- if (ret && (payload_len_out != NULL)) {
48
- *payload_len_out = MIN(payload_len,
49
- (size_t)states[0].payload - (size_t)payload);
50
- }
51
-
52
- if (!ret) {
53
- int err = zcbor_pop_error(states);
54
-
55
- zcbor_print("Return error: %d\r\n", err);
56
- return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
57
- }
58
- return ZCBOR_SUCCESS;
48
+ return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states,
49
+ (zcbor_decoder_t *)encode_integer_type_int_type, sizeof(states) / sizeof(zcbor_state_t), 1);
59
50
  }