Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp3312738rdb; Tue, 6 Feb 2024 13:47:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLqysC38WFPFVdxxykaSf0LADMRo6MFGiGTTrawIzHrqvq7TNYhjYNRjHntJoKQYKngPiH X-Received: by 2002:aa7:85d6:0:b0:6e0:5424:6b3a with SMTP id z22-20020aa785d6000000b006e054246b3amr975206pfn.11.1707256045927; Tue, 06 Feb 2024 13:47:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707256045; cv=pass; d=google.com; s=arc-20160816; b=XnlUDL7NJfs+FfwaSl6/b2psfRJcgxGSbWEVOOn91CczBkPJ8tm2iGYsWg2A5Mv1wT /r43cQvP3p/SKfu38Mvqr0AfAOsPU26WNWtLNGf0G9nWYxiVlhFmRTV0pIF1wCINNQHm es8ORWS8Pk4yBFksoGe9JK/cwAe4vI+b1g53gpTHa+s/jJGMVTb7S6d/aSoXNVJqeyAG C4Hjh04/sNAF3dGU+Bia/FbL97zbBPzJ+t8gL4T2mlauV7HSMKA6DPr85MOe0j2whljx 8SyWMu9ZcaFJcYDeReaZCphwhCkOb5g/YV+upENfoZm0OJ+WmrYyHMmQYFwANZEnlhzj J8JQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:subject:cc:to:from:date:dkim-signature; bh=zGjMP1IOUXwVMDC5kAkBaxijYMamXyALIeSRPPpA03c=; fh=kVkuS9TT/rxYJ8v7AY+VEuEeRVIIhF+uBbMo3JI3GEU=; b=Cjiw5zAEarwfaeveJ2UEykjNtsRfQTSMmYICuhpcM4+XaGQQn/Y9/XtyHpvzI6qrwC +wDraGkN16BANSZMIHJ1SqXDsIBUJOZU1gDYvzdHk7WWcBiV4bxBTK3mwRqf2YHKXE+T /bFI2UXjZytiFTsPFf0jxbzVUEQqznXi9L0sN5d3ayLCaFIBmUFBcODN9gOLdPORm08L nuP0kX3yqB6gyfOD2MJUM2tuqxc84DqfRgL7NSnXOCypyBphUy/M6TSGBQ9Kfu0kjAYx k9jAKmxcC8HtJ/ca99NoP3qIP/VwnrPVv8zce1DHDPRgjaZtAqISy50/G7+WtZeR5O54 h3OQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VaBipMUM; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-crypto+bounces-1886-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-1886-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCWm/Wv3nlUcwi3A8Xd9C0b7v8ibLylNZPOQpOwWNPycFJtnjoSxzvBdBHvlWi4gpunBQhae3NynvgdJa8kJGT1y+dqEmEO+LC+9LrdgdQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i3-20020a62c103000000b006e05634d372si2056429pfg.345.2024.02.06.13.47.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 13:47:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-1886-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VaBipMUM; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-crypto+bounces-1886-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-1886-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9134E2895D9 for ; Tue, 6 Feb 2024 21:47:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 961341CD35; Tue, 6 Feb 2024 21:47:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VaBipMUM" X-Original-To: linux-crypto@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 886C51CD38 for ; Tue, 6 Feb 2024 21:47:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707256025; cv=none; b=jKEnQFLD7Ew4J3SBand/6ySObqlVOlWD744Rp+8LJvB9VpjFi8Ry+n+QfCedvQzN63Kf1LtCb0FsK5ceu6iZUI7vvxGsPWR1D9gYa3ymNUBJipMm1cNdiTXhkkcDPFGQGWSUgZN97F9f+3jDP3mbJI70ZadRFMtLBectZ9R/Sk4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707256025; c=relaxed/simple; bh=7ywXEtr/UZE4POA2+/UNbLOVQXFOQtlQe2TNaTzprEw=; h=Date:From:To:cc:Subject:Message-ID:MIME-Version:Content-Type; b=Tq6oKshSyRgrFzMXCLb5SjcmGlTACykWU+T1E7GH3IPnADuOT0mRqXAA0HqxfSfsEmKogapbFlUNgYdSqwPqwDmTAioD2tHfoq9lHywHeL1YRikXJiC1ShdTpc7kedHd0IUUqecnq6PeGWmKEyMqlka0TpW/aD7PZk2T48YgalE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VaBipMUM; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707256022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=zGjMP1IOUXwVMDC5kAkBaxijYMamXyALIeSRPPpA03c=; b=VaBipMUM1qqG4fIzEmnoL2yJKYfcpulTBMvHkKbCgJ3/E0BrDW8z1kHZ8s/qD1hrPsRYu1 HtE85JmpI5aXlAuaiA2AJz/RrN71L5S5dMiVPHkQbWQ7jzvGa0KFKfNsmJHwdBmnLPtr01 SHJsTeFCWzt554vG5BnWD4FqjyfCl9s= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-VGXLBbFcMYGSkHF3tpgSIg-1; Tue, 06 Feb 2024 16:47:00 -0500 X-MC-Unique: VGXLBbFcMYGSkHF3tpgSIg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63C58828CE2; Tue, 6 Feb 2024 21:47:00 +0000 (UTC) Received: from file1-rdu.file-001.prod.rdu2.dc.redhat.com (unknown [10.11.5.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DEC740C9444; Tue, 6 Feb 2024 21:47:00 +0000 (UTC) Received: by file1-rdu.file-001.prod.rdu2.dc.redhat.com (Postfix, from userid 12668) id EEC6930C1B8F; Tue, 6 Feb 2024 21:46:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by file1-rdu.file-001.prod.rdu2.dc.redhat.com (Postfix) with ESMTP id EBCA03FFC5; Tue, 6 Feb 2024 22:46:59 +0100 (CET) Date: Tue, 6 Feb 2024 22:46:59 +0100 (CET) From: Mikulas Patocka To: Herbert Xu , "David S. Miller" cc: linux-crypto@vger.kernel.org, dm-devel@lists.linux.dev Subject: A question about modifying the buffer under authenticated encryption Message-ID: Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 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? Mikulas