From patchwork Wed Oct 5 14:53:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Henrique Cerri X-Patchwork-Id: 678479 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3spzLQ3sZhz9s9x; Thu, 6 Oct 2016 01:53:34 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical-com.20150623.gappssmtp.com header.i=@canonical-com.20150623.gappssmtp.com header.b=gY5v7x/T; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1brnZX-0002qG-FL; Wed, 05 Oct 2016 14:53:27 +0000 Received: from mail-pa0-f44.google.com ([209.85.220.44]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1brnZS-0002qB-Kb for kernel-team@lists.ubuntu.com; Wed, 05 Oct 2016 14:53:22 +0000 Received: by mail-pa0-f44.google.com with SMTP id cd13so82350709pac.0 for ; Wed, 05 Oct 2016 07:53:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=HODrYzvl4jO/kmegjIQWNZ5YszaeU8RCS2L7pv6u/OU=; b=gY5v7x/TbHdTwq0oaVCii3d4XCmU5/FCuukN3zBxRgv9BWfrzOBOthz0DSTcr+xjja PZgDJo9mIUB3BCe8/OS6CE5M7RhldH5BVf7rXVB8tTkg5RMkaBl5gLxrlTEtk9sD4Ri6 uk0tud/2A3Gf1g33WXhkElXZ1QRV2zKkLnaXs7ge/9Cj0VtYAlnWrfhWfCbHG4c0nmqj DeqiDiL+32IsLNJWtvissoYUpXiTfynJl1PUG+n+RwbSlMJZTpEMM280JtWj8fucvjuY ZQqX55WODMZzooZ5aBVqf6baq9khe1rEVrTmC9kxJhlkdwZfvWkHLrmsv9wOE97DEdSz MBxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HODrYzvl4jO/kmegjIQWNZ5YszaeU8RCS2L7pv6u/OU=; b=BmySHXdLUeTIADIl9m4llC6dwC93LNfi4oCK+p+rEkTdFCu8lTSnGpNJXMfMWwGiyf 7iE3RPfugdhIdVJWshNdRsDkhX2OFY3ncfrx8bsKvKeaqiCFI6oL8xvTN6LRTjArcXYH N/3nFUN7iTFU8sTF8RkpreH8987sxhVSzT2DGidOVjitm4SxoSQZastfHkhOe1FFXKRj oJRIFrvoMv4vh0KDLHH6KzNPUkOkkuZuGbPWypLo/MU5KrBqGtwkGg14EQaUJCXH+RwX /aTCCHxlsFHOuv/3zQ21iamW2s0aY8MxjM4Te/TQn6NV/muVmyJO7YKjsOrzkWqVevps S/oQ== X-Gm-Message-State: AA6/9RmNMxFhQ8fPn9S1jxHV599493Wnk8kvE3/JAnJKgxh2VCWkTvrG7UPp/VbZF9QSH2TN X-Received: by 10.66.191.36 with SMTP id gv4mr13638984pac.209.1475679201167; Wed, 05 Oct 2016 07:53:21 -0700 (PDT) Received: from localhost.localdomain (189-19-121-95.dsl.telesp.net.br. [189.19.121.95]) by smtp.gmail.com with ESMTPSA id y205sm14837165pfb.37.2016.10.05.07.53.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Oct 2016 07:53:20 -0700 (PDT) From: Marcelo Cerri To: kernel-team@lists.ubuntu.com Subject: [PATCH] [Trusty, Xenial, Yakkety] crypto: sha1-powerpc - little-endian support Date: Wed, 5 Oct 2016 11:53:07 -0300 Message-Id: <1475679187-31198-1-git-send-email-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.7.4 Cc: Herbert Xu X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com BugLink: https://bugs.launchpad.net/bugs/1629977 The driver does not handle endianness properly when loading the input data. Signed-off-by: Marcelo Cerri Signed-off-by: Herbert Xu (cherry picked from commit 74ff6cb3aa438490ad8f8432e7b68dbcfa5ca449) Signed-off-by: Marcelo Cerri --- arch/powerpc/crypto/sha1-powerpc-asm.S | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/crypto/sha1-powerpc-asm.S b/arch/powerpc/crypto/sha1-powerpc-asm.S index 125e165..82ddc9b 100644 --- a/arch/powerpc/crypto/sha1-powerpc-asm.S +++ b/arch/powerpc/crypto/sha1-powerpc-asm.S @@ -7,6 +7,15 @@ #include #include +#ifdef __BIG_ENDIAN__ +#define LWZ(rt, d, ra) \ + lwz rt,d(ra) +#else +#define LWZ(rt, d, ra) \ + li rt,d; \ + lwbrx rt,rt,ra +#endif + /* * We roll the registers for T, A, B, C, D, E around on each * iteration; T on iteration t is A on iteration t+1, and so on. @@ -23,7 +32,7 @@ #define W(t) (((t)%16)+16) #define LOADW(t) \ - lwz W(t),(t)*4(r4) + LWZ(W(t),(t)*4,r4) #define STEPD0_LOAD(t) \ andc r0,RD(t),RB(t); \ @@ -33,7 +42,7 @@ add r0,RE(t),r15; \ add RT(t),RT(t),r6; \ add r14,r0,W(t); \ - lwz W((t)+4),((t)+4)*4(r4); \ + LWZ(W((t)+4),((t)+4)*4,r4); \ rotlwi RB(t),RB(t),30; \ add RT(t),RT(t),r14