thebeanogamer / rpms / qemu-kvm

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