edhoc 1.4.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.clang-format +79 -0
- package/README.md +6 -5
- package/dist/cbor-utils.d.ts +30 -0
- package/dist/cbor-utils.d.ts.map +1 -0
- package/dist/cbor-utils.js +179 -0
- package/dist/cipher-suites.d.ts +13 -0
- package/dist/cipher-suites.d.ts.map +1 -0
- package/dist/cipher-suites.js +22 -0
- package/dist/edhoc.d.ts +84 -283
- package/dist/edhoc.d.ts.map +1 -1
- package/dist/edhoc.js +562 -34
- package/package.json +5 -19
- package/.gitmodules +0 -3
- package/binding.gyp +0 -66
- package/dist/bindings.d.ts +0 -5
- package/dist/bindings.d.ts.map +0 -1
- package/dist/bindings.js +0 -10
- package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_types.h +0 -34
- package/external/libedhoc/backends/cbor/include/backend_cbor_ead_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_ead_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_edhoc_types.h +0 -102
- package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_types.h +0 -37
- package/external/libedhoc/backends/cbor/include/backend_cbor_id_cred_x_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_id_cred_x_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_info_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_info_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_types.h +0 -34
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_1_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_1_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_2_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_2_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_3_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_3_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_4_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_4_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_error_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_error_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_2_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_2_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_3_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_3_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_4_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_4_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_decode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_encode.h +0 -35
- package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_types.h +0 -38
- package/external/libedhoc/backends/cbor/include/backend_cbor_x509_types.h +0 -180
- package/external/libedhoc/backends/cbor/src/backend_cbor_bstr_type_decode.c +0 -50
- package/external/libedhoc/backends/cbor/src/backend_cbor_bstr_type_encode.c +0 -50
- package/external/libedhoc/backends/cbor/src/backend_cbor_ead_decode.c +0 -69
- package/external/libedhoc/backends/cbor/src/backend_cbor_ead_encode.c +0 -69
- package/external/libedhoc/backends/cbor/src/backend_cbor_enc_structure_decode.c +0 -53
- package/external/libedhoc/backends/cbor/src/backend_cbor_enc_structure_encode.c +0 -53
- package/external/libedhoc/backends/cbor/src/backend_cbor_id_cred_x_decode.c +0 -152
- package/external/libedhoc/backends/cbor/src/backend_cbor_id_cred_x_encode.c +0 -152
- package/external/libedhoc/backends/cbor/src/backend_cbor_info_decode.c +0 -52
- package/external/libedhoc/backends/cbor/src/backend_cbor_info_encode.c +0 -52
- package/external/libedhoc/backends/cbor/src/backend_cbor_int_type_decode.c +0 -50
- package/external/libedhoc/backends/cbor/src/backend_cbor_int_type_encode.c +0 -50
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_1_decode.c +0 -115
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_1_encode.c +0 -115
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_2_decode.c +0 -50
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_2_encode.c +0 -50
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_3_decode.c +0 -50
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_3_encode.c +0 -50
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_4_decode.c +0 -50
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_4_encode.c +0 -50
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_error_decode.c +0 -92
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_error_encode.c +0 -92
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_2_decode.c +0 -216
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_2_encode.c +0 -217
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_3_decode.c +0 -212
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_3_encode.c +0 -212
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_4_decode.c +0 -87
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_4_encode.c +0 -87
- package/external/libedhoc/backends/cbor/src/backend_cbor_sig_structure_decode.c +0 -54
- package/external/libedhoc/backends/cbor/src/backend_cbor_sig_structure_encode.c +0 -54
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode.c +0 -31
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode.h +0 -10
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode2.c +0 -18
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode2.h +0 -9
- package/external/libedhoc/externals/Unity/examples/example_1/test/TestProductionCode.c +0 -69
- package/external/libedhoc/externals/Unity/examples/example_1/test/TestProductionCode2.c +0 -38
- package/external/libedhoc/externals/Unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +0 -53
- package/external/libedhoc/externals/Unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +0 -57
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode.c +0 -31
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode.h +0 -10
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode2.c +0 -18
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode2.h +0 -9
- package/external/libedhoc/externals/Unity/examples/example_2/test/TestProductionCode.c +0 -71
- package/external/libedhoc/externals/Unity/examples/example_2/test/TestProductionCode2.c +0 -40
- package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +0 -16
- package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +0 -18
- package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/all_tests.c +0 -19
- package/external/libedhoc/externals/Unity/examples/example_3/helper/UnityHelper.c +0 -17
- package/external/libedhoc/externals/Unity/examples/example_3/helper/UnityHelper.h +0 -19
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode.c +0 -31
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode.h +0 -10
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode2.c +0 -18
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode2.h +0 -9
- package/external/libedhoc/externals/Unity/examples/example_3/test/TestProductionCode.c +0 -69
- package/external/libedhoc/externals/Unity/examples/example_3/test/TestProductionCode2.c +0 -38
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode.c +0 -31
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode.h +0 -10
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode2.c +0 -18
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode2.h +0 -9
- package/external/libedhoc/externals/Unity/examples/example_4/test/TestProductionCode.c +0 -70
- package/external/libedhoc/externals/Unity/examples/example_4/test/TestProductionCode2.c +0 -42
- package/external/libedhoc/externals/Unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +0 -53
- package/external/libedhoc/externals/Unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +0 -57
- package/external/libedhoc/externals/Unity/examples/unity_config.h +0 -251
- package/external/libedhoc/externals/Unity/extras/bdd/src/unity_bdd.h +0 -44
- package/external/libedhoc/externals/Unity/extras/bdd/test/test_bdd.c +0 -129
- package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture.c +0 -310
- package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture.h +0 -95
- package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture_internals.h +0 -51
- package/external/libedhoc/externals/Unity/extras/fixture/test/main/AllTests.c +0 -20
- package/external/libedhoc/externals/Unity/extras/fixture/test/template_fixture_tests.c +0 -40
- package/external/libedhoc/externals/Unity/extras/fixture/test/unity_fixture_Test.c +0 -246
- package/external/libedhoc/externals/Unity/extras/fixture/test/unity_fixture_TestRunner.c +0 -33
- package/external/libedhoc/externals/Unity/extras/memory/src/unity_memory.c +0 -203
- package/external/libedhoc/externals/Unity/extras/memory/src/unity_memory.h +0 -61
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_memory_Test.c +0 -326
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_memory_TestRunner.c +0 -50
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_output_Spy.c +0 -57
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_output_Spy.h +0 -17
- package/external/libedhoc/externals/Unity/src/unity.c +0 -2501
- package/external/libedhoc/externals/Unity/src/unity.h +0 -698
- package/external/libedhoc/externals/Unity/src/unity_internals.h +0 -1183
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_cmd.c +0 -61
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_def.c +0 -57
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_head1.c +0 -55
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_head1.h +0 -15
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_cmd.c +0 -80
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_def.c +0 -76
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_head1.c +0 -75
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_head1.h +0 -13
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_new1.c +0 -89
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_new2.c +0 -89
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_param.c +0 -77
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_run1.c +0 -89
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_run2.c +0 -89
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_yaml.c +0 -90
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_new1.c +0 -67
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_new2.c +0 -70
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_param.c +0 -58
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_run1.c +0 -67
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_run2.c +0 -70
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_yaml.c +0 -71
- package/external/libedhoc/externals/Unity/test/testdata/CException.h +0 -18
- package/external/libedhoc/externals/Unity/test/testdata/Defs.h +0 -16
- package/external/libedhoc/externals/Unity/test/testdata/cmock.h +0 -21
- package/external/libedhoc/externals/Unity/test/testdata/mockMock.h +0 -20
- package/external/libedhoc/externals/Unity/test/testdata/testRunnerGenerator.c +0 -204
- package/external/libedhoc/externals/Unity/test/testdata/testRunnerGeneratorSmall.c +0 -73
- package/external/libedhoc/externals/Unity/test/testdata/testRunnerGeneratorWithMocks.c +0 -200
- package/external/libedhoc/externals/Unity/test/tests/self_assessment_utils.h +0 -151
- package/external/libedhoc/externals/Unity/test/tests/test_unity_arrays.c +0 -2941
- package/external/libedhoc/externals/Unity/test/tests/test_unity_core.c +0 -375
- package/external/libedhoc/externals/Unity/test/tests/test_unity_doubles.c +0 -1285
- package/external/libedhoc/externals/Unity/test/tests/test_unity_floats.c +0 -1395
- package/external/libedhoc/externals/Unity/test/tests/test_unity_integers.c +0 -2863
- package/external/libedhoc/externals/Unity/test/tests/test_unity_integers_64.c +0 -783
- package/external/libedhoc/externals/Unity/test/tests/test_unity_memory.c +0 -82
- package/external/libedhoc/externals/Unity/test/tests/test_unity_parameterized.c +0 -309
- package/external/libedhoc/externals/Unity/test/tests/test_unity_parameterizedDemo.c +0 -28
- package/external/libedhoc/externals/Unity/test/tests/test_unity_strings.c +0 -330
- package/external/libedhoc/externals/Unity/test/tests/types_for_test.h +0 -21
- package/external/libedhoc/externals/compact25519/src/c25519/c25519.c +0 -126
- package/external/libedhoc/externals/compact25519/src/c25519/c25519.h +0 -49
- package/external/libedhoc/externals/compact25519/src/c25519/ed25519.c +0 -323
- package/external/libedhoc/externals/compact25519/src/c25519/ed25519.h +0 -84
- package/external/libedhoc/externals/compact25519/src/c25519/edsign.c +0 -171
- package/external/libedhoc/externals/compact25519/src/c25519/edsign.h +0 -53
- package/external/libedhoc/externals/compact25519/src/c25519/f25519.c +0 -330
- package/external/libedhoc/externals/compact25519/src/c25519/f25519.h +0 -98
- package/external/libedhoc/externals/compact25519/src/c25519/fprime.c +0 -226
- package/external/libedhoc/externals/compact25519/src/c25519/fprime.h +0 -81
- package/external/libedhoc/externals/compact25519/src/c25519/sha512.c +0 -230
- package/external/libedhoc/externals/compact25519/src/c25519/sha512.h +0 -54
- package/external/libedhoc/externals/compact25519/src/compact_ed25519.c +0 -46
- package/external/libedhoc/externals/compact25519/src/compact_ed25519.h +0 -110
- package/external/libedhoc/externals/compact25519/src/compact_wipe.c +0 -12
- package/external/libedhoc/externals/compact25519/src/compact_wipe.h +0 -14
- package/external/libedhoc/externals/compact25519/src/compact_x25519.c +0 -68
- package/external/libedhoc/externals/compact25519/src/compact_x25519.h +0 -101
- package/external/libedhoc/externals/compact25519/test/pcg_random.h +0 -25
- package/external/libedhoc/externals/compact25519/test/run-all.c +0 -178
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/Hacl_Curve25519.h +0 -21
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/everest.h +0 -234
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlib/FStar_UInt128.h +0 -124
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlib/FStar_UInt64_FStar_UInt32_FStar_UInt16_FStar_UInt8.h +0 -280
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlib.h +0 -29
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/c_endianness.h +0 -204
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/builtin.h +0 -16
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/callconv.h +0 -46
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/compat.h +0 -34
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/debug.h +0 -57
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/target.h +0 -102
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/types.h +0 -61
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/kremlin/internal/wasmsupport.h +0 -5
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/vs2013/Hacl_Curve25519.h +0 -21
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/vs2013/inttypes.h +0 -36
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/vs2013/stdbool.h +0 -31
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/include/everest/x25519.h +0 -190
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/Hacl_Curve25519.c +0 -760
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/Hacl_Curve25519_joined.c +0 -50
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/everest.c +0 -102
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/kremlib/FStar_UInt128_extracted.c +0 -413
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/kremlib/FStar_UInt64_FStar_UInt32_FStar_UInt16_FStar_UInt8.c +0 -100
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/legacy/Hacl_Curve25519.c +0 -805
- package/external/libedhoc/externals/mbedtls/3rdparty/everest/library/x25519.c +0 -186
- package/external/libedhoc/externals/mbedtls/3rdparty/p256-m/p256-m/p256-m.c +0 -1514
- package/external/libedhoc/externals/mbedtls/3rdparty/p256-m/p256-m/p256-m.h +0 -135
- package/external/libedhoc/externals/mbedtls/3rdparty/p256-m/p256-m_driver_entrypoints.c +0 -312
- package/external/libedhoc/externals/mbedtls/3rdparty/p256-m/p256-m_driver_entrypoints.h +0 -219
- package/external/libedhoc/externals/mbedtls/configs/config-ccm-psk-dtls1_2.h +0 -92
- package/external/libedhoc/externals/mbedtls/configs/config-ccm-psk-tls1_2.h +0 -83
- package/external/libedhoc/externals/mbedtls/configs/config-no-entropy.h +0 -73
- package/external/libedhoc/externals/mbedtls/configs/config-suite-b.h +0 -106
- package/external/libedhoc/externals/mbedtls/configs/config-symmetric-only.h +0 -77
- package/external/libedhoc/externals/mbedtls/configs/config-thread.h +0 -76
- package/external/libedhoc/externals/mbedtls/configs/crypto-config-ccm-aes-sha256.h +0 -25
- package/external/libedhoc/externals/mbedtls/configs/crypto_config_profile_medium.h +0 -136
- package/external/libedhoc/externals/mbedtls/configs/tfm_mbedcrypto_config_profile_medium.h +0 -609
- package/external/libedhoc/externals/mbedtls/doxygen/input/doc_encdec.h +0 -54
- package/external/libedhoc/externals/mbedtls/doxygen/input/doc_hashing.h +0 -30
- package/external/libedhoc/externals/mbedtls/doxygen/input/doc_mainpage.h +0 -19
- package/external/libedhoc/externals/mbedtls/doxygen/input/doc_rng.h +0 -27
- package/external/libedhoc/externals/mbedtls/doxygen/input/doc_ssltls.h +0 -37
- package/external/libedhoc/externals/mbedtls/doxygen/input/doc_tcpip.h +0 -32
- package/external/libedhoc/externals/mbedtls/doxygen/input/doc_x509.h +0 -31
- package/external/libedhoc/externals/mbedtls/include/mbedtls/aes.h +0 -627
- package/external/libedhoc/externals/mbedtls/include/mbedtls/aria.h +0 -341
- package/external/libedhoc/externals/mbedtls/include/mbedtls/asn1.h +0 -641
- package/external/libedhoc/externals/mbedtls/include/mbedtls/asn1write.h +0 -389
- package/external/libedhoc/externals/mbedtls/include/mbedtls/base64.h +0 -82
- package/external/libedhoc/externals/mbedtls/include/mbedtls/bignum.h +0 -1084
- package/external/libedhoc/externals/mbedtls/include/mbedtls/build_info.h +0 -146
- package/external/libedhoc/externals/mbedtls/include/mbedtls/camellia.h +0 -303
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ccm.h +0 -518
- package/external/libedhoc/externals/mbedtls/include/mbedtls/chacha20.h +0 -202
- package/external/libedhoc/externals/mbedtls/include/mbedtls/chachapoly.h +0 -342
- package/external/libedhoc/externals/mbedtls/include/mbedtls/check_config.h +0 -1206
- package/external/libedhoc/externals/mbedtls/include/mbedtls/cipher.h +0 -1183
- package/external/libedhoc/externals/mbedtls/include/mbedtls/cmac.h +0 -246
- package/external/libedhoc/externals/mbedtls/include/mbedtls/compat-2.x.h +0 -46
- package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_legacy_crypto.h +0 -183
- package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_legacy_from_psa.h +0 -877
- package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_psa_from_legacy.h +0 -334
- package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_psa_superset_legacy.h +0 -142
- package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_ssl.h +0 -76
- package/external/libedhoc/externals/mbedtls/include/mbedtls/config_adjust_x509.h +0 -25
- package/external/libedhoc/externals/mbedtls/include/mbedtls/config_psa.h +0 -55
- package/external/libedhoc/externals/mbedtls/include/mbedtls/constant_time.h +0 -36
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ctr_drbg.h +0 -564
- package/external/libedhoc/externals/mbedtls/include/mbedtls/debug.h +0 -308
- package/external/libedhoc/externals/mbedtls/include/mbedtls/des.h +0 -385
- package/external/libedhoc/externals/mbedtls/include/mbedtls/dhm.h +0 -972
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ecdh.h +0 -441
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ecdsa.h +0 -671
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ecjpake.h +0 -298
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ecp.h +0 -1362
- package/external/libedhoc/externals/mbedtls/include/mbedtls/entropy.h +0 -273
- package/external/libedhoc/externals/mbedtls/include/mbedtls/error.h +0 -201
- package/external/libedhoc/externals/mbedtls/include/mbedtls/gcm.h +0 -370
- package/external/libedhoc/externals/mbedtls/include/mbedtls/hkdf.h +0 -124
- package/external/libedhoc/externals/mbedtls/include/mbedtls/hmac_drbg.h +0 -434
- package/external/libedhoc/externals/mbedtls/include/mbedtls/lms.h +0 -440
- package/external/libedhoc/externals/mbedtls/include/mbedtls/mbedtls_config.h +0 -4116
- package/external/libedhoc/externals/mbedtls/include/mbedtls/md.h +0 -640
- package/external/libedhoc/externals/mbedtls/include/mbedtls/md5.h +0 -190
- package/external/libedhoc/externals/mbedtls/include/mbedtls/memory_buffer_alloc.h +0 -142
- package/external/libedhoc/externals/mbedtls/include/mbedtls/net_sockets.h +0 -299
- package/external/libedhoc/externals/mbedtls/include/mbedtls/nist_kw.h +0 -166
- package/external/libedhoc/externals/mbedtls/include/mbedtls/oid.h +0 -722
- package/external/libedhoc/externals/mbedtls/include/mbedtls/pem.h +0 -160
- package/external/libedhoc/externals/mbedtls/include/mbedtls/pk.h +0 -1091
- package/external/libedhoc/externals/mbedtls/include/mbedtls/pkcs12.h +0 -186
- package/external/libedhoc/externals/mbedtls/include/mbedtls/pkcs5.h +0 -197
- package/external/libedhoc/externals/mbedtls/include/mbedtls/pkcs7.h +0 -241
- package/external/libedhoc/externals/mbedtls/include/mbedtls/platform.h +0 -485
- package/external/libedhoc/externals/mbedtls/include/mbedtls/platform_time.h +0 -79
- package/external/libedhoc/externals/mbedtls/include/mbedtls/platform_util.h +0 -201
- package/external/libedhoc/externals/mbedtls/include/mbedtls/poly1305.h +0 -168
- package/external/libedhoc/externals/mbedtls/include/mbedtls/private_access.h +0 -20
- package/external/libedhoc/externals/mbedtls/include/mbedtls/psa_util.h +0 -104
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ripemd160.h +0 -136
- package/external/libedhoc/externals/mbedtls/include/mbedtls/rsa.h +0 -1143
- package/external/libedhoc/externals/mbedtls/include/mbedtls/sha1.h +0 -219
- package/external/libedhoc/externals/mbedtls/include/mbedtls/sha256.h +0 -198
- package/external/libedhoc/externals/mbedtls/include/mbedtls/sha3.h +0 -172
- package/external/libedhoc/externals/mbedtls/include/mbedtls/sha512.h +0 -208
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ssl.h +0 -5369
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ssl_cache.h +0 -187
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ssl_ciphersuites.h +0 -616
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ssl_cookie.h +0 -106
- package/external/libedhoc/externals/mbedtls/include/mbedtls/ssl_ticket.h +0 -181
- package/external/libedhoc/externals/mbedtls/include/mbedtls/threading.h +0 -105
- package/external/libedhoc/externals/mbedtls/include/mbedtls/timing.h +0 -94
- package/external/libedhoc/externals/mbedtls/include/mbedtls/version.h +0 -78
- package/external/libedhoc/externals/mbedtls/include/mbedtls/x509.h +0 -550
- package/external/libedhoc/externals/mbedtls/include/mbedtls/x509_crl.h +0 -184
- package/external/libedhoc/externals/mbedtls/include/mbedtls/x509_crt.h +0 -1196
- package/external/libedhoc/externals/mbedtls/include/mbedtls/x509_csr.h +0 -319
- package/external/libedhoc/externals/mbedtls/include/psa/build_info.h +0 -20
- package/external/libedhoc/externals/mbedtls/include/psa/crypto.h +0 -4685
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_adjust_auto_enabled.h +0 -21
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_adjust_config_key_pair_types.h +0 -91
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_adjust_config_synonyms.h +0 -45
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_builtin_composites.h +0 -210
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_builtin_key_derivation.h +0 -118
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_builtin_primitives.h +0 -114
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_compat.h +0 -153
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_config.h +0 -153
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_driver_common.h +0 -44
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_driver_contexts_composites.h +0 -151
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_driver_contexts_key_derivation.h +0 -52
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_driver_contexts_primitives.h +0 -105
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_extra.h +0 -2064
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_legacy.h +0 -88
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_platform.h +0 -92
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_se_driver.h +0 -1383
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_sizes.h +0 -1282
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_struct.h +0 -460
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_types.h +0 -453
- package/external/libedhoc/externals/mbedtls/include/psa/crypto_values.h +0 -2756
- package/external/libedhoc/externals/mbedtls/library/aes.c +0 -2315
- package/external/libedhoc/externals/mbedtls/library/aesce.c +0 -503
- package/external/libedhoc/externals/mbedtls/library/aesce.h +0 -121
- package/external/libedhoc/externals/mbedtls/library/aesni.c +0 -802
- package/external/libedhoc/externals/mbedtls/library/aesni.h +0 -158
- package/external/libedhoc/externals/mbedtls/library/alignment.h +0 -509
- package/external/libedhoc/externals/mbedtls/library/aria.c +0 -991
- package/external/libedhoc/externals/mbedtls/library/asn1parse.c +0 -467
- package/external/libedhoc/externals/mbedtls/library/asn1write.c +0 -436
- package/external/libedhoc/externals/mbedtls/library/base64.c +0 -299
- package/external/libedhoc/externals/mbedtls/library/base64_internal.h +0 -45
- package/external/libedhoc/externals/mbedtls/library/bignum.c +0 -2806
- package/external/libedhoc/externals/mbedtls/library/bignum_core.c +0 -894
- package/external/libedhoc/externals/mbedtls/library/bignum_core.h +0 -763
- package/external/libedhoc/externals/mbedtls/library/bignum_mod.c +0 -394
- package/external/libedhoc/externals/mbedtls/library/bignum_mod.h +0 -452
- package/external/libedhoc/externals/mbedtls/library/bignum_mod_raw.c +0 -276
- package/external/libedhoc/externals/mbedtls/library/bignum_mod_raw.h +0 -416
- package/external/libedhoc/externals/mbedtls/library/bignum_mod_raw_invasive.h +0 -34
- package/external/libedhoc/externals/mbedtls/library/bn_mul.h +0 -1094
- package/external/libedhoc/externals/mbedtls/library/camellia.c +0 -1044
- package/external/libedhoc/externals/mbedtls/library/ccm.c +0 -712
- package/external/libedhoc/externals/mbedtls/library/chacha20.c +0 -497
- package/external/libedhoc/externals/mbedtls/library/chachapoly.c +0 -478
- package/external/libedhoc/externals/mbedtls/library/check_crypto_config.h +0 -141
- package/external/libedhoc/externals/mbedtls/library/cipher.c +0 -1664
- package/external/libedhoc/externals/mbedtls/library/cipher_wrap.c +0 -2422
- package/external/libedhoc/externals/mbedtls/library/cipher_wrap.h +0 -132
- package/external/libedhoc/externals/mbedtls/library/cmac.c +0 -1067
- package/external/libedhoc/externals/mbedtls/library/common.h +0 -325
- package/external/libedhoc/externals/mbedtls/library/constant_time.c +0 -261
- package/external/libedhoc/externals/mbedtls/library/constant_time_impl.h +0 -554
- package/external/libedhoc/externals/mbedtls/library/constant_time_internal.h +0 -579
- package/external/libedhoc/externals/mbedtls/library/ctr_drbg.c +0 -881
- package/external/libedhoc/externals/mbedtls/library/debug.c +0 -465
- package/external/libedhoc/externals/mbedtls/library/des.c +0 -1042
- package/external/libedhoc/externals/mbedtls/library/dhm.c +0 -712
- package/external/libedhoc/externals/mbedtls/library/ecdh.c +0 -685
- package/external/libedhoc/externals/mbedtls/library/ecdsa.c +0 -867
- package/external/libedhoc/externals/mbedtls/library/ecjpake.c +0 -1216
- package/external/libedhoc/externals/mbedtls/library/ecp.c +0 -3631
- package/external/libedhoc/externals/mbedtls/library/ecp_curves.c +0 -5467
- package/external/libedhoc/externals/mbedtls/library/ecp_curves_new.c +0 -6043
- package/external/libedhoc/externals/mbedtls/library/ecp_internal_alt.h +0 -287
- package/external/libedhoc/externals/mbedtls/library/ecp_invasive.h +0 -325
- package/external/libedhoc/externals/mbedtls/library/entropy.c +0 -676
- package/external/libedhoc/externals/mbedtls/library/entropy_poll.c +0 -229
- package/external/libedhoc/externals/mbedtls/library/entropy_poll.h +0 -64
- package/external/libedhoc/externals/mbedtls/library/error.c +0 -878
- package/external/libedhoc/externals/mbedtls/library/gcm.c +0 -1168
- package/external/libedhoc/externals/mbedtls/library/hkdf.c +0 -161
- package/external/libedhoc/externals/mbedtls/library/hmac_drbg.c +0 -633
- package/external/libedhoc/externals/mbedtls/library/lmots.c +0 -821
- package/external/libedhoc/externals/mbedtls/library/lmots.h +0 -311
- package/external/libedhoc/externals/mbedtls/library/lms.c +0 -779
- package/external/libedhoc/externals/mbedtls/library/md.c +0 -1108
- package/external/libedhoc/externals/mbedtls/library/md5.c +0 -426
- package/external/libedhoc/externals/mbedtls/library/md_psa.h +0 -63
- package/external/libedhoc/externals/mbedtls/library/md_wrap.h +0 -46
- package/external/libedhoc/externals/mbedtls/library/memory_buffer_alloc.c +0 -745
- package/external/libedhoc/externals/mbedtls/library/mps_common.h +0 -181
- package/external/libedhoc/externals/mbedtls/library/mps_error.h +0 -89
- package/external/libedhoc/externals/mbedtls/library/mps_reader.c +0 -538
- package/external/libedhoc/externals/mbedtls/library/mps_reader.h +0 -366
- package/external/libedhoc/externals/mbedtls/library/mps_trace.c +0 -112
- package/external/libedhoc/externals/mbedtls/library/mps_trace.h +0 -154
- package/external/libedhoc/externals/mbedtls/library/net_sockets.c +0 -696
- package/external/libedhoc/externals/mbedtls/library/nist_kw.c +0 -725
- package/external/libedhoc/externals/mbedtls/library/oid.c +0 -1154
- package/external/libedhoc/externals/mbedtls/library/padlock.c +0 -155
- package/external/libedhoc/externals/mbedtls/library/padlock.h +0 -111
- package/external/libedhoc/externals/mbedtls/library/pem.c +0 -520
- package/external/libedhoc/externals/mbedtls/library/pk.c +0 -970
- package/external/libedhoc/externals/mbedtls/library/pk_internal.h +0 -118
- package/external/libedhoc/externals/mbedtls/library/pk_wrap.c +0 -1834
- package/external/libedhoc/externals/mbedtls/library/pk_wrap.h +0 -156
- package/external/libedhoc/externals/mbedtls/library/pkcs12.c +0 -447
- package/external/libedhoc/externals/mbedtls/library/pkcs5.c +0 -496
- package/external/libedhoc/externals/mbedtls/library/pkcs7.c +0 -773
- package/external/libedhoc/externals/mbedtls/library/pkparse.c +0 -1845
- package/external/libedhoc/externals/mbedtls/library/pkwrite.c +0 -836
- package/external/libedhoc/externals/mbedtls/library/pkwrite.h +0 -112
- package/external/libedhoc/externals/mbedtls/library/platform.c +0 -402
- package/external/libedhoc/externals/mbedtls/library/platform_util.c +0 -285
- package/external/libedhoc/externals/mbedtls/library/poly1305.c +0 -492
- package/external/libedhoc/externals/mbedtls/library/psa_crypto.c +0 -8432
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_aead.c +0 -653
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_aead.h +0 -499
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_cipher.c +0 -590
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_cipher.h +0 -293
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_client.c +0 -67
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_core.h +0 -838
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_core_common.h +0 -52
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_driver_wrappers.h +0 -2871
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_driver_wrappers_no_static.c +0 -256
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_driver_wrappers_no_static.h +0 -31
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_ecp.c +0 -561
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_ecp.h +0 -267
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_ffdh.c +0 -295
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_ffdh.h +0 -132
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_hash.c +0 -470
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_hash.h +0 -211
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_invasive.h +0 -70
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_its.h +0 -131
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_mac.c +0 -496
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_mac.h +0 -264
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_pake.c +0 -571
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_pake.h +0 -159
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_random_impl.h +0 -192
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_rsa.c +0 -727
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_rsa.h +0 -317
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_se.c +0 -373
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_se.h +0 -185
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_slot_management.c +0 -559
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_slot_management.h +0 -213
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_storage.c +0 -481
- package/external/libedhoc/externals/mbedtls/library/psa_crypto_storage.h +0 -384
- package/external/libedhoc/externals/mbedtls/library/psa_its_file.c +0 -259
- package/external/libedhoc/externals/mbedtls/library/psa_util.c +0 -160
- package/external/libedhoc/externals/mbedtls/library/psa_util_internal.h +0 -96
- package/external/libedhoc/externals/mbedtls/library/ripemd160.c +0 -490
- package/external/libedhoc/externals/mbedtls/library/rsa.c +0 -2640
- package/external/libedhoc/externals/mbedtls/library/rsa_alt_helpers.c +0 -447
- package/external/libedhoc/externals/mbedtls/library/rsa_alt_helpers.h +0 -208
- package/external/libedhoc/externals/mbedtls/library/sha1.c +0 -480
- package/external/libedhoc/externals/mbedtls/library/sha256.c +0 -946
- package/external/libedhoc/externals/mbedtls/library/sha3.c +0 -626
- package/external/libedhoc/externals/mbedtls/library/sha512.c +0 -1111
- package/external/libedhoc/externals/mbedtls/library/ssl_cache.c +0 -410
- package/external/libedhoc/externals/mbedtls/library/ssl_ciphersuites.c +0 -2050
- package/external/libedhoc/externals/mbedtls/library/ssl_client.c +0 -1017
- package/external/libedhoc/externals/mbedtls/library/ssl_client.h +0 -22
- package/external/libedhoc/externals/mbedtls/library/ssl_cookie.c +0 -380
- package/external/libedhoc/externals/mbedtls/library/ssl_debug_helpers.h +0 -78
- package/external/libedhoc/externals/mbedtls/library/ssl_debug_helpers_generated.c +0 -234
- package/external/libedhoc/externals/mbedtls/library/ssl_misc.h +0 -2847
- package/external/libedhoc/externals/mbedtls/library/ssl_msg.c +0 -6155
- package/external/libedhoc/externals/mbedtls/library/ssl_ticket.c +0 -540
- package/external/libedhoc/externals/mbedtls/library/ssl_tls.c +0 -9577
- package/external/libedhoc/externals/mbedtls/library/ssl_tls12_client.c +0 -3607
- package/external/libedhoc/externals/mbedtls/library/ssl_tls12_server.c +0 -4403
- package/external/libedhoc/externals/mbedtls/library/ssl_tls13_client.c +0 -3046
- package/external/libedhoc/externals/mbedtls/library/ssl_tls13_generic.c +0 -1740
- package/external/libedhoc/externals/mbedtls/library/ssl_tls13_invasive.h +0 -23
- package/external/libedhoc/externals/mbedtls/library/ssl_tls13_keys.c +0 -1897
- package/external/libedhoc/externals/mbedtls/library/ssl_tls13_keys.h +0 -651
- package/external/libedhoc/externals/mbedtls/library/ssl_tls13_server.c +0 -3146
- package/external/libedhoc/externals/mbedtls/library/threading.c +0 -181
- package/external/libedhoc/externals/mbedtls/library/timing.c +0 -154
- package/external/libedhoc/externals/mbedtls/library/version.c +0 -32
- package/external/libedhoc/externals/mbedtls/library/version_features.c +0 -826
- package/external/libedhoc/externals/mbedtls/library/x509.c +0 -1776
- package/external/libedhoc/externals/mbedtls/library/x509_create.c +0 -557
- package/external/libedhoc/externals/mbedtls/library/x509_crl.c +0 -712
- package/external/libedhoc/externals/mbedtls/library/x509_crt.c +0 -3292
- package/external/libedhoc/externals/mbedtls/library/x509_csr.c +0 -574
- package/external/libedhoc/externals/mbedtls/library/x509write.c +0 -174
- package/external/libedhoc/externals/mbedtls/library/x509write_crt.c +0 -681
- package/external/libedhoc/externals/mbedtls/library/x509write_csr.c +0 -331
- package/external/libedhoc/externals/mbedtls/programs/aes/crypt_and_hash.c +0 -573
- package/external/libedhoc/externals/mbedtls/programs/cipher/cipher_aead_demo.c +0 -259
- package/external/libedhoc/externals/mbedtls/programs/fuzz/common.c +0 -105
- package/external/libedhoc/externals/mbedtls/programs/fuzz/common.h +0 -25
- package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_client.c +0 -195
- package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_dtlsclient.c +0 -138
- package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_dtlsserver.c +0 -183
- package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_pkcs7.c +0 -20
- package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_privkey.c +0 -106
- package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_pubkey.c +0 -86
- package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_server.c +0 -218
- package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_x509crl.c +0 -41
- package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_x509crt.c +0 -41
- package/external/libedhoc/externals/mbedtls/programs/fuzz/fuzz_x509csr.c +0 -41
- package/external/libedhoc/externals/mbedtls/programs/fuzz/onefile.c +0 -69
- package/external/libedhoc/externals/mbedtls/programs/hash/generic_sum.c +0 -209
- package/external/libedhoc/externals/mbedtls/programs/hash/hello.c +0 -45
- package/external/libedhoc/externals/mbedtls/programs/hash/md_hmac_demo.c +0 -136
- package/external/libedhoc/externals/mbedtls/programs/pkey/dh_client.c +0 -274
- package/external/libedhoc/externals/mbedtls/programs/pkey/dh_genprime.c +0 -161
- package/external/libedhoc/externals/mbedtls/programs/pkey/dh_server.c +0 -296
- package/external/libedhoc/externals/mbedtls/programs/pkey/ecdh_curve25519.c +0 -189
- package/external/libedhoc/externals/mbedtls/programs/pkey/ecdsa.c +0 -217
- package/external/libedhoc/externals/mbedtls/programs/pkey/gen_key.c +0 -419
- package/external/libedhoc/externals/mbedtls/programs/pkey/key_app.c +0 -316
- package/external/libedhoc/externals/mbedtls/programs/pkey/key_app_writer.c +0 -435
- package/external/libedhoc/externals/mbedtls/programs/pkey/mpi_demo.c +0 -84
- package/external/libedhoc/externals/mbedtls/programs/pkey/pk_decrypt.c +0 -153
- package/external/libedhoc/externals/mbedtls/programs/pkey/pk_encrypt.c +0 -154
- package/external/libedhoc/externals/mbedtls/programs/pkey/pk_sign.c +0 -155
- package/external/libedhoc/externals/mbedtls/programs/pkey/pk_verify.c +0 -128
- package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_decrypt.c +0 -172
- package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_encrypt.c +0 -149
- package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_genkey.c +0 -141
- package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_sign.c +0 -155
- package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_sign_pss.c +0 -161
- package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_verify.c +0 -131
- package/external/libedhoc/externals/mbedtls/programs/pkey/rsa_verify_pss.c +0 -136
- package/external/libedhoc/externals/mbedtls/programs/psa/aead_demo.c +0 -281
- package/external/libedhoc/externals/mbedtls/programs/psa/crypto_examples.c +0 -321
- package/external/libedhoc/externals/mbedtls/programs/psa/hmac_demo.c +0 -159
- package/external/libedhoc/externals/mbedtls/programs/psa/key_ladder_demo.c +0 -691
- package/external/libedhoc/externals/mbedtls/programs/psa/psa_constant_names.c +0 -310
- package/external/libedhoc/externals/mbedtls/programs/psa/psa_constant_names_generated.c +0 -474
- package/external/libedhoc/externals/mbedtls/programs/random/gen_entropy.c +0 -75
- package/external/libedhoc/externals/mbedtls/programs/random/gen_random_ctr_drbg.c +0 -107
- package/external/libedhoc/externals/mbedtls/programs/ssl/dtls_client.c +0 -342
- package/external/libedhoc/externals/mbedtls/programs/ssl/dtls_server.c +0 -408
- package/external/libedhoc/externals/mbedtls/programs/ssl/mini_client.c +0 -274
- package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_client1.c +0 -288
- package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_client2.c +0 -3118
- package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_context_info.c +0 -1009
- package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_fork_server.c +0 -381
- package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_mail_client.c +0 -804
- package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_pthread_server.c +0 -489
- package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_server.c +0 -362
- package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_server2.c +0 -4268
- package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_test_common_source.c +0 -375
- package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_test_lib.c +0 -601
- package/external/libedhoc/externals/mbedtls/programs/ssl/ssl_test_lib.h +0 -306
- package/external/libedhoc/externals/mbedtls/programs/test/benchmark.c +0 -1284
- package/external/libedhoc/externals/mbedtls/programs/test/cmake_package/cmake_package.c +0 -27
- package/external/libedhoc/externals/mbedtls/programs/test/cmake_package_install/cmake_package_install.c +0 -28
- package/external/libedhoc/externals/mbedtls/programs/test/cmake_subproject/cmake_subproject.c +0 -28
- package/external/libedhoc/externals/mbedtls/programs/test/dlopen.c +0 -92
- package/external/libedhoc/externals/mbedtls/programs/test/query_compile_time_config.c +0 -66
- package/external/libedhoc/externals/mbedtls/programs/test/query_config.c +0 -5137
- package/external/libedhoc/externals/mbedtls/programs/test/query_config.h +0 -34
- package/external/libedhoc/externals/mbedtls/programs/test/query_included_headers.c +0 -29
- package/external/libedhoc/externals/mbedtls/programs/test/selftest.c +0 -583
- package/external/libedhoc/externals/mbedtls/programs/test/udp_proxy.c +0 -967
- package/external/libedhoc/externals/mbedtls/programs/test/zeroize.c +0 -72
- package/external/libedhoc/externals/mbedtls/programs/util/pem2der.c +0 -265
- package/external/libedhoc/externals/mbedtls/programs/util/strerror.c +0 -61
- package/external/libedhoc/externals/mbedtls/programs/wince_main.c +0 -31
- package/external/libedhoc/externals/mbedtls/programs/x509/cert_app.c +0 -456
- package/external/libedhoc/externals/mbedtls/programs/x509/cert_req.c +0 -509
- package/external/libedhoc/externals/mbedtls/programs/x509/cert_write.c +0 -1012
- package/external/libedhoc/externals/mbedtls/programs/x509/crl_app.c +0 -132
- package/external/libedhoc/externals/mbedtls/programs/x509/load_roots.c +0 -165
- package/external/libedhoc/externals/mbedtls/programs/x509/req_app.c +0 -132
- package/external/libedhoc/externals/mbedtls/tests/configs/tls13-only.h +0 -31
- package/external/libedhoc/externals/mbedtls/tests/configs/user-config-for-test.h +0 -89
- package/external/libedhoc/externals/mbedtls/tests/configs/user-config-malloc-0-null.h +0 -22
- package/external/libedhoc/externals/mbedtls/tests/configs/user-config-zeroize-memset.h +0 -17
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/aes_alt.h +0 -23
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/aria_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/camellia_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/ccm_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/chacha20_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/chachapoly_alt.h +0 -18
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/cmac_alt.h +0 -15
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/des_alt.h +0 -22
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/dhm_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/ecjpake_alt.h +0 -15
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/ecp_alt.h +0 -22
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/gcm_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/md5_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/nist_kw_alt.h +0 -15
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/platform_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/poly1305_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/ripemd160_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/rsa_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/sha1_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/sha256_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/sha512_alt.h +0 -16
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/threading_alt.h +0 -14
- package/external/libedhoc/externals/mbedtls/tests/include/alt-dummy/timing_alt.h +0 -19
- package/external/libedhoc/externals/mbedtls/tests/include/alt-extra/psa/crypto.h +0 -7
- package/external/libedhoc/externals/mbedtls/tests/include/baremetal-override/time.h +0 -6
- package/external/libedhoc/externals/mbedtls/tests/include/spe/crypto_spe.h +0 -131
- package/external/libedhoc/externals/mbedtls/tests/include/test/arguments.h +0 -26
- package/external/libedhoc/externals/mbedtls/tests/include/test/asn1_helpers.h +0 -38
- package/external/libedhoc/externals/mbedtls/tests/include/test/bignum_helpers.h +0 -106
- package/external/libedhoc/externals/mbedtls/tests/include/test/certs.h +0 -234
- package/external/libedhoc/externals/mbedtls/tests/include/test/constant_flow.h +0 -71
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/aead.h +0 -121
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/asymmetric_encryption.h +0 -67
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/cipher.h +0 -130
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/config_test_driver.h +0 -44
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/crypto_config_test_driver_extension.h +0 -430
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/hash.h +0 -64
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/key_agreement.h +0 -62
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/key_management.h +0 -123
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/mac.h +0 -125
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/pake.h +0 -75
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/signature.h +0 -112
- package/external/libedhoc/externals/mbedtls/tests/include/test/drivers/test_driver.h +0 -32
- package/external/libedhoc/externals/mbedtls/tests/include/test/fake_external_rng_for_test.h +0 -40
- package/external/libedhoc/externals/mbedtls/tests/include/test/helpers.h +0 -268
- package/external/libedhoc/externals/mbedtls/tests/include/test/macros.h +0 -250
- package/external/libedhoc/externals/mbedtls/tests/include/test/psa_crypto_helpers.h +0 -398
- package/external/libedhoc/externals/mbedtls/tests/include/test/psa_exercise_key.h +0 -223
- package/external/libedhoc/externals/mbedtls/tests/include/test/psa_helpers.h +0 -24
- package/external/libedhoc/externals/mbedtls/tests/include/test/random.h +0 -91
- package/external/libedhoc/externals/mbedtls/tests/include/test/ssl_helpers.h +0 -628
- package/external/libedhoc/externals/mbedtls/tests/src/asn1_helpers.c +0 -62
- package/external/libedhoc/externals/mbedtls/tests/src/bignum_helpers.c +0 -145
- package/external/libedhoc/externals/mbedtls/tests/src/certs.c +0 -480
- package/external/libedhoc/externals/mbedtls/tests/src/drivers/hash.c +0 -199
- package/external/libedhoc/externals/mbedtls/tests/src/drivers/platform_builtin_keys.c +0 -78
- package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_aead.c +0 -462
- package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_asymmetric_encryption.c +0 -151
- package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_cipher.c +0 -424
- package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_key_agreement.c +0 -147
- package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_key_management.c +0 -783
- package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_mac.c +0 -422
- package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_pake.c +0 -202
- package/external/libedhoc/externals/mbedtls/tests/src/drivers/test_driver_signature.c +0 -405
- package/external/libedhoc/externals/mbedtls/tests/src/fake_external_rng_for_test.c +0 -45
- package/external/libedhoc/externals/mbedtls/tests/src/helpers.c +0 -353
- package/external/libedhoc/externals/mbedtls/tests/src/psa_crypto_helpers.c +0 -196
- package/external/libedhoc/externals/mbedtls/tests/src/psa_exercise_key.c +0 -989
- package/external/libedhoc/externals/mbedtls/tests/src/random.c +0 -136
- package/external/libedhoc/externals/mbedtls/tests/src/test_certs.h +0 -1226
- package/external/libedhoc/externals/mbedtls/tests/src/test_helpers/ssl_helpers.c +0 -2292
- package/external/libedhoc/externals/mbedtls/tests/src/threading_helpers.c +0 -210
- package/external/libedhoc/externals/zcbor/include/zcbor_common.h +0 -509
- package/external/libedhoc/externals/zcbor/include/zcbor_decode.h +0 -447
- package/external/libedhoc/externals/zcbor/include/zcbor_encode.h +0 -240
- package/external/libedhoc/externals/zcbor/include/zcbor_print.h +0 -165
- package/external/libedhoc/externals/zcbor/include/zcbor_tags.h +0 -94
- package/external/libedhoc/externals/zcbor/samples/hello_world/src/main.c +0 -41
- package/external/libedhoc/externals/zcbor/samples/pet/include/pet_decode.h +0 -39
- package/external/libedhoc/externals/zcbor/samples/pet/include/pet_encode.h +0 -39
- package/external/libedhoc/externals/zcbor/samples/pet/include/pet_types.h +0 -47
- package/external/libedhoc/externals/zcbor/samples/pet/src/main.c +0 -128
- package/external/libedhoc/externals/zcbor/samples/pet/src/pet_decode.c +0 -60
- package/external/libedhoc/externals/zcbor/samples/pet/src/pet_encode.c +0 -61
- package/external/libedhoc/externals/zcbor/src/zcbor_common.c +0 -430
- package/external/libedhoc/externals/zcbor/src/zcbor_decode.c +0 -1567
- package/external/libedhoc/externals/zcbor/src/zcbor_encode.c +0 -609
- package/external/libedhoc/externals/zcbor/tests/decode/test1_suit_old_formats/src/main.c +0 -367
- package/external/libedhoc/externals/zcbor/tests/decode/test2_suit/src/main.c +0 -189
- package/external/libedhoc/externals/zcbor/tests/decode/test3_simple/src/main.c +0 -528
- package/external/libedhoc/externals/zcbor/tests/decode/test5_corner_cases/src/main.c +0 -2154
- package/external/libedhoc/externals/zcbor/tests/decode/test7_suit9_simple/src/main.c +0 -134
- package/external/libedhoc/externals/zcbor/tests/decode/test8_suit12/src/main.c +0 -862
- package/external/libedhoc/externals/zcbor/tests/decode/test9_manifest14/src/main.c +0 -363
- package/external/libedhoc/externals/zcbor/tests/encode/test1_suit/src/main.c +0 -453
- package/external/libedhoc/externals/zcbor/tests/encode/test2_simple/src/main.c +0 -122
- package/external/libedhoc/externals/zcbor/tests/encode/test3_corner_cases/src/main.c +0 -1554
- package/external/libedhoc/externals/zcbor/tests/encode/test4_senml/src/main.c +0 -65
- package/external/libedhoc/externals/zcbor/tests/fuzz/fuzz_everything.c +0 -12
- package/external/libedhoc/externals/zcbor/tests/fuzz/fuzz_manifest12.c +0 -136
- package/external/libedhoc/externals/zcbor/tests/fuzz/fuzz_pet.c +0 -12
- package/external/libedhoc/externals/zcbor/tests/fuzz/main_entry.c +0 -60
- package/external/libedhoc/externals/zcbor/tests/fuzz/main_entry.h +0 -5
- package/external/libedhoc/externals/zcbor/tests/unit/test1_unit_tests/src/main.c +0 -1437
- package/external/libedhoc/externals/zcbor/tests/unit/test3_float16/src/main.c +0 -203
- package/external/libedhoc/include/edhoc.h +0 -687
- package/external/libedhoc/include/edhoc_common.h +0 -289
- package/external/libedhoc/include/edhoc_context.h +0 -343
- package/external/libedhoc/include/edhoc_credentials.h +0 -265
- package/external/libedhoc/include/edhoc_crypto.h +0 -331
- package/external/libedhoc/include/edhoc_ead.h +0 -102
- package/external/libedhoc/include/edhoc_macros.h +0 -60
- package/external/libedhoc/include/edhoc_values.h +0 -181
- package/external/libedhoc/library/edhoc.c +0 -253
- package/external/libedhoc/library/edhoc_common.c +0 -1314
- package/external/libedhoc/library/edhoc_exporter.c +0 -542
- package/external/libedhoc/library/edhoc_message_1.c +0 -474
- package/external/libedhoc/library/edhoc_message_2.c +0 -1697
- package/external/libedhoc/library/edhoc_message_3.c +0 -1467
- package/external/libedhoc/library/edhoc_message_4.c +0 -828
- package/external/libedhoc/library/edhoc_message_error.c +0 -238
- package/external/libedhoc/tests/include/cipher_suite_0.h +0 -131
- package/external/libedhoc/tests/include/cipher_suite_2.h +0 -139
- package/external/libedhoc/tests/include/test_vector_rfc9529_chapter_2.h +0 -786
- package/external/libedhoc/tests/include/test_vector_rfc9529_chapter_3.h +0 -529
- package/external/libedhoc/tests/include/test_vector_x5chain_sign_keys_suite_0.h +0 -137
- package/external/libedhoc/tests/include/test_vector_x5chain_sign_keys_suite_2.h +0 -168
- package/external/libedhoc/tests/include/test_vector_x5chain_static_dh_keys_suite_2.h +0 -162
- package/external/libedhoc/tests/include/test_vector_x5t_sign_keys_suite_2.h +0 -180
- package/external/libedhoc/tests/src/cipher_suite_0.c +0 -445
- package/external/libedhoc/tests/src/cipher_suite_2.c +0 -600
- package/external/libedhoc/tests/src/module_test_api.c +0 -430
- package/external/libedhoc/tests/src/module_test_cipher_suite_0.c +0 -395
- package/external/libedhoc/tests/src/module_test_cipher_suite_2.c +0 -392
- package/external/libedhoc/tests/src/module_test_error_message.c +0 -251
- package/external/libedhoc/tests/src/module_test_main.c +0 -49
- package/external/libedhoc/tests/src/module_test_rfc9528_suites_negotiation.c +0 -541
- package/external/libedhoc/tests/src/module_test_rfc9529_chapter_2.c +0 -2681
- package/external/libedhoc/tests/src/module_test_rfc9529_chapter_3.c +0 -1635
- package/external/libedhoc/tests/src/module_test_x5chain_sign_keys_suite_0.c +0 -1135
- package/external/libedhoc/tests/src/module_test_x5chain_sign_keys_suite_2.c +0 -1249
- package/external/libedhoc/tests/src/module_test_x5chain_static_dh_keys_suite_2.c +0 -798
- package/external/libedhoc/tests/src/module_test_x5t_sign_keys_suite_2.c +0 -956
- package/include/Binding.h +0 -359
- package/include/EdhocComposeAsyncWorker.h +0 -49
- package/include/EdhocCredentialManager.h +0 -106
- package/include/EdhocCryptoManager.h +0 -495
- package/include/EdhocEadManager.h +0 -147
- package/include/EdhocExportOscoreAsyncWorker.h +0 -57
- package/include/EdhocKeyExporterAsyncWorker.h +0 -56
- package/include/EdhocKeyUpdateAsyncWorker.h +0 -55
- package/include/EdhocProcessAsyncWorker.h +0 -55
- package/include/RunningContext.h +0 -102
- package/include/Suites.h +0 -27
- package/include/Utils.h +0 -71
- package/patches/prebuildify-cross+5.1.0.dev.patch +0 -26
- package/patches/prebuildify-cross+5.1.1.dev.patch +0 -26
- 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/Binding.cpp +0 -446
- package/src/EdhocComposeAsyncWorker.cpp +0 -60
- package/src/EdhocCredentialManager.cpp +0 -425
- package/src/EdhocCryptoManager.cpp +0 -593
- package/src/EdhocEadManager.cpp +0 -148
- package/src/EdhocExportOscoreAsyncWorker.cpp +0 -67
- package/src/EdhocKeyExporterAsyncWorker.cpp +0 -39
- package/src/EdhocKeyUpdateAsyncWorker.cpp +0 -31
- package/src/EdhocProcessAsyncWorker.cpp +0 -120
- package/src/RunningContext.cpp +0 -95
- package/src/Suites.cpp +0 -120
- package/src/Utils.cpp +0 -54
- package/test/basic.test.ts +0 -127
- package/test/vectors.test.ts +0 -111
|
@@ -1,1042 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* FIPS-46-3 compliant Triple-DES implementation
|
|
3
|
-
*
|
|
4
|
-
* Copyright The Mbed TLS Contributors
|
|
5
|
-
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
|
6
|
-
*/
|
|
7
|
-
/*
|
|
8
|
-
* DES, on which TDES is based, was originally designed by Horst Feistel
|
|
9
|
-
* at IBM in 1974, and was adopted as a standard by NIST (formerly NBS).
|
|
10
|
-
*
|
|
11
|
-
* http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
#include "common.h"
|
|
15
|
-
|
|
16
|
-
#if defined(MBEDTLS_DES_C)
|
|
17
|
-
|
|
18
|
-
#include "mbedtls/des.h"
|
|
19
|
-
#include "mbedtls/error.h"
|
|
20
|
-
#include "mbedtls/platform_util.h"
|
|
21
|
-
|
|
22
|
-
#include <string.h>
|
|
23
|
-
|
|
24
|
-
#include "mbedtls/platform.h"
|
|
25
|
-
|
|
26
|
-
#if !defined(MBEDTLS_DES_ALT)
|
|
27
|
-
|
|
28
|
-
/*
|
|
29
|
-
* Expanded DES S-boxes
|
|
30
|
-
*/
|
|
31
|
-
static const uint32_t SB1[64] =
|
|
32
|
-
{
|
|
33
|
-
0x01010400, 0x00000000, 0x00010000, 0x01010404,
|
|
34
|
-
0x01010004, 0x00010404, 0x00000004, 0x00010000,
|
|
35
|
-
0x00000400, 0x01010400, 0x01010404, 0x00000400,
|
|
36
|
-
0x01000404, 0x01010004, 0x01000000, 0x00000004,
|
|
37
|
-
0x00000404, 0x01000400, 0x01000400, 0x00010400,
|
|
38
|
-
0x00010400, 0x01010000, 0x01010000, 0x01000404,
|
|
39
|
-
0x00010004, 0x01000004, 0x01000004, 0x00010004,
|
|
40
|
-
0x00000000, 0x00000404, 0x00010404, 0x01000000,
|
|
41
|
-
0x00010000, 0x01010404, 0x00000004, 0x01010000,
|
|
42
|
-
0x01010400, 0x01000000, 0x01000000, 0x00000400,
|
|
43
|
-
0x01010004, 0x00010000, 0x00010400, 0x01000004,
|
|
44
|
-
0x00000400, 0x00000004, 0x01000404, 0x00010404,
|
|
45
|
-
0x01010404, 0x00010004, 0x01010000, 0x01000404,
|
|
46
|
-
0x01000004, 0x00000404, 0x00010404, 0x01010400,
|
|
47
|
-
0x00000404, 0x01000400, 0x01000400, 0x00000000,
|
|
48
|
-
0x00010004, 0x00010400, 0x00000000, 0x01010004
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
static const uint32_t SB2[64] =
|
|
52
|
-
{
|
|
53
|
-
0x80108020, 0x80008000, 0x00008000, 0x00108020,
|
|
54
|
-
0x00100000, 0x00000020, 0x80100020, 0x80008020,
|
|
55
|
-
0x80000020, 0x80108020, 0x80108000, 0x80000000,
|
|
56
|
-
0x80008000, 0x00100000, 0x00000020, 0x80100020,
|
|
57
|
-
0x00108000, 0x00100020, 0x80008020, 0x00000000,
|
|
58
|
-
0x80000000, 0x00008000, 0x00108020, 0x80100000,
|
|
59
|
-
0x00100020, 0x80000020, 0x00000000, 0x00108000,
|
|
60
|
-
0x00008020, 0x80108000, 0x80100000, 0x00008020,
|
|
61
|
-
0x00000000, 0x00108020, 0x80100020, 0x00100000,
|
|
62
|
-
0x80008020, 0x80100000, 0x80108000, 0x00008000,
|
|
63
|
-
0x80100000, 0x80008000, 0x00000020, 0x80108020,
|
|
64
|
-
0x00108020, 0x00000020, 0x00008000, 0x80000000,
|
|
65
|
-
0x00008020, 0x80108000, 0x00100000, 0x80000020,
|
|
66
|
-
0x00100020, 0x80008020, 0x80000020, 0x00100020,
|
|
67
|
-
0x00108000, 0x00000000, 0x80008000, 0x00008020,
|
|
68
|
-
0x80000000, 0x80100020, 0x80108020, 0x00108000
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
static const uint32_t SB3[64] =
|
|
72
|
-
{
|
|
73
|
-
0x00000208, 0x08020200, 0x00000000, 0x08020008,
|
|
74
|
-
0x08000200, 0x00000000, 0x00020208, 0x08000200,
|
|
75
|
-
0x00020008, 0x08000008, 0x08000008, 0x00020000,
|
|
76
|
-
0x08020208, 0x00020008, 0x08020000, 0x00000208,
|
|
77
|
-
0x08000000, 0x00000008, 0x08020200, 0x00000200,
|
|
78
|
-
0x00020200, 0x08020000, 0x08020008, 0x00020208,
|
|
79
|
-
0x08000208, 0x00020200, 0x00020000, 0x08000208,
|
|
80
|
-
0x00000008, 0x08020208, 0x00000200, 0x08000000,
|
|
81
|
-
0x08020200, 0x08000000, 0x00020008, 0x00000208,
|
|
82
|
-
0x00020000, 0x08020200, 0x08000200, 0x00000000,
|
|
83
|
-
0x00000200, 0x00020008, 0x08020208, 0x08000200,
|
|
84
|
-
0x08000008, 0x00000200, 0x00000000, 0x08020008,
|
|
85
|
-
0x08000208, 0x00020000, 0x08000000, 0x08020208,
|
|
86
|
-
0x00000008, 0x00020208, 0x00020200, 0x08000008,
|
|
87
|
-
0x08020000, 0x08000208, 0x00000208, 0x08020000,
|
|
88
|
-
0x00020208, 0x00000008, 0x08020008, 0x00020200
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
static const uint32_t SB4[64] =
|
|
92
|
-
{
|
|
93
|
-
0x00802001, 0x00002081, 0x00002081, 0x00000080,
|
|
94
|
-
0x00802080, 0x00800081, 0x00800001, 0x00002001,
|
|
95
|
-
0x00000000, 0x00802000, 0x00802000, 0x00802081,
|
|
96
|
-
0x00000081, 0x00000000, 0x00800080, 0x00800001,
|
|
97
|
-
0x00000001, 0x00002000, 0x00800000, 0x00802001,
|
|
98
|
-
0x00000080, 0x00800000, 0x00002001, 0x00002080,
|
|
99
|
-
0x00800081, 0x00000001, 0x00002080, 0x00800080,
|
|
100
|
-
0x00002000, 0x00802080, 0x00802081, 0x00000081,
|
|
101
|
-
0x00800080, 0x00800001, 0x00802000, 0x00802081,
|
|
102
|
-
0x00000081, 0x00000000, 0x00000000, 0x00802000,
|
|
103
|
-
0x00002080, 0x00800080, 0x00800081, 0x00000001,
|
|
104
|
-
0x00802001, 0x00002081, 0x00002081, 0x00000080,
|
|
105
|
-
0x00802081, 0x00000081, 0x00000001, 0x00002000,
|
|
106
|
-
0x00800001, 0x00002001, 0x00802080, 0x00800081,
|
|
107
|
-
0x00002001, 0x00002080, 0x00800000, 0x00802001,
|
|
108
|
-
0x00000080, 0x00800000, 0x00002000, 0x00802080
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
static const uint32_t SB5[64] =
|
|
112
|
-
{
|
|
113
|
-
0x00000100, 0x02080100, 0x02080000, 0x42000100,
|
|
114
|
-
0x00080000, 0x00000100, 0x40000000, 0x02080000,
|
|
115
|
-
0x40080100, 0x00080000, 0x02000100, 0x40080100,
|
|
116
|
-
0x42000100, 0x42080000, 0x00080100, 0x40000000,
|
|
117
|
-
0x02000000, 0x40080000, 0x40080000, 0x00000000,
|
|
118
|
-
0x40000100, 0x42080100, 0x42080100, 0x02000100,
|
|
119
|
-
0x42080000, 0x40000100, 0x00000000, 0x42000000,
|
|
120
|
-
0x02080100, 0x02000000, 0x42000000, 0x00080100,
|
|
121
|
-
0x00080000, 0x42000100, 0x00000100, 0x02000000,
|
|
122
|
-
0x40000000, 0x02080000, 0x42000100, 0x40080100,
|
|
123
|
-
0x02000100, 0x40000000, 0x42080000, 0x02080100,
|
|
124
|
-
0x40080100, 0x00000100, 0x02000000, 0x42080000,
|
|
125
|
-
0x42080100, 0x00080100, 0x42000000, 0x42080100,
|
|
126
|
-
0x02080000, 0x00000000, 0x40080000, 0x42000000,
|
|
127
|
-
0x00080100, 0x02000100, 0x40000100, 0x00080000,
|
|
128
|
-
0x00000000, 0x40080000, 0x02080100, 0x40000100
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
static const uint32_t SB6[64] =
|
|
132
|
-
{
|
|
133
|
-
0x20000010, 0x20400000, 0x00004000, 0x20404010,
|
|
134
|
-
0x20400000, 0x00000010, 0x20404010, 0x00400000,
|
|
135
|
-
0x20004000, 0x00404010, 0x00400000, 0x20000010,
|
|
136
|
-
0x00400010, 0x20004000, 0x20000000, 0x00004010,
|
|
137
|
-
0x00000000, 0x00400010, 0x20004010, 0x00004000,
|
|
138
|
-
0x00404000, 0x20004010, 0x00000010, 0x20400010,
|
|
139
|
-
0x20400010, 0x00000000, 0x00404010, 0x20404000,
|
|
140
|
-
0x00004010, 0x00404000, 0x20404000, 0x20000000,
|
|
141
|
-
0x20004000, 0x00000010, 0x20400010, 0x00404000,
|
|
142
|
-
0x20404010, 0x00400000, 0x00004010, 0x20000010,
|
|
143
|
-
0x00400000, 0x20004000, 0x20000000, 0x00004010,
|
|
144
|
-
0x20000010, 0x20404010, 0x00404000, 0x20400000,
|
|
145
|
-
0x00404010, 0x20404000, 0x00000000, 0x20400010,
|
|
146
|
-
0x00000010, 0x00004000, 0x20400000, 0x00404010,
|
|
147
|
-
0x00004000, 0x00400010, 0x20004010, 0x00000000,
|
|
148
|
-
0x20404000, 0x20000000, 0x00400010, 0x20004010
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
static const uint32_t SB7[64] =
|
|
152
|
-
{
|
|
153
|
-
0x00200000, 0x04200002, 0x04000802, 0x00000000,
|
|
154
|
-
0x00000800, 0x04000802, 0x00200802, 0x04200800,
|
|
155
|
-
0x04200802, 0x00200000, 0x00000000, 0x04000002,
|
|
156
|
-
0x00000002, 0x04000000, 0x04200002, 0x00000802,
|
|
157
|
-
0x04000800, 0x00200802, 0x00200002, 0x04000800,
|
|
158
|
-
0x04000002, 0x04200000, 0x04200800, 0x00200002,
|
|
159
|
-
0x04200000, 0x00000800, 0x00000802, 0x04200802,
|
|
160
|
-
0x00200800, 0x00000002, 0x04000000, 0x00200800,
|
|
161
|
-
0x04000000, 0x00200800, 0x00200000, 0x04000802,
|
|
162
|
-
0x04000802, 0x04200002, 0x04200002, 0x00000002,
|
|
163
|
-
0x00200002, 0x04000000, 0x04000800, 0x00200000,
|
|
164
|
-
0x04200800, 0x00000802, 0x00200802, 0x04200800,
|
|
165
|
-
0x00000802, 0x04000002, 0x04200802, 0x04200000,
|
|
166
|
-
0x00200800, 0x00000000, 0x00000002, 0x04200802,
|
|
167
|
-
0x00000000, 0x00200802, 0x04200000, 0x00000800,
|
|
168
|
-
0x04000002, 0x04000800, 0x00000800, 0x00200002
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
static const uint32_t SB8[64] =
|
|
172
|
-
{
|
|
173
|
-
0x10001040, 0x00001000, 0x00040000, 0x10041040,
|
|
174
|
-
0x10000000, 0x10001040, 0x00000040, 0x10000000,
|
|
175
|
-
0x00040040, 0x10040000, 0x10041040, 0x00041000,
|
|
176
|
-
0x10041000, 0x00041040, 0x00001000, 0x00000040,
|
|
177
|
-
0x10040000, 0x10000040, 0x10001000, 0x00001040,
|
|
178
|
-
0x00041000, 0x00040040, 0x10040040, 0x10041000,
|
|
179
|
-
0x00001040, 0x00000000, 0x00000000, 0x10040040,
|
|
180
|
-
0x10000040, 0x10001000, 0x00041040, 0x00040000,
|
|
181
|
-
0x00041040, 0x00040000, 0x10041000, 0x00001000,
|
|
182
|
-
0x00000040, 0x10040040, 0x00001000, 0x00041040,
|
|
183
|
-
0x10001000, 0x00000040, 0x10000040, 0x10040000,
|
|
184
|
-
0x10040040, 0x10000000, 0x00040000, 0x10001040,
|
|
185
|
-
0x00000000, 0x10041040, 0x00040040, 0x10000040,
|
|
186
|
-
0x10040000, 0x10001000, 0x10001040, 0x00000000,
|
|
187
|
-
0x10041040, 0x00041000, 0x00041000, 0x00001040,
|
|
188
|
-
0x00001040, 0x00040040, 0x10000000, 0x10041000
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
/*
|
|
192
|
-
* PC1: left and right halves bit-swap
|
|
193
|
-
*/
|
|
194
|
-
static const uint32_t LHs[16] =
|
|
195
|
-
{
|
|
196
|
-
0x00000000, 0x00000001, 0x00000100, 0x00000101,
|
|
197
|
-
0x00010000, 0x00010001, 0x00010100, 0x00010101,
|
|
198
|
-
0x01000000, 0x01000001, 0x01000100, 0x01000101,
|
|
199
|
-
0x01010000, 0x01010001, 0x01010100, 0x01010101
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
static const uint32_t RHs[16] =
|
|
203
|
-
{
|
|
204
|
-
0x00000000, 0x01000000, 0x00010000, 0x01010000,
|
|
205
|
-
0x00000100, 0x01000100, 0x00010100, 0x01010100,
|
|
206
|
-
0x00000001, 0x01000001, 0x00010001, 0x01010001,
|
|
207
|
-
0x00000101, 0x01000101, 0x00010101, 0x01010101,
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
/*
|
|
211
|
-
* Initial Permutation macro
|
|
212
|
-
*/
|
|
213
|
-
#define DES_IP(X, Y) \
|
|
214
|
-
do \
|
|
215
|
-
{ \
|
|
216
|
-
T = (((X) >> 4) ^ (Y)) & 0x0F0F0F0F; (Y) ^= T; (X) ^= (T << 4); \
|
|
217
|
-
T = (((X) >> 16) ^ (Y)) & 0x0000FFFF; (Y) ^= T; (X) ^= (T << 16); \
|
|
218
|
-
T = (((Y) >> 2) ^ (X)) & 0x33333333; (X) ^= T; (Y) ^= (T << 2); \
|
|
219
|
-
T = (((Y) >> 8) ^ (X)) & 0x00FF00FF; (X) ^= T; (Y) ^= (T << 8); \
|
|
220
|
-
(Y) = (((Y) << 1) | ((Y) >> 31)) & 0xFFFFFFFF; \
|
|
221
|
-
T = ((X) ^ (Y)) & 0xAAAAAAAA; (Y) ^= T; (X) ^= T; \
|
|
222
|
-
(X) = (((X) << 1) | ((X) >> 31)) & 0xFFFFFFFF; \
|
|
223
|
-
} while (0)
|
|
224
|
-
|
|
225
|
-
/*
|
|
226
|
-
* Final Permutation macro
|
|
227
|
-
*/
|
|
228
|
-
#define DES_FP(X, Y) \
|
|
229
|
-
do \
|
|
230
|
-
{ \
|
|
231
|
-
(X) = (((X) << 31) | ((X) >> 1)) & 0xFFFFFFFF; \
|
|
232
|
-
T = ((X) ^ (Y)) & 0xAAAAAAAA; (X) ^= T; (Y) ^= T; \
|
|
233
|
-
(Y) = (((Y) << 31) | ((Y) >> 1)) & 0xFFFFFFFF; \
|
|
234
|
-
T = (((Y) >> 8) ^ (X)) & 0x00FF00FF; (X) ^= T; (Y) ^= (T << 8); \
|
|
235
|
-
T = (((Y) >> 2) ^ (X)) & 0x33333333; (X) ^= T; (Y) ^= (T << 2); \
|
|
236
|
-
T = (((X) >> 16) ^ (Y)) & 0x0000FFFF; (Y) ^= T; (X) ^= (T << 16); \
|
|
237
|
-
T = (((X) >> 4) ^ (Y)) & 0x0F0F0F0F; (Y) ^= T; (X) ^= (T << 4); \
|
|
238
|
-
} while (0)
|
|
239
|
-
|
|
240
|
-
/*
|
|
241
|
-
* DES round macro
|
|
242
|
-
*/
|
|
243
|
-
#define DES_ROUND(X, Y) \
|
|
244
|
-
do \
|
|
245
|
-
{ \
|
|
246
|
-
T = *SK++ ^ (X); \
|
|
247
|
-
(Y) ^= SB8[(T) & 0x3F] ^ \
|
|
248
|
-
SB6[(T >> 8) & 0x3F] ^ \
|
|
249
|
-
SB4[(T >> 16) & 0x3F] ^ \
|
|
250
|
-
SB2[(T >> 24) & 0x3F]; \
|
|
251
|
-
\
|
|
252
|
-
T = *SK++ ^ (((X) << 28) | ((X) >> 4)); \
|
|
253
|
-
(Y) ^= SB7[(T) & 0x3F] ^ \
|
|
254
|
-
SB5[(T >> 8) & 0x3F] ^ \
|
|
255
|
-
SB3[(T >> 16) & 0x3F] ^ \
|
|
256
|
-
SB1[(T >> 24) & 0x3F]; \
|
|
257
|
-
} while (0)
|
|
258
|
-
|
|
259
|
-
#define SWAP(a, b) \
|
|
260
|
-
do \
|
|
261
|
-
{ \
|
|
262
|
-
uint32_t t = (a); (a) = (b); (b) = t; t = 0; \
|
|
263
|
-
} while (0)
|
|
264
|
-
|
|
265
|
-
void mbedtls_des_init(mbedtls_des_context *ctx)
|
|
266
|
-
{
|
|
267
|
-
memset(ctx, 0, sizeof(mbedtls_des_context));
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
void mbedtls_des_free(mbedtls_des_context *ctx)
|
|
271
|
-
{
|
|
272
|
-
if (ctx == NULL) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
mbedtls_platform_zeroize(ctx, sizeof(mbedtls_des_context));
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
void mbedtls_des3_init(mbedtls_des3_context *ctx)
|
|
280
|
-
{
|
|
281
|
-
memset(ctx, 0, sizeof(mbedtls_des3_context));
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
void mbedtls_des3_free(mbedtls_des3_context *ctx)
|
|
285
|
-
{
|
|
286
|
-
if (ctx == NULL) {
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
mbedtls_platform_zeroize(ctx, sizeof(mbedtls_des3_context));
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
static const unsigned char odd_parity_table[128] = { 1, 2, 4, 7, 8,
|
|
294
|
-
11, 13, 14, 16, 19, 21, 22, 25, 26, 28, 31, 32,
|
|
295
|
-
35, 37, 38, 41, 42, 44,
|
|
296
|
-
47, 49, 50, 52, 55, 56, 59, 61, 62, 64, 67, 69,
|
|
297
|
-
70, 73, 74, 76, 79, 81,
|
|
298
|
-
82, 84, 87, 88, 91, 93, 94, 97, 98, 100, 103,
|
|
299
|
-
104, 107, 109, 110, 112,
|
|
300
|
-
115, 117, 118, 121, 122, 124, 127, 128, 131,
|
|
301
|
-
133, 134, 137, 138, 140,
|
|
302
|
-
143, 145, 146, 148, 151, 152, 155, 157, 158,
|
|
303
|
-
161, 162, 164, 167, 168,
|
|
304
|
-
171, 173, 174, 176, 179, 181, 182, 185, 186,
|
|
305
|
-
188, 191, 193, 194, 196,
|
|
306
|
-
199, 200, 203, 205, 206, 208, 211, 213, 214,
|
|
307
|
-
217, 218, 220, 223, 224,
|
|
308
|
-
227, 229, 230, 233, 234, 236, 239, 241, 242,
|
|
309
|
-
244, 247, 248, 251, 253,
|
|
310
|
-
254 };
|
|
311
|
-
|
|
312
|
-
void mbedtls_des_key_set_parity(unsigned char key[MBEDTLS_DES_KEY_SIZE])
|
|
313
|
-
{
|
|
314
|
-
int i;
|
|
315
|
-
|
|
316
|
-
for (i = 0; i < MBEDTLS_DES_KEY_SIZE; i++) {
|
|
317
|
-
key[i] = odd_parity_table[key[i] / 2];
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/*
|
|
322
|
-
* Check the given key's parity, returns 1 on failure, 0 on SUCCESS
|
|
323
|
-
*/
|
|
324
|
-
int mbedtls_des_key_check_key_parity(const unsigned char key[MBEDTLS_DES_KEY_SIZE])
|
|
325
|
-
{
|
|
326
|
-
int i;
|
|
327
|
-
|
|
328
|
-
for (i = 0; i < MBEDTLS_DES_KEY_SIZE; i++) {
|
|
329
|
-
if (key[i] != odd_parity_table[key[i] / 2]) {
|
|
330
|
-
return 1;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
return 0;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/*
|
|
338
|
-
* Table of weak and semi-weak keys
|
|
339
|
-
*
|
|
340
|
-
* Source: http://en.wikipedia.org/wiki/Weak_key
|
|
341
|
-
*
|
|
342
|
-
* Weak:
|
|
343
|
-
* Alternating ones + zeros (0x0101010101010101)
|
|
344
|
-
* Alternating 'F' + 'E' (0xFEFEFEFEFEFEFEFE)
|
|
345
|
-
* '0xE0E0E0E0F1F1F1F1'
|
|
346
|
-
* '0x1F1F1F1F0E0E0E0E'
|
|
347
|
-
*
|
|
348
|
-
* Semi-weak:
|
|
349
|
-
* 0x011F011F010E010E and 0x1F011F010E010E01
|
|
350
|
-
* 0x01E001E001F101F1 and 0xE001E001F101F101
|
|
351
|
-
* 0x01FE01FE01FE01FE and 0xFE01FE01FE01FE01
|
|
352
|
-
* 0x1FE01FE00EF10EF1 and 0xE01FE01FF10EF10E
|
|
353
|
-
* 0x1FFE1FFE0EFE0EFE and 0xFE1FFE1FFE0EFE0E
|
|
354
|
-
* 0xE0FEE0FEF1FEF1FE and 0xFEE0FEE0FEF1FEF1
|
|
355
|
-
*
|
|
356
|
-
*/
|
|
357
|
-
|
|
358
|
-
#define WEAK_KEY_COUNT 16
|
|
359
|
-
|
|
360
|
-
static const unsigned char weak_key_table[WEAK_KEY_COUNT][MBEDTLS_DES_KEY_SIZE] =
|
|
361
|
-
{
|
|
362
|
-
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },
|
|
363
|
-
{ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE },
|
|
364
|
-
{ 0x1F, 0x1F, 0x1F, 0x1F, 0x0E, 0x0E, 0x0E, 0x0E },
|
|
365
|
-
{ 0xE0, 0xE0, 0xE0, 0xE0, 0xF1, 0xF1, 0xF1, 0xF1 },
|
|
366
|
-
|
|
367
|
-
{ 0x01, 0x1F, 0x01, 0x1F, 0x01, 0x0E, 0x01, 0x0E },
|
|
368
|
-
{ 0x1F, 0x01, 0x1F, 0x01, 0x0E, 0x01, 0x0E, 0x01 },
|
|
369
|
-
{ 0x01, 0xE0, 0x01, 0xE0, 0x01, 0xF1, 0x01, 0xF1 },
|
|
370
|
-
{ 0xE0, 0x01, 0xE0, 0x01, 0xF1, 0x01, 0xF1, 0x01 },
|
|
371
|
-
{ 0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE },
|
|
372
|
-
{ 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01 },
|
|
373
|
-
{ 0x1F, 0xE0, 0x1F, 0xE0, 0x0E, 0xF1, 0x0E, 0xF1 },
|
|
374
|
-
{ 0xE0, 0x1F, 0xE0, 0x1F, 0xF1, 0x0E, 0xF1, 0x0E },
|
|
375
|
-
{ 0x1F, 0xFE, 0x1F, 0xFE, 0x0E, 0xFE, 0x0E, 0xFE },
|
|
376
|
-
{ 0xFE, 0x1F, 0xFE, 0x1F, 0xFE, 0x0E, 0xFE, 0x0E },
|
|
377
|
-
{ 0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1, 0xFE },
|
|
378
|
-
{ 0xFE, 0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1 }
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
int mbedtls_des_key_check_weak(const unsigned char key[MBEDTLS_DES_KEY_SIZE])
|
|
382
|
-
{
|
|
383
|
-
int i;
|
|
384
|
-
|
|
385
|
-
for (i = 0; i < WEAK_KEY_COUNT; i++) {
|
|
386
|
-
if (memcmp(weak_key_table[i], key, MBEDTLS_DES_KEY_SIZE) == 0) {
|
|
387
|
-
return 1;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
return 0;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
#if !defined(MBEDTLS_DES_SETKEY_ALT)
|
|
395
|
-
void mbedtls_des_setkey(uint32_t SK[32], const unsigned char key[MBEDTLS_DES_KEY_SIZE])
|
|
396
|
-
{
|
|
397
|
-
int i;
|
|
398
|
-
uint32_t X, Y, T;
|
|
399
|
-
|
|
400
|
-
X = MBEDTLS_GET_UINT32_BE(key, 0);
|
|
401
|
-
Y = MBEDTLS_GET_UINT32_BE(key, 4);
|
|
402
|
-
|
|
403
|
-
/*
|
|
404
|
-
* Permuted Choice 1
|
|
405
|
-
*/
|
|
406
|
-
T = ((Y >> 4) ^ X) & 0x0F0F0F0F; X ^= T; Y ^= (T << 4);
|
|
407
|
-
T = ((Y) ^ X) & 0x10101010; X ^= T; Y ^= (T);
|
|
408
|
-
|
|
409
|
-
X = (LHs[(X) & 0xF] << 3) | (LHs[(X >> 8) & 0xF] << 2)
|
|
410
|
-
| (LHs[(X >> 16) & 0xF] << 1) | (LHs[(X >> 24) & 0xF])
|
|
411
|
-
| (LHs[(X >> 5) & 0xF] << 7) | (LHs[(X >> 13) & 0xF] << 6)
|
|
412
|
-
| (LHs[(X >> 21) & 0xF] << 5) | (LHs[(X >> 29) & 0xF] << 4);
|
|
413
|
-
|
|
414
|
-
Y = (RHs[(Y >> 1) & 0xF] << 3) | (RHs[(Y >> 9) & 0xF] << 2)
|
|
415
|
-
| (RHs[(Y >> 17) & 0xF] << 1) | (RHs[(Y >> 25) & 0xF])
|
|
416
|
-
| (RHs[(Y >> 4) & 0xF] << 7) | (RHs[(Y >> 12) & 0xF] << 6)
|
|
417
|
-
| (RHs[(Y >> 20) & 0xF] << 5) | (RHs[(Y >> 28) & 0xF] << 4);
|
|
418
|
-
|
|
419
|
-
X &= 0x0FFFFFFF;
|
|
420
|
-
Y &= 0x0FFFFFFF;
|
|
421
|
-
|
|
422
|
-
/*
|
|
423
|
-
* calculate subkeys
|
|
424
|
-
*/
|
|
425
|
-
for (i = 0; i < 16; i++) {
|
|
426
|
-
if (i < 2 || i == 8 || i == 15) {
|
|
427
|
-
X = ((X << 1) | (X >> 27)) & 0x0FFFFFFF;
|
|
428
|
-
Y = ((Y << 1) | (Y >> 27)) & 0x0FFFFFFF;
|
|
429
|
-
} else {
|
|
430
|
-
X = ((X << 2) | (X >> 26)) & 0x0FFFFFFF;
|
|
431
|
-
Y = ((Y << 2) | (Y >> 26)) & 0x0FFFFFFF;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
*SK++ = ((X << 4) & 0x24000000) | ((X << 28) & 0x10000000)
|
|
435
|
-
| ((X << 14) & 0x08000000) | ((X << 18) & 0x02080000)
|
|
436
|
-
| ((X << 6) & 0x01000000) | ((X << 9) & 0x00200000)
|
|
437
|
-
| ((X >> 1) & 0x00100000) | ((X << 10) & 0x00040000)
|
|
438
|
-
| ((X << 2) & 0x00020000) | ((X >> 10) & 0x00010000)
|
|
439
|
-
| ((Y >> 13) & 0x00002000) | ((Y >> 4) & 0x00001000)
|
|
440
|
-
| ((Y << 6) & 0x00000800) | ((Y >> 1) & 0x00000400)
|
|
441
|
-
| ((Y >> 14) & 0x00000200) | ((Y) & 0x00000100)
|
|
442
|
-
| ((Y >> 5) & 0x00000020) | ((Y >> 10) & 0x00000010)
|
|
443
|
-
| ((Y >> 3) & 0x00000008) | ((Y >> 18) & 0x00000004)
|
|
444
|
-
| ((Y >> 26) & 0x00000002) | ((Y >> 24) & 0x00000001);
|
|
445
|
-
|
|
446
|
-
*SK++ = ((X << 15) & 0x20000000) | ((X << 17) & 0x10000000)
|
|
447
|
-
| ((X << 10) & 0x08000000) | ((X << 22) & 0x04000000)
|
|
448
|
-
| ((X >> 2) & 0x02000000) | ((X << 1) & 0x01000000)
|
|
449
|
-
| ((X << 16) & 0x00200000) | ((X << 11) & 0x00100000)
|
|
450
|
-
| ((X << 3) & 0x00080000) | ((X >> 6) & 0x00040000)
|
|
451
|
-
| ((X << 15) & 0x00020000) | ((X >> 4) & 0x00010000)
|
|
452
|
-
| ((Y >> 2) & 0x00002000) | ((Y << 8) & 0x00001000)
|
|
453
|
-
| ((Y >> 14) & 0x00000808) | ((Y >> 9) & 0x00000400)
|
|
454
|
-
| ((Y) & 0x00000200) | ((Y << 7) & 0x00000100)
|
|
455
|
-
| ((Y >> 7) & 0x00000020) | ((Y >> 3) & 0x00000011)
|
|
456
|
-
| ((Y << 2) & 0x00000004) | ((Y >> 21) & 0x00000002);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
#endif /* !MBEDTLS_DES_SETKEY_ALT */
|
|
460
|
-
|
|
461
|
-
/*
|
|
462
|
-
* DES key schedule (56-bit, encryption)
|
|
463
|
-
*/
|
|
464
|
-
int mbedtls_des_setkey_enc(mbedtls_des_context *ctx, const unsigned char key[MBEDTLS_DES_KEY_SIZE])
|
|
465
|
-
{
|
|
466
|
-
mbedtls_des_setkey(ctx->sk, key);
|
|
467
|
-
|
|
468
|
-
return 0;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/*
|
|
472
|
-
* DES key schedule (56-bit, decryption)
|
|
473
|
-
*/
|
|
474
|
-
int mbedtls_des_setkey_dec(mbedtls_des_context *ctx, const unsigned char key[MBEDTLS_DES_KEY_SIZE])
|
|
475
|
-
{
|
|
476
|
-
int i;
|
|
477
|
-
|
|
478
|
-
mbedtls_des_setkey(ctx->sk, key);
|
|
479
|
-
|
|
480
|
-
for (i = 0; i < 16; i += 2) {
|
|
481
|
-
SWAP(ctx->sk[i], ctx->sk[30 - i]);
|
|
482
|
-
SWAP(ctx->sk[i + 1], ctx->sk[31 - i]);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
return 0;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
static void des3_set2key(uint32_t esk[96],
|
|
489
|
-
uint32_t dsk[96],
|
|
490
|
-
const unsigned char key[MBEDTLS_DES_KEY_SIZE*2])
|
|
491
|
-
{
|
|
492
|
-
int i;
|
|
493
|
-
|
|
494
|
-
mbedtls_des_setkey(esk, key);
|
|
495
|
-
mbedtls_des_setkey(dsk + 32, key + 8);
|
|
496
|
-
|
|
497
|
-
for (i = 0; i < 32; i += 2) {
|
|
498
|
-
dsk[i] = esk[30 - i];
|
|
499
|
-
dsk[i + 1] = esk[31 - i];
|
|
500
|
-
|
|
501
|
-
esk[i + 32] = dsk[62 - i];
|
|
502
|
-
esk[i + 33] = dsk[63 - i];
|
|
503
|
-
|
|
504
|
-
esk[i + 64] = esk[i];
|
|
505
|
-
esk[i + 65] = esk[i + 1];
|
|
506
|
-
|
|
507
|
-
dsk[i + 64] = dsk[i];
|
|
508
|
-
dsk[i + 65] = dsk[i + 1];
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
/*
|
|
513
|
-
* Triple-DES key schedule (112-bit, encryption)
|
|
514
|
-
*/
|
|
515
|
-
int mbedtls_des3_set2key_enc(mbedtls_des3_context *ctx,
|
|
516
|
-
const unsigned char key[MBEDTLS_DES_KEY_SIZE * 2])
|
|
517
|
-
{
|
|
518
|
-
uint32_t sk[96];
|
|
519
|
-
|
|
520
|
-
des3_set2key(ctx->sk, sk, key);
|
|
521
|
-
mbedtls_platform_zeroize(sk, sizeof(sk));
|
|
522
|
-
|
|
523
|
-
return 0;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
/*
|
|
527
|
-
* Triple-DES key schedule (112-bit, decryption)
|
|
528
|
-
*/
|
|
529
|
-
int mbedtls_des3_set2key_dec(mbedtls_des3_context *ctx,
|
|
530
|
-
const unsigned char key[MBEDTLS_DES_KEY_SIZE * 2])
|
|
531
|
-
{
|
|
532
|
-
uint32_t sk[96];
|
|
533
|
-
|
|
534
|
-
des3_set2key(sk, ctx->sk, key);
|
|
535
|
-
mbedtls_platform_zeroize(sk, sizeof(sk));
|
|
536
|
-
|
|
537
|
-
return 0;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
static void des3_set3key(uint32_t esk[96],
|
|
541
|
-
uint32_t dsk[96],
|
|
542
|
-
const unsigned char key[24])
|
|
543
|
-
{
|
|
544
|
-
int i;
|
|
545
|
-
|
|
546
|
-
mbedtls_des_setkey(esk, key);
|
|
547
|
-
mbedtls_des_setkey(dsk + 32, key + 8);
|
|
548
|
-
mbedtls_des_setkey(esk + 64, key + 16);
|
|
549
|
-
|
|
550
|
-
for (i = 0; i < 32; i += 2) {
|
|
551
|
-
dsk[i] = esk[94 - i];
|
|
552
|
-
dsk[i + 1] = esk[95 - i];
|
|
553
|
-
|
|
554
|
-
esk[i + 32] = dsk[62 - i];
|
|
555
|
-
esk[i + 33] = dsk[63 - i];
|
|
556
|
-
|
|
557
|
-
dsk[i + 64] = esk[30 - i];
|
|
558
|
-
dsk[i + 65] = esk[31 - i];
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
/*
|
|
563
|
-
* Triple-DES key schedule (168-bit, encryption)
|
|
564
|
-
*/
|
|
565
|
-
int mbedtls_des3_set3key_enc(mbedtls_des3_context *ctx,
|
|
566
|
-
const unsigned char key[MBEDTLS_DES_KEY_SIZE * 3])
|
|
567
|
-
{
|
|
568
|
-
uint32_t sk[96];
|
|
569
|
-
|
|
570
|
-
des3_set3key(ctx->sk, sk, key);
|
|
571
|
-
mbedtls_platform_zeroize(sk, sizeof(sk));
|
|
572
|
-
|
|
573
|
-
return 0;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
/*
|
|
577
|
-
* Triple-DES key schedule (168-bit, decryption)
|
|
578
|
-
*/
|
|
579
|
-
int mbedtls_des3_set3key_dec(mbedtls_des3_context *ctx,
|
|
580
|
-
const unsigned char key[MBEDTLS_DES_KEY_SIZE * 3])
|
|
581
|
-
{
|
|
582
|
-
uint32_t sk[96];
|
|
583
|
-
|
|
584
|
-
des3_set3key(sk, ctx->sk, key);
|
|
585
|
-
mbedtls_platform_zeroize(sk, sizeof(sk));
|
|
586
|
-
|
|
587
|
-
return 0;
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
/*
|
|
591
|
-
* DES-ECB block encryption/decryption
|
|
592
|
-
*/
|
|
593
|
-
#if !defined(MBEDTLS_DES_CRYPT_ECB_ALT)
|
|
594
|
-
int mbedtls_des_crypt_ecb(mbedtls_des_context *ctx,
|
|
595
|
-
const unsigned char input[8],
|
|
596
|
-
unsigned char output[8])
|
|
597
|
-
{
|
|
598
|
-
int i;
|
|
599
|
-
uint32_t X, Y, T, *SK;
|
|
600
|
-
|
|
601
|
-
SK = ctx->sk;
|
|
602
|
-
|
|
603
|
-
X = MBEDTLS_GET_UINT32_BE(input, 0);
|
|
604
|
-
Y = MBEDTLS_GET_UINT32_BE(input, 4);
|
|
605
|
-
|
|
606
|
-
DES_IP(X, Y);
|
|
607
|
-
|
|
608
|
-
for (i = 0; i < 8; i++) {
|
|
609
|
-
DES_ROUND(Y, X);
|
|
610
|
-
DES_ROUND(X, Y);
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
DES_FP(Y, X);
|
|
614
|
-
|
|
615
|
-
MBEDTLS_PUT_UINT32_BE(Y, output, 0);
|
|
616
|
-
MBEDTLS_PUT_UINT32_BE(X, output, 4);
|
|
617
|
-
|
|
618
|
-
return 0;
|
|
619
|
-
}
|
|
620
|
-
#endif /* !MBEDTLS_DES_CRYPT_ECB_ALT */
|
|
621
|
-
|
|
622
|
-
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
|
623
|
-
/*
|
|
624
|
-
* DES-CBC buffer encryption/decryption
|
|
625
|
-
*/
|
|
626
|
-
int mbedtls_des_crypt_cbc(mbedtls_des_context *ctx,
|
|
627
|
-
int mode,
|
|
628
|
-
size_t length,
|
|
629
|
-
unsigned char iv[8],
|
|
630
|
-
const unsigned char *input,
|
|
631
|
-
unsigned char *output)
|
|
632
|
-
{
|
|
633
|
-
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
634
|
-
unsigned char temp[8];
|
|
635
|
-
|
|
636
|
-
if (length % 8) {
|
|
637
|
-
return MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
if (mode == MBEDTLS_DES_ENCRYPT) {
|
|
641
|
-
while (length > 0) {
|
|
642
|
-
mbedtls_xor(output, input, iv, 8);
|
|
643
|
-
|
|
644
|
-
ret = mbedtls_des_crypt_ecb(ctx, output, output);
|
|
645
|
-
if (ret != 0) {
|
|
646
|
-
goto exit;
|
|
647
|
-
}
|
|
648
|
-
memcpy(iv, output, 8);
|
|
649
|
-
|
|
650
|
-
input += 8;
|
|
651
|
-
output += 8;
|
|
652
|
-
length -= 8;
|
|
653
|
-
}
|
|
654
|
-
} else { /* MBEDTLS_DES_DECRYPT */
|
|
655
|
-
while (length > 0) {
|
|
656
|
-
memcpy(temp, input, 8);
|
|
657
|
-
ret = mbedtls_des_crypt_ecb(ctx, input, output);
|
|
658
|
-
if (ret != 0) {
|
|
659
|
-
goto exit;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
mbedtls_xor(output, output, iv, 8);
|
|
663
|
-
|
|
664
|
-
memcpy(iv, temp, 8);
|
|
665
|
-
|
|
666
|
-
input += 8;
|
|
667
|
-
output += 8;
|
|
668
|
-
length -= 8;
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
ret = 0;
|
|
672
|
-
|
|
673
|
-
exit:
|
|
674
|
-
return ret;
|
|
675
|
-
}
|
|
676
|
-
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
|
677
|
-
|
|
678
|
-
/*
|
|
679
|
-
* 3DES-ECB block encryption/decryption
|
|
680
|
-
*/
|
|
681
|
-
#if !defined(MBEDTLS_DES3_CRYPT_ECB_ALT)
|
|
682
|
-
int mbedtls_des3_crypt_ecb(mbedtls_des3_context *ctx,
|
|
683
|
-
const unsigned char input[8],
|
|
684
|
-
unsigned char output[8])
|
|
685
|
-
{
|
|
686
|
-
int i;
|
|
687
|
-
uint32_t X, Y, T, *SK;
|
|
688
|
-
|
|
689
|
-
SK = ctx->sk;
|
|
690
|
-
|
|
691
|
-
X = MBEDTLS_GET_UINT32_BE(input, 0);
|
|
692
|
-
Y = MBEDTLS_GET_UINT32_BE(input, 4);
|
|
693
|
-
|
|
694
|
-
DES_IP(X, Y);
|
|
695
|
-
|
|
696
|
-
for (i = 0; i < 8; i++) {
|
|
697
|
-
DES_ROUND(Y, X);
|
|
698
|
-
DES_ROUND(X, Y);
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
for (i = 0; i < 8; i++) {
|
|
702
|
-
DES_ROUND(X, Y);
|
|
703
|
-
DES_ROUND(Y, X);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
for (i = 0; i < 8; i++) {
|
|
707
|
-
DES_ROUND(Y, X);
|
|
708
|
-
DES_ROUND(X, Y);
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
DES_FP(Y, X);
|
|
712
|
-
|
|
713
|
-
MBEDTLS_PUT_UINT32_BE(Y, output, 0);
|
|
714
|
-
MBEDTLS_PUT_UINT32_BE(X, output, 4);
|
|
715
|
-
|
|
716
|
-
return 0;
|
|
717
|
-
}
|
|
718
|
-
#endif /* !MBEDTLS_DES3_CRYPT_ECB_ALT */
|
|
719
|
-
|
|
720
|
-
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
|
721
|
-
/*
|
|
722
|
-
* 3DES-CBC buffer encryption/decryption
|
|
723
|
-
*/
|
|
724
|
-
int mbedtls_des3_crypt_cbc(mbedtls_des3_context *ctx,
|
|
725
|
-
int mode,
|
|
726
|
-
size_t length,
|
|
727
|
-
unsigned char iv[8],
|
|
728
|
-
const unsigned char *input,
|
|
729
|
-
unsigned char *output)
|
|
730
|
-
{
|
|
731
|
-
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
732
|
-
unsigned char temp[8];
|
|
733
|
-
|
|
734
|
-
if (length % 8) {
|
|
735
|
-
return MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
if (mode == MBEDTLS_DES_ENCRYPT) {
|
|
739
|
-
while (length > 0) {
|
|
740
|
-
mbedtls_xor(output, input, iv, 8);
|
|
741
|
-
|
|
742
|
-
ret = mbedtls_des3_crypt_ecb(ctx, output, output);
|
|
743
|
-
if (ret != 0) {
|
|
744
|
-
goto exit;
|
|
745
|
-
}
|
|
746
|
-
memcpy(iv, output, 8);
|
|
747
|
-
|
|
748
|
-
input += 8;
|
|
749
|
-
output += 8;
|
|
750
|
-
length -= 8;
|
|
751
|
-
}
|
|
752
|
-
} else { /* MBEDTLS_DES_DECRYPT */
|
|
753
|
-
while (length > 0) {
|
|
754
|
-
memcpy(temp, input, 8);
|
|
755
|
-
ret = mbedtls_des3_crypt_ecb(ctx, input, output);
|
|
756
|
-
if (ret != 0) {
|
|
757
|
-
goto exit;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
mbedtls_xor(output, output, iv, 8);
|
|
761
|
-
|
|
762
|
-
memcpy(iv, temp, 8);
|
|
763
|
-
|
|
764
|
-
input += 8;
|
|
765
|
-
output += 8;
|
|
766
|
-
length -= 8;
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
ret = 0;
|
|
770
|
-
|
|
771
|
-
exit:
|
|
772
|
-
return ret;
|
|
773
|
-
}
|
|
774
|
-
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
|
775
|
-
|
|
776
|
-
#endif /* !MBEDTLS_DES_ALT */
|
|
777
|
-
|
|
778
|
-
#if defined(MBEDTLS_SELF_TEST)
|
|
779
|
-
/*
|
|
780
|
-
* DES and 3DES test vectors from:
|
|
781
|
-
*
|
|
782
|
-
* http://csrc.nist.gov/groups/STM/cavp/documents/des/tripledes-vectors.zip
|
|
783
|
-
*/
|
|
784
|
-
static const unsigned char des3_test_keys[24] =
|
|
785
|
-
{
|
|
786
|
-
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
|
|
787
|
-
0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01,
|
|
788
|
-
0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23
|
|
789
|
-
};
|
|
790
|
-
|
|
791
|
-
static const unsigned char des3_test_buf[8] =
|
|
792
|
-
{
|
|
793
|
-
0x4E, 0x6F, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74
|
|
794
|
-
};
|
|
795
|
-
|
|
796
|
-
static const unsigned char des3_test_ecb_dec[3][8] =
|
|
797
|
-
{
|
|
798
|
-
{ 0x37, 0x2B, 0x98, 0xBF, 0x52, 0x65, 0xB0, 0x59 },
|
|
799
|
-
{ 0xC2, 0x10, 0x19, 0x9C, 0x38, 0x5A, 0x65, 0xA1 },
|
|
800
|
-
{ 0xA2, 0x70, 0x56, 0x68, 0x69, 0xE5, 0x15, 0x1D }
|
|
801
|
-
};
|
|
802
|
-
|
|
803
|
-
static const unsigned char des3_test_ecb_enc[3][8] =
|
|
804
|
-
{
|
|
805
|
-
{ 0x1C, 0xD5, 0x97, 0xEA, 0x84, 0x26, 0x73, 0xFB },
|
|
806
|
-
{ 0xB3, 0x92, 0x4D, 0xF3, 0xC5, 0xB5, 0x42, 0x93 },
|
|
807
|
-
{ 0xDA, 0x37, 0x64, 0x41, 0xBA, 0x6F, 0x62, 0x6F }
|
|
808
|
-
};
|
|
809
|
-
|
|
810
|
-
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
|
811
|
-
static const unsigned char des3_test_iv[8] =
|
|
812
|
-
{
|
|
813
|
-
0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF,
|
|
814
|
-
};
|
|
815
|
-
|
|
816
|
-
static const unsigned char des3_test_cbc_dec[3][8] =
|
|
817
|
-
{
|
|
818
|
-
{ 0x58, 0xD9, 0x48, 0xEF, 0x85, 0x14, 0x65, 0x9A },
|
|
819
|
-
{ 0x5F, 0xC8, 0x78, 0xD4, 0xD7, 0x92, 0xD9, 0x54 },
|
|
820
|
-
{ 0x25, 0xF9, 0x75, 0x85, 0xA8, 0x1E, 0x48, 0xBF }
|
|
821
|
-
};
|
|
822
|
-
|
|
823
|
-
static const unsigned char des3_test_cbc_enc[3][8] =
|
|
824
|
-
{
|
|
825
|
-
{ 0x91, 0x1C, 0x6D, 0xCF, 0x48, 0xA7, 0xC3, 0x4D },
|
|
826
|
-
{ 0x60, 0x1A, 0x76, 0x8F, 0xA1, 0xF9, 0x66, 0xF1 },
|
|
827
|
-
{ 0xA1, 0x50, 0x0F, 0x99, 0xB2, 0xCD, 0x64, 0x76 }
|
|
828
|
-
};
|
|
829
|
-
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
|
830
|
-
|
|
831
|
-
/*
|
|
832
|
-
* Checkup routine
|
|
833
|
-
*/
|
|
834
|
-
int mbedtls_des_self_test(int verbose)
|
|
835
|
-
{
|
|
836
|
-
int i, j, u, v, ret = 0;
|
|
837
|
-
mbedtls_des_context ctx;
|
|
838
|
-
mbedtls_des3_context ctx3;
|
|
839
|
-
unsigned char buf[8];
|
|
840
|
-
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
|
841
|
-
unsigned char prv[8];
|
|
842
|
-
unsigned char iv[8];
|
|
843
|
-
#endif
|
|
844
|
-
|
|
845
|
-
mbedtls_des_init(&ctx);
|
|
846
|
-
mbedtls_des3_init(&ctx3);
|
|
847
|
-
/*
|
|
848
|
-
* ECB mode
|
|
849
|
-
*/
|
|
850
|
-
for (i = 0; i < 6; i++) {
|
|
851
|
-
u = i >> 1;
|
|
852
|
-
v = i & 1;
|
|
853
|
-
|
|
854
|
-
if (verbose != 0) {
|
|
855
|
-
mbedtls_printf(" DES%c-ECB-%3d (%s): ",
|
|
856
|
-
(u == 0) ? ' ' : '3', 56 + u * 56,
|
|
857
|
-
(v == MBEDTLS_DES_DECRYPT) ? "dec" : "enc");
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
memcpy(buf, des3_test_buf, 8);
|
|
861
|
-
|
|
862
|
-
switch (i) {
|
|
863
|
-
case 0:
|
|
864
|
-
ret = mbedtls_des_setkey_dec(&ctx, des3_test_keys);
|
|
865
|
-
break;
|
|
866
|
-
|
|
867
|
-
case 1:
|
|
868
|
-
ret = mbedtls_des_setkey_enc(&ctx, des3_test_keys);
|
|
869
|
-
break;
|
|
870
|
-
|
|
871
|
-
case 2:
|
|
872
|
-
ret = mbedtls_des3_set2key_dec(&ctx3, des3_test_keys);
|
|
873
|
-
break;
|
|
874
|
-
|
|
875
|
-
case 3:
|
|
876
|
-
ret = mbedtls_des3_set2key_enc(&ctx3, des3_test_keys);
|
|
877
|
-
break;
|
|
878
|
-
|
|
879
|
-
case 4:
|
|
880
|
-
ret = mbedtls_des3_set3key_dec(&ctx3, des3_test_keys);
|
|
881
|
-
break;
|
|
882
|
-
|
|
883
|
-
case 5:
|
|
884
|
-
ret = mbedtls_des3_set3key_enc(&ctx3, des3_test_keys);
|
|
885
|
-
break;
|
|
886
|
-
|
|
887
|
-
default:
|
|
888
|
-
return 1;
|
|
889
|
-
}
|
|
890
|
-
if (ret != 0) {
|
|
891
|
-
goto exit;
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
for (j = 0; j < 100; j++) {
|
|
895
|
-
if (u == 0) {
|
|
896
|
-
ret = mbedtls_des_crypt_ecb(&ctx, buf, buf);
|
|
897
|
-
} else {
|
|
898
|
-
ret = mbedtls_des3_crypt_ecb(&ctx3, buf, buf);
|
|
899
|
-
}
|
|
900
|
-
if (ret != 0) {
|
|
901
|
-
goto exit;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
if ((v == MBEDTLS_DES_DECRYPT &&
|
|
906
|
-
memcmp(buf, des3_test_ecb_dec[u], 8) != 0) ||
|
|
907
|
-
(v != MBEDTLS_DES_DECRYPT &&
|
|
908
|
-
memcmp(buf, des3_test_ecb_enc[u], 8) != 0)) {
|
|
909
|
-
if (verbose != 0) {
|
|
910
|
-
mbedtls_printf("failed\n");
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
ret = 1;
|
|
914
|
-
goto exit;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
if (verbose != 0) {
|
|
918
|
-
mbedtls_printf("passed\n");
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
if (verbose != 0) {
|
|
923
|
-
mbedtls_printf("\n");
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
|
927
|
-
/*
|
|
928
|
-
* CBC mode
|
|
929
|
-
*/
|
|
930
|
-
for (i = 0; i < 6; i++) {
|
|
931
|
-
u = i >> 1;
|
|
932
|
-
v = i & 1;
|
|
933
|
-
|
|
934
|
-
if (verbose != 0) {
|
|
935
|
-
mbedtls_printf(" DES%c-CBC-%3d (%s): ",
|
|
936
|
-
(u == 0) ? ' ' : '3', 56 + u * 56,
|
|
937
|
-
(v == MBEDTLS_DES_DECRYPT) ? "dec" : "enc");
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
memcpy(iv, des3_test_iv, 8);
|
|
941
|
-
memcpy(prv, des3_test_iv, 8);
|
|
942
|
-
memcpy(buf, des3_test_buf, 8);
|
|
943
|
-
|
|
944
|
-
switch (i) {
|
|
945
|
-
case 0:
|
|
946
|
-
ret = mbedtls_des_setkey_dec(&ctx, des3_test_keys);
|
|
947
|
-
break;
|
|
948
|
-
|
|
949
|
-
case 1:
|
|
950
|
-
ret = mbedtls_des_setkey_enc(&ctx, des3_test_keys);
|
|
951
|
-
break;
|
|
952
|
-
|
|
953
|
-
case 2:
|
|
954
|
-
ret = mbedtls_des3_set2key_dec(&ctx3, des3_test_keys);
|
|
955
|
-
break;
|
|
956
|
-
|
|
957
|
-
case 3:
|
|
958
|
-
ret = mbedtls_des3_set2key_enc(&ctx3, des3_test_keys);
|
|
959
|
-
break;
|
|
960
|
-
|
|
961
|
-
case 4:
|
|
962
|
-
ret = mbedtls_des3_set3key_dec(&ctx3, des3_test_keys);
|
|
963
|
-
break;
|
|
964
|
-
|
|
965
|
-
case 5:
|
|
966
|
-
ret = mbedtls_des3_set3key_enc(&ctx3, des3_test_keys);
|
|
967
|
-
break;
|
|
968
|
-
|
|
969
|
-
default:
|
|
970
|
-
return 1;
|
|
971
|
-
}
|
|
972
|
-
if (ret != 0) {
|
|
973
|
-
goto exit;
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
if (v == MBEDTLS_DES_DECRYPT) {
|
|
977
|
-
for (j = 0; j < 100; j++) {
|
|
978
|
-
if (u == 0) {
|
|
979
|
-
ret = mbedtls_des_crypt_cbc(&ctx, v, 8, iv, buf, buf);
|
|
980
|
-
} else {
|
|
981
|
-
ret = mbedtls_des3_crypt_cbc(&ctx3, v, 8, iv, buf, buf);
|
|
982
|
-
}
|
|
983
|
-
if (ret != 0) {
|
|
984
|
-
goto exit;
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
} else {
|
|
988
|
-
for (j = 0; j < 100; j++) {
|
|
989
|
-
unsigned char tmp[8];
|
|
990
|
-
|
|
991
|
-
if (u == 0) {
|
|
992
|
-
ret = mbedtls_des_crypt_cbc(&ctx, v, 8, iv, buf, buf);
|
|
993
|
-
} else {
|
|
994
|
-
ret = mbedtls_des3_crypt_cbc(&ctx3, v, 8, iv, buf, buf);
|
|
995
|
-
}
|
|
996
|
-
if (ret != 0) {
|
|
997
|
-
goto exit;
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
memcpy(tmp, prv, 8);
|
|
1001
|
-
memcpy(prv, buf, 8);
|
|
1002
|
-
memcpy(buf, tmp, 8);
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
memcpy(buf, prv, 8);
|
|
1006
|
-
}
|
|
1007
|
-
|
|
1008
|
-
if ((v == MBEDTLS_DES_DECRYPT &&
|
|
1009
|
-
memcmp(buf, des3_test_cbc_dec[u], 8) != 0) ||
|
|
1010
|
-
(v != MBEDTLS_DES_DECRYPT &&
|
|
1011
|
-
memcmp(buf, des3_test_cbc_enc[u], 8) != 0)) {
|
|
1012
|
-
if (verbose != 0) {
|
|
1013
|
-
mbedtls_printf("failed\n");
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
ret = 1;
|
|
1017
|
-
goto exit;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
if (verbose != 0) {
|
|
1021
|
-
mbedtls_printf("passed\n");
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
|
1025
|
-
|
|
1026
|
-
if (verbose != 0) {
|
|
1027
|
-
mbedtls_printf("\n");
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
exit:
|
|
1031
|
-
mbedtls_des_free(&ctx);
|
|
1032
|
-
mbedtls_des3_free(&ctx3);
|
|
1033
|
-
|
|
1034
|
-
if (ret != 0) {
|
|
1035
|
-
ret = 1;
|
|
1036
|
-
}
|
|
1037
|
-
return ret;
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
#endif /* MBEDTLS_SELF_TEST */
|
|
1041
|
-
|
|
1042
|
-
#endif /* MBEDTLS_DES_C */
|