aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjia Zhang <[email protected]>2022-03-01 17:56:54 +0800
committerJussi Kivilinna <[email protected]>2022-03-02 20:45:48 +0200
commit7d2983979866223d96aad4806af0311671585f64 (patch)
tree46b9fe2269fbe0347bf7401e114a934e2266b05c
parent6951e0f591ccff24b9ce2e43c2dcab955e3302c4 (diff)
downloadlibgcrypt-7d2983979866223d96aad4806af0311671585f64.tar.gz
libgcrypt-7d2983979866223d96aad4806af0311671585f64.tar.bz2
libgcrypt-7d2983979866223d96aad4806af0311671585f64.zip
hwf-arm: add ARMv8.2 optional crypto extension HW features
* src/g10lib.h (HWF_ARM_SHA3, HWF_ARM_SM3, HWF_ARM_SM4) (HWF_ARM_SHA512): New. * src/hwf-arm.c (arm_features): Add sha3, sm3, sm4, sha512 HW features. * src/hwfeatures.c (hwflist): Add sha3, sm3, sm4, sha512 HW features. -- Signed-off-by: Tianjia Zhang <[email protected]>
-rw-r--r--src/g10lib.h4
-rw-r--r--src/hwf-arm.c16
-rw-r--r--src/hwfeatures.c4
3 files changed, 24 insertions, 0 deletions
diff --git a/src/g10lib.h b/src/g10lib.h
index 22c0f0c2..985e75c6 100644
--- a/src/g10lib.h
+++ b/src/g10lib.h
@@ -245,6 +245,10 @@ char **_gcry_strtokenize (const char *string, const char *delim);
#define HWF_ARM_SHA1 (1 << 2)
#define HWF_ARM_SHA2 (1 << 3)
#define HWF_ARM_PMULL (1 << 4)
+#define HWF_ARM_SHA3 (1 << 5)
+#define HWF_ARM_SM3 (1 << 6)
+#define HWF_ARM_SM4 (1 << 7)
+#define HWF_ARM_SHA512 (1 << 8)
#elif defined(HAVE_CPU_ARCH_PPC)
diff --git a/src/hwf-arm.c b/src/hwf-arm.c
index 60107f36..70d375b2 100644
--- a/src/hwf-arm.c
+++ b/src/hwf-arm.c
@@ -137,6 +137,18 @@ static const struct feature_map_s arm_features[] =
#ifndef HWCAP_SHA2
# define HWCAP_SHA2 64
#endif
+#ifndef HWCAP_SHA3
+# define HWCAP_SHA3 (1 << 17)
+#endif
+#ifndef HWCAP_SM3
+# define HWCAP_SM3 (1 << 18)
+#endif
+#ifndef HWCAP_SM4
+# define HWCAP_SM4 (1 << 19)
+#endif
+#ifndef HWCAP_SHA512
+# define HWCAP_SHA512 (1 << 21)
+#endif
static const struct feature_map_s arm_features[] =
{
@@ -148,6 +160,10 @@ static const struct feature_map_s arm_features[] =
{ HWCAP_SHA1, 0, " sha1", HWF_ARM_SHA1 },
{ HWCAP_SHA2, 0, " sha2", HWF_ARM_SHA2 },
{ HWCAP_PMULL, 0, " pmull", HWF_ARM_PMULL },
+ { HWCAP_SHA3, 0, " sha3", HWF_ARM_SHA3 },
+ { HWCAP_SM3, 0, " sm3", HWF_ARM_SM3 },
+ { HWCAP_SM4, 0, " sm4", HWF_ARM_SM4 },
+ { HWCAP_SHA512, 0, " sha512", HWF_ARM_SHA512 },
#endif
};
diff --git a/src/hwfeatures.c b/src/hwfeatures.c
index 97e67b3c..7060d995 100644
--- a/src/hwfeatures.c
+++ b/src/hwfeatures.c
@@ -68,6 +68,10 @@ static struct
{ HWF_ARM_SHA1, "arm-sha1" },
{ HWF_ARM_SHA2, "arm-sha2" },
{ HWF_ARM_PMULL, "arm-pmull" },
+ { HWF_ARM_SHA3, "arm-sha3" },
+ { HWF_ARM_SM3, "arm-sm3" },
+ { HWF_ARM_SM4, "arm-sm4" },
+ { HWF_ARM_SHA512, "arm-sha512" },
#elif defined(HAVE_CPU_ARCH_PPC)
{ HWF_PPC_VCRYPTO, "ppc-vcrypto" },
{ HWF_PPC_ARCH_3_00, "ppc-arch_3_00" },