glibc/sysdeps/sparc/sparc64/multiarch/sha512-crop.S

132 lines
3.1 KiB
ArmAsm
Raw Normal View History

Add support for sparc cryptographic hash opcodes. * crypt/Makefile: Move test targets after toplevel Rules inclusion. Grab any necessary sysdep routines when linking. * crypt/md5.c (md5_process_block): Remove define, we will always name it __md5_process_block. (md5_finish_ctx): Update md5_process_block call. (md5_stream): Likewise. (md5_process_bytes): Likewise. (md5_process_block): Rename to __md5_process_block and move to ... * crypt/md5-block.c: ... here. * crypt/sha256.c (sha256_process_block): Move to ... * crypt/sha256-block.c: ... here. * crypt/sha512.c (sha512_process_block): Move to ... * crypt/sha512-block.c: ... here. * locale/Makefile (CFLAGS-md5.c): Define to add crypt/ to include path. * sysdeps/sparc/sparc-ifunc.c (sparc_libc_ifunc): Define. * sysdeps/sparc/sparc64/multiarch/Makefile (libcrypt-sysdep_routines): Add crypto assembler sysdeps when in crypt subdir. (localedef-aux): Add md5 crypto assembler when in locale subdir. * sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile: Mirror sparc64 multiarch changes. * sysdeps/sparc/sparc64/multiarch/md5-block.c: New file. * sysdeps/sparc/sparc64/multiarch/md5-crop.S: New file. * sysdeps/sparc/sparc64/multiarch/sha256-block.c: New file. * sysdeps/sparc/sparc64/multiarch/sha256-crop.S: New file. * sysdeps/sparc/sparc64/multiarch/sha512-block.c: New file. * sysdeps/sparc/sparc64/multiarch/sha512-crop.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/md5-block.c: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/md5-crop.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-block.c: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-crop.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-block.c: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-crop.S: New file.
2012-11-12 23:17:31 +00:00
/* SHA512 using sparc crypto opcodes.
Copyright (C) 2012-2021 Free Software Foundation, Inc.
Add support for sparc cryptographic hash opcodes. * crypt/Makefile: Move test targets after toplevel Rules inclusion. Grab any necessary sysdep routines when linking. * crypt/md5.c (md5_process_block): Remove define, we will always name it __md5_process_block. (md5_finish_ctx): Update md5_process_block call. (md5_stream): Likewise. (md5_process_bytes): Likewise. (md5_process_block): Rename to __md5_process_block and move to ... * crypt/md5-block.c: ... here. * crypt/sha256.c (sha256_process_block): Move to ... * crypt/sha256-block.c: ... here. * crypt/sha512.c (sha512_process_block): Move to ... * crypt/sha512-block.c: ... here. * locale/Makefile (CFLAGS-md5.c): Define to add crypt/ to include path. * sysdeps/sparc/sparc-ifunc.c (sparc_libc_ifunc): Define. * sysdeps/sparc/sparc64/multiarch/Makefile (libcrypt-sysdep_routines): Add crypto assembler sysdeps when in crypt subdir. (localedef-aux): Add md5 crypto assembler when in locale subdir. * sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile: Mirror sparc64 multiarch changes. * sysdeps/sparc/sparc64/multiarch/md5-block.c: New file. * sysdeps/sparc/sparc64/multiarch/md5-crop.S: New file. * sysdeps/sparc/sparc64/multiarch/sha256-block.c: New file. * sysdeps/sparc/sparc64/multiarch/sha256-crop.S: New file. * sysdeps/sparc/sparc64/multiarch/sha512-block.c: New file. * sysdeps/sparc/sparc64/multiarch/sha512-crop.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/md5-block.c: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/md5-crop.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-block.c: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-crop.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-block.c: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-crop.S: New file.
2012-11-12 23:17:31 +00:00
This file is part of the GNU C Library.
Contributed by David S. Miller (davem@davemloft.net)
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
Prefer https to http for gnu.org and fsf.org URLs Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
<https://www.gnu.org/licenses/>. */
Add support for sparc cryptographic hash opcodes. * crypt/Makefile: Move test targets after toplevel Rules inclusion. Grab any necessary sysdep routines when linking. * crypt/md5.c (md5_process_block): Remove define, we will always name it __md5_process_block. (md5_finish_ctx): Update md5_process_block call. (md5_stream): Likewise. (md5_process_bytes): Likewise. (md5_process_block): Rename to __md5_process_block and move to ... * crypt/md5-block.c: ... here. * crypt/sha256.c (sha256_process_block): Move to ... * crypt/sha256-block.c: ... here. * crypt/sha512.c (sha512_process_block): Move to ... * crypt/sha512-block.c: ... here. * locale/Makefile (CFLAGS-md5.c): Define to add crypt/ to include path. * sysdeps/sparc/sparc-ifunc.c (sparc_libc_ifunc): Define. * sysdeps/sparc/sparc64/multiarch/Makefile (libcrypt-sysdep_routines): Add crypto assembler sysdeps when in crypt subdir. (localedef-aux): Add md5 crypto assembler when in locale subdir. * sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile: Mirror sparc64 multiarch changes. * sysdeps/sparc/sparc64/multiarch/md5-block.c: New file. * sysdeps/sparc/sparc64/multiarch/md5-crop.S: New file. * sysdeps/sparc/sparc64/multiarch/sha256-block.c: New file. * sysdeps/sparc/sparc64/multiarch/sha256-crop.S: New file. * sysdeps/sparc/sparc64/multiarch/sha512-block.c: New file. * sysdeps/sparc/sparc64/multiarch/sha512-crop.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/md5-block.c: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/md5-crop.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-block.c: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-crop.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-block.c: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-crop.S: New file.
2012-11-12 23:17:31 +00:00
#include <sysdep.h>
#define SHA512 \
.word 0x81b02860;
.text
.align 32
ENTRY(__sha512_process_block_crop)
/* %o0=buffer, %o1=len, %o2=CTX */
ldx [%o2 + 0x48], %g1
add %g1, %o1, %o4
stx %o4, [%o2 + 0x48]
cmp %o4, %g1
bgeu,pt %xcc, 1f
nop
ldx [%o2 + 0x40], %g1
add %g1, 1, %g1
stx %g1, [%o2 + 0x40]
1: ldd [%o2 + 0x00], %f0
ldd [%o2 + 0x08], %f2
ldd [%o2 + 0x10], %f4
ldd [%o2 + 0x18], %f6
ldd [%o2 + 0x20], %f8
ldd [%o2 + 0x28], %f10
andcc %o1, 0x7, %g0
ldd [%o2 + 0x30], %f12
bne,pn %xcc, 10f
ldd [%o2 + 0x38], %f14
1:
ldd [%o0 + 0x00], %f16
ldd [%o0 + 0x08], %f18
ldd [%o0 + 0x10], %f20
ldd [%o0 + 0x18], %f22
ldd [%o0 + 0x20], %f24
ldd [%o0 + 0x28], %f26
ldd [%o0 + 0x30], %f28
ldd [%o0 + 0x38], %f30
ldd [%o0 + 0x40], %f32
ldd [%o0 + 0x48], %f34
ldd [%o0 + 0x50], %f36
ldd [%o0 + 0x58], %f38
ldd [%o0 + 0x60], %f40
ldd [%o0 + 0x68], %f42
ldd [%o0 + 0x70], %f44
ldd [%o0 + 0x78], %f46
SHA512
subcc %o1, 0x80, %o1
bne,pt %xcc, 1b
add %o0, 0x80, %o0
5:
std %f0, [%o2 + 0x00]
std %f2, [%o2 + 0x08]
std %f4, [%o2 + 0x10]
std %f6, [%o2 + 0x18]
std %f8, [%o2 + 0x20]
std %f10, [%o2 + 0x28]
std %f12, [%o2 + 0x30]
retl
std %f14, [%o2 + 0x38]
10:
alignaddr %o0, %g0, %o0
ldd [%o0 + 0x00], %f18
1:
ldd [%o0 + 0x08], %f20
ldd [%o0 + 0x10], %f22
ldd [%o0 + 0x18], %f24
ldd [%o0 + 0x20], %f26
ldd [%o0 + 0x28], %f28
ldd [%o0 + 0x30], %f30
ldd [%o0 + 0x38], %f32
ldd [%o0 + 0x40], %f34
ldd [%o0 + 0x48], %f36
ldd [%o0 + 0x50], %f38
ldd [%o0 + 0x58], %f40
ldd [%o0 + 0x60], %f42
ldd [%o0 + 0x68], %f44
ldd [%o0 + 0x70], %f46
ldd [%o0 + 0x78], %f48
ldd [%o0 + 0x80], %f50
faligndata %f18, %f20, %f16
faligndata %f20, %f22, %f18
faligndata %f22, %f24, %f20
faligndata %f24, %f26, %f22
faligndata %f26, %f28, %f24
faligndata %f28, %f30, %f26
faligndata %f30, %f32, %f28
faligndata %f32, %f34, %f30
faligndata %f34, %f36, %f32
faligndata %f36, %f38, %f34
faligndata %f38, %f40, %f36
faligndata %f40, %f42, %f38
faligndata %f42, %f44, %f40
faligndata %f44, %f46, %f42
faligndata %f46, %f48, %f44
faligndata %f48, %f50, %f46
SHA512
subcc %o1, 0x80, %o1
fsrc2 %f50, %f18
bne,pt %xcc, 1b
add %o0, 0x80, %o0
ba,a,pt %xcc, 5b
END(__sha512_process_block_crop)