From patchwork Tue Jun 18 21:27:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 167197 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4728817ilk; Tue, 18 Jun 2019 14:28:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1vzmySO8q90dxLKK9Sk0TlQEDUrIHh97Gut1WScMr19llSKq0mYuxg6fXTejh3AbOWsS8 X-Received: by 2002:a63:c006:: with SMTP id h6mr4459785pgg.285.1560893288588; Tue, 18 Jun 2019 14:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560893288; cv=none; d=google.com; s=arc-20160816; b=E1g7NAJs+bznvyBN0ro+EOLEV3lCkdZQms52X2Zp6c2fQe7rOwQmL3tcy3qLtHG4v3 cGqwZV1Hr4Fxc3oKq9bRNo6cMV+ZH+oPk0srjajJuducpjdWaCbpy6WqysspCjFX1Ats dufRP+eL8r/2uAAf6ptd+9Su5dP7U4jDk9ZHHrEuBwM75uDB3pPvVx35+xSAfQQnyS/w fchYG6t+RFMeUB00n58DbBqUoD7Pso35piLjg6PUhm3CBfUGyefANULwhcYn237fG72p /Q2sTfQRr6ANX0L/2UlmjCOhOrN211hnSVqepsEMaY+7AvHTC5vOBpzeQ5ymXl6Y1tqU KMDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=NgQVif3SJzNXiAZCno1M2C2zTfT84Y/U1CUnXY4DVsM=; b=xuqaARsUH6wp+StPraTPNCaRzfKVAmsqYumS1zS1EFdgDQnMJ2yAUcPAdf4IychxLP CyB6X4Aa47e52el8ATMlZhrLjkDbxus3VoJu0zQdJw87RyWGgcMkWplnc9+Xro5Ezvgg MKxfqa1ioUnx61YGHqIoqe0Y6UeH6/WTGeDO80llDNKcm4UmNGKMjUyeNRaW6ceWv1qa ihbPOpVixOGNjAE7+7W6nMHG6KxSAFHvd7/Ml3ls9/NnAIvZAs4hVrX2dDAa6MSp+TkL dDu+ZkgtmuVctmXfQNHRpsYFAfZaVq3hw6o/8IQTwc1UnKcsZOYG6XlcjAslW+2Irpq/ T6DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zoKcuhnP; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si3179923pjs.35.2019.06.18.14.28.08; Tue, 18 Jun 2019 14:28:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zoKcuhnP; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730301AbfFRV2H (ORCPT + 3 others); Tue, 18 Jun 2019 17:28:07 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35186 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730102AbfFRV2G (ORCPT ); Tue, 18 Jun 2019 17:28:06 -0400 Received: by mail-wr1-f65.google.com with SMTP id m3so1077381wrv.2 for ; Tue, 18 Jun 2019 14:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=NgQVif3SJzNXiAZCno1M2C2zTfT84Y/U1CUnXY4DVsM=; b=zoKcuhnPc6YVnlS3X3fUJX74xIyUsF/Wc3w19VeACAsSP3fFi6sXxOrYahrn4KHoWb M4wXn/yuqgZOr4/oxr98AUkEp3V/OlQnzQxj/5NCSiPikL2n62i6k0JH1clAtRtEdhWh D2B3Yb/hvBB3wnXKMPBfraXnKPX1XSOdGLz/Vyl3ApnwHXU4nzTqNnzL98gOCJPuuASf brEC8unTqTLjtqnIxDWeuOXc+NZRrrKybJRa7I9oTfyQyJ5JhGzpgl3LDyB8d+L8GKo7 TScSIfSdX1U/dOcgU6Rsny5veX3bsVYUtWP73SPGPTXURai1Pi0D3mhbBlCl7xib8QDd j/aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NgQVif3SJzNXiAZCno1M2C2zTfT84Y/U1CUnXY4DVsM=; b=j5lAfSBsdu24rR2WKc1qOy/7nHZ1bymCWNIvohhAXu6LJzm/tA7ZgAFOlbU4qgZZ1h i+foxnIxAPCu4Mxuuv1h9e0C03en+oijXY6D5lYBk83QklZh95WJiarr/rrIJfRzLlK0 129pOUsAbr4IDKeYeEIxsBpzYl1nJO5N9JyueF6Jdu4ag0n2GYAbWOajP/4xrcGhrgbD QhFNrC2GxwqvBn0J3TC+VMPBwskA5vobLnz8kgrZ0+TUeqLSBm3h82A2VZ2wAqYDHRuo w1EcxmuqRAbaf15+LJvgJYS2dRme8MzYzbLAb0HIoOHuhR8tQQKKntCKMi/XXiTSZdo0 Cx3A== X-Gm-Message-State: APjAAAUM7YH0LYguqBWn3FfYgaSUE4gE/yqajakgik/703vBO7e83zEu KElF4yLT9J+q+HLyth1o/VLsDyn65/RslTcs X-Received: by 2002:adf:f442:: with SMTP id f2mr16345724wrp.275.1560893284262; Tue, 18 Jun 2019 14:28:04 -0700 (PDT) Received: from e111045-lin.arm.com (lfbn-nic-1-216-10.w2-15.abo.wanadoo.fr. [2.15.62.10]) by smtp.gmail.com with ESMTPSA id h21sm2273831wmb.47.2019.06.18.14.28.03 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 18 Jun 2019 14:28:03 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: Ard Biesheuvel , Herbert Xu , Eric Biggers , dm-devel@redhat.com, linux-fscrypt@vger.kernel.org, Gilad Ben-Yossef , Milan Broz Subject: [PATCH v2 0/4] crypto: switch to crypto API for ESSIV generation Date: Tue, 18 Jun 2019 23:27:45 +0200 Message-Id: <20190618212749.8995-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This series creates an ESSIV template that produces a skcipher or AEAD transform based on a tuple of the form ',,' (or ',,' for the AEAD case). It exposes the encapsulated sync or async skcipher/aead by passing through all operations, while using the cipher/shash pair to transform the input IV into an ESSIV output IV. This matches what both users of ESSIV in the kernel do, and so it is proposed as a replacement for those, in patches #2 and #4. This code has been tested using the fscrypt test suggested by Eric (generic/549), as well as the mode-test script suggested by Milan for the dm-crypt case. I also tested the aead case in a virtual machine, but it definitely needs some wider testing from the dm-crypt experts. Cc: Herbert Xu Cc: Eric Biggers Cc: dm-devel@redhat.com Cc: linux-fscrypt@vger.kernel.org Cc: Gilad Ben-Yossef Cc: Milan Broz Ard Biesheuvel (4): crypto: essiv - create wrapper template for ESSIV generation fs: crypto: invoke crypto API for ESSIV handling md: dm-crypt: infer ESSIV block cipher from cipher string directly md: dm-crypt: switch to ESSIV crypto API template crypto/Kconfig | 4 + crypto/Makefile | 1 + crypto/essiv.c | 624 ++++++++++++++++++++ drivers/md/Kconfig | 1 + drivers/md/dm-crypt.c | 237 ++------ fs/crypto/Kconfig | 1 + fs/crypto/crypto.c | 5 - fs/crypto/fscrypt_private.h | 9 - fs/crypto/keyinfo.c | 88 +-- 9 files changed, 675 insertions(+), 295 deletions(-) create mode 100644 crypto/essiv.c -- 2.17.1