/uoscore-uedhoc-3.7.0/src/edhoc/ |
D | cert.c | 52 size_t len) in deser_sign_cb() argument 58 memcpy(ctx->seek, start + len - ctx->unit_size, in deser_sign_cb() 66 static int find_pk_cb(void *void_ppk, int tag, unsigned char *start, size_t len) in find_pk_cb() argument 68 (void)len; in find_pk_cb() 87 #define EXPECTO_TAG(tag, cursor, len) \ argument 96 mbedtls_asn1_get_len(&cursor, end, &len); \ 99 len--; \ 115 const unsigned char *end, uint32_t *len) in mbedtls_asn1_get_len() argument 121 *len = *(*p)++; in mbedtls_asn1_get_len() 128 *len = (*p)[1]; in mbedtls_asn1_get_len() [all …]
|
D | signature_or_mac_msg.c | 55 BYTE_ARRAY_NEW(th_enc, AS_BSTR_SIZE(HASH_SIZE), AS_BSTR_SIZE(th->len)); in mac() 60 AS_BSTR_SIZE(c_r->len) + id_cred->len + cred->len + in mac() 61 ead->len + th_enc.len); in mac() 62 uint32_t capacity = context_mac.len; in mac() 63 context_mac.len = 0; in mac() 64 if (c_r->len != 0) { in mac() 66 AS_BSTR_SIZE(c_r->len)); in mac() 68 TRY(encode_int((const int32_t *)c_r->ptr, c_r->len, in mac() 79 if (0 < ead->len) { in mac() 83 PRINT_ARRAY("MAC context", context_mac.ptr, context_mac.len); in mac() [all …]
|
D | th.c | 44 th2.th2_hash_msg1.len = hash_msg1->len; in th2_input_encode() 48 th2.th2_G_Y.len = g_y->len; in th2_input_encode() 50 TRY_EXPECT(cbor_encode_th2(th2_input->ptr, th2_input->len, &th2, in th2_input_encode() 55 th2_input->len = (uint32_t)payload_len_out; in th2_input_encode() 58 th2_input->len); in th2_input_encode() 77 PRINT_ARRAY("th23", th23->ptr, th23->len); in th34_input_encode() 78 PRINT_ARRAY("plaintext_23", plaintext_23->ptr, plaintext_23->len); in th34_input_encode() 79 PRINT_ARRAY("cred", cred->ptr, cred->len); in th34_input_encode() 82 uint32_t tmp_len = th34_input->len; in th34_input_encode() 85 th34_input->len - tmp_len - cred->len, plaintext_23->ptr, in th34_input_encode() [all …]
|
D | retrieve_cred.c | 46 PRINT_ARRAY("ID_CRED_x contains a certificate", cert->ptr, cert->len); in verify_cert2cred() 55 pk->len = 0; in verify_cert2cred() 58 g->len = 0; in verify_cert2cred() 65 pk->len = 0; in verify_cert2cred() 68 g->len = 0; in verify_cert2cred() 104 for (uint32_t i = 0; i < cred_array->len; i++) { in get_local_cred() 105 if ((cred_array->ptr[i].id_cred.len == ID_cred->len) && in get_local_cred() 107 ID_cred->len))) { in get_local_cred() 109 TRY(_memcpy_s(cred->ptr, cred->len, in get_local_cred() 111 cred_array->ptr[i].cred.len)); in get_local_cred() [all …]
|
D | edhoc_cose.c | 29 enc_structure.edhoc_enc_structure_context.len = context->len; in cose_enc_structure_encode() 32 enc_structure.edhoc_enc_structure_external_aad.len = external_aad->len; in cose_enc_structure_encode() 44 if (0 != protected->len) { in cose_enc_structure_encode() 55 enc_structure.edhoc_enc_structure_protected.len = protected->len; in cose_enc_structure_encode() 58 TRY_EXPECT(cbor_encode_edhoc_enc_structure(out->ptr, out->len, in cose_enc_structure_encode() 62 out->len = (uint32_t)payload_len_out; in cose_enc_structure_encode() 75 sig_structure.sig_structure_context.len = context->len; in cose_sig_structure_encode() 77 sig_structure.sig_structure_protected.len = protected->len; in cose_sig_structure_encode() 79 sig_structure.sig_structure_external_aad.len = external_aad->len; in cose_sig_structure_encode() 81 sig_structure.sig_structure_payload.len = payload->len; in cose_sig_structure_encode() [all …]
|
D | ciphertext.c | 39 if (in1->len != in2->len) { in xor_arrays() 42 for (uint32_t i = 0; i < in1->len; i++) { in xor_arrays() 70 PRINT_ARRAY("in", in->ptr, in->len); in ciphertext_encrypt_decrypt() 95 PRINT_ARRAY("KEYSTREAM_2", key->ptr, key->len); in key_gen() 101 PRINT_ARRAY("K_3", key->ptr, key->len); in key_gen() 104 PRINT_ARRAY("IV_3", iv->ptr, iv->len); in key_gen() 108 PRINT_ARRAY("PRK_4e3m", prk->ptr, prk->len); in key_gen() 109 PRINT_ARRAY("TH_4", th->ptr, th->len); in key_gen() 111 PRINT_ARRAY("K_4", key->ptr, key->len); in key_gen() 113 PRINT_ARRAY("IV_4", iv->ptr, iv->len); in key_gen() [all …]
|
D | responder.c | 64 TRY_EXPECT(cbor_decode_message_1(msg1->ptr, msg1->len, &m, &decode_len), in msg1_parse() 79 suites_i->len = 1; in msg1_parse() 86 if (m.SUITES_I_suite_l_suite_count > suites_i->len) { in msg1_parse() 93 suites_i->len = (uint32_t)m.SUITES_I_suite_l_suite_count; in msg1_parse() 95 PRINT_ARRAY("msg1 SUITES_I", suites_i->ptr, suites_i->len); in msg1_parse() 98 TRY(_memcpy_s(g_x->ptr, g_x->len, m.message_1_G_X.value, in msg1_parse() 99 (uint32_t)m.message_1_G_X.len)); in msg1_parse() 100 g_x->len = (uint32_t)m.message_1_G_X.len; in msg1_parse() 101 PRINT_ARRAY("msg1 G_X", g_x->ptr, g_x->len); in msg1_parse() 106 c_i->len = 1; in msg1_parse() [all …]
|
D | plaintext_decode.c | 57 map.id_cred_x_map_x5chain.id_cred_x_map_x5chain.len = id_len; in id_cred_x_encode() 65 map.id_cred_x_map_x5t.id_cred_x_map_x5t_hash.len = id_len; in id_cred_x_encode() 71 TRY_EXPECT(cbor_encode_id_cred_x_map(id_cred_x->ptr, id_cred_x->len, in id_cred_x_encode() 75 id_cred_x->len = (uint32_t)payload_len_out; in id_cred_x_encode() 87 TRY_EXPECT(cbor_decode_plaintext(ptxt->ptr, ptxt->len, &p, &decode_len), in plaintext_split() 94 TRY(_memcpy_s(c_r->ptr, c_r->len, in plaintext_split() 97 .plaintext_C_R_bstr.len)); in plaintext_split() 98 c_r->len = in plaintext_split() 99 (uint32_t)p.plaintext_C_R.plaintext_C_R_bstr.len; in plaintext_split() 118 .map_x5chain.map_x5chain.len, in plaintext_split() [all …]
|
D | initiator.c | 55 TRY(_memcpy_s(g_y->ptr, g_y->len, g_y_ciphertext_2.ptr, g_y->len)); in msg2_parse() 56 PRINT_ARRAY("g_y", g_y->ptr, g_y->len); in msg2_parse() 58 TRY(_memcpy_s(ciphertext2->ptr, ciphertext2->len, in msg2_parse() 59 g_y_ciphertext_2.ptr + g_y->len, in msg2_parse() 60 g_y_ciphertext_2.len - g_y->len)); in msg2_parse() 62 ciphertext2->len = g_y_ciphertext_2.len - g_y->len; in msg2_parse() 63 PRINT_ARRAY("ciphertext2", ciphertext2->ptr, ciphertext2->len); in msg2_parse() 77 if (c->suites_i.len == 1) { in msg1_gen() 81 } else if (c->suites_i.len > 1) { in msg1_gen() 84 m1.SUITES_I_suite_l_suite_count = c->suites_i.len; in msg1_gen() [all …]
|
/uoscore-uedhoc-3.7.0/test/edhoc_integration_tests/ |
D | edhoc_tests_rfc9529.c | 26 zassert_mem_equal__(data->ptr, T1_RFC9529__MESSAGE_1, data->len, in tx_fkt() 28 zassert_equal(data->len, T1_RFC9529__MESSAGE_1_LEN, in tx_fkt() 32 zassert_mem_equal__(data->ptr, T1_RFC9529__MESSAGE_2, data->len, in tx_fkt() 34 zassert_equal(data->len, T1_RFC9529__MESSAGE_2_LEN, in tx_fkt() 38 zassert_mem_equal__(data->ptr, T1_RFC9529__MESSAGE_3, data->len, in tx_fkt() 40 zassert_equal(data->len, T1_RFC9529__MESSAGE_3_LEN, in tx_fkt() 44 zassert_mem_equal__(data->ptr, T1_RFC9529__MESSAGE_4, data->len, in tx_fkt() 46 zassert_equal(data->len, T1_RFC9529__MESSAGE_4_LEN, in tx_fkt() 63 TRY(_memcpy_s(data->ptr, data->len, T1_RFC9529__MESSAGE_1, in rx_fkt() 65 data->len = T1_RFC9529__MESSAGE_1_LEN; in rx_fkt() [all …]
|
D | initiator_responder_interaction.c | 18 .len = sizeof(I_prk_exporter_buf) }; 22 .len = sizeof(I_master_secret_buf) }; 26 .len = sizeof(I_master_salt_buf) }; 30 .len = sizeof(I_PRK_out_buf) }; 34 .len = sizeof(I_err_msg_buf) }; 39 .len = sizeof(R_prk_exporter_buf) }; 43 .len = sizeof(R_master_secret_buf) }; 47 .len = sizeof(R_master_salt_buf) }; 51 .len = sizeof(R_PRK_out_buf) }; 55 .len = sizeof(R_err_msg_buf) }; [all …]
|
/uoscore-uedhoc-3.7.0/src/oscore/ |
D | oscore_cose.c | 41 enc_structure.oscore_enc_structure_context.len = in create_enc_structure() 44 enc_structure.oscore_enc_structure_protected.len = 0; in create_enc_structure() 47 enc_structure.oscore_enc_structure_external_aad.len = in create_enc_structure() 48 external_aad->len; in create_enc_structure() 52 TRY_EXPECT(cbor_encode_oscore_enc_structure(out->ptr, out->len, in create_enc_structure() 57 out->len = (uint32_t)payload_len_out; in create_enc_structure() 68 uint32_t aad_len = recipient_aad->len + ENCRYPT0_ENCODING_OVERHEAD; in oscore_cose_decrypt() 71 PRINT_ARRAY("AAD encoded", aad.ptr, aad.len); in oscore_cose_decrypt() 73 (in_ciphertext->ptr + in_ciphertext->len - 8), 8); in oscore_cose_decrypt() 75 PRINT_ARRAY("Ciphertext", in_ciphertext->ptr, in_ciphertext->len); in oscore_cose_decrypt() [all …]
|
D | security_context.c | 48 PRINT_ARRAY("info struct", info.ptr, info.len); in derive() 70 PRINT_ARRAY("Common IV", cc->common_iv.ptr, cc->common_iv.len); in derive_common_iv() 84 PRINT_ARRAY("Sender Key", sc->sender_key.ptr, sc->sender_key.len); in derive_sender_key() 100 rc->recipient_key.len); in derive_recipient_key() 126 c->cc.common_iv.len = sizeof(c->cc.common_iv_buf); in oscore_context_init() 133 c->rc.recipient_id.len = params->recipient_id.len; in oscore_context_init() 136 params->recipient_id.len); in oscore_context_init() 137 c->rc.recipient_key.len = sizeof(c->rc.recipient_key_buf); in oscore_context_init() 143 c->sc.sender_key.len = sizeof(c->sc.sender_key_buf); in oscore_context_init() 154 c->rrc.nonce.len = sizeof(c->rrc.nonce_buf); in oscore_context_init() [all …]
|
D | oscore_hkdf_info.c | 48 uint8_t len = 0; in oscore_create_hkdf_info() local 52 len = 16; in oscore_create_hkdf_info() 56 len = 13; in oscore_create_hkdf_info() 61 info_struct.oscore_info_id.len = id->len; in oscore_create_hkdf_info() 63 if (id_context->len == 0) { in oscore_create_hkdf_info() 71 info_struct.oscore_info_id_context_bstr.len = id_context->len; in oscore_create_hkdf_info() 77 info_struct.oscore_info_type.len = (uint32_t)strlen(type_enc); in oscore_create_hkdf_info() 78 info_struct.oscore_info_L = len; in oscore_create_hkdf_info() 82 TRY_EXPECT(cbor_encode_oscore_info(out->ptr, out->len, &info_struct, in oscore_create_hkdf_info() 86 out->len = (uint32_t)payload_len_out; in oscore_create_hkdf_info()
|
D | oscore_coap.c | 51 uint32_t out_capacity = out->len; in options_serialize() 52 out->len = 0; in options_serialize() 56 len_extra_byte = opt_extra_bytes(options[i].len); in options_serialize() 80 *(header_byte) |= (uint8_t)(options[i].len); in options_serialize() 85 (uint8_t)(options[i].len - 13); in options_serialize() 89 uint16_t temp_len = (uint16_t)(options[i].len - 269); in options_serialize() 100 out->len = (uint32_t)(out->len + 1 + delta_extra_byte + in options_serialize() 101 len_extra_byte + options[i].len); in options_serialize() 103 if (0 != options[i].len) { in options_serialize() 107 options[i].len)); in options_serialize() [all …]
|
D | nonce.c | 26 TRY(_memcpy_s(&padded_piv[sizeof(padded_piv) - piv->len], piv->len, in create_nonce() 27 piv->ptr, piv->len)); in create_nonce() 33 TRY(_memcpy_s(&padded_id_piv[sizeof(padded_id_piv) - id_piv->len], in create_nonce() 34 id_piv->len, id_piv->ptr, id_piv->len)); in create_nonce() 37 nonce->ptr[0] = (uint8_t)id_piv->len; in create_nonce() 44 PRINT_ARRAY("nonce input A", nonce->ptr, nonce->len); in create_nonce() 45 PRINT_ARRAY("nonce input B", common_iv->ptr, common_iv->len); in create_nonce() 47 for (uint32_t i = 0; i < common_iv->len; i++) { in create_nonce() 51 PRINT_ARRAY("nonce", nonce->ptr, nonce->len); in create_nonce()
|
D | aad.c | 34 aad_array.aad_array_request_kid.len = kid->len; in create_aad() 36 aad_array.aad_array_request_piv.len = piv->len; in create_aad() 38 PRINT_ARRAY("request_piv", piv->ptr, piv->len); in create_aad() 39 PRINT_ARRAY("request_kid", kid->ptr, kid->len); in create_aad() 46 aad_array.aad_array_options.len = 0; in create_aad() 50 TRY_EXPECT(cbor_encode_aad_array(out->ptr, out->len, &aad_array, in create_aad() 54 out->len = (uint32_t)payload_len_out; in create_aad() 55 PRINT_ARRAY("AAD", out->ptr, out->len); in create_aad()
|
/uoscore-uedhoc-3.7.0/src/common/ |
D | byte_array.c | 18 .len = 0, 23 .len = 0, 30 if (source->len + dest->len > capacity) { in byte_array_append() 33 TRY(_memcpy_s(dest->ptr + dest->len, capacity - dest->len, source->ptr, in byte_array_append() 34 source->len)); in byte_array_append() 35 dest->len += source->len; in byte_array_append() 42 TRY(_memcpy_s(dest->ptr, dest_max_len, src->ptr, src->len)); in byte_array_cpy() 43 dest->len = src->len; in byte_array_cpy() 49 if (left->len != right->len) { in array_equals() 52 for (uint32_t i = 0; i < left->len; i++) { in array_equals()
|
D | crypto_wrapper.c | 253 .len = key_len }) && in aead_mock_args_match_predefined() 256 .len = nonce_len }) && in aead_mock_args_match_predefined() 259 .len = aad_len }) && in aead_mock_args_match_predefined() 261 &(struct byte_array){ .ptr = tag, .len = tag_len }); in aead_mock_args_match_predefined() 275 predefined_in_out, key->ptr, key->len, nonce->ptr, in aead() 276 nonce->len, aad->ptr, aad->len, tag->ptr, in aead() 277 tag->len)) { in aead() 279 predefined_in_out->out.len); in aead() 290 TRY_EXPECT(tc_ccm_config(&c, &sched, nonce->ptr, nonce->len, tag->len), in aead() 294 TRY_EXPECT(tc_ccm_decryption_verification(out->ptr, out->len, in aead() [all …]
|
/uoscore-uedhoc-3.7.0/test/oscore_unit_tests/ |
D | unit_test_coap2oscore.c | 28 PRINT_ARRAY("value", opt[i].value, opt[i].len); in print_options() 42 zassert_equal(opt[i].len, opt_expected[i].len, "wrong length"); in assert_options() 47 opt[i].len, "wrong value"); in assert_options() 74 .len = 0, in t100_inner_outer_option_split__no_special_options() 79 .len = 0, in t100_inner_outer_option_split__no_special_options() 84 .len = 0, in t100_inner_outer_option_split__no_special_options() 89 .len = 0, in t100_inner_outer_option_split__no_special_options() 93 .payload.len = 0, in t100_inner_outer_option_split__no_special_options() 110 .len = 0, in t100_inner_outer_option_split__no_special_options() 114 { .delta = 3, .len = 0, .value = NULL, .option_number = ETAG }, in t100_inner_outer_option_split__no_special_options() [all …]
|
D | unit_test_oscore2coap.c | 38 .piv.len = 0, in t300_oscore_option_parser_no_piv() 40 .kid_context.len = sizeof(kid_context), in t300_oscore_option_parser_no_piv() 42 .kid.len = sizeof(kid), in t300_oscore_option_parser_no_piv() 52 .len = sizeof(val), in t300_oscore_option_parser_no_piv() 65 zassert_equal(result.piv.len, 0, "wrong piv len"); in t300_oscore_option_parser_no_piv() 67 result.kid.len, "wrong kid"); in t300_oscore_option_parser_no_piv() 70 result.kid_context.len, "wrong kid_context"); in t300_oscore_option_parser_no_piv() 79 .len = sizeof(val), in t301_oscore_option_parser_wrong_n() 109 .piv.len = sizeof(piv), in t302_oscore_option_parser_no_kid() 111 .kid_context.len = sizeof(kid_context), in t302_oscore_option_parser_no_kid() [all …]
|
/uoscore-uedhoc-3.7.0/samples/linux_edhoc/initiator/src/ |
D | main.cpp | 92 pdu->setPayload(data->ptr, data->len); in tx() 126 if (data->len >= payload_len) { in rx() 128 data->len = payload_len; in rx() 155 c_i.c_i.len = test_vectors[vec_num_i].c_i_len; in main() 158 c_i.suites_i.len = test_vectors[vec_num_i].SUITES_I_len; in main() 160 c_i.ead_1.len = test_vectors[vec_num_i].ead_1_len; in main() 162 c_i.ead_3.len = test_vectors[vec_num_i].ead_3_len; in main() 164 c_i.id_cred_i.len = test_vectors[vec_num_i].id_cred_i_len; in main() 166 c_i.cred_i.len = test_vectors[vec_num_i].cred_i_len; in main() 168 c_i.g_x.len = test_vectors[vec_num_i].g_x_raw_len; in main() [all …]
|
/uoscore-uedhoc-3.7.0/samples/linux_edhoc/responder/src/ |
D | main.cpp | 119 txPDU->setPayload(data->ptr, data->len); in tx() 148 if (data->len >= payload_len) { in rx() 150 data->len = payload_len; in rx() 190 c_r.c_r.len = test_vectors[vec_num_i].c_r_len; in main() 191 c_r.suites_r.len = test_vectors[vec_num_i].SUITES_R_len; in main() 193 c_r.ead_2.len = test_vectors[vec_num_i].ead_2_len; in main() 195 c_r.ead_4.len = test_vectors[vec_num_i].ead_4_len; in main() 197 c_r.id_cred_r.len = test_vectors[vec_num_i].id_cred_r_len; in main() 199 c_r.cred_r.len = test_vectors[vec_num_i].cred_r_len; in main() 201 c_r.g_y.len = test_vectors[vec_num_i].g_y_raw_len; in main() [all …]
|
/uoscore-uedhoc-3.7.0/samples/zephyr_edhoc/initiator/src/ |
D | main.c | 74 TRY_EXPECT(coap_packet_append_payload(&request, data->ptr, data->len), in tx() 115 if (data->len >= edhoc_data_len) { in rx() 117 data->len = edhoc_data_len; in rx() 147 c_i.c_i.len = test_vectors[vec_num_i].c_i_len; in internal_main() 150 c_i.suites_i.len = test_vectors[vec_num_i].SUITES_I_len; in internal_main() 152 c_i.ead_1.len = test_vectors[vec_num_i].ead_1_len; in internal_main() 154 c_i.ead_3.len = test_vectors[vec_num_i].ead_3_len; in internal_main() 156 c_i.id_cred_i.len = test_vectors[vec_num_i].id_cred_i_len; in internal_main() 158 c_i.cred_i.len = test_vectors[vec_num_i].cred_i_len; in internal_main() 160 c_i.g_x.len = test_vectors[vec_num_i].g_x_raw_len; in internal_main() [all …]
|
/uoscore-uedhoc-3.7.0/samples/zephyr_edhoc/responder/src/ |
D | main.c | 77 r = coap_packet_append_payload(&cp_ack, data->ptr, data->len); in tx() 125 if (data->len >= edhoc_data_len) { in rx() 127 data->len = edhoc_data_len; in rx() 156 c_r.c_r.len = test_vectors[vec_num_i].c_r_len; in internal_main() 157 c_r.suites_r.len = test_vectors[vec_num_i].SUITES_R_len; in internal_main() 159 c_r.ead_2.len = test_vectors[vec_num_i].ead_2_len; in internal_main() 161 c_r.ead_4.len = test_vectors[vec_num_i].ead_4_len; in internal_main() 163 c_r.id_cred_r.len = test_vectors[vec_num_i].id_cred_r_len; in internal_main() 165 c_r.cred_r.len = test_vectors[vec_num_i].cred_r_len; in internal_main() 167 c_r.g_y.len = test_vectors[vec_num_i].g_y_raw_len; in internal_main() [all …]
|