From patchwork Sat Nov 2 21:24:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Broz X-Patchwork-Id: 3131741 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B49399F43F for ; Sat, 2 Nov 2013 21:28:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E7E6520343 for ; Sat, 2 Nov 2013 21:28:33 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id 18D592034B for ; Sat, 2 Nov 2013 21:28:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rA2LOo6i020468; Sat, 2 Nov 2013 17:24:51 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rA2LOnmg027466 for ; Sat, 2 Nov 2013 17:24:49 -0400 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rA2LOnB5018633 for ; Sat, 2 Nov 2013 17:24:49 -0400 Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA2LOl4R028197 for ; Sat, 2 Nov 2013 17:24:48 -0400 Received: by mail-ee0-f54.google.com with SMTP id c50so399049eek.13 for ; Sat, 02 Nov 2013 14:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Q7SbLMSHHCnBBOi0t60X+SKCeCqg1looE/dfOJA6RPs=; b=1KOciC2aTc5ktbnoPneFr8yf4lRZQRSb0PZUe+uCOcD95wBSnqKNZzFoolHFXimuCd mja9xuqSoLUoPkcQWnvwp1ol+iw10L2uAHKFT7hM1mPBkeI5yGNZDqcN47IwVJhsym5i ojHbQqkJ6FBDjeGH1eSKlthfO1+nFJ2xiHiDLoyjZfEpljtToXrjXaMZ8PBkA/zUQ9e0 1o3g0OF6B8vqDGtvZBenUg0reMfRutFLu/bVhTvXtUBqrNxdZGMiMLG4SSxTTtT9+Kb3 v25t4Z7CTBCNMMNlL9gij6W436TtPi1bhErAhyg/M5/KfGUcIur8FpIOORiUjNm+46pW 5egQ== X-Received: by 10.15.76.129 with SMTP id n1mr1145814eey.85.1383427487498; Sat, 02 Nov 2013 14:24:47 -0700 (PDT) Received: from tawny.mazyland.net (56.157.broadband5.iol.cz. [88.100.157.56]) by mx.google.com with ESMTPSA id x47sm25123852eea.16.2013.11.02.14.24.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Nov 2013 14:24:46 -0700 (PDT) From: Milan Broz To: dm-devel@redhat.com Date: Sat, 2 Nov 2013 22:24:03 +0100 Message-Id: <1383427444-19174-1-git-send-email-gmazyland@gmail.com> In-Reply-To: <20131030181241.GA24325@agk-dp.fab.redhat.com> References: <20131030181241.GA24325@agk-dp.fab.redhat.com> X-RedHat-Spam-Score: -3.1 (BAYES_00, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: Milan Broz Subject: [dm-devel] [PATCH 3/4] dm-crypt: Fix code formatting to make agk happy X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix code style format. Add note that loopAES key must be the same size. (probably should be folded into previous patch) Signed-off-by: Milan Broz --- drivers/md/dm-crypt.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index cfdaa12..2d6ee75f 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -706,18 +706,21 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc, /* xor whitening with sector number */ memcpy(buf, tcw->whitening, TCW_WHITENING_SIZE); - crypto_xor(buf, (u8*)§or, 8); - crypto_xor(&buf[8], (u8*)§or, 8); + crypto_xor(buf, (u8 *)§or, 8); + crypto_xor(&buf[8], (u8 *)§or, 8); /* calculate crc32 for every 32bit part and xor it */ sdesc.desc.tfm = tcw->crc32_tfm; sdesc.desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; for (i = 0; i < 4; i++) { - if ((r = crypto_shash_init(&sdesc.desc))) + r = crypto_shash_init(&sdesc.desc); + if (r) goto out; - if ((r = crypto_shash_update(&sdesc.desc, &buf[i * 4], 4))) + r = crypto_shash_update(&sdesc.desc, &buf[i * 4], 4); + if (r) goto out; - if ((r = crypto_shash_final(&sdesc.desc, &buf[i * 4]))) + r = crypto_shash_final(&sdesc.desc, &buf[i * 4]); + if (r) goto out; } crypto_xor(&buf[0], &buf[12], 4); @@ -748,9 +751,9 @@ static int crypt_iv_tcw_gen(struct crypt_config *cc, u8 *iv, /* Calculate IV */ memcpy(iv, tcw->iv_seed, cc->iv_size); - crypto_xor(iv, (u8*)§or, 8); + crypto_xor(iv, (u8 *)§or, 8); if (cc->iv_size > 8) - crypto_xor(&iv[8], (u8*)§or, cc->iv_size - 8); + crypto_xor(&iv[8], (u8 *)§or, cc->iv_size - 8); return r; } @@ -1663,9 +1666,11 @@ static int crypt_ctr_cipher(struct dm_target *ti, cc->iv_gen_ops = &crypt_iv_null_ops; else if (strcmp(ivmode, "lmk") == 0) { cc->iv_gen_ops = &crypt_iv_lmk_ops; - /* Version 2 and 3 is recognised according + /* + * Version 2 and 3 is recognised according * to length of provided multi-key string. * If present (version 3), last key is used as IV seed. + * All keys (including IV seed) are always the same size. */ if (cc->key_size % cc->key_parts) { cc->key_parts++;