1/* SHA512 using sparc crypto opcodes. 2 Copyright (C) 2012-2022 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 4 5 The GNU C Library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 The GNU C Library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with the GNU C Library; if not, see 17 <https://www.gnu.org/licenses/>. */ 18 19#include <sysdep.h> 20 21#define SHA512 \ 22 .word 0x81b02860; 23 24 .text 25 .align 32 26ENTRY(__sha512_process_block_crop) 27 /* %o0=buffer, %o1=len, %o2=CTX */ 28 ldx [%o2 + 0x48], %g1 29 add %g1, %o1, %o4 30 stx %o4, [%o2 + 0x48] 31 cmp %o4, %g1 32 bgeu,pt %xcc, 1f 33 nop 34 ldx [%o2 + 0x40], %g1 35 add %g1, 1, %g1 36 stx %g1, [%o2 + 0x40] 37 381: ldd [%o2 + 0x00], %f0 39 ldd [%o2 + 0x08], %f2 40 ldd [%o2 + 0x10], %f4 41 ldd [%o2 + 0x18], %f6 42 ldd [%o2 + 0x20], %f8 43 ldd [%o2 + 0x28], %f10 44 andcc %o1, 0x7, %g0 45 ldd [%o2 + 0x30], %f12 46 bne,pn %xcc, 10f 47 ldd [%o2 + 0x38], %f14 48 491: 50 ldd [%o0 + 0x00], %f16 51 ldd [%o0 + 0x08], %f18 52 ldd [%o0 + 0x10], %f20 53 ldd [%o0 + 0x18], %f22 54 ldd [%o0 + 0x20], %f24 55 ldd [%o0 + 0x28], %f26 56 ldd [%o0 + 0x30], %f28 57 ldd [%o0 + 0x38], %f30 58 ldd [%o0 + 0x40], %f32 59 ldd [%o0 + 0x48], %f34 60 ldd [%o0 + 0x50], %f36 61 ldd [%o0 + 0x58], %f38 62 ldd [%o0 + 0x60], %f40 63 ldd [%o0 + 0x68], %f42 64 ldd [%o0 + 0x70], %f44 65 ldd [%o0 + 0x78], %f46 66 67 SHA512 68 69 subcc %o1, 0x80, %o1 70 bne,pt %xcc, 1b 71 add %o0, 0x80, %o0 72 735: 74 std %f0, [%o2 + 0x00] 75 std %f2, [%o2 + 0x08] 76 std %f4, [%o2 + 0x10] 77 std %f6, [%o2 + 0x18] 78 std %f8, [%o2 + 0x20] 79 std %f10, [%o2 + 0x28] 80 std %f12, [%o2 + 0x30] 81 retl 82 std %f14, [%o2 + 0x38] 8310: 84 alignaddr %o0, %g0, %o0 85 86 ldd [%o0 + 0x00], %f18 871: 88 ldd [%o0 + 0x08], %f20 89 ldd [%o0 + 0x10], %f22 90 ldd [%o0 + 0x18], %f24 91 ldd [%o0 + 0x20], %f26 92 ldd [%o0 + 0x28], %f28 93 ldd [%o0 + 0x30], %f30 94 ldd [%o0 + 0x38], %f32 95 ldd [%o0 + 0x40], %f34 96 ldd [%o0 + 0x48], %f36 97 ldd [%o0 + 0x50], %f38 98 ldd [%o0 + 0x58], %f40 99 ldd [%o0 + 0x60], %f42 100 ldd [%o0 + 0x68], %f44 101 ldd [%o0 + 0x70], %f46 102 ldd [%o0 + 0x78], %f48 103 ldd [%o0 + 0x80], %f50 104 105 faligndata %f18, %f20, %f16 106 faligndata %f20, %f22, %f18 107 faligndata %f22, %f24, %f20 108 faligndata %f24, %f26, %f22 109 faligndata %f26, %f28, %f24 110 faligndata %f28, %f30, %f26 111 faligndata %f30, %f32, %f28 112 faligndata %f32, %f34, %f30 113 faligndata %f34, %f36, %f32 114 faligndata %f36, %f38, %f34 115 faligndata %f38, %f40, %f36 116 faligndata %f40, %f42, %f38 117 faligndata %f42, %f44, %f40 118 faligndata %f44, %f46, %f42 119 faligndata %f46, %f48, %f44 120 faligndata %f48, %f50, %f46 121 122 SHA512 123 124 subcc %o1, 0x80, %o1 125 fsrc2 %f50, %f18 126 bne,pt %xcc, 1b 127 add %o0, 0x80, %o0 128 129 ba,a,pt %xcc, 5b 130END(__sha512_process_block_crop) 131