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
|
*/
|
|
@@ -10,49 +10,58 @@
|
|
|
10
10
|
#include <string.h>
|
|
11
11
|
#include "zcbor_encode.h"
|
|
12
12
|
#include "backend_cbor_plaintext_3_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_map_kid(zcbor_state_t *state, const struct
|
|
19
|
-
static bool encode_COSE_X509(zcbor_state_t *state, const struct
|
|
19
|
+
static bool encode_repeated_map_kid(zcbor_state_t *state, const struct map_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_map_x5chain(zcbor_state_t *state, const struct map_x5chain *input);
|
|
21
22
|
static bool encode_COSE_CertHash(zcbor_state_t *state, const struct COSE_CertHash *input);
|
|
22
23
|
static bool encode_repeated_map_x5t(zcbor_state_t *state, const struct map_x5t *input);
|
|
23
24
|
static bool encode_map(zcbor_state_t *state, const struct map *input);
|
|
24
|
-
static bool
|
|
25
|
-
static bool
|
|
25
|
+
static bool encode_ead_y(zcbor_state_t *state, const struct ead_y *input);
|
|
26
|
+
static bool encode_EAD_3(zcbor_state_t *state, const struct EAD_3 *input);
|
|
26
27
|
static bool encode_plaintext_3(zcbor_state_t *state, const struct plaintext_3 *input);
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
static bool encode_repeated_map_kid(
|
|
30
|
-
zcbor_state_t *state, const struct
|
|
31
|
+
zcbor_state_t *state, const struct map_kid_r *input)
|
|
31
32
|
{
|
|
32
|
-
|
|
33
|
+
zcbor_log("%s\r\n", __func__);
|
|
33
34
|
|
|
34
35
|
bool tmp_result = ((((zcbor_uint32_put(state, (4))))
|
|
35
|
-
&& (((*input).
|
|
36
|
-
: (((*input).
|
|
36
|
+
&& (((*input).map_kid_choice == map_kid_int_c) ? ((zcbor_int32_encode(state, (&(*input).map_kid_int))))
|
|
37
|
+
: (((*input).map_kid_choice == map_kid_bstr_c) ? ((zcbor_bstr_encode(state, (&(*input).map_kid_bstr))))
|
|
37
38
|
: false))));
|
|
38
39
|
|
|
39
|
-
if (!tmp_result)
|
|
40
|
-
|
|
40
|
+
if (!tmp_result) {
|
|
41
|
+
zcbor_trace_file(state);
|
|
42
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
43
|
+
} else {
|
|
44
|
+
zcbor_log("%s success\r\n", __func__);
|
|
45
|
+
}
|
|
41
46
|
|
|
42
47
|
return tmp_result;
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
static bool encode_COSE_X509(
|
|
46
|
-
zcbor_state_t *state, const struct
|
|
51
|
+
zcbor_state_t *state, const struct COSE_X509_r *input)
|
|
47
52
|
{
|
|
48
|
-
|
|
53
|
+
zcbor_log("%s\r\n", __func__);
|
|
49
54
|
|
|
50
|
-
bool tmp_result = (((((*input).
|
|
51
|
-
: (((*input).
|
|
55
|
+
bool tmp_result = (((((*input).COSE_X509_choice == COSE_X509_bstr_c) ? ((zcbor_bstr_encode(state, (&(*input).COSE_X509_bstr))))
|
|
56
|
+
: (((*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)))
|
|
52
57
|
: false))));
|
|
53
58
|
|
|
54
|
-
if (!tmp_result)
|
|
55
|
-
|
|
59
|
+
if (!tmp_result) {
|
|
60
|
+
zcbor_trace_file(state);
|
|
61
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
62
|
+
} else {
|
|
63
|
+
zcbor_log("%s success\r\n", __func__);
|
|
64
|
+
}
|
|
56
65
|
|
|
57
66
|
return tmp_result;
|
|
58
67
|
}
|
|
@@ -60,13 +69,17 @@ static bool encode_COSE_X509(
|
|
|
60
69
|
static bool encode_repeated_map_x5chain(
|
|
61
70
|
zcbor_state_t *state, const struct map_x5chain *input)
|
|
62
71
|
{
|
|
63
|
-
|
|
72
|
+
zcbor_log("%s\r\n", __func__);
|
|
64
73
|
|
|
65
74
|
bool tmp_result = ((((zcbor_uint32_put(state, (33))))
|
|
66
|
-
&& (encode_COSE_X509(state, (&(*input).
|
|
75
|
+
&& (encode_COSE_X509(state, (&(*input).map_x5chain)))));
|
|
67
76
|
|
|
68
|
-
if (!tmp_result)
|
|
69
|
-
|
|
77
|
+
if (!tmp_result) {
|
|
78
|
+
zcbor_trace_file(state);
|
|
79
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
80
|
+
} else {
|
|
81
|
+
zcbor_log("%s success\r\n", __func__);
|
|
82
|
+
}
|
|
70
83
|
|
|
71
84
|
return tmp_result;
|
|
72
85
|
}
|
|
@@ -74,15 +87,19 @@ static bool encode_repeated_map_x5chain(
|
|
|
74
87
|
static bool encode_COSE_CertHash(
|
|
75
88
|
zcbor_state_t *state, const struct COSE_CertHash *input)
|
|
76
89
|
{
|
|
77
|
-
|
|
90
|
+
zcbor_log("%s\r\n", __func__);
|
|
78
91
|
|
|
79
|
-
bool tmp_result = (((zcbor_list_start_encode(state, 2) && ((((((*input).
|
|
80
|
-
: (((*input).
|
|
92
|
+
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))))
|
|
93
|
+
: (((*input).COSE_CertHash_hashAlg_choice == COSE_CertHash_hashAlg_tstr_c) ? ((zcbor_tstr_encode(state, (&(*input).COSE_CertHash_hashAlg_tstr))))
|
|
81
94
|
: false)))
|
|
82
|
-
&& ((zcbor_bstr_encode(state, (&(*input).
|
|
95
|
+
&& ((zcbor_bstr_encode(state, (&(*input).COSE_CertHash_hashValue))))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 2))));
|
|
83
96
|
|
|
84
|
-
if (!tmp_result)
|
|
85
|
-
|
|
97
|
+
if (!tmp_result) {
|
|
98
|
+
zcbor_trace_file(state);
|
|
99
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
100
|
+
} else {
|
|
101
|
+
zcbor_log("%s success\r\n", __func__);
|
|
102
|
+
}
|
|
86
103
|
|
|
87
104
|
return tmp_result;
|
|
88
105
|
}
|
|
@@ -90,13 +107,17 @@ static bool encode_COSE_CertHash(
|
|
|
90
107
|
static bool encode_repeated_map_x5t(
|
|
91
108
|
zcbor_state_t *state, const struct map_x5t *input)
|
|
92
109
|
{
|
|
93
|
-
|
|
110
|
+
zcbor_log("%s\r\n", __func__);
|
|
94
111
|
|
|
95
112
|
bool tmp_result = ((((zcbor_uint32_put(state, (34))))
|
|
96
|
-
&& (encode_COSE_CertHash(state, (&(*input).
|
|
113
|
+
&& (encode_COSE_CertHash(state, (&(*input).map_x5t)))));
|
|
97
114
|
|
|
98
|
-
if (!tmp_result)
|
|
99
|
-
|
|
115
|
+
if (!tmp_result) {
|
|
116
|
+
zcbor_trace_file(state);
|
|
117
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
118
|
+
} else {
|
|
119
|
+
zcbor_log("%s success\r\n", __func__);
|
|
120
|
+
}
|
|
100
121
|
|
|
101
122
|
return tmp_result;
|
|
102
123
|
}
|
|
@@ -104,41 +125,53 @@ static bool encode_repeated_map_x5t(
|
|
|
104
125
|
static bool encode_map(
|
|
105
126
|
zcbor_state_t *state, const struct map *input)
|
|
106
127
|
{
|
|
107
|
-
|
|
128
|
+
zcbor_log("%s\r\n", __func__);
|
|
108
129
|
|
|
109
|
-
bool tmp_result = (((zcbor_map_start_encode(state, 3) && ((
|
|
110
|
-
&&
|
|
111
|
-
&&
|
|
130
|
+
bool tmp_result = (((zcbor_map_start_encode(state, 3) && (((!(*input).map_kid_present || encode_repeated_map_kid(state, (&(*input).map_kid)))
|
|
131
|
+
&& (!(*input).map_x5chain_present || encode_repeated_map_x5chain(state, (&(*input).map_x5chain)))
|
|
132
|
+
&& (!(*input).map_x5t_present || encode_repeated_map_x5t(state, (&(*input).map_x5t)))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_map_end_encode(state, 3))));
|
|
112
133
|
|
|
113
|
-
if (!tmp_result)
|
|
114
|
-
|
|
134
|
+
if (!tmp_result) {
|
|
135
|
+
zcbor_trace_file(state);
|
|
136
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
137
|
+
} else {
|
|
138
|
+
zcbor_log("%s success\r\n", __func__);
|
|
139
|
+
}
|
|
115
140
|
|
|
116
141
|
return tmp_result;
|
|
117
142
|
}
|
|
118
143
|
|
|
119
|
-
static bool
|
|
120
|
-
zcbor_state_t *state, const struct
|
|
144
|
+
static bool encode_ead_y(
|
|
145
|
+
zcbor_state_t *state, const struct ead_y *input)
|
|
121
146
|
{
|
|
122
|
-
|
|
147
|
+
zcbor_log("%s\r\n", __func__);
|
|
123
148
|
|
|
124
|
-
bool tmp_result = (((((zcbor_int32_encode(state, (&(*input).
|
|
125
|
-
&&
|
|
149
|
+
bool tmp_result = (((((zcbor_int32_encode(state, (&(*input).ead_y_ead_label))))
|
|
150
|
+
&& (!(*input).ead_y_ead_value_present || zcbor_bstr_encode(state, (&(*input).ead_y_ead_value))))));
|
|
126
151
|
|
|
127
|
-
if (!tmp_result)
|
|
128
|
-
|
|
152
|
+
if (!tmp_result) {
|
|
153
|
+
zcbor_trace_file(state);
|
|
154
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
155
|
+
} else {
|
|
156
|
+
zcbor_log("%s success\r\n", __func__);
|
|
157
|
+
}
|
|
129
158
|
|
|
130
159
|
return tmp_result;
|
|
131
160
|
}
|
|
132
161
|
|
|
133
|
-
static bool
|
|
134
|
-
zcbor_state_t *state, const struct
|
|
162
|
+
static bool encode_EAD_3(
|
|
163
|
+
zcbor_state_t *state, const struct EAD_3 *input)
|
|
135
164
|
{
|
|
136
|
-
|
|
165
|
+
zcbor_log("%s\r\n", __func__);
|
|
137
166
|
|
|
138
|
-
bool tmp_result = (zcbor_multi_encode_minmax(1, 3, &(*input).
|
|
167
|
+
bool tmp_result = (zcbor_multi_encode_minmax(1, 3, &(*input).EAD_3_count, (zcbor_encoder_t *)encode_ead_y, state, (&(*input).EAD_3), sizeof(struct ead_y)));
|
|
139
168
|
|
|
140
|
-
if (!tmp_result)
|
|
141
|
-
|
|
169
|
+
if (!tmp_result) {
|
|
170
|
+
zcbor_trace_file(state);
|
|
171
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
172
|
+
} else {
|
|
173
|
+
zcbor_log("%s success\r\n", __func__);
|
|
174
|
+
}
|
|
142
175
|
|
|
143
176
|
return tmp_result;
|
|
144
177
|
}
|
|
@@ -146,17 +179,21 @@ static bool encode_ead_x(
|
|
|
146
179
|
static bool encode_plaintext_3(
|
|
147
180
|
zcbor_state_t *state, const struct plaintext_3 *input)
|
|
148
181
|
{
|
|
149
|
-
|
|
182
|
+
zcbor_log("%s\r\n", __func__);
|
|
150
183
|
|
|
151
|
-
bool tmp_result = (((((((*input).
|
|
152
|
-
: (((*input).
|
|
153
|
-
: (((*input).
|
|
184
|
+
bool tmp_result = (((((((*input).plaintext_3_ID_CRED_I_choice == plaintext_3_ID_CRED_I_int_c) ? ((zcbor_int32_encode(state, (&(*input).plaintext_3_ID_CRED_I_int))))
|
|
185
|
+
: (((*input).plaintext_3_ID_CRED_I_choice == plaintext_3_ID_CRED_I_bstr_c) ? ((zcbor_bstr_encode(state, (&(*input).plaintext_3_ID_CRED_I_bstr))))
|
|
186
|
+
: (((*input).plaintext_3_ID_CRED_I_choice == plaintext_3_ID_CRED_I_map_m_c) ? ((encode_map(state, (&(*input).plaintext_3_ID_CRED_I_map_m))))
|
|
154
187
|
: false))))
|
|
155
|
-
&& ((zcbor_bstr_encode(state, (&(*input).
|
|
156
|
-
&&
|
|
157
|
-
|
|
158
|
-
if (!tmp_result)
|
|
159
|
-
|
|
188
|
+
&& ((zcbor_bstr_encode(state, (&(*input).plaintext_3_Signature_or_MAC_3))))
|
|
189
|
+
&& (!(*input).plaintext_3_EAD_3_m_present || encode_EAD_3(state, (&(*input).plaintext_3_EAD_3_m))))));
|
|
190
|
+
|
|
191
|
+
if (!tmp_result) {
|
|
192
|
+
zcbor_trace_file(state);
|
|
193
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
194
|
+
} else {
|
|
195
|
+
zcbor_log("%s success\r\n", __func__);
|
|
196
|
+
}
|
|
160
197
|
|
|
161
198
|
return tmp_result;
|
|
162
199
|
}
|
|
@@ -170,20 +207,6 @@ int cbor_encode_plaintext_3(
|
|
|
170
207
|
{
|
|
171
208
|
zcbor_state_t states[6];
|
|
172
209
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
bool ret = encode_plaintext_3(states, input);
|
|
176
|
-
|
|
177
|
-
if (ret && (payload_len_out != NULL)) {
|
|
178
|
-
*payload_len_out = MIN(payload_len,
|
|
179
|
-
(size_t)states[0].payload - (size_t)payload);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (!ret) {
|
|
183
|
-
int err = zcbor_pop_error(states);
|
|
184
|
-
|
|
185
|
-
zcbor_print("Return error: %d\r\n", err);
|
|
186
|
-
return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
|
|
187
|
-
}
|
|
188
|
-
return ZCBOR_SUCCESS;
|
|
210
|
+
return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states,
|
|
211
|
+
(zcbor_decoder_t *)encode_plaintext_3, sizeof(states) / sizeof(zcbor_state_t), 8);
|
|
189
212
|
}
|
|
@@ -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,79 +10,78 @@
|
|
|
10
10
|
#include <string.h>
|
|
11
11
|
#include "zcbor_decode.h"
|
|
12
12
|
#include "backend_cbor_plaintext_4_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
|
|
20
|
-
static bool
|
|
19
|
+
static bool decode_ead_y(zcbor_state_t *state, struct ead_y *result);
|
|
20
|
+
static bool decode_EAD_4(zcbor_state_t *state, struct EAD_4 *result);
|
|
21
|
+
static bool decode_plaintext_4(zcbor_state_t *state, struct plaintext_4 *result);
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
static bool
|
|
24
|
-
zcbor_state_t *state, struct
|
|
24
|
+
static bool decode_ead_y(
|
|
25
|
+
zcbor_state_t *state, struct ead_y *result)
|
|
25
26
|
{
|
|
26
|
-
|
|
27
|
+
zcbor_log("%s\r\n", __func__);
|
|
27
28
|
|
|
28
|
-
bool tmp_result = (((((zcbor_int32_decode(state, (&(*result).
|
|
29
|
-
&&
|
|
29
|
+
bool tmp_result = (((((zcbor_int32_decode(state, (&(*result).ead_y_ead_label))))
|
|
30
|
+
&& ((*result).ead_y_ead_value_present = ((zcbor_bstr_decode(state, (&(*result).ead_y_ead_value)))), 1))));
|
|
30
31
|
|
|
31
|
-
if (!tmp_result)
|
|
32
|
-
|
|
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
|
}
|
|
36
41
|
|
|
37
|
-
static bool
|
|
38
|
-
zcbor_state_t *state, struct
|
|
42
|
+
static bool decode_EAD_4(
|
|
43
|
+
zcbor_state_t *state, struct EAD_4 *result)
|
|
39
44
|
{
|
|
40
|
-
|
|
45
|
+
zcbor_log("%s\r\n", __func__);
|
|
41
46
|
|
|
42
|
-
bool tmp_result = (zcbor_multi_decode(1, 3, &(*result).
|
|
47
|
+
bool tmp_result = (zcbor_multi_decode(1, 3, &(*result).EAD_4_count, (zcbor_decoder_t *)decode_ead_y, state, (&(*result).EAD_4), sizeof(struct ead_y)));
|
|
43
48
|
|
|
44
|
-
if (!tmp_result)
|
|
45
|
-
|
|
49
|
+
if (!tmp_result) {
|
|
50
|
+
zcbor_trace_file(state);
|
|
51
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
52
|
+
} else {
|
|
53
|
+
zcbor_log("%s success\r\n", __func__);
|
|
54
|
+
}
|
|
46
55
|
|
|
47
56
|
return tmp_result;
|
|
48
57
|
}
|
|
49
58
|
|
|
50
|
-
static bool
|
|
51
|
-
zcbor_state_t *state, struct
|
|
59
|
+
static bool decode_plaintext_4(
|
|
60
|
+
zcbor_state_t *state, struct plaintext_4 *result)
|
|
52
61
|
{
|
|
53
|
-
|
|
62
|
+
zcbor_log("%s\r\n", __func__);
|
|
54
63
|
|
|
55
|
-
bool tmp_result = (
|
|
64
|
+
bool tmp_result = (((*result).plaintext_4_present = ((decode_EAD_4(state, (&(*result).plaintext_4)))), 1));
|
|
56
65
|
|
|
57
|
-
if (!tmp_result)
|
|
58
|
-
|
|
66
|
+
if (!tmp_result) {
|
|
67
|
+
zcbor_trace_file(state);
|
|
68
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
69
|
+
} else {
|
|
70
|
+
zcbor_log("%s success\r\n", __func__);
|
|
71
|
+
}
|
|
59
72
|
|
|
60
73
|
return tmp_result;
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
|
|
64
77
|
|
|
65
|
-
int
|
|
78
|
+
int cbor_decode_plaintext_4(
|
|
66
79
|
const uint8_t *payload, size_t payload_len,
|
|
67
|
-
struct
|
|
80
|
+
struct plaintext_4 *result,
|
|
68
81
|
size_t *payload_len_out)
|
|
69
82
|
{
|
|
70
83
|
zcbor_state_t states[2];
|
|
71
84
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
bool ret = decode_plaintext_4_EAD_4(states, result);
|
|
75
|
-
|
|
76
|
-
if (ret && (payload_len_out != NULL)) {
|
|
77
|
-
*payload_len_out = MIN(payload_len,
|
|
78
|
-
(size_t)states[0].payload - (size_t)payload);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (!ret) {
|
|
82
|
-
int err = zcbor_pop_error(states);
|
|
83
|
-
|
|
84
|
-
zcbor_print("Return error: %d\r\n", err);
|
|
85
|
-
return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
|
|
86
|
-
}
|
|
87
|
-
return ZCBOR_SUCCESS;
|
|
85
|
+
return zcbor_entry_function(payload, payload_len, (void *)result, payload_len_out, states,
|
|
86
|
+
(zcbor_decoder_t *)decode_plaintext_4, sizeof(states) / sizeof(zcbor_state_t), 6);
|
|
88
87
|
}
|
|
@@ -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,79 +10,78 @@
|
|
|
10
10
|
#include <string.h>
|
|
11
11
|
#include "zcbor_encode.h"
|
|
12
12
|
#include "backend_cbor_plaintext_4_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
|
|
20
|
-
static bool
|
|
19
|
+
static bool encode_ead_y(zcbor_state_t *state, const struct ead_y *input);
|
|
20
|
+
static bool encode_EAD_4(zcbor_state_t *state, const struct EAD_4 *input);
|
|
21
|
+
static bool encode_plaintext_4(zcbor_state_t *state, const struct plaintext_4 *input);
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
static bool
|
|
24
|
-
zcbor_state_t *state, const struct
|
|
24
|
+
static bool encode_ead_y(
|
|
25
|
+
zcbor_state_t *state, const struct ead_y *input)
|
|
25
26
|
{
|
|
26
|
-
|
|
27
|
+
zcbor_log("%s\r\n", __func__);
|
|
27
28
|
|
|
28
|
-
bool tmp_result = (((((zcbor_int32_encode(state, (&(*input).
|
|
29
|
-
&&
|
|
29
|
+
bool tmp_result = (((((zcbor_int32_encode(state, (&(*input).ead_y_ead_label))))
|
|
30
|
+
&& (!(*input).ead_y_ead_value_present || zcbor_bstr_encode(state, (&(*input).ead_y_ead_value))))));
|
|
30
31
|
|
|
31
|
-
if (!tmp_result)
|
|
32
|
-
|
|
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
|
}
|
|
36
41
|
|
|
37
|
-
static bool
|
|
38
|
-
zcbor_state_t *state, const struct
|
|
42
|
+
static bool encode_EAD_4(
|
|
43
|
+
zcbor_state_t *state, const struct EAD_4 *input)
|
|
39
44
|
{
|
|
40
|
-
|
|
45
|
+
zcbor_log("%s\r\n", __func__);
|
|
41
46
|
|
|
42
|
-
bool tmp_result = (zcbor_multi_encode_minmax(1, 3, &(*input).
|
|
47
|
+
bool tmp_result = (zcbor_multi_encode_minmax(1, 3, &(*input).EAD_4_count, (zcbor_encoder_t *)encode_ead_y, state, (&(*input).EAD_4), sizeof(struct ead_y)));
|
|
43
48
|
|
|
44
|
-
if (!tmp_result)
|
|
45
|
-
|
|
49
|
+
if (!tmp_result) {
|
|
50
|
+
zcbor_trace_file(state);
|
|
51
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
52
|
+
} else {
|
|
53
|
+
zcbor_log("%s success\r\n", __func__);
|
|
54
|
+
}
|
|
46
55
|
|
|
47
56
|
return tmp_result;
|
|
48
57
|
}
|
|
49
58
|
|
|
50
|
-
static bool
|
|
51
|
-
zcbor_state_t *state, const struct
|
|
59
|
+
static bool encode_plaintext_4(
|
|
60
|
+
zcbor_state_t *state, const struct plaintext_4 *input)
|
|
52
61
|
{
|
|
53
|
-
|
|
62
|
+
zcbor_log("%s\r\n", __func__);
|
|
54
63
|
|
|
55
|
-
bool tmp_result = (
|
|
64
|
+
bool tmp_result = ((!(*input).plaintext_4_present || encode_EAD_4(state, (&(*input).plaintext_4))));
|
|
56
65
|
|
|
57
|
-
if (!tmp_result)
|
|
58
|
-
|
|
66
|
+
if (!tmp_result) {
|
|
67
|
+
zcbor_trace_file(state);
|
|
68
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
69
|
+
} else {
|
|
70
|
+
zcbor_log("%s success\r\n", __func__);
|
|
71
|
+
}
|
|
59
72
|
|
|
60
73
|
return tmp_result;
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
|
|
64
77
|
|
|
65
|
-
int
|
|
78
|
+
int cbor_encode_plaintext_4(
|
|
66
79
|
uint8_t *payload, size_t payload_len,
|
|
67
|
-
const struct
|
|
80
|
+
const struct plaintext_4 *input,
|
|
68
81
|
size_t *payload_len_out)
|
|
69
82
|
{
|
|
70
83
|
zcbor_state_t states[2];
|
|
71
84
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
bool ret = encode_plaintext_4_EAD_4(states, input);
|
|
75
|
-
|
|
76
|
-
if (ret && (payload_len_out != NULL)) {
|
|
77
|
-
*payload_len_out = MIN(payload_len,
|
|
78
|
-
(size_t)states[0].payload - (size_t)payload);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (!ret) {
|
|
82
|
-
int err = zcbor_pop_error(states);
|
|
83
|
-
|
|
84
|
-
zcbor_print("Return error: %d\r\n", err);
|
|
85
|
-
return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
|
|
86
|
-
}
|
|
87
|
-
return ZCBOR_SUCCESS;
|
|
85
|
+
return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states,
|
|
86
|
+
(zcbor_decoder_t *)encode_plaintext_4, sizeof(states) / sizeof(zcbor_state_t), 6);
|
|
88
87
|
}
|
|
@@ -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_sig_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,16 +22,20 @@ static bool decode_sig_structure(zcbor_state_t *state, struct sig_structure *res
|
|
|
21
22
|
static bool decode_sig_structure(
|
|
22
23
|
zcbor_state_t *state, struct sig_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 *)"Signature1", tmp_str.len = sizeof("Signature1") - 1, &tmp_str)))))
|
|
28
|
-
&& ((zcbor_bstr_decode(state, (&(*result).
|
|
29
|
-
&& ((zcbor_bstr_decode(state, (&(*result).
|
|
30
|
-
&& ((zcbor_bstr_decode(state, (&(*result).
|
|
31
|
-
|
|
32
|
-
if (!tmp_result)
|
|
33
|
-
|
|
29
|
+
&& ((zcbor_bstr_decode(state, (&(*result).sig_structure_protected))))
|
|
30
|
+
&& ((zcbor_bstr_decode(state, (&(*result).sig_structure_external_aad))))
|
|
31
|
+
&& ((zcbor_bstr_decode(state, (&(*result).sig_structure_payload))))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state))));
|
|
32
|
+
|
|
33
|
+
if (!tmp_result) {
|
|
34
|
+
zcbor_trace_file(state);
|
|
35
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
36
|
+
} else {
|
|
37
|
+
zcbor_log("%s success\r\n", __func__);
|
|
38
|
+
}
|
|
34
39
|
|
|
35
40
|
return tmp_result;
|
|
36
41
|
}
|
|
@@ -44,20 +49,6 @@ int cbor_decode_sig_structure(
|
|
|
44
49
|
{
|
|
45
50
|
zcbor_state_t states[3];
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
bool ret = decode_sig_structure(states, result);
|
|
50
|
-
|
|
51
|
-
if (ret && (payload_len_out != NULL)) {
|
|
52
|
-
*payload_len_out = MIN(payload_len,
|
|
53
|
-
(size_t)states[0].payload - (size_t)payload);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (!ret) {
|
|
57
|
-
int err = zcbor_pop_error(states);
|
|
58
|
-
|
|
59
|
-
zcbor_print("Return error: %d\r\n", err);
|
|
60
|
-
return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
|
|
61
|
-
}
|
|
62
|
-
return ZCBOR_SUCCESS;
|
|
52
|
+
return zcbor_entry_function(payload, payload_len, (void *)result, payload_len_out, states,
|
|
53
|
+
(zcbor_decoder_t *)decode_sig_structure, sizeof(states) / sizeof(zcbor_state_t), 1);
|
|
63
54
|
}
|
|
@@ -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_sig_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,16 +22,20 @@ static bool encode_sig_structure(zcbor_state_t *state, const struct sig_structur
|
|
|
21
22
|
static bool encode_sig_structure(
|
|
22
23
|
zcbor_state_t *state, const struct sig_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, 4) && ((((zcbor_tstr_encode(state, ((tmp_str.value = (uint8_t *)"Signature1", tmp_str.len = sizeof("Signature1") - 1, &tmp_str)))))
|
|
28
|
-
&& ((zcbor_bstr_encode(state, (&(*input).
|
|
29
|
-
&& ((zcbor_bstr_encode(state, (&(*input).
|
|
30
|
-
&& ((zcbor_bstr_encode(state, (&(*input).
|
|
31
|
-
|
|
32
|
-
if (!tmp_result)
|
|
33
|
-
|
|
29
|
+
&& ((zcbor_bstr_encode(state, (&(*input).sig_structure_protected))))
|
|
30
|
+
&& ((zcbor_bstr_encode(state, (&(*input).sig_structure_external_aad))))
|
|
31
|
+
&& ((zcbor_bstr_encode(state, (&(*input).sig_structure_payload))))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 4))));
|
|
32
|
+
|
|
33
|
+
if (!tmp_result) {
|
|
34
|
+
zcbor_trace_file(state);
|
|
35
|
+
zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
|
|
36
|
+
} else {
|
|
37
|
+
zcbor_log("%s success\r\n", __func__);
|
|
38
|
+
}
|
|
34
39
|
|
|
35
40
|
return tmp_result;
|
|
36
41
|
}
|
|
@@ -44,20 +49,6 @@ int cbor_encode_sig_structure(
|
|
|
44
49
|
{
|
|
45
50
|
zcbor_state_t states[3];
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
bool ret = encode_sig_structure(states, input);
|
|
50
|
-
|
|
51
|
-
if (ret && (payload_len_out != NULL)) {
|
|
52
|
-
*payload_len_out = MIN(payload_len,
|
|
53
|
-
(size_t)states[0].payload - (size_t)payload);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (!ret) {
|
|
57
|
-
int err = zcbor_pop_error(states);
|
|
58
|
-
|
|
59
|
-
zcbor_print("Return error: %d\r\n", err);
|
|
60
|
-
return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err;
|
|
61
|
-
}
|
|
62
|
-
return ZCBOR_SUCCESS;
|
|
52
|
+
return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states,
|
|
53
|
+
(zcbor_decoder_t *)encode_sig_structure, sizeof(states) / sizeof(zcbor_state_t), 1);
|
|
63
54
|
}
|