SHA256
1
0
forked from pool/openssl-1_1
openssl-1_1/0008-s390x-assembly-pack-extended-s390x-capability-vector.patch

74 lines
2.6 KiB
Diff
Raw Normal View History

From 5534badade984ccad7dbe56e17bcf0b2d00820c0 Mon Sep 17 00:00:00 2001
From: Patrick Steuer <patrick.steuer@de.ibm.com>
Date: Sun, 12 Feb 2017 12:27:00 +0100
Subject: [PATCH 08/44] s390x assembly pack: extended s390x capability vector
(KMA).
Extended the s390x capability vector to store the doubleword pair
returned by the KMA instruction's QUERY function.
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
---
crypto/aes/asm/aes-s390x.pl | 2 +-
crypto/s390x_arch.h | 9 +++++++--
crypto/s390xcpuid.S | 12 +++++++++++-
crypto/sha/asm/sha1-s390x.pl | 2 +-
crypto/sha/asm/sha512-s390x.pl | 2 +-
5 files changed, 21 insertions(+), 6 deletions(-)
Index: openssl-1.1.0g/crypto/s390x_arch.h
===================================================================
--- openssl-1.1.0g.orig/crypto/s390x_arch.h 2018-01-10 15:38:21.714301915 +0100
+++ openssl-1.1.0g/crypto/s390x_arch.h 2018-01-10 15:38:28.942417111 +0100
@@ -18,10 +18,10 @@
* functions. If STFLE returns fewer doublewords or an instruction is not
* supported, the corresponding element is zero. The order is as follows:
*
- * STFLE:STFLE:STFLE.KIMD:KIMD:KM:KM:KMC:KMC:KMCTR:KMCTR
+ * STFLE:STFLE:STFLE.KIMD:KIMD:KM:KM:KMC:KMC:KMCTR:KMCTR:KMA:KMA
*/
# define S390X_STFLE_DWORDS 3
-# define S390X_QUERY_DWORDS 8
+# define S390X_QUERY_DWORDS 10
# define S390X_CAP_DWORDS (S390X_STFLE_DWORDS + S390X_QUERY_DWORDS)
extern unsigned long long OPENSSL_s390xcap_P[];
@@ -40,4 +40,9 @@ extern unsigned long long OPENSSL_s390xc
# define S390X_KMC_AES_192 (1ULL << 44)
# define S390X_KMC_AES_128 (1ULL << 45)
+/* OPENSSL_s390xcap_P[11] flags */
+# define S390X_KMA_GCM_AES_256 (1ULL << 43)
+# define S390X_KMA_GCM_AES_192 (1ULL << 44)
+# define S390X_KMA_GCM_AES_128 (1ULL << 45)
+
#endif
Index: openssl-1.1.0g/crypto/s390xcpuid.S
===================================================================
--- openssl-1.1.0g.orig/crypto/s390xcpuid.S 2018-01-10 15:38:21.706301789 +0100
+++ openssl-1.1.0g/crypto/s390xcpuid.S 2018-01-10 15:38:21.722302044 +0100
@@ -22,6 +22,8 @@ OPENSSL_s390x_facilities:
stg %r0,64(%r4)
stg %r0,72(%r4)
stg %r0,80(%r4)
+ stg %r0,88(%r4)
+ stg %r0,96(%r4)
.long 0xb2b04000 # stfle 0(%r4)
brc 8,.Ldone
@@ -54,6 +56,14 @@ OPENSSL_s390x_facilities:
la %r1,72(%r4)
.long 0xb92d2042 # kmctr %r4,%r2,%r2
+ lg %r2,16(%r4)
+ tmhl %r2,0x2000 # check for message-security-assist-8
+ jz .Lret
+
+ lghi %r0,0 # query kma capability vector
+ la %r1,88(%r4)
+ .long 0xb9294022 # kma %r2,%r4,%r2
+
.Lret:
br %r14
.size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities