From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Christian Ebner <c.ebner@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-backup] pbs-key-config: ensure password-protected key is long enough
Date: Tue, 10 Nov 2026 10:06:29 +0100 [thread overview]
Message-ID: <1794301542.iv0x4kkfm6.astroid@yuna.none> (raw)
In-Reply-To: <da2cba4c-a6ce-40e9-837b-5d2fd289bdca@proxmox.com>
On November 10, 2026 10:01 am, Christian Ebner wrote:
> On 11/5/26 12:07 PM, Fabian Grünbichler wrote:
>> while openssl fails if provided an empty slice, the resulting error message
>> points at the password instead of the key. checking for at least one byte of
>> data ensures plain and password-protected keys are distinguished.
>>
>> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
>> ---
>> pbs-key-config/src/lib.rs | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/pbs-key-config/src/lib.rs b/pbs-key-config/src/lib.rs
>> index 7b87b4ea9..0cffdf008 100644
>> --- a/pbs-key-config/src/lib.rs
>> +++ b/pbs-key-config/src/lib.rs
>> @@ -211,7 +211,7 @@ impl KeyConfig {
>>
>> let derived_key = kdf.derive_key(&passphrase)?;
>>
>> - if raw_data.len() < 32 {
>> + if raw_data.len() < EXPECTED_KEY_LEN + 1 {
>> bail!("Unable to decrypt key - short data");
>> }
>> let iv = &raw_data[0..16];
>
> +1 for the check, should this really use the EXPECTED_KEY_LEN constant
> though?
>
> After all the first 32 bytes here are the IV and tag, not really the key
> data... So either we have constants for these as well or stick to the
> plain numeric values?
right, probably separate constants and using them in the slice access as
well makes sense.. will send a v2!
prev parent reply other threads:[~2026-11-10 9:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 11:07 [PATCH proxmox-backup] pbs-key-config: ensure password-protected key is long enough Fabian Grünbichler
2026-11-10 9:01 ` Christian Ebner
2026-11-10 9:06 ` Fabian Grünbichler [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=1794301542.iv0x4kkfm6.astroid@yuna.none \
--to=f.gruenbichler@proxmox.com \
--cc=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.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