edhoc 1.0.5 → 1.1.1
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.
- package/README.md +170 -0
- package/binding.gyp +13 -11
- package/dist/crypto.d.ts +9 -2
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +112 -84
- package/dist/edhoc.d.ts +31 -9
- package/dist/edhoc.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/x509credentials.d.ts +20 -0
- package/dist/x509credentials.d.ts.map +1 -0
- package/dist/x509credentials.js +140 -0
- package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_types.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_ead_decode.h +2 -2
- package/external/libedhoc/backends/cbor/include/backend_cbor_ead_encode.h +2 -2
- package/external/libedhoc/backends/cbor/include/backend_cbor_edhoc_types.h +48 -43
- package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_types.h +3 -3
- package/external/libedhoc/backends/cbor/include/backend_cbor_id_cred_x_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_id_cred_x_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_info_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_info_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_types.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_1_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_1_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_2_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_2_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_3_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_3_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_4_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_4_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_error_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_error_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_2_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_2_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_3_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_3_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_4_decode.h +3 -3
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_4_encode.h +3 -3
- package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_types.h +4 -4
- package/external/libedhoc/backends/cbor/include/backend_cbor_x509_types.h +93 -83
- package/external/libedhoc/backends/cbor/src/backend_cbor_bstr_type_decode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_bstr_type_encode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_ead_decode.c +27 -32
- package/external/libedhoc/backends/cbor/src/backend_cbor_ead_encode.c +27 -32
- package/external/libedhoc/backends/cbor/src/backend_cbor_enc_structure_decode.c +14 -23
- package/external/libedhoc/backends/cbor/src/backend_cbor_enc_structure_encode.c +14 -23
- package/external/libedhoc/backends/cbor/src/backend_cbor_id_cred_x_decode.c +63 -52
- package/external/libedhoc/backends/cbor/src/backend_cbor_id_cred_x_encode.c +62 -51
- package/external/libedhoc/backends/cbor/src/backend_cbor_info_decode.c +14 -23
- package/external/libedhoc/backends/cbor/src/backend_cbor_info_encode.c +14 -23
- package/external/libedhoc/backends/cbor/src/backend_cbor_int_type_decode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_int_type_encode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_1_decode.c +54 -51
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_1_encode.c +54 -51
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_2_decode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_2_encode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_3_decode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_3_encode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_4_decode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_4_encode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_error_decode.c +36 -37
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_error_encode.c +36 -37
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_2_decode.c +103 -80
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_2_encode.c +102 -79
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_3_decode.c +99 -76
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_3_encode.c +98 -75
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_4_decode.c +40 -41
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_4_encode.c +40 -41
- package/external/libedhoc/backends/cbor/src/backend_cbor_sig_structure_decode.c +15 -24
- package/external/libedhoc/backends/cbor/src/backend_cbor_sig_structure_encode.c +15 -24
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode.c +31 -0
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode.h +10 -0
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode2.c +18 -0
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode2.h +9 -0
- package/external/libedhoc/externals/Unity/examples/example_1/test/TestProductionCode.c +69 -0
- package/external/libedhoc/externals/Unity/examples/example_1/test/TestProductionCode2.c +38 -0
- package/external/libedhoc/externals/Unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
- package/external/libedhoc/externals/Unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode.c +31 -0
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode.h +10 -0
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode2.c +18 -0
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode2.h +9 -0
- package/external/libedhoc/externals/Unity/examples/example_2/test/TestProductionCode.c +71 -0
- package/external/libedhoc/externals/Unity/examples/example_2/test/TestProductionCode2.c +40 -0
- package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +16 -0
- package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +18 -0
- package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/all_tests.c +19 -0
- package/external/libedhoc/externals/Unity/examples/example_3/helper/UnityHelper.c +17 -0
- package/external/libedhoc/externals/Unity/examples/example_3/helper/UnityHelper.h +19 -0
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode.c +31 -0
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode.h +10 -0
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode2.c +18 -0
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode2.h +9 -0
- package/external/libedhoc/externals/Unity/examples/example_3/test/TestProductionCode.c +69 -0
- package/external/libedhoc/externals/Unity/examples/example_3/test/TestProductionCode2.c +38 -0
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode.c +31 -0
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode.h +10 -0
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode2.c +18 -0
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode2.h +9 -0
- package/external/libedhoc/externals/Unity/examples/example_4/test/TestProductionCode.c +70 -0
- package/external/libedhoc/externals/Unity/examples/example_4/test/TestProductionCode2.c +42 -0
- package/external/libedhoc/externals/Unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +53 -0
- package/external/libedhoc/externals/Unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +57 -0
- package/external/libedhoc/externals/Unity/examples/unity_config.h +251 -0
- package/external/libedhoc/externals/Unity/extras/bdd/src/unity_bdd.h +44 -0
- package/external/libedhoc/externals/Unity/extras/bdd/test/test_bdd.c +129 -0
- package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture.c +310 -0
- package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture.h +95 -0
- package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture_internals.h +51 -0
- package/external/libedhoc/externals/Unity/extras/fixture/test/main/AllTests.c +20 -0
- package/external/libedhoc/externals/Unity/extras/fixture/test/template_fixture_tests.c +40 -0
- package/external/libedhoc/externals/Unity/extras/fixture/test/unity_fixture_Test.c +246 -0
- package/external/libedhoc/externals/Unity/extras/fixture/test/unity_fixture_TestRunner.c +33 -0
- package/external/libedhoc/externals/Unity/extras/memory/src/unity_memory.c +203 -0
- package/external/libedhoc/externals/Unity/extras/memory/src/unity_memory.h +61 -0
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_memory_Test.c +326 -0
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_memory_TestRunner.c +50 -0
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_output_Spy.c +57 -0
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_output_Spy.h +17 -0
- package/external/libedhoc/externals/Unity/src/unity.c +2501 -0
- package/external/libedhoc/externals/Unity/src/unity.h +698 -0
- package/external/libedhoc/externals/Unity/src/unity_internals.h +1183 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_cmd.c +61 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_def.c +57 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_head1.c +55 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_head1.h +15 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_cmd.c +80 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_def.c +76 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_head1.c +75 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_head1.h +13 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_new1.c +89 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_new2.c +89 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_param.c +77 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_run1.c +89 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_run2.c +89 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_yaml.c +90 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_new1.c +67 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_new2.c +70 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_param.c +58 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_run1.c +67 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_run2.c +70 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_yaml.c +71 -0
- package/external/libedhoc/externals/Unity/test/testdata/CException.h +18 -0
- package/external/libedhoc/externals/Unity/test/testdata/Defs.h +16 -0
- package/external/libedhoc/externals/Unity/test/testdata/cmock.h +21 -0
- package/external/libedhoc/externals/Unity/test/testdata/mockMock.h +20 -0
- package/external/libedhoc/externals/Unity/test/testdata/testRunnerGenerator.c +204 -0
- package/external/libedhoc/externals/Unity/test/testdata/testRunnerGeneratorSmall.c +73 -0
- package/external/libedhoc/externals/Unity/test/testdata/testRunnerGeneratorWithMocks.c +200 -0
- package/external/libedhoc/externals/Unity/test/tests/self_assessment_utils.h +151 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_arrays.c +2941 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_core.c +375 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_doubles.c +1285 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_floats.c +1395 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_integers.c +2863 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_integers_64.c +783 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_memory.c +82 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_parameterized.c +309 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_parameterizedDemo.c +28 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_strings.c +330 -0
- package/external/libedhoc/externals/Unity/test/tests/types_for_test.h +21 -0
- package/external/libedhoc/externals/zcbor/include/zcbor_common.h +147 -60
- package/external/libedhoc/externals/zcbor/include/zcbor_decode.h +291 -202
- package/external/libedhoc/externals/zcbor/include/zcbor_encode.h +100 -156
- package/external/libedhoc/externals/zcbor/include/zcbor_print.h +165 -0
- package/external/libedhoc/externals/zcbor/samples/hello_world/src/main.c +1 -1
- package/external/libedhoc/externals/zcbor/samples/pet/include/pet_decode.h +1 -1
- package/external/libedhoc/externals/zcbor/samples/pet/include/pet_encode.h +1 -1
- package/external/libedhoc/externals/zcbor/samples/pet/include/pet_types.h +4 -4
- package/external/libedhoc/externals/zcbor/samples/pet/src/main.c +4 -4
- package/external/libedhoc/externals/zcbor/samples/pet/src/pet_decode.c +15 -24
- package/external/libedhoc/externals/zcbor/samples/pet/src/pet_encode.c +14 -23
- package/external/libedhoc/externals/zcbor/src/zcbor_common.c +202 -29
- package/external/libedhoc/externals/zcbor/src/zcbor_decode.c +633 -173
- package/external/libedhoc/externals/zcbor/src/zcbor_encode.c +71 -184
- package/external/libedhoc/externals/zcbor/tests/decode/test1_suit_old_formats/src/main.c +152 -153
- package/external/libedhoc/externals/zcbor/tests/decode/test2_suit/src/main.c +64 -64
- package/external/libedhoc/externals/zcbor/tests/decode/test3_simple/src/main.c +15 -16
- package/external/libedhoc/externals/zcbor/tests/decode/test5_corner_cases/src/main.c +228 -84
- package/external/libedhoc/externals/zcbor/tests/decode/test7_suit9_simple/src/main.c +9 -9
- package/external/libedhoc/externals/zcbor/tests/decode/test8_suit12/src/main.c +0 -1
- package/external/libedhoc/externals/zcbor/tests/decode/test9_manifest14/src/main.c +172 -173
- package/external/libedhoc/externals/zcbor/tests/encode/test1_suit/src/main.c +73 -73
- package/external/libedhoc/externals/zcbor/tests/encode/test2_simple/src/main.c +1 -2
- package/external/libedhoc/externals/zcbor/tests/encode/test3_corner_cases/src/main.c +83 -56
- package/external/libedhoc/externals/zcbor/tests/encode/test4_senml/src/main.c +15 -16
- package/external/libedhoc/externals/zcbor/tests/fuzz/fuzz_everything.c +12 -0
- package/external/libedhoc/externals/zcbor/tests/fuzz/fuzz_manifest12.c +69 -69
- package/external/libedhoc/externals/zcbor/tests/unit/test1_unit_tests/src/main.c +448 -55
- package/external/libedhoc/externals/zcbor/tests/unit/test3_float16/src/main.c +49 -48
- package/external/libedhoc/include/edhoc.h +348 -54
- package/external/libedhoc/include/edhoc_common.h +289 -0
- package/external/libedhoc/include/edhoc_context.h +60 -35
- package/external/libedhoc/include/edhoc_credentials.h +55 -7
- package/external/libedhoc/include/edhoc_crypto.h +10 -10
- package/external/libedhoc/include/edhoc_ead.h +13 -10
- package/external/libedhoc/include/edhoc_macros.h +20 -11
- package/external/libedhoc/include/edhoc_values.h +2 -2
- package/external/libedhoc/library/edhoc.c +70 -36
- package/external/libedhoc/library/edhoc_common.c +1314 -0
- package/external/libedhoc/library/edhoc_exporter.c +45 -46
- package/external/libedhoc/library/edhoc_message_1.c +107 -72
- package/external/libedhoc/library/edhoc_message_2.c +396 -1693
- package/external/libedhoc/library/edhoc_message_3.c +465 -1656
- package/external/libedhoc/library/edhoc_message_4.c +93 -91
- package/external/libedhoc/library/edhoc_message_error.c +41 -41
- package/external/libedhoc/tests/include/{cipher_suites/cipher_suite_0.h → cipher_suite_0.h} +131 -134
- package/external/libedhoc/tests/include/{cipher_suites/cipher_suite_2.h → cipher_suite_2.h} +139 -140
- package/external/libedhoc/tests/include/{edhoc_trace_1/test_vector_1.h → test_vector_rfc9529_chapter_2.h} +786 -738
- package/external/libedhoc/tests/include/{edhoc_trace_2/test_vector_2.h → test_vector_rfc9529_chapter_3.h} +14 -10
- 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
- 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
- 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
- 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
- package/external/libedhoc/tests/src/{cipher_suites/cipher_suite_0.c → cipher_suite_0.c} +445 -447
- package/external/libedhoc/tests/src/{cipher_suites/cipher_suite_2.c → cipher_suite_2.c} +600 -600
- package/external/libedhoc/tests/src/module_test_api.c +430 -0
- package/external/libedhoc/tests/src/module_test_cipher_suite_0.c +395 -0
- package/external/libedhoc/tests/src/module_test_cipher_suite_2.c +392 -0
- package/external/libedhoc/tests/src/{error_message/test_edhoc_error_message.c → module_test_error_message.c} +94 -69
- package/external/libedhoc/tests/src/module_test_main.c +49 -0
- package/external/libedhoc/tests/src/{cipher_suite_negotiation/test_edhoc_cipher_suite_negotiation.c → module_test_rfc9528_suites_negotiation.c} +224 -227
- package/external/libedhoc/tests/src/module_test_rfc9529_chapter_2.c +2681 -0
- package/external/libedhoc/tests/src/module_test_rfc9529_chapter_3.c +1635 -0
- package/external/libedhoc/tests/src/module_test_x5chain_sign_keys_suite_0.c +1135 -0
- package/external/libedhoc/tests/src/module_test_x5chain_sign_keys_suite_2.c +1249 -0
- package/external/libedhoc/tests/src/module_test_x5chain_static_dh_keys_suite_2.c +798 -0
- package/external/libedhoc/tests/src/module_test_x5t_sign_keys_suite_2.c +956 -0
- package/include/EdhocComposeAsyncWorker.h +8 -6
- package/include/EdhocCredentialManager.h +16 -11
- package/include/EdhocCryptoManager.h +28 -21
- package/include/EdhocEadManager.h +3 -6
- package/include/{EdhocExportAsyncWorker.h → EdhocExportOscoreAsyncWorker.h} +20 -17
- package/include/EdhocKeyExporterAsyncWorker.h +76 -0
- package/include/EdhocKeyUpdateAsyncWorker.h +72 -0
- package/include/EdhocProcessAsyncWorker.h +14 -10
- package/include/LibEDHOC.h +44 -20
- package/include/UserContext.h +7 -9
- package/include/Utils.h +31 -27
- package/package.json +14 -3
- package/prebuilds/android-arm/edhoc.armv7.node +0 -0
- package/prebuilds/android-arm64/edhoc.armv8.node +0 -0
- package/prebuilds/darwin-arm64/edhoc.node +0 -0
- package/prebuilds/darwin-x64/edhoc.node +0 -0
- package/prebuilds/linux-arm/edhoc.armv6.node +0 -0
- package/prebuilds/linux-arm/edhoc.armv7.node +0 -0
- package/prebuilds/linux-arm64/edhoc.armv8.node +0 -0
- package/prebuilds/linux-x64/edhoc.glibc.node +0 -0
- package/prebuilds/linux-x64/edhoc.musl.node +0 -0
- package/prebuilds/win32-ia32/edhoc.node +0 -0
- package/prebuilds/win32-x64/edhoc.node +0 -0
- package/src/EdhocComposeAsyncWorker.cpp +18 -35
- package/src/EdhocCredentialManager.cpp +160 -187
- package/src/EdhocCryptoManager.cpp +386 -586
- package/src/EdhocEadManager.cpp +10 -18
- package/src/EdhocExportOscoreAsyncWorker.cpp +77 -0
- package/src/EdhocKeyExporterAsyncWorker.cpp +49 -0
- package/src/EdhocKeyUpdateAsyncWorker.cpp +41 -0
- package/src/EdhocProcessAsyncWorker.cpp +72 -19
- package/src/LibEDHOC.cpp +213 -174
- package/src/Suites.cpp +39 -72
- package/src/Utils.cpp +32 -56
- package/test/basic.test.ts +64 -0
- package/test/vectors.test.ts +111 -0
- package/dist/credentials.d.ts +0 -16
- package/dist/credentials.d.ts.map +0 -1
- package/dist/credentials.js +0 -84
- package/external/libedhoc/externals/zcbor/include/zcbor_debug.h +0 -69
- package/external/libedhoc/tests/include/cipher_suite_negotiation/test_edhoc_cipher_suite_negotiation.h +0 -37
- package/external/libedhoc/tests/include/cipher_suites/test_cipher_suite_0.h +0 -48
- package/external/libedhoc/tests/include/cipher_suites/test_cipher_suite_2.h +0 -48
- package/external/libedhoc/tests/include/edhoc_trace_1/authentication_credentials_1.h +0 -60
- package/external/libedhoc/tests/include/edhoc_trace_1/test_edhoc_handshake_1.h +0 -208
- package/external/libedhoc/tests/include/edhoc_trace_1/test_edhoc_handshake_ead_1.h +0 -59
- package/external/libedhoc/tests/include/edhoc_trace_2/authentication_credentials_2.h +0 -60
- package/external/libedhoc/tests/include/edhoc_trace_2/test_edhoc_handshake_2.h +0 -199
- package/external/libedhoc/tests/include/error_message/test_edhoc_error_message.h +0 -48
- package/external/libedhoc/tests/include/x509_chain_cs_0/authentication_credentials_x5chain_cs_0.h +0 -92
- package/external/libedhoc/tests/include/x509_chain_cs_0/test_edhoc_handshake_x5chain_cs_0.h +0 -96
- package/external/libedhoc/tests/include/x509_chain_cs_2/authentication_credentials_x5chain_cs_2.h +0 -58
- package/external/libedhoc/tests/include/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2.h +0 -56
- package/external/libedhoc/tests/include/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2_ead.h +0 -57
- package/external/libedhoc/tests/include/x509_chain_cs_2_static_dh/authentication_credentials_x5chain_cs_2_static_dh.h +0 -59
- package/external/libedhoc/tests/include/x509_chain_cs_2_static_dh/test_edhoc_handshake_x5chain_cs_2_static_dh_ead.h +0 -57
- package/external/libedhoc/tests/include/x509_hash_cs_2/authentication_credentials_x5t_cs_2.h +0 -60
- package/external/libedhoc/tests/include/x509_hash_cs_2/test_edhoc_handshake_x5t_cs_2_ead.h +0 -57
- package/external/libedhoc/tests/src/cipher_suites/test_cipher_suite_0.c +0 -475
- package/external/libedhoc/tests/src/cipher_suites/test_cipher_suite_2.c +0 -473
- package/external/libedhoc/tests/src/edhoc_trace_1/authentication_credentials_1.c +0 -252
- package/external/libedhoc/tests/src/edhoc_trace_1/test_edhoc_handshake_1.c +0 -1829
- package/external/libedhoc/tests/src/edhoc_trace_1/test_edhoc_handshake_ead_1.c +0 -1247
- package/external/libedhoc/tests/src/edhoc_trace_2/authentication_credentials_2.c +0 -170
- package/external/libedhoc/tests/src/edhoc_trace_2/test_edhoc_handshake_2.c +0 -1783
- package/external/libedhoc/tests/src/tests.c +0 -228
- package/external/libedhoc/tests/src/x509_chain_cs_0/authentication_credentials_x5chain_cs_0.c +0 -332
- package/external/libedhoc/tests/src/x509_chain_cs_0/test_edhoc_handshake_x5chain_cs_0.c +0 -936
- package/external/libedhoc/tests/src/x509_chain_cs_2/authentication_credentials_x5chain_cs_2.c +0 -166
- package/external/libedhoc/tests/src/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2.c +0 -587
- package/external/libedhoc/tests/src/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2_ead.c +0 -917
- package/external/libedhoc/tests/src/x509_chain_cs_2_static_dh/authentication_credentials_x5chain_cs_2_static_dh.c +0 -186
- package/external/libedhoc/tests/src/x509_chain_cs_2_static_dh/test_edhoc_handshake_x5chain_cs_2_static_dh_ead.c +0 -743
- package/external/libedhoc/tests/src/x509_hash_cs_2/authentication_credentials_x5t_cs_2.c +0 -261
- package/external/libedhoc/tests/src/x509_hash_cs_2/test_edhoc_handshake_x5t_cs_2_ead.c +0 -854
- package/src/EdhocExportAsyncWorker.cpp +0 -82
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Generated using zcbor version 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
|
*/
|
|
@@ -25,142 +25,152 @@ extern "C" {
|
|
|
25
25
|
*/
|
|
26
26
|
#define DEFAULT_MAX_QTY 3
|
|
27
27
|
|
|
28
|
-
struct
|
|
28
|
+
struct id_cred_x_kid_r {
|
|
29
29
|
union {
|
|
30
|
-
int32_t
|
|
31
|
-
struct zcbor_string
|
|
30
|
+
int32_t id_cred_x_kid_int;
|
|
31
|
+
struct zcbor_string id_cred_x_kid_bstr;
|
|
32
32
|
};
|
|
33
33
|
enum {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
34
|
+
id_cred_x_kid_int_c,
|
|
35
|
+
id_cred_x_kid_bstr_c,
|
|
36
|
+
} id_cred_x_kid_choice;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
struct
|
|
39
|
+
struct COSE_X509_r {
|
|
40
40
|
union {
|
|
41
|
-
struct zcbor_string
|
|
41
|
+
struct zcbor_string COSE_X509_bstr;
|
|
42
42
|
struct {
|
|
43
|
-
struct zcbor_string
|
|
44
|
-
size_t
|
|
43
|
+
struct zcbor_string COSE_X509_certs_l_certs[3];
|
|
44
|
+
size_t COSE_X509_certs_l_certs_count;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
enum {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
48
|
+
COSE_X509_bstr_c,
|
|
49
|
+
COSE_X509_certs_l_c,
|
|
50
|
+
} COSE_X509_choice;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
struct id_cred_x_x5chain {
|
|
54
|
-
struct
|
|
54
|
+
struct COSE_X509_r id_cred_x_x5chain;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
struct COSE_CertHash {
|
|
58
58
|
union {
|
|
59
|
-
int32_t
|
|
60
|
-
struct zcbor_string
|
|
59
|
+
int32_t COSE_CertHash_hashAlg_int;
|
|
60
|
+
struct zcbor_string COSE_CertHash_hashAlg_tstr;
|
|
61
61
|
};
|
|
62
62
|
enum {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
struct zcbor_string
|
|
63
|
+
COSE_CertHash_hashAlg_int_c,
|
|
64
|
+
COSE_CertHash_hashAlg_tstr_c,
|
|
65
|
+
} COSE_CertHash_hashAlg_choice;
|
|
66
|
+
struct zcbor_string COSE_CertHash_hashValue;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
struct id_cred_x_x5t {
|
|
70
|
-
struct COSE_CertHash
|
|
70
|
+
struct COSE_CertHash id_cred_x_x5t;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
struct id_cred_x {
|
|
74
|
-
struct
|
|
75
|
-
bool
|
|
76
|
-
struct id_cred_x_x5chain
|
|
77
|
-
bool
|
|
78
|
-
struct id_cred_x_x5t
|
|
79
|
-
bool
|
|
74
|
+
struct id_cred_x_kid_r id_cred_x_kid;
|
|
75
|
+
bool id_cred_x_kid_present;
|
|
76
|
+
struct id_cred_x_x5chain id_cred_x_x5chain;
|
|
77
|
+
bool id_cred_x_x5chain_present;
|
|
78
|
+
struct id_cred_x_x5t id_cred_x_x5t;
|
|
79
|
+
bool id_cred_x_x5t_present;
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
struct
|
|
83
|
-
int32_t _ead_x_ead_label;
|
|
84
|
-
struct zcbor_string _ead_x_ead_value;
|
|
85
|
-
bool _ead_x_ead_value_present;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
struct ead_x_ {
|
|
89
|
-
struct ead_x _ead_x[3];
|
|
90
|
-
size_t _ead_x_count;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
struct plaintext_4_EAD_4 {
|
|
94
|
-
struct ead_x_ _plaintext_4_EAD_4;
|
|
95
|
-
bool _plaintext_4_EAD_4_present;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
struct map_kid_ {
|
|
82
|
+
struct map_kid_r {
|
|
99
83
|
union {
|
|
100
|
-
int32_t
|
|
101
|
-
struct zcbor_string
|
|
84
|
+
int32_t map_kid_int;
|
|
85
|
+
struct zcbor_string map_kid_bstr;
|
|
102
86
|
};
|
|
103
87
|
enum {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
88
|
+
map_kid_int_c,
|
|
89
|
+
map_kid_bstr_c,
|
|
90
|
+
} map_kid_choice;
|
|
107
91
|
};
|
|
108
92
|
|
|
109
93
|
struct map_x5chain {
|
|
110
|
-
struct
|
|
94
|
+
struct COSE_X509_r map_x5chain;
|
|
111
95
|
};
|
|
112
96
|
|
|
113
97
|
struct map_x5t {
|
|
114
|
-
struct COSE_CertHash
|
|
98
|
+
struct COSE_CertHash map_x5t;
|
|
115
99
|
};
|
|
116
100
|
|
|
117
101
|
struct map {
|
|
118
|
-
struct
|
|
119
|
-
bool
|
|
120
|
-
struct map_x5chain
|
|
121
|
-
bool
|
|
122
|
-
struct map_x5t
|
|
123
|
-
bool
|
|
102
|
+
struct map_kid_r map_kid;
|
|
103
|
+
bool map_kid_present;
|
|
104
|
+
struct map_x5chain map_x5chain;
|
|
105
|
+
bool map_x5chain_present;
|
|
106
|
+
struct map_x5t map_x5t;
|
|
107
|
+
bool map_x5t_present;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
struct ead_y {
|
|
111
|
+
int32_t ead_y_ead_label;
|
|
112
|
+
struct zcbor_string ead_y_ead_value;
|
|
113
|
+
bool ead_y_ead_value_present;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
struct EAD_2 {
|
|
117
|
+
struct ead_y EAD_2[3];
|
|
118
|
+
size_t EAD_2_count;
|
|
124
119
|
};
|
|
125
120
|
|
|
126
121
|
struct plaintext_2 {
|
|
127
122
|
union {
|
|
128
|
-
struct zcbor_string
|
|
129
|
-
int32_t
|
|
123
|
+
struct zcbor_string plaintext_2_C_R_bstr;
|
|
124
|
+
int32_t plaintext_2_C_R_int;
|
|
130
125
|
};
|
|
131
126
|
enum {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
127
|
+
plaintext_2_C_R_bstr_c,
|
|
128
|
+
plaintext_2_C_R_int_c,
|
|
129
|
+
} plaintext_2_C_R_choice;
|
|
135
130
|
union {
|
|
136
|
-
int32_t
|
|
137
|
-
struct zcbor_string
|
|
138
|
-
struct map
|
|
131
|
+
int32_t plaintext_2_ID_CRED_R_int;
|
|
132
|
+
struct zcbor_string plaintext_2_ID_CRED_R_bstr;
|
|
133
|
+
struct map plaintext_2_ID_CRED_R_map_m;
|
|
139
134
|
};
|
|
140
135
|
enum {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
struct zcbor_string
|
|
146
|
-
struct
|
|
147
|
-
bool
|
|
136
|
+
plaintext_2_ID_CRED_R_int_c,
|
|
137
|
+
plaintext_2_ID_CRED_R_bstr_c,
|
|
138
|
+
plaintext_2_ID_CRED_R_map_m_c,
|
|
139
|
+
} plaintext_2_ID_CRED_R_choice;
|
|
140
|
+
struct zcbor_string plaintext_2_Signature_or_MAC_2;
|
|
141
|
+
struct EAD_2 plaintext_2_EAD_2_m;
|
|
142
|
+
bool plaintext_2_EAD_2_m_present;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
struct EAD_3 {
|
|
146
|
+
struct ead_y EAD_3[3];
|
|
147
|
+
size_t EAD_3_count;
|
|
148
148
|
};
|
|
149
149
|
|
|
150
150
|
struct plaintext_3 {
|
|
151
151
|
union {
|
|
152
|
-
int32_t
|
|
153
|
-
struct zcbor_string
|
|
154
|
-
struct map
|
|
152
|
+
int32_t plaintext_3_ID_CRED_I_int;
|
|
153
|
+
struct zcbor_string plaintext_3_ID_CRED_I_bstr;
|
|
154
|
+
struct map plaintext_3_ID_CRED_I_map_m;
|
|
155
155
|
};
|
|
156
156
|
enum {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
struct zcbor_string
|
|
162
|
-
struct
|
|
163
|
-
bool
|
|
157
|
+
plaintext_3_ID_CRED_I_int_c,
|
|
158
|
+
plaintext_3_ID_CRED_I_bstr_c,
|
|
159
|
+
plaintext_3_ID_CRED_I_map_m_c,
|
|
160
|
+
} plaintext_3_ID_CRED_I_choice;
|
|
161
|
+
struct zcbor_string plaintext_3_Signature_or_MAC_3;
|
|
162
|
+
struct EAD_3 plaintext_3_EAD_3_m;
|
|
163
|
+
bool plaintext_3_EAD_3_m_present;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
struct EAD_4 {
|
|
167
|
+
struct ead_y EAD_4[3];
|
|
168
|
+
size_t EAD_4_count;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
struct plaintext_4 {
|
|
172
|
+
struct EAD_4 plaintext_4;
|
|
173
|
+
bool plaintext_4_present;
|
|
164
174
|
};
|
|
165
175
|
|
|
166
176
|
#ifdef __cplusplus
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Generated using zcbor version 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_bstr_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_byte_string_type_bstr_type(zcbor_state_t *state, struct zcbor
|
|
|
21
22
|
static bool decode_byte_string_type_bstr_type(
|
|
22
23
|
zcbor_state_t *state, struct zcbor_string *result)
|
|
23
24
|
{
|
|
24
|
-
|
|
25
|
+
zcbor_log("%s\r\n", __func__);
|
|
25
26
|
|
|
26
27
|
bool tmp_result = (((zcbor_bstr_decode(state, (&(*result))))));
|
|
27
28
|
|
|
28
|
-
if (!tmp_result)
|
|
29
|
-
|
|
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_byte_string_type_bstr_type(
|
|
|
40
45
|
{
|
|
41
46
|
zcbor_state_t states[2];
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
bool ret = decode_byte_string_type_bstr_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_byte_string_type_bstr_type, sizeof(states) / sizeof(zcbor_state_t), 1);
|
|
59
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Generated using zcbor version 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_bstr_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_byte_string_type_bstr_type(zcbor_state_t *state, const struct
|
|
|
21
22
|
static bool encode_byte_string_type_bstr_type(
|
|
22
23
|
zcbor_state_t *state, const struct zcbor_string *input)
|
|
23
24
|
{
|
|
24
|
-
|
|
25
|
+
zcbor_log("%s\r\n", __func__);
|
|
25
26
|
|
|
26
27
|
bool tmp_result = (((zcbor_bstr_encode(state, (&(*input))))));
|
|
27
28
|
|
|
28
|
-
if (!tmp_result)
|
|
29
|
-
|
|
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_byte_string_type_bstr_type(
|
|
|
40
45
|
{
|
|
41
46
|
zcbor_state_t states[2];
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
bool ret = encode_byte_string_type_bstr_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_byte_string_type_bstr_type, sizeof(states) / sizeof(zcbor_state_t), 1);
|
|
59
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Generated using zcbor version 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,38 +10,47 @@
|
|
|
10
10
|
#include <string.h>
|
|
11
11
|
#include "zcbor_decode.h"
|
|
12
12
|
#include "backend_cbor_ead_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
|
|
19
|
-
static bool decode_ead(zcbor_state_t *state, struct
|
|
19
|
+
static bool decode_ead_x(zcbor_state_t *state, struct ead_x *result);
|
|
20
|
+
static bool decode_ead(zcbor_state_t *state, struct ead *result);
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
static bool
|
|
23
|
-
zcbor_state_t *state, struct
|
|
23
|
+
static bool decode_ead_x(
|
|
24
|
+
zcbor_state_t *state, struct ead_x *result)
|
|
24
25
|
{
|
|
25
|
-
|
|
26
|
+
zcbor_log("%s\r\n", __func__);
|
|
26
27
|
|
|
27
|
-
bool tmp_result = (((((zcbor_int32_decode(state, (&(*result).
|
|
28
|
-
&&
|
|
28
|
+
bool tmp_result = (((((zcbor_int32_decode(state, (&(*result).ead_x_ead_label))))
|
|
29
|
+
&& ((*result).ead_x_ead_value_present = ((zcbor_bstr_decode(state, (&(*result).ead_x_ead_value)))), 1))));
|
|
29
30
|
|
|
30
|
-
if (!tmp_result)
|
|
31
|
-
|
|
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
|
}
|
|
35
40
|
|
|
36
41
|
static bool decode_ead(
|
|
37
|
-
zcbor_state_t *state, struct
|
|
42
|
+
zcbor_state_t *state, struct ead *result)
|
|
38
43
|
{
|
|
39
|
-
|
|
44
|
+
zcbor_log("%s\r\n", __func__);
|
|
40
45
|
|
|
41
|
-
bool tmp_result = (zcbor_multi_decode(1, 3, &(*result).
|
|
46
|
+
bool tmp_result = (zcbor_multi_decode(1, 3, &(*result).ead_count, (zcbor_decoder_t *)decode_ead_x, state, (&(*result).ead), sizeof(struct ead_x)));
|
|
42
47
|
|
|
43
|
-
if (!tmp_result)
|
|
44
|
-
|
|
48
|
+
if (!tmp_result) {
|
|
49
|
+
zcbor_trace_file(state);
|
|
50
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
51
|
+
} else {
|
|
52
|
+
zcbor_log("%s success\r\n", __func__);
|
|
53
|
+
}
|
|
45
54
|
|
|
46
55
|
return tmp_result;
|
|
47
56
|
}
|
|
@@ -50,25 +59,11 @@ static bool decode_ead(
|
|
|
50
59
|
|
|
51
60
|
int cbor_decode_ead(
|
|
52
61
|
const uint8_t *payload, size_t payload_len,
|
|
53
|
-
struct
|
|
62
|
+
struct ead *result,
|
|
54
63
|
size_t *payload_len_out)
|
|
55
64
|
{
|
|
56
65
|
zcbor_state_t states[2];
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
bool ret = decode_ead(states, result);
|
|
61
|
-
|
|
62
|
-
if (ret && (payload_len_out != NULL)) {
|
|
63
|
-
*payload_len_out = MIN(payload_len,
|
|
64
|
-
(size_t)states[0].payload - (size_t)payload);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (!ret) {
|
|
68
|
-
int err = zcbor_pop_error(states);
|
|
69
|
-
|
|
70
|
-
zcbor_print("Return error: %d\r\n", err);
|
|
71
|
-
return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
|
|
72
|
-
}
|
|
73
|
-
return ZCBOR_SUCCESS;
|
|
67
|
+
return zcbor_entry_function(payload, payload_len, (void *)result, payload_len_out, states,
|
|
68
|
+
(zcbor_decoder_t *)decode_ead, sizeof(states) / sizeof(zcbor_state_t), 6);
|
|
74
69
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Generated using zcbor version 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,38 +10,47 @@
|
|
|
10
10
|
#include <string.h>
|
|
11
11
|
#include "zcbor_encode.h"
|
|
12
12
|
#include "backend_cbor_ead_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
|
|
19
|
-
static bool encode_ead(zcbor_state_t *state, const struct
|
|
19
|
+
static bool encode_ead_x(zcbor_state_t *state, const struct ead_x *input);
|
|
20
|
+
static bool encode_ead(zcbor_state_t *state, const struct ead *input);
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
static bool
|
|
23
|
-
zcbor_state_t *state, const struct
|
|
23
|
+
static bool encode_ead_x(
|
|
24
|
+
zcbor_state_t *state, const struct ead_x *input)
|
|
24
25
|
{
|
|
25
|
-
|
|
26
|
+
zcbor_log("%s\r\n", __func__);
|
|
26
27
|
|
|
27
|
-
bool tmp_result = (((((zcbor_int32_encode(state, (&(*input).
|
|
28
|
-
&&
|
|
28
|
+
bool tmp_result = (((((zcbor_int32_encode(state, (&(*input).ead_x_ead_label))))
|
|
29
|
+
&& (!(*input).ead_x_ead_value_present || zcbor_bstr_encode(state, (&(*input).ead_x_ead_value))))));
|
|
29
30
|
|
|
30
|
-
if (!tmp_result)
|
|
31
|
-
|
|
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
|
}
|
|
35
40
|
|
|
36
41
|
static bool encode_ead(
|
|
37
|
-
zcbor_state_t *state, const struct
|
|
42
|
+
zcbor_state_t *state, const struct ead *input)
|
|
38
43
|
{
|
|
39
|
-
|
|
44
|
+
zcbor_log("%s\r\n", __func__);
|
|
40
45
|
|
|
41
|
-
bool tmp_result = (zcbor_multi_encode_minmax(1, 3, &(*input).
|
|
46
|
+
bool tmp_result = (zcbor_multi_encode_minmax(1, 3, &(*input).ead_count, (zcbor_encoder_t *)encode_ead_x, state, (&(*input).ead), sizeof(struct ead_x)));
|
|
42
47
|
|
|
43
|
-
if (!tmp_result)
|
|
44
|
-
|
|
48
|
+
if (!tmp_result) {
|
|
49
|
+
zcbor_trace_file(state);
|
|
50
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
51
|
+
} else {
|
|
52
|
+
zcbor_log("%s success\r\n", __func__);
|
|
53
|
+
}
|
|
45
54
|
|
|
46
55
|
return tmp_result;
|
|
47
56
|
}
|
|
@@ -50,25 +59,11 @@ static bool encode_ead(
|
|
|
50
59
|
|
|
51
60
|
int cbor_encode_ead(
|
|
52
61
|
uint8_t *payload, size_t payload_len,
|
|
53
|
-
const struct
|
|
62
|
+
const struct ead *input,
|
|
54
63
|
size_t *payload_len_out)
|
|
55
64
|
{
|
|
56
65
|
zcbor_state_t states[2];
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
bool ret = encode_ead(states, input);
|
|
61
|
-
|
|
62
|
-
if (ret && (payload_len_out != NULL)) {
|
|
63
|
-
*payload_len_out = MIN(payload_len,
|
|
64
|
-
(size_t)states[0].payload - (size_t)payload);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (!ret) {
|
|
68
|
-
int err = zcbor_pop_error(states);
|
|
69
|
-
|
|
70
|
-
zcbor_print("Return error: %d\r\n", err);
|
|
71
|
-
return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
|
|
72
|
-
}
|
|
73
|
-
return ZCBOR_SUCCESS;
|
|
67
|
+
return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states,
|
|
68
|
+
(zcbor_decoder_t *)encode_ead, sizeof(states) / sizeof(zcbor_state_t), 6);
|
|
74
69
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Generated using zcbor version 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_enc_structure_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,15 +22,19 @@ static bool decode_enc_structure(zcbor_state_t *state, struct enc_structure *res
|
|
|
21
22
|
static bool decode_enc_structure(
|
|
22
23
|
zcbor_state_t *state, struct enc_structure *result)
|
|
23
24
|
{
|
|
24
|
-
|
|
25
|
+
zcbor_log("%s\r\n", __func__);
|
|
25
26
|
struct zcbor_string tmp_str;
|
|
26
27
|
|
|
27
28
|
bool tmp_result = (((zcbor_list_start_decode(state) && ((((zcbor_tstr_expect(state, ((tmp_str.value = (uint8_t *)"Encrypt0", tmp_str.len = sizeof("Encrypt0") - 1, &tmp_str)))))
|
|
28
|
-
&& ((zcbor_bstr_decode(state, (&(*result).
|
|
29
|
-
&& ((zcbor_bstr_decode(state, (&(*result).
|
|
30
|
-
|
|
31
|
-
if (!tmp_result)
|
|
32
|
-
|
|
29
|
+
&& ((zcbor_bstr_decode(state, (&(*result).enc_structure_protected))))
|
|
30
|
+
&& ((zcbor_bstr_decode(state, (&(*result).enc_structure_external_aad))))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state))));
|
|
31
|
+
|
|
32
|
+
if (!tmp_result) {
|
|
33
|
+
zcbor_trace_file(state);
|
|
34
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
35
|
+
} else {
|
|
36
|
+
zcbor_log("%s success\r\n", __func__);
|
|
37
|
+
}
|
|
33
38
|
|
|
34
39
|
return tmp_result;
|
|
35
40
|
}
|
|
@@ -43,20 +48,6 @@ int cbor_decode_enc_structure(
|
|
|
43
48
|
{
|
|
44
49
|
zcbor_state_t states[3];
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
bool ret = decode_enc_structure(states, result);
|
|
49
|
-
|
|
50
|
-
if (ret && (payload_len_out != NULL)) {
|
|
51
|
-
*payload_len_out = MIN(payload_len,
|
|
52
|
-
(size_t)states[0].payload - (size_t)payload);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (!ret) {
|
|
56
|
-
int err = zcbor_pop_error(states);
|
|
57
|
-
|
|
58
|
-
zcbor_print("Return error: %d\r\n", err);
|
|
59
|
-
return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
|
|
60
|
-
}
|
|
61
|
-
return ZCBOR_SUCCESS;
|
|
51
|
+
return zcbor_entry_function(payload, payload_len, (void *)result, payload_len_out, states,
|
|
52
|
+
(zcbor_decoder_t *)decode_enc_structure, sizeof(states) / sizeof(zcbor_state_t), 1);
|
|
62
53
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Generated using zcbor version 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_enc_structure_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,15 +22,19 @@ static bool encode_enc_structure(zcbor_state_t *state, const struct enc_structur
|
|
|
21
22
|
static bool encode_enc_structure(
|
|
22
23
|
zcbor_state_t *state, const struct enc_structure *input)
|
|
23
24
|
{
|
|
24
|
-
|
|
25
|
+
zcbor_log("%s\r\n", __func__);
|
|
25
26
|
struct zcbor_string tmp_str;
|
|
26
27
|
|
|
27
28
|
bool tmp_result = (((zcbor_list_start_encode(state, 3) && ((((zcbor_tstr_encode(state, ((tmp_str.value = (uint8_t *)"Encrypt0", tmp_str.len = sizeof("Encrypt0") - 1, &tmp_str)))))
|
|
28
|
-
&& ((zcbor_bstr_encode(state, (&(*input).
|
|
29
|
-
&& ((zcbor_bstr_encode(state, (&(*input).
|
|
30
|
-
|
|
31
|
-
if (!tmp_result)
|
|
32
|
-
|
|
29
|
+
&& ((zcbor_bstr_encode(state, (&(*input).enc_structure_protected))))
|
|
30
|
+
&& ((zcbor_bstr_encode(state, (&(*input).enc_structure_external_aad))))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 3))));
|
|
31
|
+
|
|
32
|
+
if (!tmp_result) {
|
|
33
|
+
zcbor_trace_file(state);
|
|
34
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
35
|
+
} else {
|
|
36
|
+
zcbor_log("%s success\r\n", __func__);
|
|
37
|
+
}
|
|
33
38
|
|
|
34
39
|
return tmp_result;
|
|
35
40
|
}
|
|
@@ -43,20 +48,6 @@ int cbor_encode_enc_structure(
|
|
|
43
48
|
{
|
|
44
49
|
zcbor_state_t states[3];
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
bool ret = encode_enc_structure(states, input);
|
|
49
|
-
|
|
50
|
-
if (ret && (payload_len_out != NULL)) {
|
|
51
|
-
*payload_len_out = MIN(payload_len,
|
|
52
|
-
(size_t)states[0].payload - (size_t)payload);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (!ret) {
|
|
56
|
-
int err = zcbor_pop_error(states);
|
|
57
|
-
|
|
58
|
-
zcbor_print("Return error: %d\r\n", err);
|
|
59
|
-
return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
|
|
60
|
-
}
|
|
61
|
-
return ZCBOR_SUCCESS;
|
|
51
|
+
return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states,
|
|
52
|
+
(zcbor_decoder_t *)encode_enc_structure, sizeof(states) / sizeof(zcbor_state_t), 1);
|
|
62
53
|
}
|