On 20/10/26 21:54, Philippe Mathieu-Daudé wrote:
Hi,
On 20/10/26 16:55, Stian Halseth wrote:
Implement the SHA1, SHA256 and SHA512 instructions according
to OSA (Oracle SPARC Architecture) 2011 section 7.115,
using the algorithms defined in FIPS 180-4.
Read and update the fixed floating-point registers and mark the
lower FPR bank dirty. Share the SHA-2 Boolean functions between
the SHA256 and SHA512 helpers.
Gated behind the crypto CPU feature and disabled for sparc32.
Signed-off-by: Stian Halseth <[email protected]>
---
target/sparc/crypto_helper.c | 272 +++++++++++++++++++++++++++++++++++
target/sparc/helper.h | 3 +
target/sparc/insns.decode | 4 +
target/sparc/translate.c | 18 +++
4 files changed, 297 insertions(+)
diff --git a/target/sparc/helper.h b/target/sparc/helper.h
index 1320f5ebba..4be84622c8 100644
--- a/target/sparc/helper.h
+++ b/target/sparc/helper.h
@@ -134,6 +134,9 @@ DEF_HELPER_FLAGS_2(aes_kexpand0,
TCG_CALL_NO_RWG_SE, i64, i64, i64)
DEF_HELPER_FLAGS_3(aes_kexpand1, TCG_CALL_NO_RWG_SE, i64, i64, i64,
i32)
DEF_HELPER_FLAGS_2(aes_kexpand2, TCG_CALL_NO_RWG_SE, i64, i64, i64)
DEF_HELPER_FLAGS_2(crc32c, TCG_CALL_NO_RWG_SE, i64, i64, i64)
+DEF_HELPER_FLAGS_1(sha1, TCG_CALL_NO_RWG, void, env)
+DEF_HELPER_FLAGS_1(sha256, TCG_CALL_NO_RWG, void, env)
+DEF_HELPER_FLAGS_1(sha512, TCG_CALL_NO_RWG, void, env)
Hmm you set TCG_CALL_NO_RWG but the helper do read env->fpr[].
While benign in practice because fpr[] aren't tracked as global
TCG regs, the correct declaration is using no flag at all:
DEF_HELPER_1(sha1, void, env)
DEF_HELPER_1(sha256, void, env)
DEF_HELPER_1(sha512, void, env)
I apologize I was wrong, your patch is correct: fpr[] is not
a TCG global. I'm having some confusion with TCG_CALL_NO_RWG.
Otherwise:
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>