[LTP] [PATCH] syscalls/keyctl/keyctl09.c: fix test encrypted key

Mimi Zohar zohar@linux.ibm.com
Wed Oct 12 14:48:35 CEST 2022


Hi Nikolaus,

On Thu, 2022-10-06 at 08:15 +0200, Nikolaus Voss wrote:
> This commit fixes the test for adding encrypted keys with unencrypted data.
> Unencryted data must be provided hex-ascii encoding. Due to a kernel
> bug, the unencypted data was not decoded to binary thus the length of
> the key was only half the specified key size. This patch doubles the key
> size and adds a test with a wrong key size to trigger a corresponding
> error.
> 
> This patch must be used with the kernel fix
> https://lore.kernel.org/lkml/20220919072317.E41421357@mail.steuer-voss.de

Petr, please correct me if I'm wrong.  Changing an existing LTP test so
that it only works on kernels with the kernel patch applied, doesn't
sound right.  The test should emit a warning if the original "valid
payload" successfully loads.

As previously suggested, instead of replacing the existing valid
payload, define a new valid payload as the hex-ascii representation of
the existing one.  The kernel decrypted data would then be the same on
systems with and without the patch.

 #define ENCRYPTED_KEY_VALID_PAYLOAD    "new enc32 user:masterkey 32 abcdefABCDE
F1234567890aaaaaaaaaa"
+#define ENCRYPTED_KEY_VALID_PAYLOAD_NEW   "new enc32 user:masterkey 32 b61626364656
64142434445463132333435363738393061616161616161616161"

-- 
thanks,

Mimi



More information about the ltp mailing list