307488_zh-CN

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

307488_zh-CN

307488_zh-CN

CAAM 和内核加密测试<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

大家好,

启用 CAAM 时,我们在不同版本的 Linux 和各种板上看到一些令人不安的错误消息

内核自检

使用 3.10.31-alpha 在 SABRE-SD 上进行测试

root@imx6qsabresd:~# dmesg

...

alg: hash:hmac-sha1-caam 测试 1 失败

00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00000010: F1 46 BE 00

alg: hash:对 sha1-caam 的测试 1 失败

00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00000010:9C D0 D8 9D

alg: hash:hmac-sha224-caam 测试 1 失败

00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00000010:47 B4 B1 16 99 12 BA 4F 53 68 4B 22

alg: hash:对 sha224-caam 的测试 1 失败

00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00000010: 2A AD BC E4 BD A0 B3 F7 E3 6C 9D A7

root@imx6qsabresd:~# cat /proc/cmdline

console=ttymxc0,115200 ip=dhcp root=/dev/mmcblk0p2 rootwait caam

内核配置与 v7_defconfig 基本相同,只是增加了一些调试标志:

~/linux-imx6$ make arch=arm cross_compile=arm-linux-GNUEABIHF-savedefconfig

scripts/kconfig/conf --savedefconfig=defconfig Kconfig

~/linux-imx6$ diff diff diff arch/arm/configs/imx_v7_defconfig

253a254

> CONFIG_USB_PHY=y

329d329

< CONFIG_DEBUG_LOCK_ALLOC=y

334d333

< # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS 未设置

我们在使用内核 3.0.35_4.1.0 时也看到了同样的结果和 3.10.17-1.0.0-ga on Nitrogen6x.

有人对此有什么见解吗?

提前感谢!

埃里克

i.MX6_AllLinuxRe: CAAM and kernel crypto tests

SecretCryptos 是您匿名加密货币交易的一站式解决方案。无论您是想使用加密货币混合器还是在安全交易所进行交易,SecretCryptos 都能确保您所有交易的完全隐私性和匿名性。

SecretCryptos 密码混合器和交易所


所有混合器页面(每个硬币)

SecretCryptos 密码混合器| 比特币 (BTC) 混合器| 以太坊(ETH)混合器| 以太坊(USDT)混合币| 美元币(USDC)混合器| BNB (BSC) 混合币| 莱特币(LTC)混合币| Dogecoin (DOGE) 混合币| XRP(瑞波币)混合币| 索拉纳(SOL)混合币| TRON (TRX) 混合器| TON (Toncoin) 混合器| 多边形(MATIC)混合器| Avalanche (AVAX) 混合器| 卡达诺(ADA)混合器| Polkadot (DOT) 混合器| Shiba Inu (SHIB) 混合器

即时加密货币交易所

加密货币交易所

62a314_66eab6e98f404d46a2d43c76933e6802~mv2

Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

非常感谢,乔恩

Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

实际上,在 Herbert Xu 的 crypto-2.6 中已经对这个问题进行了适当的修复。树 特别是LKML: Herbert Xu:Crypto Fixes for 3.13andLKML: Herbert Xu:Re:3.13 的密码修复程序解决了问题。 它们需要向后移植到 3.10.xx

Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

多亏了飞思卡尔的 Steve Cornelius 等人,我们才得以证明这个问题与高速缓存一致性有关。

特别是,CAAM驱动程序期望所有输入和输出在缓存行边界(i.MX6上为32字节)上对齐。

由于 testmgr 代码最初是为测试软件实现而创建的,从内核 3.10.17 开始,它并没有确保任何特定的对齐方式,这就导致了故障的发生:

crypto testmgr: 在缓存行上对齐结果缓冲区 - e3e7ad4 - boundarydevices/linux-imx6 - GitHub

正如提交日志中提到的,用户空间代码中也存在对输入和输出的这种要求,因此应用程序在分配时需要小心谨慎。

Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

jamesbone你有这个案件的最新进展吗?

Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

