lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <9F9F1AD7-135E-43F4-9A46-BD5A60DA0921@linux.dev>
Date: Fri, 14 Nov 2025 11:30:15 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: David Laight <david.laight.linux@...il.com>
Cc: Eric Biggers <ebiggers@...nel.org>,
 Mimi Zohar <zohar@...ux.ibm.com>,
 David Howells <dhowells@...hat.com>,
 Jarkko Sakkinen <jarkko@...nel.org>,
 Paul Moore <paul@...l-moore.com>,
 James Morris <jmorris@...ei.org>,
 "Serge E. Hallyn" <serge@...lyn.com>,
 linux-hardening@...r.kernel.org,
 linux-integrity@...r.kernel.org,
 keyrings@...r.kernel.org,
 linux-security-module@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] KEYS: encrypted: Replace deprecated strcpy and improve
 get_derived_key

Hi David,

On 14. Nov 2025, at 10:34, David Laight wrote:
> On Thu, 13 Nov 2025 22:55:45 +0100
> Thorsten Blum <thorsten.blum@...ux.dev> wrote:
> 
>> strcpy() is deprecated; use the safer strscpy() and use its return
>> value, the number of bytes copied, instead of calling strlen() on the
>> destination buffer again. String truncation can be ignored since
>> 'derived_buf' is guaranteed to be large enough.
>> 
>> Link: https://github.com/KSPP/linux/issues/88
>> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
>> ---
>> [...]
> 
> I'm not sure this is an improvement, but has this code ever been correct?
> The buffer passed to sha256 is either:
> 	"AUTH_KEY"'\0'master_key
> or
> 	"ENC_KEY"'\0'master_key
> For short master_key the buffer is HASH_SIZE bytes and padded with zeros (ok).
> However for long master_key the length is calculated using "AUTH_KEY" so
> there is an additional trailing '\0' in the "ENC_KEY" case.

I removed the trailing '\0' in v1, but since Eric pointed out that it
changes the sha256 hash, I reverted it in v2.

Thanks,
Thorsten


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