2 * Copyright 2004-2022 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * https://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * Portions Copyright (c) 2022 Tino Reichardt <milky-zfs@mcmilk.de>
19 * - modified assembly to fit into OpenZFS
22 #if (defined(__PPC64__) && defined(__BIG_ENDIAN__))
24 #if (!defined(_CALL_ELF) || _CALL_ELF == 1)
28 .globl .zfs_sha256_ppc
29 .type zfs_sha256_ppc,@function
33 .quad .zfs_sha256_ppc,.TOC.@tocbase,0
42 .type zfs_sha256_ppc,@function
45 .localentry zfs_sha256_ppc,0
89 bl .Lsha2_block_private
104 bl .Lsha2_block_private
129 bl .Lsha2_block_private
159 .byte 0,12,4,1,0x80,18,3,0
162 .Lsha2_block_private:
1322 bne .Lsha2_block_private
1325 .byte 0,12,0x14,0,0,0,0,0
1326 #if (!defined(_CALL_ELF) || _CALL_ELF == 1)
1327 .size .zfs_sha256_ppc,.-.zfs_sha256_ppc
1328 .size zfs_sha256_ppc,.-.zfs_sha256_ppc
1330 .size zfs_sha256_ppc,.-zfs_sha256_ppc
1341 .byte 0,12,0x14,0,0,0,0,0
1343 .long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
1344 .long 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
1345 .long 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
1346 .long 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
1347 .long 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
1348 .long 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
1349 .long 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
1350 .long 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
1351 .long 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
1352 .long 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
1353 .long 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
1354 .long 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
1355 .long 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
1356 .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
1357 .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
1358 .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
1360 #elif (defined(__PPC64__) && defined(__LITTLE_ENDIAN__))
1365 .globl zfs_sha256_ppc
1366 .type zfs_sha256_ppc,@function
1369 .localentry zfs_sha256_ppc,0
1413 bl .Lsha2_block_private
1428 bl .Lsha2_block_private
1453 bl .Lsha2_block_private
1483 .byte 0,12,4,1,0x80,18,3,0
1486 .Lsha2_block_private:
1491 rlwimi 16,3,24,16,23
1523 rlwimi 17,3,24,16,23
1555 rlwimi 18,3,24,16,23
1587 rlwimi 19,3,24,16,23
1619 rlwimi 20,3,24,16,23
1651 rlwimi 21,3,24,16,23
1683 rlwimi 22,3,24,16,23
1715 rlwimi 23,3,24,16,23
1747 rlwimi 24,3,24,16,23
1779 rlwimi 25,3,24,16,23
1811 rlwimi 26,3,24,16,23
1843 rlwimi 27,3,24,16,23
1875 rlwimi 28,3,24,16,23
1907 rlwimi 29,3,24,16,23
1939 rlwimi 30,3,24,16,23
1971 rlwimi 31,3,24,16,23
2694 bne .Lsha2_block_private
2697 .byte 0,12,0x14,0,0,0,0,0
2698 .size zfs_sha256_ppc,.-zfs_sha256_ppc
2708 .byte 0,12,0x14,0,0,0,0,0
2710 .long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
2711 .long 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
2712 .long 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
2713 .long 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
2714 .long 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
2715 .long 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
2716 .long 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
2717 .long 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
2718 .long 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
2719 .long 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
2720 .long 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
2721 .long 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
2722 .long 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
2723 .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
2724 .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
2725 .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2