Lines Matching refs:msg

101     unsigned char msg[10];
112 memset(msg, 0, sizeof(msg));
121 msg, out, tag, tag_len) == res);
124 msg, out, tag, tag_len);
144 unsigned char msg[10];
154 memset(msg, 0, sizeof(msg));
164 add, add_len, msg, out, tag, tag_len) == res);
167 add_len, msg, out, tag, tag_len);
182 data_t *msg, data_t *iv,
189 const size_t expected_tag_len = result->len - msg->len;
190 const uint8_t *expected_tag = result->x + msg->len;
193 ASSERT_ALLOC(io_msg_buf, msg->len);
194 if (msg->len != 0) {
195 memcpy(io_msg_buf, msg->x, msg->len);
204 TEST_EQUAL(mbedtls_ccm_encrypt_and_tag(&ctx, msg->len, iv->x, iv->len, add->x, add->len,
207 ASSERT_COMPARE(io_msg_buf, msg->len, result->x, msg->len);
212 .len = msg->len };
216 for (n1 = 0; n1 <= msg->len; n1 += 1) {
220 iv, add, msg,
238 data_t *msg, data_t *iv, data_t *result)
247 TEST_EQUAL(0, mbedtls_ccm_set_lengths(&ctx, 0, msg->len, 0));
249 ASSERT_ALLOC(output, msg->len);
250 TEST_EQUAL(0, mbedtls_ccm_update(&ctx, msg->x, msg->len, output, msg->len, &olen));
263 data_t *msg, data_t *iv,
270 const size_t expected_msg_len = msg->len - expected_tag_len;
271 const uint8_t *expected_tag = msg->x + expected_msg_len;
277 memcpy(io_msg_buf, msg->x, expected_msg_len);
291 const data_t encrypted = { .x = msg->x,
325 data_t *key, data_t *msg,
337 const uint8_t *expected_tag = expected_result->x + msg->len;
347 ASSERT_ALLOC(io_msg_buf, msg->len);
348 if (msg->len) {
349 memcpy(io_msg_buf, msg->x, msg->len);
371 TEST_EQUAL(mbedtls_ccm_star_encrypt_and_tag(&ctx, msg->len, iv, iv_len,
375 ASSERT_COMPARE(io_msg_buf, msg->len, expected_result->x, msg->len);
383 .len = msg->len };
387 for (n1 = 0; n1 <= msg->len; n1 += 1) {
391 &iv_data, add, msg,
410 data_t *key, data_t *msg,
427 const size_t expected_msg_len = msg->len - expected_tag_len;
428 const uint8_t *expected_tag = msg->x + expected_msg_len;
434 memcpy(io_msg_buf, msg->x, expected_msg_len);
459 const data_t encrypted = { .x = msg->x,
488 data_t *key, data_t *msg, data_t *iv,
496 TEST_EQUAL(msg->len, result->len);
501 TEST_EQUAL(0, mbedtls_ccm_set_lengths(&ctx, 0, msg->len, tag->len));
505 TEST_EQUAL(0, mbedtls_ccm_update(&ctx, msg->x, msg->len, output, result->len, &olen));
562 // use hardcoded values for msg length and tag length. They are not a part of this test
583 // use hardcoded values for msg length and tag length. They are not a part of this test
595 data_t *key, data_t *msg, data_t *iv,
610 ASSERT_ALLOC(output, msg->len);
613 mbedtls_ccm_update(&ctx, msg->x, msg->len, output, msg->len, &olen));
631 // use hardcoded values for msg length and tag length. They are not a part of this test
657 // use hardcoded values for msg length and tag length. They are not a part of this test
685 // use hardcoded values for msg length and tag length. They are not a part of this test
700 data_t *key, data_t *msg, data_t *iv,
711 // subtract 1 from configured msg length to provoke an overflow
712 TEST_EQUAL(0, mbedtls_ccm_set_lengths(&ctx, add->len, msg->len - 1, 16));
716 ASSERT_ALLOC(output, msg->len);
718 mbedtls_ccm_update(&ctx, msg->x, msg->len, output, msg->len, &olen));
728 data_t *key, data_t *msg, data_t *iv,
739 TEST_EQUAL(0, mbedtls_ccm_set_lengths(&ctx, add->len, msg->len, 16));
743 ASSERT_ALLOC(output, msg->len);
745 TEST_EQUAL(0, mbedtls_ccm_update(&ctx, msg->x, msg->len - 1, output, msg->len, &olen));
762 data_t *key, data_t *msg, data_t *iv,
773 TEST_EQUAL(0, mbedtls_ccm_set_lengths(&ctx, add->len, msg->len, 16));
777 ASSERT_ALLOC(output, msg->len);
779 TEST_EQUAL(0, mbedtls_ccm_update(&ctx, msg->x, msg->len, output, msg->len, &olen));
782 mbedtls_ccm_update(&ctx, msg->x, 1, output, 1, &olen));
793 data_t *key, data_t *msg, data_t *iv,
801 msg_second_buffer[0] = msg->x[msg->len - 1];
808 TEST_EQUAL(0, mbedtls_ccm_set_lengths(&ctx, add->len, msg->len, 16));
812 ASSERT_ALLOC(output, msg->len + 1);
814 TEST_EQUAL(0, mbedtls_ccm_update(&ctx, msg->x, msg->len - 1, output, msg->len + 1, &olen));
817 mbedtls_ccm_update(&ctx, msg_second_buffer, 2, output + msg->len - 1, 2, &olen));
835 // use hardcoded values for add length, msg length and tag length.