Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp684174ybi; Wed, 19 Jun 2019 06:13:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGtnJkrkca6ur2NRcmJwv5ZenI1lsGVkrlbd6x13m9UU7jvvTgM2gDEW3bo3qvmf59lsqh X-Received: by 2002:a63:595e:: with SMTP id j30mr7238252pgm.2.1560950027747; Wed, 19 Jun 2019 06:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560950027; cv=none; d=google.com; s=arc-20160816; b=huaqEFhRblEpsmjxH0BVsEhAGVnKbJLUt4Rl4JE2ognl+a50kiLbl5ulzfFzTLKubZ JBrji3u2KFyiQZyaw+y9W7oBc4fqjYgrOqcPT1h6trvxi5wfwSRvyFZYl/CvFhYAoE20 Bry5Es/GEgQEgKbFyAcSQ7gzy9x2YjEoYh+coHlKkGKVP4AMrORkNN+25udC27zipAuy 60pv44sX9fcmVTgINe59SaDufBWSlzeJ0kKpMAMh7Tx9yaWQmRiWdbBK82kRoTdwMKeI mUWSZwx8ufUcvPiqAZxnDj9GyPRsIc0ZCqrHkqY5BJQ/bRffd/b9i5IwnOGN48IQ+7bz ImHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VSWvIHqoIGtDBhRJ6HSvvihcZCQQtqciIVVRqtR6+BA=; b=uoyWJDW4zUqhCwO1rx/M9Vz8ohCwE7IAEnfvYE2wCFMl0Ahbe1L6+CLf6dNWT7S4o3 nsL9RC5pPk9/y5bY29x6chs5/TzlaE595ZQrmhNXwem9vR3+4gkK5otye1kKqDpBKT5E X6Ko3ainq56aa4H+Q+Hp71m2NVqhkKhp+7NUEFfVh6aOE6qfDW79uIudrzcxAEOCeXED w+joxpZNUokh1rXSuz6vvMtv/17GP7E9yccDIHFwRW96n83jULEJcc0aa9SrzxcQMjMT pfHQVMUADa+l1nT/66hvBGoeUrRjQFE8t5SB7LwlBknxEW0YhfzOUcDFGLiEYji6pwhX YRnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RgUtRygR; 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 b16si10683971pfd.126.2019.06.19.06.13.32; Wed, 19 Jun 2019 06:13:47 -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=RgUtRygR; 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 S1727126AbfFSNN1 (ORCPT + 99 others); Wed, 19 Jun 2019 09:13:27 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:41773 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730289AbfFSNN0 (ORCPT ); Wed, 19 Jun 2019 09:13:26 -0400 Received: by mail-io1-f66.google.com with SMTP id w25so37920872ioc.8 for ; Wed, 19 Jun 2019 06:13:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VSWvIHqoIGtDBhRJ6HSvvihcZCQQtqciIVVRqtR6+BA=; b=RgUtRygRSD2cNeIMgRGdHzRGhna+FOMtEp0dVmSrLw6CirMvKMu8x9fYR4mMrl8wkN Qp7rlV9j5497pjDNd/A0NjfrooPJbpw6GjSs45K7m4Js73642UaWS7ghFLMAPT/Sm5D9 G1FvS6H2OJQyeoKCl3+Q+C/JQn/UIrp3JoQIu9MXrBA5Per0q0SbUYoDTn9t+C4kqeSR 8MI/gF7tuNmtJiM4FY5p8/5f8bMAgDfftBpt0dbsMH3o5eUhuyfdeaNixXfVuFb0HpVQ f7mJzJzJ/9V/VvE6XzZmFpioBvsIk4thwXXCjOp0ZfuRvl8t1dFNfEjOEDbDe3sjxNAH KK4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VSWvIHqoIGtDBhRJ6HSvvihcZCQQtqciIVVRqtR6+BA=; b=PB0ba8u/GcDq8jLP2AIjRxaEwPbHq03XW0Fb8OEUNzYwG1+6zb+mK65Sm51sZzbO1N r2m9RwAI/kk8oc2+pTLTP7hC7ZlHKXnIx0rRt41PwN29tnpjW/txDoqSRXMlXlI6EeY9 kmHEt7BCNMNjTCtXtoLUONWwGOCR/RcCL4QUtEYopYWdgQqg8HPQgvX8oduiUPq24yuj ZNwCRJzfKeVX5nm+1gvKLV1BgjHVP8W0qGzgzJBAJwIw3/njC/AAnEkN3SIje36DFngG SQtfuTJ+Cv/Rq7o3E2urYXfAx1MVQwRjVB2wT9l4XgNr1dITutKnYHoQf5+Vl6bDwtfe lWpg== X-Gm-Message-State: APjAAAWz6QbgQDEYBia2SuK0Sq/XwzVjtWWnJ/726utwXiN+OQLaPXtO 0i9mHF81O6XVvqj8dn5pyVt0PBwStu8PMNhimvcVDw== X-Received: by 2002:a02:ce37:: with SMTP id v23mr10491946jar.2.1560950006153; Wed, 19 Jun 2019 06:13:26 -0700 (PDT) MIME-Version: 1.0 References: <20190618212749.8995-1-ard.biesheuvel@linaro.org> <099346ee-af6e-a560-079d-3fb68fb4eeba@gmail.com> In-Reply-To: From: Ard Biesheuvel Date: Wed, 19 Jun 2019 15:13:15 +0200 Message-ID: Subject: Re: [PATCH v2 0/4] crypto: switch to crypto API for ESSIV generation To: Milan Broz Cc: "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Herbert Xu , Eric Biggers , device-mapper development , linux-fscrypt@vger.kernel.org, Gilad Ben-Yossef Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, 19 Jun 2019 at 14:49, Ard Biesheuvel wrote: > > On Wed, 19 Jun 2019 at 14:36, Ard Biesheuvel wrote: > > > > On Wed, 19 Jun 2019 at 13:33, Milan Broz wrote: > > > > > > On 19/06/2019 13:16, Ard Biesheuvel wrote: > > > >> Try > > > >> cryptsetup open --type plain -c null /dev/sdd test -q > > > >> or > > > >> dmsetup create test --table " 0 417792 crypt cipher_null-ecb - 0 /dev/sdd 0" > > > >> > > > >> (or just run full cryptsetup testsuite) > > > >> > > > > > > > > Is that your mode-test script? > > > > > > > > I saw some errors about the null cipher, but tbh, it looked completely > > > > unrelated to me, so i skipped those for the moment. But now, it looks > > > > like it is related after all. > > > > > > This was triggered by align-test, mode-test fails the same though. > > > > > > It is definitely related, I think you just changed the mode parsing in dm-crypt. > > > (cipher null contains only one dash I guess). > > > > > > > On my unpatched 4.19 kernel, mode-test gives me > > > > $ sudo ./mode-test > > aes PLAIN:[table OK][status OK] > > LUKS1:[table OK][status OK] CHECKSUM:[OK] > > aes-plain PLAIN:[table OK][status OK] > > LUKS1:[table OK][status OK] CHECKSUM:[OK] > > null PLAIN:[table OK][status OK] > > LUKS1:[table OK][status OK] CHECKSUM:[OK] > > cipher_null PLAIN:[table FAIL] > > Expecting cipher_null-ecb got cipher_null-cbc-plain. > > FAILED at line 64 ./mode-test > > > > which is why I commented out those tests in the first place. > > > > I can reproduce the crash after I re-enable them again, so I will need > > to look into that. But something seems to be broken already. > > Note that this is running on arm64 using a kconfig based on the Debian kernel. > > Actually, could this be an issue with cryptsetup being out of date? On > another arm64 system with a more recent distro, it works fine This should fix the crash you are seeing diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 89efd7d249fd..12d28880ec34 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -2357,7 +2357,7 @@ static int crypt_ctr_cipher_old(struct dm_target *ti, char *cipher_in, char *key if (!cipher_api) goto bad_mem; - if (!strcmp(*ivmode, "essiv")) { + if (*ivmode && !strcmp(*ivmode, "essiv")) { if (!*ivopts) { ti->error = "Digest algorithm missing for ESSIV mode"; return -EINVAL; Apologies for the sloppiness - this is a check that I had added and then removed again, given that *ivmode was assigned unconditionally, but i didn't realize tmp could be NULL. With these two changes applied, mode-test successfully runs to completion. Can you recommend another test suite I could run?