public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: Nikolaus Voss <nikolaus.voss@haag-streit.com>
Cc: Yael Tzur <yaelt@google.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] syscalls/keyctl/keyctl09.c: fix test encrypted key
Date: Thu, 12 Jan 2023 11:03:39 +0000	[thread overview]
Message-ID: <87lem8hv54.fsf@suse.de> (raw)
In-Reply-To: <20230111142316.A0DBECA25@mail.steuer-voss.de>

Hello,

Merged, Thanks!

Nikolaus Voss <nikolaus.voss@haag-streit.com> writes:

> 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.
>
> Fixes: 342e7a0dd ("syscalls/keyctl09: test encrypted keys with provided decrypted data.")
> Link: https://lore.kernel.org/ltp/20221006081709.92303897@mail.steuer-voss.de/
> Signed-off-by: Nikolaus Voss <nikolaus.voss@haag-streit.com>
> ---
> v2: add linux-git tag for kernel fix, only correct test input data
>
>  testcases/kernel/syscalls/keyctl/keyctl09.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/keyctl/keyctl09.c b/testcases/kernel/syscalls/keyctl/keyctl09.c
> index c88c481b9..cfd5f7e5f 100644
> --- a/testcases/kernel/syscalls/keyctl/keyctl09.c
> +++ b/testcases/kernel/syscalls/keyctl/keyctl09.c
> @@ -13,8 +13,8 @@
>  #include "tst_test.h"
>  #include "lapi/keyctl.h"
>  
> -#define ENCRYPTED_KEY_VALID_PAYLOAD	"new enc32 user:masterkey 32 abcdefABCDEF1234567890aaaaaaaaaa"
> -#define ENCRYPTED_KEY_INVALID_PAYLOAD	"new enc32 user:masterkey 32 plaintext123@123!123@123!123@123"
> +#define ENCRYPTED_KEY_VALID_PAYLOAD	"new enc32 user:masterkey 32 abcdefABCDEF1234567890aaaaaaaaaaabcdefABCDEF1234567890aaaaaaaaaa"
> +#define ENCRYPTED_KEY_INVALID_PAYLOAD	"new enc32 user:masterkey 32 plaintext123@123!123@123!123@123plaintext123@123!123@123!123@123"
>  
>  static void do_test(void)
>  {
> @@ -28,7 +28,8 @@ static void do_test(void)
>  
>  	TST_EXP_POSITIVE(add_key("encrypted", "ltptestkey1",
>  			    ENCRYPTED_KEY_VALID_PAYLOAD,
> -			    60, KEY_SPEC_PROCESS_KEYRING));
> +			    strlen(ENCRYPTED_KEY_VALID_PAYLOAD),
> +			    KEY_SPEC_PROCESS_KEYRING));
>  
>  	if (!TST_PASS)
>  		return;
> @@ -39,7 +40,8 @@ static void do_test(void)
>  		return;
>  
>  	TST_EXP_FAIL2(add_key("encrypted", "ltptestkey2",
> -			    ENCRYPTED_KEY_INVALID_PAYLOAD, 60,
> +			    ENCRYPTED_KEY_INVALID_PAYLOAD,
> +			    strlen(ENCRYPTED_KEY_INVALID_PAYLOAD),
>  			    KEY_SPEC_PROCESS_KEYRING), EINVAL);
>  
>  	keyctl(KEYCTL_CLEAR, KEY_SPEC_PROCESS_KEYRING);
> @@ -50,5 +52,9 @@ static struct tst_test test = {
>  	.needs_kconfigs = (const char *[]) {
>  		"CONFIG_USER_DECRYPTED_DATA=y",
>  		NULL
> +	},
> +	.tags = (const struct tst_tag[]) {
> +		{ "linux-git", "5adedd42245af"},
> +		{}
>  	}
>  };
> -- 
> 2.34.1


-- 
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      parent reply	other threads:[~2023-01-12 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 14:23 [LTP] [PATCH v2] syscalls/keyctl/keyctl09.c: fix test encrypted key Nikolaus Voss
2023-01-12  0:39 ` Petr Vorel
2023-01-12  9:01   ` Nikolaus Voss
2023-01-12 11:03 ` Richard Palethorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lem8hv54.fsf@suse.de \
    --to=rpalethorpe@suse.de \
    --cc=ltp@lists.linux.it \
    --cc=nikolaus.voss@haag-streit.com \
    --cc=yaelt@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox