Hardware encryption without black keys

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

Hardware encryption without black keys

跳至解决方案
81 次查看
flobro
Contributor IV

I have hardware encryption using black keys (CAAM), but the customer would also like hardware encryption without the black keys so an ssd partition can be hardware encrypted but be removed in case of a board failure and decrypted on another machine with the key used.

I cannot seem to get the cipher/key working with dmsetup, and am kind of confused as how to tell the system how to tell the difference between using CAAM generated keys and regular keys.

Is it the "capi" part of the cipher, or something else that determines?

(from the imx8m hardware encryption document)

For HW encryption with a caam-keygen key added to kernel keychain:
dmsetup -v create encrypted --table "0 $(blockdev --getsz /dev/loop0) crypt capi:tk(cbc(aes))-plain :36:logon:logkey: 0 /dev/loop0 0 1 sector_size:512"

How to use regular key?

 

标记 (2)
0 项奖励
回复
1 解答
31 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

When using CAAM for hardware encryption, there are two approaches:

1. Using CAAM-generated black keys (device-specific):
- The black keys are encrypted with the device's OPTMK (One-Time Programmable Master Key)
- These keys cannot be transferred between devices
- This is what your current implementation uses

2. Using regular keys with hardware acceleration:
- For your requirement to decrypt data on another machine, you need to use regular keys
- The difference is in the cipher specification with dmsetup

For regular key hardware encryption, modify your dmsetup command by removing the "capi:tk" prefix:

```
dmsetup -v create encrypted --table "0 $(blockdev --getsz /dev/loop0) crypt cbc(aes)-plain :36:logon:logkey: 0 /dev/loop0 0 1 sector_size:512"
```

The key difference is:
- With CAAM black keys: `capi:tk(cbc(aes))-plain`
- With regular keys: `cbc(aes)-plain`

The "tk" in "capi:tk" stands for "tagged key" which indicates CAAM black key usage. By removing this prefix, you're instructing the system to use standard keys while still leveraging hardware acceleration where available.

This approach will allow you to create an encrypted partition that can be moved to another machine and decrypted using the same key.

Regards

在原帖中查看解决方案

0 项奖励
回复
2 回复数
32 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

When using CAAM for hardware encryption, there are two approaches:

1. Using CAAM-generated black keys (device-specific):
- The black keys are encrypted with the device's OPTMK (One-Time Programmable Master Key)
- These keys cannot be transferred between devices
- This is what your current implementation uses

2. Using regular keys with hardware acceleration:
- For your requirement to decrypt data on another machine, you need to use regular keys
- The difference is in the cipher specification with dmsetup

For regular key hardware encryption, modify your dmsetup command by removing the "capi:tk" prefix:

```
dmsetup -v create encrypted --table "0 $(blockdev --getsz /dev/loop0) crypt cbc(aes)-plain :36:logon:logkey: 0 /dev/loop0 0 1 sector_size:512"
```

The key difference is:
- With CAAM black keys: `capi:tk(cbc(aes))-plain`
- With regular keys: `cbc(aes)-plain`

The "tk" in "capi:tk" stands for "tagged key" which indicates CAAM black key usage. By removing this prefix, you're instructing the system to use standard keys while still leveraging hardware acceleration where available.

This approach will allow you to create an encrypted partition that can be moved to another machine and decrypted using the same key.

Regards

0 项奖励
回复
23 次查看
flobro
Contributor IV
I did a compare between TK encryption, no TK HW encryption, and software encryption, and to my surprise - writing a 20GB file to the partition with no caching only resulted in a 1 second difference: TK wins, then no tk next, followed by software encryption.

Not real impressive for acceleration
0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2255304%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E6%97%A0%E9%9C%80%E9%BB%91%E9%92%A5%E5%8C%99%E7%9A%84%E7%A1%AC%E4%BB%B6%E5%8A%A0%E5%AF%86%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2255304%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%88%91%E4%BD%BF%E7%94%A8%E9%BB%91%E5%AF%86%E9%92%A5%20(CAAM)%20%E8%BF%9B%E8%A1%8C%E4%BA%86%E7%A1%AC%E4%BB%B6%E5%8A%A0%E5%AF%86%EF%BC%8C%E4%BD%86%E6%98%AF%E5%AE%A2%E6%88%B7%E4%B9%9F%E5%B8%8C%E6%9C%9B%E5%9C%A8%E6%B2%A1%E6%9C%89%E9%BB%91%E5%AF%86%E9%92%A5%E7%9A%84%E6%83%85%E5%86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0%EF%BC%9F%3C%2FP%3E%3CP%3E(%E6%91%98%E8%87%AA%20imx8m%20%E7%A1%AC%E4%BB%B6%E5%8A%A0%E5%AF%86%E6%96%87%E4%BB%B6%EF%BC%89%3C%2FP%3E%3CP%3E%E5%AF%B9%E4%BA%8E%E5%9C%A8%E5%86%85%E6%A0%B8%E5%AF%86%E9%92%A5%E9%93%BE%E4%B8%AD%E6%B7%BB%E5%8A%A0%20caam-keygen%20%E5%AF%86%E9%92%A5%E8%BF%9B%E8%A1%8C%E7%A1%AC%E4%BB%B6%E5%8A%A0%E5%AF%86%EF%BC%9A%3CBR%20%2F%3Edmsetup%20-v%20create%20encrypted%20--table%20%220%20%24(blockdev%20--getsz%20%2Fdev%2Floop0)%20crypt%20capi%3Atk(%E5%AF%86%E7%A0%81%E5%9D%97%E9%93%BE%E6%8E%A5(CBC)-aes)-plain%20%3A36%3Alogon%3Alogkey%3A%200%20%2Fdev%2Floop0%200%201%20sector_size%3A512%22%3C%2FP%3E%3CP%3E%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%99%AE%E9%80%9A%E9%92%A5%E5%8C%99%EF%BC%9F%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2255304%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3Ei.MX%208%20%E7%B3%BB%E5%88%97%20%7C%20i.MX%208QuadMax%20(8QM)%20%7C%208QuadPlus%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ELinux%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E