summaryrefslogtreecommitdiffstats
path: root/crypto/s390xcap.c
diff options
context:
space:
mode:
authorPatrick Steuer <patrick.steuer@de.ibm.com>2019-06-27 01:07:54 +0200
committerPatrick Steuer <patrick.steuer@de.ibm.com>2019-06-29 23:13:45 +0200
commite382f507fb67863be02bfa69b08533cc55f0cd96 (patch)
tree1816af155b07436fa78746dcd97b452275df4e82 /crypto/s390xcap.c
parentSupport SM2 certificate signing (diff)
downloadopenssl-e382f507fb67863be02bfa69b08533cc55f0cd96.tar.xz
openssl-e382f507fb67863be02bfa69b08533cc55f0cd96.zip
s390x assembly pack: add support for pcc and kma instructions
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9258)
Diffstat (limited to 'crypto/s390xcap.c')
-rw-r--r--crypto/s390xcap.c119
1 files changed, 119 insertions, 0 deletions
diff --git a/crypto/s390xcap.c b/crypto/s390xcap.c
index 717849e574..b75eacf22f 100644
--- a/crypto/s390xcap.c
+++ b/crypto/s390xcap.c
@@ -137,6 +137,10 @@ void OPENSSL_cpuid_setup(void)
OPENSSL_s390xcap_P.prno[1] &= cap.prno[1];
OPENSSL_s390xcap_P.kma[0] &= cap.kma[0];
OPENSSL_s390xcap_P.kma[1] &= cap.kma[1];
+ OPENSSL_s390xcap_P.pcc[0] &= cap.pcc[0];
+ OPENSSL_s390xcap_P.pcc[1] &= cap.pcc[1];
+ OPENSSL_s390xcap_P.kdsa[0] &= cap.kdsa[0];
+ OPENSSL_s390xcap_P.kdsa[1] &= cap.kdsa[1];
}
}
@@ -163,6 +167,8 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
/*.kmf = */{0ULL, 0ULL},
/*.prno = */{0ULL, 0ULL},
/*.kma = */{0ULL, 0ULL},
+ /*.pcc = */{0ULL, 0ULL},
+ /*.kdsa = */{0ULL, 0ULL},
};
/*-
@@ -189,6 +195,8 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
/*.kmf = */{0ULL, 0ULL},
/*.prno = */{0ULL, 0ULL},
/*.kma = */{0ULL, 0ULL},
+ /*.pcc = */{0ULL, 0ULL},
+ /*.kdsa = */{0ULL, 0ULL},
};
/*-
@@ -220,6 +228,8 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
/*.kmf = */{0ULL, 0ULL},
/*.prno = */{0ULL, 0ULL},
/*.kma = */{0ULL, 0ULL},
+ /*.pcc = */{0ULL, 0ULL},
+ /*.kdsa = */{0ULL, 0ULL},
};
/*-
@@ -257,6 +267,8 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
/*.kmf = */{0ULL, 0ULL},
/*.prno = */{0ULL, 0ULL},
/*.kma = */{0ULL, 0ULL},
+ /*.pcc = */{0ULL, 0ULL},
+ /*.kdsa = */{0ULL, 0ULL},
};
/*-
@@ -313,6 +325,9 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
0ULL},
/*.prno = */{0ULL, 0ULL},
/*.kma = */{0ULL, 0ULL},
+ /*.pcc = */{S390X_CAPBIT(S390X_QUERY),
+ 0ULL},
+ /*.kdsa = */{0ULL, 0ULL},
};
/*-
@@ -369,6 +384,9 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
0ULL},
/*.prno = */{0ULL, 0ULL},
/*.kma = */{0ULL, 0ULL},
+ /*.pcc = */{S390X_CAPBIT(S390X_QUERY),
+ 0ULL},
+ /*.kdsa = */{0ULL, 0ULL},
};
/*-
@@ -429,6 +447,9 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
| S390X_CAPBIT(S390X_SHA_512_DRNG),
0ULL},
/*.kma = */{0ULL, 0ULL},
+ /*.pcc = */{S390X_CAPBIT(S390X_QUERY),
+ 0ULL},
+ /*.kdsa = */{0ULL, 0ULL},
};
/*-
@@ -508,6 +529,101 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
| S390X_CAPBIT(S390X_AES_192)
| S390X_CAPBIT(S390X_AES_256),
0ULL},
+ /*.pcc = */{S390X_CAPBIT(S390X_QUERY),
+ 0ULL},
+ /*.kdsa = */{0ULL, 0ULL},
+ };
+
+ /*-
+ * z15 (2019) - z/Architecture POP SA22-7832-12
+ * Implements MSA and MSA1-9.
+ */
+ static const struct OPENSSL_s390xcap_st z15 = {
+ /*.stfle = */{S390X_CAPBIT(S390X_MSA)
+ | S390X_CAPBIT(S390X_STCKF)
+ | S390X_CAPBIT(S390X_MSA5),
+ S390X_CAPBIT(S390X_MSA3)
+ | S390X_CAPBIT(S390X_MSA4),
+ S390X_CAPBIT(S390X_VX)
+ | S390X_CAPBIT(S390X_VXD)
+ | S390X_CAPBIT(S390X_VXE)
+ | S390X_CAPBIT(S390X_MSA8),
+ 0ULL},
+ /*.kimd = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_SHA_1)
+ | S390X_CAPBIT(S390X_SHA_256)
+ | S390X_CAPBIT(S390X_SHA_512)
+ | S390X_CAPBIT(S390X_SHA3_224)
+ | S390X_CAPBIT(S390X_SHA3_256)
+ | S390X_CAPBIT(S390X_SHA3_384)
+ | S390X_CAPBIT(S390X_SHA3_512)
+ | S390X_CAPBIT(S390X_SHAKE_128)
+ | S390X_CAPBIT(S390X_SHAKE_256),
+ S390X_CAPBIT(S390X_GHASH)},
+ /*.klmd = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_SHA_1)
+ | S390X_CAPBIT(S390X_SHA_256)
+ | S390X_CAPBIT(S390X_SHA_512)
+ | S390X_CAPBIT(S390X_SHA3_224)
+ | S390X_CAPBIT(S390X_SHA3_256)
+ | S390X_CAPBIT(S390X_SHA3_384)
+ | S390X_CAPBIT(S390X_SHA3_512)
+ | S390X_CAPBIT(S390X_SHAKE_128)
+ | S390X_CAPBIT(S390X_SHAKE_256),
+ 0ULL},
+ /*.km = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_AES_128)
+ | S390X_CAPBIT(S390X_AES_192)
+ | S390X_CAPBIT(S390X_AES_256)
+ | S390X_CAPBIT(S390X_XTS_AES_128)
+ | S390X_CAPBIT(S390X_XTS_AES_256),
+ 0ULL},
+ /*.kmc = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_AES_128)
+ | S390X_CAPBIT(S390X_AES_192)
+ | S390X_CAPBIT(S390X_AES_256),
+ 0ULL},
+ /*.kmac = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_AES_128)
+ | S390X_CAPBIT(S390X_AES_192)
+ | S390X_CAPBIT(S390X_AES_256),
+ 0ULL},
+ /*.kmctr = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_AES_128)
+ | S390X_CAPBIT(S390X_AES_192)
+ | S390X_CAPBIT(S390X_AES_256),
+ 0ULL},
+ /*.kmo = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_AES_128)
+ | S390X_CAPBIT(S390X_AES_192)
+ | S390X_CAPBIT(S390X_AES_256),
+ 0ULL},
+ /*.kmf = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_AES_128)
+ | S390X_CAPBIT(S390X_AES_192)
+ | S390X_CAPBIT(S390X_AES_256),
+ 0ULL},
+ /*.prno = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_SHA_512_DRNG),
+ S390X_CAPBIT(S390X_TRNG)},
+ /*.kma = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_AES_128)
+ | S390X_CAPBIT(S390X_AES_192)
+ | S390X_CAPBIT(S390X_AES_256),
+ 0ULL},
+ /*.pcc = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_SCALAR_MULTIPLY_P256)
+ | S390X_CAPBIT(S390X_SCALAR_MULTIPLY_P384)
+ | S390X_CAPBIT(S390X_SCALAR_MULTIPLY_P521),
+ 0ULL},
+ /*.kdsa = */{S390X_CAPBIT(S390X_QUERY)
+ | S390X_CAPBIT(S390X_ECDSA_VERIFY_P256)
+ | S390X_CAPBIT(S390X_ECDSA_VERIFY_P384)
+ | S390X_CAPBIT(S390X_ECDSA_VERIFY_P521)
+ | S390X_CAPBIT(S390X_ECDSA_SIGN_P256)
+ | S390X_CAPBIT(S390X_ECDSA_SIGN_P384)
+ | S390X_CAPBIT(S390X_ECDSA_SIGN_P521),
+ 0ULL},
};
char *tok_begin, *tok_end, *buff, tok[S390X_STFLE_MAX][LEN + 1];
@@ -551,6 +667,8 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
else if TOK_FUNC(kmf)
else if TOK_FUNC(prno)
else if TOK_FUNC(kma)
+ else if TOK_FUNC(pcc)
+ else if TOK_FUNC(kdsa)
/* CPU model tokens */
else if TOK_CPU(z900)
@@ -561,6 +679,7 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
else if TOK_CPU(zEC12)
else if TOK_CPU(z13)
else if TOK_CPU(z14)
+ else if TOK_CPU(z15)
/* whitespace(ignored) or invalid tokens */
else {