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)
27 .globl zfs_sha256_power8
28 .globl .zfs_sha256_power8
29 .type zfs_sha256_power8,@function
33 .quad .zfs_sha256_power8,.TOC.@tocbase,0
41 .globl zfs_sha256_power8
42 .type zfs_sha256_power8,@function
45 .localentry zfs_sha256_power8,0
689 .byte 0,12,4,1,0x80,6,3,0
691 #if (!defined(_CALL_ELF) || _CALL_ELF == 1)
692 .size .zfs_sha256_power8,.-.zfs_sha256_power8
693 .size zfs_sha256_power8,.-.zfs_sha256_power8
695 .size zfs_sha256_power8,.-zfs_sha256_power8
706 .byte 0,12,0x14,0,0,0,0,0
708 .long 0x428a2f98,0x428a2f98,0x428a2f98,0x428a2f98
709 .long 0x71374491,0x71374491,0x71374491,0x71374491
710 .long 0xb5c0fbcf,0xb5c0fbcf,0xb5c0fbcf,0xb5c0fbcf
711 .long 0xe9b5dba5,0xe9b5dba5,0xe9b5dba5,0xe9b5dba5
712 .long 0x3956c25b,0x3956c25b,0x3956c25b,0x3956c25b
713 .long 0x59f111f1,0x59f111f1,0x59f111f1,0x59f111f1
714 .long 0x923f82a4,0x923f82a4,0x923f82a4,0x923f82a4
715 .long 0xab1c5ed5,0xab1c5ed5,0xab1c5ed5,0xab1c5ed5
716 .long 0xd807aa98,0xd807aa98,0xd807aa98,0xd807aa98
717 .long 0x12835b01,0x12835b01,0x12835b01,0x12835b01
718 .long 0x243185be,0x243185be,0x243185be,0x243185be
719 .long 0x550c7dc3,0x550c7dc3,0x550c7dc3,0x550c7dc3
720 .long 0x72be5d74,0x72be5d74,0x72be5d74,0x72be5d74
721 .long 0x80deb1fe,0x80deb1fe,0x80deb1fe,0x80deb1fe
722 .long 0x9bdc06a7,0x9bdc06a7,0x9bdc06a7,0x9bdc06a7
723 .long 0xc19bf174,0xc19bf174,0xc19bf174,0xc19bf174
724 .long 0xe49b69c1,0xe49b69c1,0xe49b69c1,0xe49b69c1
725 .long 0xefbe4786,0xefbe4786,0xefbe4786,0xefbe4786
726 .long 0x0fc19dc6,0x0fc19dc6,0x0fc19dc6,0x0fc19dc6
727 .long 0x240ca1cc,0x240ca1cc,0x240ca1cc,0x240ca1cc
728 .long 0x2de92c6f,0x2de92c6f,0x2de92c6f,0x2de92c6f
729 .long 0x4a7484aa,0x4a7484aa,0x4a7484aa,0x4a7484aa
730 .long 0x5cb0a9dc,0x5cb0a9dc,0x5cb0a9dc,0x5cb0a9dc
731 .long 0x76f988da,0x76f988da,0x76f988da,0x76f988da
732 .long 0x983e5152,0x983e5152,0x983e5152,0x983e5152
733 .long 0xa831c66d,0xa831c66d,0xa831c66d,0xa831c66d
734 .long 0xb00327c8,0xb00327c8,0xb00327c8,0xb00327c8
735 .long 0xbf597fc7,0xbf597fc7,0xbf597fc7,0xbf597fc7
736 .long 0xc6e00bf3,0xc6e00bf3,0xc6e00bf3,0xc6e00bf3
737 .long 0xd5a79147,0xd5a79147,0xd5a79147,0xd5a79147
738 .long 0x06ca6351,0x06ca6351,0x06ca6351,0x06ca6351
739 .long 0x14292967,0x14292967,0x14292967,0x14292967
740 .long 0x27b70a85,0x27b70a85,0x27b70a85,0x27b70a85
741 .long 0x2e1b2138,0x2e1b2138,0x2e1b2138,0x2e1b2138
742 .long 0x4d2c6dfc,0x4d2c6dfc,0x4d2c6dfc,0x4d2c6dfc
743 .long 0x53380d13,0x53380d13,0x53380d13,0x53380d13
744 .long 0x650a7354,0x650a7354,0x650a7354,0x650a7354
745 .long 0x766a0abb,0x766a0abb,0x766a0abb,0x766a0abb
746 .long 0x81c2c92e,0x81c2c92e,0x81c2c92e,0x81c2c92e
747 .long 0x92722c85,0x92722c85,0x92722c85,0x92722c85
748 .long 0xa2bfe8a1,0xa2bfe8a1,0xa2bfe8a1,0xa2bfe8a1
749 .long 0xa81a664b,0xa81a664b,0xa81a664b,0xa81a664b
750 .long 0xc24b8b70,0xc24b8b70,0xc24b8b70,0xc24b8b70
751 .long 0xc76c51a3,0xc76c51a3,0xc76c51a3,0xc76c51a3
752 .long 0xd192e819,0xd192e819,0xd192e819,0xd192e819
753 .long 0xd6990624,0xd6990624,0xd6990624,0xd6990624
754 .long 0xf40e3585,0xf40e3585,0xf40e3585,0xf40e3585
755 .long 0x106aa070,0x106aa070,0x106aa070,0x106aa070
756 .long 0x19a4c116,0x19a4c116,0x19a4c116,0x19a4c116
757 .long 0x1e376c08,0x1e376c08,0x1e376c08,0x1e376c08
758 .long 0x2748774c,0x2748774c,0x2748774c,0x2748774c
759 .long 0x34b0bcb5,0x34b0bcb5,0x34b0bcb5,0x34b0bcb5
760 .long 0x391c0cb3,0x391c0cb3,0x391c0cb3,0x391c0cb3
761 .long 0x4ed8aa4a,0x4ed8aa4a,0x4ed8aa4a,0x4ed8aa4a
762 .long 0x5b9cca4f,0x5b9cca4f,0x5b9cca4f,0x5b9cca4f
763 .long 0x682e6ff3,0x682e6ff3,0x682e6ff3,0x682e6ff3
764 .long 0x748f82ee,0x748f82ee,0x748f82ee,0x748f82ee
765 .long 0x78a5636f,0x78a5636f,0x78a5636f,0x78a5636f
766 .long 0x84c87814,0x84c87814,0x84c87814,0x84c87814
767 .long 0x8cc70208,0x8cc70208,0x8cc70208,0x8cc70208
768 .long 0x90befffa,0x90befffa,0x90befffa,0x90befffa
769 .long 0xa4506ceb,0xa4506ceb,0xa4506ceb,0xa4506ceb
770 .long 0xbef9a3f7,0xbef9a3f7,0xbef9a3f7,0xbef9a3f7
771 .long 0xc67178f2,0xc67178f2,0xc67178f2,0xc67178f2
773 .long 0x00010203,0x10111213,0x10111213,0x10111213
774 .long 0x00010203,0x04050607,0x10111213,0x10111213
775 .long 0x00010203,0x04050607,0x08090a0b,0x10111213
777 #elif (defined(__PPC64__) && defined(__LITTLE_ENDIAN__))
782 .globl zfs_sha256_power8
783 .type zfs_sha256_power8,@function
786 .localentry zfs_sha256_power8,0
1438 .byte 0,12,4,1,0x80,6,3,0
1440 .size zfs_sha256_power8,.-zfs_sha256_power8
1450 .byte 0,12,0x14,0,0,0,0,0
1452 .long 0x428a2f98,0x428a2f98,0x428a2f98,0x428a2f98
1453 .long 0x71374491,0x71374491,0x71374491,0x71374491
1454 .long 0xb5c0fbcf,0xb5c0fbcf,0xb5c0fbcf,0xb5c0fbcf
1455 .long 0xe9b5dba5,0xe9b5dba5,0xe9b5dba5,0xe9b5dba5
1456 .long 0x3956c25b,0x3956c25b,0x3956c25b,0x3956c25b
1457 .long 0x59f111f1,0x59f111f1,0x59f111f1,0x59f111f1
1458 .long 0x923f82a4,0x923f82a4,0x923f82a4,0x923f82a4
1459 .long 0xab1c5ed5,0xab1c5ed5,0xab1c5ed5,0xab1c5ed5
1460 .long 0xd807aa98,0xd807aa98,0xd807aa98,0xd807aa98
1461 .long 0x12835b01,0x12835b01,0x12835b01,0x12835b01
1462 .long 0x243185be,0x243185be,0x243185be,0x243185be
1463 .long 0x550c7dc3,0x550c7dc3,0x550c7dc3,0x550c7dc3
1464 .long 0x72be5d74,0x72be5d74,0x72be5d74,0x72be5d74
1465 .long 0x80deb1fe,0x80deb1fe,0x80deb1fe,0x80deb1fe
1466 .long 0x9bdc06a7,0x9bdc06a7,0x9bdc06a7,0x9bdc06a7
1467 .long 0xc19bf174,0xc19bf174,0xc19bf174,0xc19bf174
1468 .long 0xe49b69c1,0xe49b69c1,0xe49b69c1,0xe49b69c1
1469 .long 0xefbe4786,0xefbe4786,0xefbe4786,0xefbe4786
1470 .long 0x0fc19dc6,0x0fc19dc6,0x0fc19dc6,0x0fc19dc6
1471 .long 0x240ca1cc,0x240ca1cc,0x240ca1cc,0x240ca1cc
1472 .long 0x2de92c6f,0x2de92c6f,0x2de92c6f,0x2de92c6f
1473 .long 0x4a7484aa,0x4a7484aa,0x4a7484aa,0x4a7484aa
1474 .long 0x5cb0a9dc,0x5cb0a9dc,0x5cb0a9dc,0x5cb0a9dc
1475 .long 0x76f988da,0x76f988da,0x76f988da,0x76f988da
1476 .long 0x983e5152,0x983e5152,0x983e5152,0x983e5152
1477 .long 0xa831c66d,0xa831c66d,0xa831c66d,0xa831c66d
1478 .long 0xb00327c8,0xb00327c8,0xb00327c8,0xb00327c8
1479 .long 0xbf597fc7,0xbf597fc7,0xbf597fc7,0xbf597fc7
1480 .long 0xc6e00bf3,0xc6e00bf3,0xc6e00bf3,0xc6e00bf3
1481 .long 0xd5a79147,0xd5a79147,0xd5a79147,0xd5a79147
1482 .long 0x06ca6351,0x06ca6351,0x06ca6351,0x06ca6351
1483 .long 0x14292967,0x14292967,0x14292967,0x14292967
1484 .long 0x27b70a85,0x27b70a85,0x27b70a85,0x27b70a85
1485 .long 0x2e1b2138,0x2e1b2138,0x2e1b2138,0x2e1b2138
1486 .long 0x4d2c6dfc,0x4d2c6dfc,0x4d2c6dfc,0x4d2c6dfc
1487 .long 0x53380d13,0x53380d13,0x53380d13,0x53380d13
1488 .long 0x650a7354,0x650a7354,0x650a7354,0x650a7354
1489 .long 0x766a0abb,0x766a0abb,0x766a0abb,0x766a0abb
1490 .long 0x81c2c92e,0x81c2c92e,0x81c2c92e,0x81c2c92e
1491 .long 0x92722c85,0x92722c85,0x92722c85,0x92722c85
1492 .long 0xa2bfe8a1,0xa2bfe8a1,0xa2bfe8a1,0xa2bfe8a1
1493 .long 0xa81a664b,0xa81a664b,0xa81a664b,0xa81a664b
1494 .long 0xc24b8b70,0xc24b8b70,0xc24b8b70,0xc24b8b70
1495 .long 0xc76c51a3,0xc76c51a3,0xc76c51a3,0xc76c51a3
1496 .long 0xd192e819,0xd192e819,0xd192e819,0xd192e819
1497 .long 0xd6990624,0xd6990624,0xd6990624,0xd6990624
1498 .long 0xf40e3585,0xf40e3585,0xf40e3585,0xf40e3585
1499 .long 0x106aa070,0x106aa070,0x106aa070,0x106aa070
1500 .long 0x19a4c116,0x19a4c116,0x19a4c116,0x19a4c116
1501 .long 0x1e376c08,0x1e376c08,0x1e376c08,0x1e376c08
1502 .long 0x2748774c,0x2748774c,0x2748774c,0x2748774c
1503 .long 0x34b0bcb5,0x34b0bcb5,0x34b0bcb5,0x34b0bcb5
1504 .long 0x391c0cb3,0x391c0cb3,0x391c0cb3,0x391c0cb3
1505 .long 0x4ed8aa4a,0x4ed8aa4a,0x4ed8aa4a,0x4ed8aa4a
1506 .long 0x5b9cca4f,0x5b9cca4f,0x5b9cca4f,0x5b9cca4f
1507 .long 0x682e6ff3,0x682e6ff3,0x682e6ff3,0x682e6ff3
1508 .long 0x748f82ee,0x748f82ee,0x748f82ee,0x748f82ee
1509 .long 0x78a5636f,0x78a5636f,0x78a5636f,0x78a5636f
1510 .long 0x84c87814,0x84c87814,0x84c87814,0x84c87814
1511 .long 0x8cc70208,0x8cc70208,0x8cc70208,0x8cc70208
1512 .long 0x90befffa,0x90befffa,0x90befffa,0x90befffa
1513 .long 0xa4506ceb,0xa4506ceb,0xa4506ceb,0xa4506ceb
1514 .long 0xbef9a3f7,0xbef9a3f7,0xbef9a3f7,0xbef9a3f7
1515 .long 0xc67178f2,0xc67178f2,0xc67178f2,0xc67178f2
1517 .long 0x10111213,0x10111213,0x10111213,0x00010203
1518 .long 0x10111213,0x10111213,0x04050607,0x00010203
1519 .long 0x10111213,0x08090a0b,0x04050607,0x00010203