This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TMS320F28377D:AES-CMAC 测试矢量

Guru**** 1839620 points
Other Parts Discussed in Thread: C2000WARE
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1424808/tms320f28377d-aes-cmac-test-vectors

器件型号:TMS320F28377D
Thread 中讨论的其他器件:C2000WARE

工具与软件:

尊敬的 E2E:

在 C2000Ware_5_03_00_00中的 AES CMAC 实现中如何使用填充、我感觉有点困惑。 我似乎与 RFC4493中发布的 AES-CMAC 测试向量1或3不匹配。 这两个测试向量的输入数据都不是128位的倍数。 我的理解是、AES-CMAC 的填充在 RFC4493中被指定为128位边界的0x80..00。 我如何修改以下内容以匹配测试向量情况1?

TEST(TEST_aes, TEST_rfc4493_case1) {
   uint16_t key[16U] = {
         0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
         0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
   };
   uint16_t msg[16] = {
         0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
   };
   uint16_t exp_cmac[16] = {
         0xbb, 0x1d, 0x69, 0x29, 0xe9, 0x59, 0x37, 0x28,
         0x7f, 0xa3, 0x7d, 0x12, 0x9b, 0x75, 0x67, 0x46
   };
   uint16_t *cmac = AES_performCMAC(msg, 1U, key, AES_128);
   for(uint16_t idx = 0; idx < 16U; idx++) {
      TEST_ASSERT_EQUAL(exp_cmac[idx], cmac[idx]);
   }
}

谢谢!

挪亚

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Noah、

    很抱歉、我需要重复一些其他问题、以便为您提供完整的答案。  将尝试通过 tommorow 获取更新。

    此致!

    Matthew

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好、Noah、

    对于延迟、我们深表歉意。  您应该也以提供其他数据的相同方式提供填充数据。

    例如、我已经用纯文本示例说明了需要如何在数组中指定数据以提供给 AES 引擎、您可以将其用作参考。 然后、您可以使用预期的身份验证标签对其进行交叉验证。  

    //plain text : 7393172a e93d7e11 2e409f96 6bc1bee2
    // 45af8e51 9eb76fac 1e03ac9c ae2d8a57
    // 00000000 80000000 a35ce411 30c81c46
    
    // Tag out : aaf3d8f1 de5640c2 32f5b169 b9c911e6
    
    uint32_t plaintextarray[12] = {
    0xe2bec16b,0x969f402e,0x117e3de9,0x2a179373,
    0x578a2dae,0x9cac031e,0xac6fb79e,0x518eaf45,
    0x461cc830,0x11e45ca3,0x00000080,0x00000000
    };
    
    uint32_t tag_outarray[4] = {
    0xf1d8f3aa,0xc24056de,0x69b1f532,0xe611c9b9
    };

    希望这可以澄清您的问题。  

    谢谢、此致

    Pramod