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.

[参考译文] CC2652:使用 AES CCM 加密时是否出现问题?

Guru**** 2524460 points
Other Parts Discussed in Thread: CC2652R

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/915508/cc2652-am-i-doing-something-wrong-while-using-aes-ccm-encryption

主题中讨论的其他器件:CC2652R

我正在尝试加密 CC2652R 上的一条简单消息、然后通过 UART 将其发送到 python 脚本。 在这里、结果始终是解密失败。 我知道消息 MAC 和 Nonce 都正确到达。 在 CC2652R 上运行的脚本和程序都已包含预共享密钥。

为了解决此问题、我还尝试使用相同的 PSK 和 nonce 对 python 脚本中的同一消息进行加密。 但是、生成的密文在 python 脚本中是不同的。 我在 CC2652R 上执行 AES CCM 模块是否不正确?

这是 CC2652R 上的代码:

//摘要是预共享 salt 的 SHA256结果。
// CC2652R 和 python 脚本
结果相同= CryptoKeyPlaintext_initKey (&& cryptoKey、digest、sizeof (digest));
如果(Result!= CryptoKey_STATUS_Success)返回1;

AESCM_Params ccmParams;
AESCM_Params_Open_CCCM_PALESC0;AESCM_PALIT_PALIC_PAGE_RETURN

= AESCM_PALICATION;AESCM_PALIT_PALIT_RESCM_PALIT = AESCM_PALIT_RESCM_RESPRATICATION;AESCM_PALIT = AESCM_PALICATION &ccmParams);
if (_ccmHandle == NULL)返回0;

AESCM_Operation 操作;
AESCM_Operation_init (&operation);
char msg[]={'H'、'E'、'L'、'L'、'O'};
字符输出[5];
operation.key =&_cryptoKey;
operation.input = msg;
operation.output =输出;
operation.inputLength = 5;
operation.nonce = nonce;// nonce 硬编码为{0xE3、0x00、0x00、0x00、0x00、 0x00、0x00、0x00、0x00、0x00、 0x00、0x00}、现在
为 operation.nonceLength = NONCE_SIZE;
operation.Mac = Mac;
operation.macLength = 16;
int_fast16_t 结果= AESCM_oneStepEncrypt (_ccmHandle、&operation);

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

    尊敬的 Vincent:

    您是否已经验证了两种实现方式中的字节序以及在非字节对齐输入中可能使用的填充?