+2022-07-29 Niels Möller <nisse@lysator.liu.se>
+
+ * s390x/msa_x1/sha256-compress-n.asm: New file. replacing...
+ * s390x/msa_x1/sha256-compress.asm: ...deleted file.
+ * s390x/fat/sha256-compress-n-2.asm: New file. replacing...
+ * s390x/fat/sha256-compress-2.asm: ...deleted file.
+ * fat-s390x.c: Update fat setup.
+
2022-07-26 Niels Möller <nisse@lysator.liu.se>
* arm/v6/sha256-compress-n.asm: New file. replacing...
DECLARE_FAT_FUNC_VAR(sha1_compress, sha1_compress_func, c)
DECLARE_FAT_FUNC_VAR(sha1_compress, sha1_compress_func, s390x)
-DECLARE_FAT_FUNC(_nettle_sha256_compress, sha256_compress_func)
-DECLARE_FAT_FUNC_VAR(sha256_compress, sha256_compress_func, c)
-DECLARE_FAT_FUNC_VAR(sha256_compress, sha256_compress_func, s390x)
+DECLARE_FAT_FUNC(_nettle_sha256_compress_n, sha256_compress_n_func)
+DECLARE_FAT_FUNC_VAR(sha256_compress_n, sha256_compress_n_func, c)
+DECLARE_FAT_FUNC_VAR(sha256_compress_n, sha256_compress_n_func, s390x)
DECLARE_FAT_FUNC(_nettle_sha512_compress, sha512_compress_func)
DECLARE_FAT_FUNC_VAR(sha512_compress, sha512_compress_func, c)
{
if (verbose)
fprintf (stderr, "libnettle: enabling hardware accelerated SHA256 compress code.\n");
- _nettle_sha256_compress_vec = _nettle_sha256_compress_s390x;
+ _nettle_sha256_compress_n_vec = _nettle_sha256_compress_n_s390x;
}
else
{
- _nettle_sha256_compress_vec = _nettle_sha256_compress_c;
+ _nettle_sha256_compress_n_vec = _nettle_sha256_compress_n_c;
}
/* SHA512 */
(state, input))
/* SHA256 */
-DEFINE_FAT_FUNC(_nettle_sha256_compress, void,
- (uint32_t *state, const uint8_t *input, const uint32_t *k),
- (state, input, k))
+DEFINE_FAT_FUNC(_nettle_sha256_compress_n, const uint8_t *,
+ (uint32_t *state, const uint32_t *k,
+ size_t blocks, const uint8_t *input),
+ (state, k, blocks, input))
/* SHA512 */
DEFINE_FAT_FUNC(_nettle_sha512_compress, void,
-C s390x/fat/sha256-compress-2.asm
+C s390x/fat/sha256-compress-n-2.asm
ifelse(`
Copyright (C) 2021 Mamone Tarsha
not, see http://www.gnu.org/licenses/.
')
-dnl PROLOGUE(_nettle_sha256_compress) picked up by configure
+dnl PROLOGUE(_nettle_sha256_compress_n) picked up by configure
define(`fat_transform', `$1_s390x')
-include_src(`s390x/msa_x1/sha256-compress.asm')
+include_src(`s390x/msa_x1/sha256-compress-n.asm')
-C s390x/msa_x1/sha256-compress.asm
+C s390x/msa_x1/sha256-compress-n.asm
ifelse(`
- Copyright (C) 2021 Mamone Tarsha
+ Copyright (C) 2021, 2022 Mamone Tarsha, Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
C | H7 (4 bytes) |
C *----------------------------------------------*
-.file "sha256-compress.asm"
+.file "sha256-compress-n.asm"
.text
C SHA function code
define(`SHA256_FUNCTION_CODE', `2')
-C Size of block
-define(`SHA256_BLOCK_SIZE', `64')
-C void
-C _nettle_sha256_compress(uint32_t *state, const uint8_t *input,
-C const uint32_t *k)
+C const uint8_t *
+C _nettle_sha256_compress_n(uint32_t *state, const uint32_t *k,
+C size_t blocks, const uint8_t *input)
-PROLOGUE(_nettle_sha256_compress)
+PROLOGUE(_nettle_sha256_compress_n)
lghi %r0,SHA256_FUNCTION_CODE C SHA-256 Function Code
lgr %r1,%r2
- lgr %r4,%r3
- lghi %r5,SHA256_BLOCK_SIZE
-1: .long 0xb93e0004 C kimd %r0,%r4. perform KIMD-SHA operation on data
+ lgr %r2, %r5
+ sllg %r3, %r4, 6 C 64 * block size
+1: .long 0xb93e0002 C kimd %r0,%r2. perform KIMD-SHA operation on data
brc 1,1b
br RA
-EPILOGUE(_nettle_sha256_compress)
+EPILOGUE(_nettle_sha256_compress_n)