Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, dm-devel@lists.linux.dev
Subject: Re: A question about modifying the buffer under authenticated encryption
Date: Tue, 6 Feb 2024 16:47:23 -0800	[thread overview]
Message-ID: <20240207004723.GA35324@sol.localdomain> (raw)
In-Reply-To: <f22dae2c-9cac-a63-fff-3b0b7305be6@redhat.com>

On Tue, Feb 06, 2024 at 10:46:59PM +0100, Mikulas Patocka wrote:
> Hi
> 
> I'm trying to fix some problems in dm-crypt that it may report 
> authentication failures when the user reads data with O_DIRECT and 
> modifies the read buffer while it is being read.
> 
> I'd like to ask you:
> 
> 1. If the authenticated encryption encrypts a message, reading from 
>    buffer1 and writing to buffer2 - and buffer1 changes while reading from 
>    it - is it possible that it generates invalid authentication tag?
> 
> 2. If the authenticated encryption decrypts a message, reading from 
>    buffer1 and writing to buffer2 - and buffer2 changes while writing to 
>    it - is is possible that it reports authentication tag mismatch?
> 

Yes, both scenarios are possible.  But it depends on the AEAD algorithm and how
it happens to be implemented, and on whether the data overlaps or not.

This is very much a "don't do that" sort of thing.

- Eric

  reply	other threads:[~2024-02-07  0:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 21:46 A question about modifying the buffer under authenticated encryption Mikulas Patocka
2024-02-07  0:47 ` Eric Biggers [this message]
2024-02-07 12:51   ` Mikulas Patocka
2024-02-08  3:42     ` Herbert Xu
2024-02-08  4:36     ` Eric Biggers
2024-02-08  4:40       ` Herbert Xu

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=20240207004723.GA35324@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dm-devel@lists.linux.dev \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=mpatocka@redhat.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