diff options
author | David S. Miller <davem@davemloft.net> | 2012-11-12 15:17:31 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-13 17:12:45 -0800 |
commit | 3a0d900a997f8ade1332b56cd952e44158770491 (patch) | |
tree | d9b0b8c117b3f7019476682ac065f8eaf883bba1 /sysdeps/sparc/sparc64/multiarch/sha256-crop.S | |
parent | e27d476a652874ad8556fcdb06d877ebabb3e9c7 (diff) | |
download | glibc-3a0d900a997f8ade1332b56cd952e44158770491.tar.gz glibc-3a0d900a997f8ade1332b56cd952e44158770491.tar.xz glibc-3a0d900a997f8ade1332b56cd952e44158770491.zip |
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.
Diffstat (limited to 'sysdeps/sparc/sparc64/multiarch/sha256-crop.S')
-rw-r--r-- | sysdeps/sparc/sparc64/multiarch/sha256-crop.S | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/sysdeps/sparc/sparc64/multiarch/sha256-crop.S b/sysdeps/sparc/sparc64/multiarch/sha256-crop.S new file mode 100644 index 0000000000..b79f536c48 --- /dev/null +++ b/sysdeps/sparc/sparc64/multiarch/sha256-crop.S @@ -0,0 +1,101 @@ +/* SHA256 using sparc crypto opcodes. + Copyright (C) 2012 Free Software Foundation, Inc. + 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 + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +#define SHA256 \ + .word 0x81b02840; + + .text + .align 32 +ENTRY(__sha256_process_block_crop) + /* %o0=buffer, %o1=len, %o2=CTX */ + ldx [%o2 + 0x20], %g1 + add %g1, %o1, %g1 + stx %g1, [%o2 + 0x20] + + ld [%o2 + 0x00], %f0 + ld [%o2 + 0x04], %f1 + ld [%o2 + 0x08], %f2 + ld [%o2 + 0x0c], %f3 + ld [%o2 + 0x10], %f4 + ld [%o2 + 0x14], %f5 + andcc %o1, 0x7, %g0 + ld [%o2 + 0x18], %f6 + bne,pn %xcc, 10f + ld [%o2 + 0x1c], %f7 + +1: + ldd [%o0 + 0x00], %f8 + ldd [%o0 + 0x08], %f10 + ldd [%o0 + 0x10], %f12 + ldd [%o0 + 0x18], %f14 + ldd [%o0 + 0x20], %f16 + ldd [%o0 + 0x28], %f18 + ldd [%o0 + 0x30], %f20 + ldd [%o0 + 0x38], %f22 + + SHA256 + + subcc %o1, 0x40, %o1 + bne,pt %xcc, 1b + add %o0, 0x40, %o0 + +5: + st %f0, [%o2 + 0x00] + st %f1, [%o2 + 0x04] + st %f2, [%o2 + 0x08] + st %f3, [%o2 + 0x0c] + st %f4, [%o2 + 0x10] + st %f5, [%o2 + 0x14] + st %f6, [%o2 + 0x18] + retl + st %f7, [%o2 + 0x1c] +10: + alignaddr %o0, %g0, %o0 + + ldd [%o0 + 0x00], %f10 +1: + ldd [%o0 + 0x08], %f12 + ldd [%o0 + 0x10], %f14 + ldd [%o0 + 0x18], %f16 + ldd [%o0 + 0x20], %f18 + ldd [%o0 + 0x28], %f20 + ldd [%o0 + 0x30], %f22 + ldd [%o0 + 0x38], %f24 + ldd [%o0 + 0x40], %f26 + + faligndata %f10, %f12, %f8 + faligndata %f12, %f14, %f10 + faligndata %f14, %f16, %f12 + faligndata %f16, %f18, %f14 + faligndata %f18, %f20, %f16 + faligndata %f20, %f22, %f18 + faligndata %f22, %f24, %f20 + faligndata %f24, %f26, %f22 + + SHA256 + + subcc %o1, 0x40, %o1 + fsrc2 %f26, %f10 + bne,pt %xcc, 1b + add %o0, 0x40, %o0 + + ba,a,pt %xcc, 5b +END(__sha256_process_block_crop) |