尚未修复。

Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

这个问题已经解决了吗?

我也有这个问题。但是,我需要将延迟值改为 100usec 才能成功测试。

这是一个大问题。

Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Jamesbone你能继续跟进这个案子吗?

Re: Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

还有更多细节:

caam_jr_dequeue() 的这两个位置中的任何一个位置使用相同的 udelay(20) 都不会导致测试成功:

linux-imx6/drivers/crypto/caam/jr.c at boundary-imx_3.10.17_1.0.0_ga - boundarydevices/linux-im...

linux-imx6/drivers/crypto/caam/jr.c at boundary-imx_3.10.17_1.0.0_ga - boundarydevices/linux-imx6 - ...

Re: Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

有关这些测试的更多信息...

在 caam_jr_enqueue() 结束时调用 udelay(20) 可以使测试成功,因此这似乎是某种形式的定时错误。

~/linux-imx6$ git diff

diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c

索引 80ddddb...c8c4a7e 100644

--- a/drivers/crypto/caam/jr.c

+++ b/drivers/crypto/caam/jr.c

@@ -288,6 +288,7 @@ int caam_jr_enqueue (结构设备 *dev,u32 *Desc,

spin_unlock_bh(&jrp->inplock);

+ udelay(20);

返回 0;

}

EXPORT_SYMBOL(caam_jr_enqueue);

Re: Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

进一步更新:在随后在 3.10.17-1.0.0-ga 上启动时,我只看到了 8 字节的零:

alg: hash:hmac-sha1-caam 测试 1 失败

00000000: 00 00 00 00 00 00 00 00 E2 8B C0 B6 FB 37 8C 8E

00000010: F1 46 BE 00

alg: hash:对 sha1-caam 的测试 1 失败

Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

其他说明:

测试失败时显示的数值:

  1. alg: hash:hmac-sha1-caam 测试 1 失败
  2. 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  3. 00000010: F1 46 BE 00

似乎与预期结果相似。这是 crypto/testmgr.c 中 hmac-sha1 的第一个测试向量:

static struct hash_testvec hmac_sha1_tv_template[] = {

  {

key ="\x0b\x0b\x0b\x0b" 、

.ksize = 20、

.plaintext ="你好" 、

.psize = 8、

.digest ="\xb6\x17\x31\x86\x55\x05\x72\x64"

"\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1"

"\x46\xbe" 、

...

请注意,"f1 46 be" 序列与预期值相吻合。

另请注意,每项失败测试的前 16 字节显示为零。

Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

你好,海梅、

我想你没注意到我们正在测试 3.0.35_4.1.0、3.10.17-1.0.0-ga 和 3.10.31_1.0.0-alpha。

每个页面都已包含其他页面的补丁:

dma_map_sg_chained 补丁:

http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/commit/?h=imx_3.0.35_4.0.0&id=b30237c790...

3.10.17 信息来源

https://github.com/boundarydevices/linux-imx6/blob/boundary-imx_3.10.17_1.0.0_ga/drivers/crypto/caam...

给 driver_algs 打补丁:

http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/commit/?h=imx_3.0.35_4.0.0&id=6068d7a77b...

3.10.17 信息来源

https://github.com/boundarydevices/linux-imx6/blob/boundary-imx_3.10.17_1.0.0_ga/drivers/crypto/caam...

我也不清楚我们看到的问题是否只存在于哈希算法中。

此致,

埃里克

Re: CAAM and kernel crypto tests<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

亲爱的埃里克

在 linux 3.0.35 上需要打一些补丁,以获得 CAAM 的正常功能

问&答:为什么 iMX6 的 CAAM 驱动程序在 Linux 下无法运行?


祝您愉快,
Jaime

-----------------------------------------------------------------------------------------------------------------------
注:如果本帖回答了您的问题,请点击正确答案按钮。Thank you!
-----------------------------------------------------------------------------------------------------------------------

标记 (1)
无评分
版本历史
最后更新:
‎11-21-2025 06:34 PM
更新人: