cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
902636
From b8c8288a65146952cdfe7d5f0cd96734c9de8ee1 Mon Sep 17 00:00:00 2001
902636
From: jmaloy <jmaloy@redhat.com>
902636
Date: Thu, 7 May 2020 17:57:08 +0100
902636
Subject: [PATCH 1/7] target/arm: Fix PAuth sbox functions
902636
MIME-Version: 1.0
902636
Content-Type: text/plain; charset=UTF-8
902636
Content-Transfer-Encoding: 8bit
902636
902636
RH-Author: jmaloy <jmaloy@redhat.com>
902636
Message-id: <20200507175708.1165177-2-jmaloy@redhat.com>
902636
Patchwork-id: 96341
902636
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 1/1] target/arm: Fix PAuth sbox functions
902636
Bugzilla: 1813940
902636
RH-Acked-by: Andrew Jones <drjones@redhat.com>
902636
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
902636
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
902636
902636
From: Vincent Dehors <vincent.dehors@smile.fr>
902636
902636
In the PAC computation, sbox was applied over wrong bits.
902636
As this is a 4-bit sbox, bit index should be incremented by 4 instead of 16.
902636
902636
Test vector from QARMA paper (https://eprint.iacr.org/2016/444.pdf) was
902636
used to verify one computation of the pauth_computepac() function which
902636
uses sbox2.
902636
902636
Launchpad: https://bugs.launchpad.net/bugs/1859713
902636
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
902636
Signed-off-by: Vincent DEHORS <vincent.dehors@smile.fr>
902636
Signed-off-by: Adrien GRASSEIN <adrien.grassein@smile.fr>
902636
Message-id: 20200116230809.19078-2-richard.henderson@linaro.org
902636
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
902636
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
902636
(cherry picked from commit de0b1bae6461f67243282555475f88b2384a1eb9)
902636
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
902636
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
902636
---
902636
 target/arm/pauth_helper.c | 4 ++--
902636
 1 file changed, 2 insertions(+), 2 deletions(-)
902636
902636
diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
902636
index d3194f2..0a5f41e 100644
902636
--- a/target/arm/pauth_helper.c
902636
+++ b/target/arm/pauth_helper.c
902636
@@ -89,7 +89,7 @@ static uint64_t pac_sub(uint64_t i)
902636
     uint64_t o = 0;
902636
     int b;
902636
 
902636
-    for (b = 0; b < 64; b += 16) {
902636
+    for (b = 0; b < 64; b += 4) {
902636
         o |= (uint64_t)sub[(i >> b) & 0xf] << b;
902636
     }
902636
     return o;
902636
@@ -104,7 +104,7 @@ static uint64_t pac_inv_sub(uint64_t i)
902636
     uint64_t o = 0;
902636
     int b;
902636
 
902636
-    for (b = 0; b < 64; b += 16) {
902636
+    for (b = 0; b < 64; b += 4) {
902636
         o |= (uint64_t)inv_sub[(i >> b) & 0xf] << b;
902636
     }
902636
     return o;
902636
-- 
902636
1.8.3.1
902636