From patchwork Mon Jan 23 14:05:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 92214 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1233314obz; Mon, 23 Jan 2017 06:05:36 -0800 (PST) X-Received: by 10.99.228.5 with SMTP id a5mr32973391pgi.1.1485180336094; Mon, 23 Jan 2017 06:05:36 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l36si15767527plg.145.2017.01.23.06.05.36; Mon, 23 Jan 2017 06:05:36 -0800 (PST) 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=neutral (body hash did not verify) header.i=@linaro.org; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751206AbdAWOFf (ORCPT + 1 other); Mon, 23 Jan 2017 09:05:35 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:37461 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751113AbdAWOFf (ORCPT ); Mon, 23 Jan 2017 09:05:35 -0500 Received: by mail-wm0-f53.google.com with SMTP id c206so157127865wme.0 for ; Mon, 23 Jan 2017 06:05:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CzjTHOxkTE4Qgd4iwVqP3xmJj/nHZVRS08KnoIo68+M=; b=Rea/jWm/nn5qGoFe64Nnxsbi87psL8hwWR8uUj0X8jLnJNRGd0nvpysJC5yY42TuXY 5iNWXAXMYr0YLQlp5nvzgBu2xpEebgcFXS3gDeN4J+EYddZU052pc+0R7aaGMA3BCNAy pxB7DVBFZYxa4GDQKEzXi/gFgBgGeD2b8CZvM= 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:in-reply-to :references; bh=CzjTHOxkTE4Qgd4iwVqP3xmJj/nHZVRS08KnoIo68+M=; b=SdBUb6B56+0Ot36OlKSyHyg6BjBQMqH8CIAy8VC4/EQ1SQ8o0UJ0jPJUm1RofXowDP 4b0q1P+CIU50xJYdZMmmM8ByE802f1rx4QD4yh6zBSwoJZaBIPCuJlnq3pcIjy1MAXgB Ha8nnMhxm1Bm65VAw4RFkE6eYVPoy/AjQBr5OQenUsATm4KC3hyzHpodSwgwdlgR5I+W ueE15gCZVnEqmnQCKv87roUvz1A5HAdK/HEa8GK9i8vbavU95A9TVmnVYN0RjGm5i0x5 j1ICcQKDHcbw/zlShFfN1f43Ib2aYx5wNsver9//dPj1wfIk7f6QRd/Ax3Pe7ndT9/Wt fSvg== X-Gm-Message-State: AIkVDXIzUl9LkBFDuUS0X4E4Mv13dPTibdOd7RFAlI2itAoWidOgYBV+ed7fi4c+vGOvyfh+ X-Received: by 10.28.169.135 with SMTP id s129mr13395764wme.24.1485180333321; Mon, 23 Jan 2017 06:05:33 -0800 (PST) Received: from localhost.localdomain ([160.160.111.139]) by smtp.gmail.com with ESMTPSA id y65sm21319790wmb.5.2017.01.23.06.05.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jan 2017 06:05:32 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au Cc: Ard Biesheuvel Subject: [PATCH v2 01/10] crypto: arm64/aes-neon-bs - honour iv_out requirement in CTR mode Date: Mon, 23 Jan 2017 14:05:17 +0000 Message-Id: <1485180326-25612-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485180326-25612-1-git-send-email-ard.biesheuvel@linaro.org> References: <1485180326-25612-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Update the new bitsliced NEON AES implementation in CTR mode to return the next IV back to the skcipher API client. This is necessary for chaining to work correctly. Note that this is only done if the request is a round multiple of the block size, since otherwise, chaining is impossible anyway. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/aes-neonbs-core.S | 25 +++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/crypto/aes-neonbs-core.S b/arch/arm64/crypto/aes-neonbs-core.S index 8d0cdaa2768d..2ada12dd768e 100644 --- a/arch/arm64/crypto/aes-neonbs-core.S +++ b/arch/arm64/crypto/aes-neonbs-core.S @@ -874,12 +874,19 @@ CPU_LE( rev x8, x8 ) csel x4, x4, xzr, pl csel x9, x9, xzr, le + tbnz x9, #1, 0f next_ctr v1 + tbnz x9, #2, 0f next_ctr v2 + tbnz x9, #3, 0f next_ctr v3 + tbnz x9, #4, 0f next_ctr v4 + tbnz x9, #5, 0f next_ctr v5 + tbnz x9, #6, 0f next_ctr v6 + tbnz x9, #7, 0f next_ctr v7 0: mov bskey, x2 @@ -928,11 +935,11 @@ CPU_LE( rev x8, x8 ) eor v5.16b, v5.16b, v15.16b st1 {v5.16b}, [x0], #16 - next_ctr v0 +8: next_ctr v0 cbnz x4, 99b 0: st1 {v0.16b}, [x5] -8: ldp x29, x30, [sp], #16 +9: ldp x29, x30, [sp], #16 ret /* @@ -941,23 +948,23 @@ CPU_LE( rev x8, x8 ) */ 1: cbz x6, 8b st1 {v1.16b}, [x5] - b 8b + b 9b 2: cbz x6, 8b st1 {v4.16b}, [x5] - b 8b + b 9b 3: cbz x6, 8b st1 {v6.16b}, [x5] - b 8b + b 9b 4: cbz x6, 8b st1 {v3.16b}, [x5] - b 8b + b 9b 5: cbz x6, 8b st1 {v7.16b}, [x5] - b 8b + b 9b 6: cbz x6, 8b st1 {v2.16b}, [x5] - b 8b + b 9b 7: cbz x6, 8b st1 {v5.16b}, [x5] - b 8b + b 9b ENDPROC(aesbs_ctr_encrypt)