]>
Commit | Line | Data |
---|---|---|
3a0d900a | 1 | /* SHA256 using sparc crypto opcodes. |
b168057a | 2 | Copyright (C) 2012-2015 Free Software Foundation, Inc. |
3a0d900a DM |
3 | This file is part of the GNU C Library. |
4 | Contributed by David S. Miller (davem@davemloft.net) | |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Lesser General Public | |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
10 | ||
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Lesser General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Lesser General Public | |
17 | License along with the GNU C Library; if not, see | |
18 | <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | #include <sysdep.h> | |
21 | ||
22 | #define SHA256 \ | |
23 | .word 0x81b02840; | |
24 | ||
25 | .text | |
26 | .align 32 | |
27 | ENTRY(__sha256_process_block_crop) | |
28 | /* %o0=buffer, %o1=len, %o2=CTX */ | |
29 | ldx [%o2 + 0x20], %g1 | |
30 | add %g1, %o1, %g1 | |
31 | stx %g1, [%o2 + 0x20] | |
32 | ||
33 | ld [%o2 + 0x00], %f0 | |
34 | ld [%o2 + 0x04], %f1 | |
35 | ld [%o2 + 0x08], %f2 | |
36 | ld [%o2 + 0x0c], %f3 | |
37 | ld [%o2 + 0x10], %f4 | |
38 | ld [%o2 + 0x14], %f5 | |
39 | andcc %o1, 0x7, %g0 | |
40 | ld [%o2 + 0x18], %f6 | |
41 | bne,pn %xcc, 10f | |
42 | ld [%o2 + 0x1c], %f7 | |
43 | ||
44 | 1: | |
45 | ldd [%o0 + 0x00], %f8 | |
46 | ldd [%o0 + 0x08], %f10 | |
47 | ldd [%o0 + 0x10], %f12 | |
48 | ldd [%o0 + 0x18], %f14 | |
49 | ldd [%o0 + 0x20], %f16 | |
50 | ldd [%o0 + 0x28], %f18 | |
51 | ldd [%o0 + 0x30], %f20 | |
52 | ldd [%o0 + 0x38], %f22 | |
53 | ||
54 | SHA256 | |
55 | ||
56 | subcc %o1, 0x40, %o1 | |
57 | bne,pt %xcc, 1b | |
58 | add %o0, 0x40, %o0 | |
59 | ||
60 | 5: | |
61 | st %f0, [%o2 + 0x00] | |
62 | st %f1, [%o2 + 0x04] | |
63 | st %f2, [%o2 + 0x08] | |
64 | st %f3, [%o2 + 0x0c] | |
65 | st %f4, [%o2 + 0x10] | |
66 | st %f5, [%o2 + 0x14] | |
67 | st %f6, [%o2 + 0x18] | |
68 | retl | |
69 | st %f7, [%o2 + 0x1c] | |
70 | 10: | |
71 | alignaddr %o0, %g0, %o0 | |
72 | ||
73 | ldd [%o0 + 0x00], %f10 | |
74 | 1: | |
75 | ldd [%o0 + 0x08], %f12 | |
76 | ldd [%o0 + 0x10], %f14 | |
77 | ldd [%o0 + 0x18], %f16 | |
78 | ldd [%o0 + 0x20], %f18 | |
79 | ldd [%o0 + 0x28], %f20 | |
80 | ldd [%o0 + 0x30], %f22 | |
81 | ldd [%o0 + 0x38], %f24 | |
82 | ldd [%o0 + 0x40], %f26 | |
83 | ||
84 | faligndata %f10, %f12, %f8 | |
85 | faligndata %f12, %f14, %f10 | |
86 | faligndata %f14, %f16, %f12 | |
87 | faligndata %f16, %f18, %f14 | |
88 | faligndata %f18, %f20, %f16 | |
89 | faligndata %f20, %f22, %f18 | |
90 | faligndata %f22, %f24, %f20 | |
91 | faligndata %f24, %f26, %f22 | |
92 | ||
93 | SHA256 | |
94 | ||
95 | subcc %o1, 0x40, %o1 | |
96 | fsrc2 %f26, %f10 | |
97 | bne,pt %xcc, 1b | |
98 | add %o0, 0x40, %o0 | |
99 | ||
100 | ba,a,pt %xcc, 5b | |
101 | END(__sha256_process_block_crop) |