Hardware encryption without black keys

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hardware encryption without black keys

Jump to solution
146 Views
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?

 

Tags (2)
0 Kudos
Reply
1 Solution
96 Views
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

View solution in original post

0 Kudos
Reply
2 Replies
97 Views
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 Kudos
Reply
88 Views
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 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2255304%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHardware%20encryption%20without%20black%20keys%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2255304%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20have%20hardware%20encryption%20using%20black%20keys%20(CAAM)%2C%20but%20the%20customer%20would%20also%20like%20hardware%20encryption%20without%20the%20black%20keys%20so%20an%20ssd%20partition%20can%20be%20hardware%20encrypted%20but%20be%20removed%20in%20case%20of%20a%20board%20failure%20and%20decrypted%20on%20another%20machine%20with%20the%20key%20used.%3C%2FP%3E%3CP%3EI%20cannot%20seem%20to%20get%20the%20cipher%2Fkey%20working%20with%20dmsetup%2C%20and%20am%20kind%20of%20confused%20as%20how%20to%20tell%20the%20system%20how%20to%20tell%20the%20difference%20between%20using%20CAAM%20generated%20keys%20and%20regular%20keys.%3C%2FP%3E%3CP%3EIs%20it%20the%20%22capi%22%20part%20of%20the%20cipher%2C%20or%20something%20else%20that%20determines%3F%3C%2FP%3E%3CP%3E(from%20the%20imx8m%20hardware%20encryption%20document)%3C%2FP%3E%3CP%3EFor%20HW%20encryption%20with%20a%20caam-keygen%20key%20added%20to%20kernel%20keychain%3A%3CBR%20%2F%3Edmsetup%20-v%20create%20encrypted%20--table%20%220%20%24(blockdev%20--getsz%20%2Fdev%2Floop0)%20crypt%20capi%3Atk(cbc(aes))-plain%20%3A36%3Alogon%3Alogkey%3A%200%20%2Fdev%2Floop0%200%201%20sector_size%3A512%22%3C%2FP%3E%3CP%3EHow%20to%20use%20regular%20key%3F%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%20Family%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