From d9288fa870037b49a214c1774f465af749246309 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 1 Dec 2018 10:33:04 -0500 Subject: [PATCH] Add additional ARM test programs The SHA512 and SHA3 programs need fixing, but they are stubbed out --- TestPrograms/test_arm_sha3.cxx | 29 +++++++++++++++++++++++++++++ TestPrograms/test_arm_sha512.cxx | 29 +++++++++++++++++++++++++++++ TestPrograms/test_arm_sm3.cxx | 29 +++++++++++++++++++++++++++++ TestPrograms/test_arm_sm4.cxx | 29 +++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 TestPrograms/test_arm_sha3.cxx create mode 100644 TestPrograms/test_arm_sha512.cxx create mode 100644 TestPrograms/test_arm_sm3.cxx create mode 100644 TestPrograms/test_arm_sm4.cxx diff --git a/TestPrograms/test_arm_sha3.cxx b/TestPrograms/test_arm_sha3.cxx new file mode 100644 index 00000000..a71721f9 --- /dev/null +++ b/TestPrograms/test_arm_sha3.cxx @@ -0,0 +1,29 @@ +#include +#include + +// test_acle.h determines if this is available. Then, +// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS +// if the ACLE header is not available. +#if (CRYPTOPP_ARM_ACLE_AVAILABLE) +# include +#endif + +int main(int argc, char* argv[]) +{ + // SM4 block cipher + uint32x4_t x; + x=vsm4ekeyq_u32(x,x); + x=vsm4eq_u32(x,x); + + // SM3 hash + uint32x4_t y; + y=vsm3ss1q_u32(x,y,y); + y=vsm3tt1aq_u32(x,y,y,3); + y=vsm3tt1bq_u32(x,y,y,1); + y=vsm3tt2aq_u32(x,y,y,2); + y=vsm3tt2bq_u32(x,y,y,3); + y=vsm3partw1q_u32(x,y,y); + y=vsm3partw2q_u32(x,y,y); + + return 0; +} diff --git a/TestPrograms/test_arm_sha512.cxx b/TestPrograms/test_arm_sha512.cxx new file mode 100644 index 00000000..a71721f9 --- /dev/null +++ b/TestPrograms/test_arm_sha512.cxx @@ -0,0 +1,29 @@ +#include +#include + +// test_acle.h determines if this is available. Then, +// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS +// if the ACLE header is not available. +#if (CRYPTOPP_ARM_ACLE_AVAILABLE) +# include +#endif + +int main(int argc, char* argv[]) +{ + // SM4 block cipher + uint32x4_t x; + x=vsm4ekeyq_u32(x,x); + x=vsm4eq_u32(x,x); + + // SM3 hash + uint32x4_t y; + y=vsm3ss1q_u32(x,y,y); + y=vsm3tt1aq_u32(x,y,y,3); + y=vsm3tt1bq_u32(x,y,y,1); + y=vsm3tt2aq_u32(x,y,y,2); + y=vsm3tt2bq_u32(x,y,y,3); + y=vsm3partw1q_u32(x,y,y); + y=vsm3partw2q_u32(x,y,y); + + return 0; +} diff --git a/TestPrograms/test_arm_sm3.cxx b/TestPrograms/test_arm_sm3.cxx new file mode 100644 index 00000000..a71721f9 --- /dev/null +++ b/TestPrograms/test_arm_sm3.cxx @@ -0,0 +1,29 @@ +#include +#include + +// test_acle.h determines if this is available. Then, +// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS +// if the ACLE header is not available. +#if (CRYPTOPP_ARM_ACLE_AVAILABLE) +# include +#endif + +int main(int argc, char* argv[]) +{ + // SM4 block cipher + uint32x4_t x; + x=vsm4ekeyq_u32(x,x); + x=vsm4eq_u32(x,x); + + // SM3 hash + uint32x4_t y; + y=vsm3ss1q_u32(x,y,y); + y=vsm3tt1aq_u32(x,y,y,3); + y=vsm3tt1bq_u32(x,y,y,1); + y=vsm3tt2aq_u32(x,y,y,2); + y=vsm3tt2bq_u32(x,y,y,3); + y=vsm3partw1q_u32(x,y,y); + y=vsm3partw2q_u32(x,y,y); + + return 0; +} diff --git a/TestPrograms/test_arm_sm4.cxx b/TestPrograms/test_arm_sm4.cxx new file mode 100644 index 00000000..a71721f9 --- /dev/null +++ b/TestPrograms/test_arm_sm4.cxx @@ -0,0 +1,29 @@ +#include +#include + +// test_acle.h determines if this is available. Then, +// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS +// if the ACLE header is not available. +#if (CRYPTOPP_ARM_ACLE_AVAILABLE) +# include +#endif + +int main(int argc, char* argv[]) +{ + // SM4 block cipher + uint32x4_t x; + x=vsm4ekeyq_u32(x,x); + x=vsm4eq_u32(x,x); + + // SM3 hash + uint32x4_t y; + y=vsm3ss1q_u32(x,y,y); + y=vsm3tt1aq_u32(x,y,y,3); + y=vsm3tt1bq_u32(x,y,y,1); + y=vsm3tt2aq_u32(x,y,y,2); + y=vsm3tt2bq_u32(x,y,y,3); + y=vsm3partw1q_u32(x,y,y); + y=vsm3partw2q_u32(x,y,y); + + return 0; +}