Lines Matching full:0

48  *   If MSB(p) = 0, then p = (p << 1)
50 * with R_64 = 0x1B and R_128 = 0x87
59 const unsigned char R_128 = 0x87; in cmac_multiply_by_u()
61 uint32_t overflow = 0x00; in cmac_multiply_by_u()
69 const unsigned char R_64 = 0x1B; in cmac_multiply_by_u()
77 for (i = (int) blocksize - 4; i >= 0; i -= 4) { in cmac_multiply_by_u()
78 uint32_t i32 = MBEDTLS_GET_UINT32_BE(&input[i], 0); in cmac_multiply_by_u()
81 MBEDTLS_PUT_UINT32_BE(i32, &output[i], 0); in cmac_multiply_by_u()
85 R_n = (unsigned char) mbedtls_ct_uint_if_else_0(mbedtls_ct_bool(input[0] >> 7), R_n); in cmac_multiply_by_u()
88 return 0; in cmac_multiply_by_u()
107 /* Calculate Ek(0) */ in cmac_generate_subkeys()
108 if ((ret = mbedtls_cipher_update(ctx, L, block_size, L, &olen)) != 0) { in cmac_generate_subkeys()
115 if ((ret = cmac_multiply_by_u(K1, L, block_size)) != 0) { in cmac_generate_subkeys()
119 if ((ret = cmac_multiply_by_u(K2, K1, block_size)) != 0) { in cmac_generate_subkeys()
145 for (j = 0; j < padded_block_len; j++) { in cmac_pad()
149 padded_block[j] = 0x80; in cmac_pad()
151 padded_block[j] = 0x00; in cmac_pad()
168 MBEDTLS_ENCRYPT)) != 0) { in mbedtls_cipher_cmac_starts()
195 return 0; in mbedtls_cipher_cmac_starts()
203 int ret = 0; in mbedtls_cipher_cmac_update()
216 * error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=] */ in mbedtls_cipher_cmac_update()
221 if (cmac_ctx->unprocessed_len > 0 && in mbedtls_cipher_cmac_update()
230 &olen)) != 0) { in mbedtls_cipher_cmac_update()
236 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_update()
248 &olen)) != 0) { in mbedtls_cipher_cmac_update()
257 if (ilen > 0) { in mbedtls_cipher_cmac_update()
307 &olen)) != 0) { in mbedtls_cipher_cmac_finish()
319 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_finish()
338 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_reset()
344 return 0; in mbedtls_cipher_cmac_reset()
361 if ((ret = mbedtls_cipher_setup(&ctx, cipher_info)) != 0) { in mbedtls_cipher_cmac()
366 if (ret != 0) { in mbedtls_cipher_cmac()
371 if (ret != 0) { in mbedtls_cipher_cmac()
411 memset(zero_key, 0, MBEDTLS_AES_BLOCK_SIZE); in mbedtls_aes_cmac_prf_128()
415 if (ret != 0) { in mbedtls_aes_cmac_prf_128()
449 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
450 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
451 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
452 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
453 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
454 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
455 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
456 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
464 0,
472 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
473 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
478 0xfb, 0xee, 0xd6, 0x18, 0x35, 0x71, 0x33, 0x66,
479 0x7c, 0x85, 0xe0, 0x8f, 0x72, 0x36, 0xa8, 0xde
483 0xf7, 0xdd, 0xac, 0x30, 0x6a, 0xe2, 0x66, 0xcc,
484 0xf9, 0x0b, 0xc1, 0x1e, 0xe4, 0x6d, 0x51, 0x3b
491 0xbb, 0x1d, 0x69, 0x29, 0xe9, 0x59, 0x37, 0x28,
492 0x7f, 0xa3, 0x7d, 0x12, 0x9b, 0x75, 0x67, 0x46
496 0x07, 0x0a, 0x16, 0xb4, 0x6b, 0x4d, 0x41, 0x44,
497 0xf7, 0x9b, 0xdd, 0x9d, 0xd0, 0x4a, 0x28, 0x7c
501 0x7d, 0x85, 0x44, 0x9e, 0xa6, 0xea, 0x19, 0xc8,
502 0x23, 0xa7, 0xbf, 0x78, 0x83, 0x7d, 0xfa, 0xde
506 0x51, 0xf0, 0xbe, 0xbf, 0x7e, 0x3b, 0x9d, 0x92,
507 0xfc, 0x49, 0x74, 0x17, 0x79, 0x36, 0x3c, 0xfe
514 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
515 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
516 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b
521 0x44, 0x8a, 0x5b, 0x1c, 0x93, 0x51, 0x4b, 0x27,
522 0x3e, 0xe6, 0x43, 0x9d, 0xd4, 0xda, 0xa2, 0x96
526 0x89, 0x14, 0xb6, 0x39, 0x26, 0xa2, 0x96, 0x4e,
527 0x7d, 0xcc, 0x87, 0x3b, 0xa9, 0xb5, 0x45, 0x2c
534 0xd1, 0x7d, 0xdf, 0x46, 0xad, 0xaa, 0xcd, 0xe5,
535 0x31, 0xca, 0xc4, 0x83, 0xde, 0x7a, 0x93, 0x67
539 0x9e, 0x99, 0xa7, 0xbf, 0x31, 0xe7, 0x10, 0x90,
540 0x06, 0x62, 0xf6, 0x5e, 0x61, 0x7c, 0x51, 0x84
544 0x3d, 0x75, 0xc1, 0x94, 0xed, 0x96, 0x07, 0x04,
545 0x44, 0xa9, 0xfa, 0x7e, 0xc7, 0x40, 0xec, 0xf8
549 0xa1, 0xd5, 0xdf, 0x0e, 0xed, 0x79, 0x0f, 0x79,
550 0x4d, 0x77, 0x58, 0x96, 0x59, 0xf3, 0x9a, 0x11
558 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
559 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
560 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
561 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4
566 0xca, 0xd1, 0xed, 0x03, 0x29, 0x9e, 0xed, 0xac,
567 0x2e, 0x9a, 0x99, 0x80, 0x86, 0x21, 0x50, 0x2f
571 0x95, 0xa3, 0xda, 0x06, 0x53, 0x3d, 0xdb, 0x58,
572 0x5d, 0x35, 0x33, 0x01, 0x0c, 0x42, 0xa0, 0xd9
579 0x02, 0x89, 0x62, 0xf6, 0x1b, 0x7b, 0xf8, 0x9e,
580 0xfc, 0x6b, 0x55, 0x1f, 0x46, 0x67, 0xd9, 0x83
584 0x28, 0xa7, 0x02, 0x3f, 0x45, 0x2e, 0x8f, 0x82,
585 0xbd, 0x4b, 0xf2, 0x8d, 0x8c, 0x37, 0xc3, 0x5c
589 0x15, 0x67, 0x27, 0xdc, 0x08, 0x78, 0x94, 0x4a,
590 0x02, 0x3c, 0x1f, 0xe0, 0x3b, 0xad, 0x6d, 0x93
594 0xe1, 0x99, 0x21, 0x90, 0x54, 0x9f, 0x6e, 0xd5,
595 0x69, 0x6a, 0x2c, 0x05, 0x6c, 0x31, 0x54, 0x10
604 0,
613 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
615 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xEF, 0x01,
617 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef
622 0x0d, 0xd2, 0xcb, 0x7a, 0x3d, 0x88, 0x88, 0xd9
626 0x1b, 0xa5, 0x96, 0xf4, 0x7b, 0x11, 0x11, 0xb2
633 0x79, 0xce, 0x52, 0xa7, 0xf7, 0x86, 0xa9, 0x60
637 0xcc, 0x18, 0xa0, 0xb7, 0x9a, 0xf2, 0x41, 0x3b
641 0xc0, 0x6d, 0x37, 0x7e, 0xcd, 0x10, 0x19, 0x69
645 0x9c, 0xd3, 0x35, 0x80, 0xf9, 0xb6, 0x4d, 0xfb
652 0x01, 0x23, 0x45, 0x67, 0x89, 0xaa, 0xcd, 0xef,
654 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01,
656 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23
661 0x9d, 0x74, 0xe7, 0x39, 0x33, 0x17, 0x96, 0xc0
665 0x3a, 0xe9, 0xce, 0x72, 0x66, 0x2f, 0x2d, 0x9b
672 0x7d, 0xb0, 0xd3, 0x7d, 0xf9, 0x36, 0xc5, 0x50
676 0x30, 0x23, 0x9c, 0xf1, 0xf5, 0x2e, 0x66, 0x09
680 0x6c, 0x9f, 0x3e, 0xe4, 0x92, 0x3f, 0x6b, 0xe2
684 0x99, 0x42, 0x9b, 0xd0, 0xbF, 0x79, 0x04, 0xe5
694 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
695 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
696 0xed, 0xcb
708 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
709 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
710 0x10, 0x11, 0x12, 0x13
715 0x84, 0xa3, 0x48, 0xa4, 0xa4, 0x5d, 0x23, 0x5b,
716 0xab, 0xff, 0xfc, 0x0d, 0x2b, 0x4d, 0xa0, 0x9a
719 0x98, 0x0a, 0xe8, 0x7b, 0x5f, 0x4c, 0x9c, 0x52,
720 0x14, 0xf5, 0xb6, 0xa8, 0x45, 0x5e, 0x4c, 0x2d
723 0x29, 0x0d, 0x9e, 0x11, 0x2e, 0xdb, 0x09, 0xee,
724 0x14, 0x1f, 0xcf, 0x64, 0xc0, 0xb7, 0x2f, 0x3d
738 int i, ret = 0; in cmac_test_subkeys()
750 for (i = 0; i < num_tests; i++) { in cmac_test_subkeys()
751 if (verbose != 0) { in cmac_test_subkeys()
757 if ((ret = mbedtls_cipher_setup(&ctx, cipher_info)) != 0) { in cmac_test_subkeys()
758 if (verbose != 0) { in cmac_test_subkeys()
766 MBEDTLS_ENCRYPT)) != 0) { in cmac_test_subkeys()
774 if (verbose != 0) { in cmac_test_subkeys()
780 if (verbose != 0) { in cmac_test_subkeys()
788 if (ret != 0) { in cmac_test_subkeys()
789 if (verbose != 0) { in cmac_test_subkeys()
796 if ((ret = memcmp(K1, subkeys, block_size)) != 0 || in cmac_test_subkeys()
797 (ret = memcmp(K2, &subkeys[block_size], block_size)) != 0) { in cmac_test_subkeys()
798 if (verbose != 0) { in cmac_test_subkeys()
805 if (verbose != 0) { in cmac_test_subkeys()
813 ret = 0; in cmac_test_subkeys()
835 int i, ret = 0; in cmac_test_wth_cipher()
845 for (i = 0; i < num_tests; i++) { in cmac_test_wth_cipher()
846 if (verbose != 0) { in cmac_test_wth_cipher()
851 message_lengths[i], output)) != 0) { in cmac_test_wth_cipher()
860 if (verbose != 0) { in cmac_test_wth_cipher()
866 if (verbose != 0) { in cmac_test_wth_cipher()
872 if ((ret = memcmp(output, &expected_result[i * block_size], block_size)) != 0) { in cmac_test_wth_cipher()
873 if (verbose != 0) { in cmac_test_wth_cipher()
879 if (verbose != 0) { in cmac_test_wth_cipher()
883 ret = 0; in cmac_test_wth_cipher()
896 for (i = 0; i < NB_PRF_TESTS; i++) { in test_aes128_cmac_prf()
899 if (ret != 0 || in test_aes128_cmac_prf()
900 memcmp(output, PRFT[i], MBEDTLS_AES_BLOCK_SIZE) != 0) { in test_aes128_cmac_prf()
902 if (verbose != 0) { in test_aes128_cmac_prf()
907 } else if (verbose != 0) { in test_aes128_cmac_prf()
928 NB_CMAC_TESTS_PER_KEY)) != 0) { in mbedtls_cmac_self_test()
941 NB_CMAC_TESTS_PER_KEY)) != 0) { in mbedtls_cmac_self_test()
954 NB_CMAC_TESTS_PER_KEY)) != 0) { in mbedtls_cmac_self_test()
967 NB_CMAC_TESTS_PER_KEY)) != 0) { in mbedtls_cmac_self_test()
981 NB_CMAC_TESTS_PER_KEY)) != 0) { in mbedtls_cmac_self_test()
994 NB_CMAC_TESTS_PER_KEY)) != 0) { in mbedtls_cmac_self_test()
1009 NB_CMAC_TESTS_PER_KEY)) != 0) { in mbedtls_cmac_self_test()
1022 NB_CMAC_TESTS_PER_KEY)) != 0) { in mbedtls_cmac_self_test()
1034 NB_CMAC_TESTS_PER_KEY)) != 0) { in mbedtls_cmac_self_test()
1047 NB_CMAC_TESTS_PER_KEY)) != 0) { in mbedtls_cmac_self_test()
1053 if ((ret = test_aes128_cmac_prf(verbose)) != 0) { in mbedtls_cmac_self_test()
1058 if (verbose != 0) { in mbedtls_cmac_self_test()
1062 return 0; in mbedtls_cmac_self_test()