18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 OR MIT 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. 48c2ecf20Sopenharmony_ci * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <crypto/curve25519.h> 88c2ecf20Sopenharmony_ci#include <crypto/internal/kpp.h> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/types.h> 118c2ecf20Sopenharmony_ci#include <linux/jump_label.h> 128c2ecf20Sopenharmony_ci#include <linux/kernel.h> 138c2ecf20Sopenharmony_ci#include <linux/module.h> 148c2ecf20Sopenharmony_ci#include <linux/scatterlist.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <asm/cpufeature.h> 178c2ecf20Sopenharmony_ci#include <asm/processor.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_cistatic __always_inline u64 eq_mask(u64 a, u64 b) 208c2ecf20Sopenharmony_ci{ 218c2ecf20Sopenharmony_ci u64 x = a ^ b; 228c2ecf20Sopenharmony_ci u64 minus_x = ~x + (u64)1U; 238c2ecf20Sopenharmony_ci u64 x_or_minus_x = x | minus_x; 248c2ecf20Sopenharmony_ci u64 xnx = x_or_minus_x >> (u32)63U; 258c2ecf20Sopenharmony_ci return xnx - (u64)1U; 268c2ecf20Sopenharmony_ci} 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistatic __always_inline u64 gte_mask(u64 a, u64 b) 298c2ecf20Sopenharmony_ci{ 308c2ecf20Sopenharmony_ci u64 x = a; 318c2ecf20Sopenharmony_ci u64 y = b; 328c2ecf20Sopenharmony_ci u64 x_xor_y = x ^ y; 338c2ecf20Sopenharmony_ci u64 x_sub_y = x - y; 348c2ecf20Sopenharmony_ci u64 x_sub_y_xor_y = x_sub_y ^ y; 358c2ecf20Sopenharmony_ci u64 q = x_xor_y | x_sub_y_xor_y; 368c2ecf20Sopenharmony_ci u64 x_xor_q = x ^ q; 378c2ecf20Sopenharmony_ci u64 x_xor_q_ = x_xor_q >> (u32)63U; 388c2ecf20Sopenharmony_ci return x_xor_q_ - (u64)1U; 398c2ecf20Sopenharmony_ci} 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* Computes the addition of four-element f1 with value in f2 428c2ecf20Sopenharmony_ci * and returns the carry (if any) */ 438c2ecf20Sopenharmony_cistatic inline u64 add_scalar(u64 *out, const u64 *f1, u64 f2) 448c2ecf20Sopenharmony_ci{ 458c2ecf20Sopenharmony_ci u64 carry_r; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci asm volatile( 488c2ecf20Sopenharmony_ci /* Clear registers to propagate the carry bit */ 498c2ecf20Sopenharmony_ci " xor %%r8d, %%r8d;" 508c2ecf20Sopenharmony_ci " xor %%r9d, %%r9d;" 518c2ecf20Sopenharmony_ci " xor %%r10d, %%r10d;" 528c2ecf20Sopenharmony_ci " xor %%r11d, %%r11d;" 538c2ecf20Sopenharmony_ci " xor %k1, %k1;" 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci /* Begin addition chain */ 568c2ecf20Sopenharmony_ci " addq 0(%3), %0;" 578c2ecf20Sopenharmony_ci " movq %0, 0(%2);" 588c2ecf20Sopenharmony_ci " adcxq 8(%3), %%r8;" 598c2ecf20Sopenharmony_ci " movq %%r8, 8(%2);" 608c2ecf20Sopenharmony_ci " adcxq 16(%3), %%r9;" 618c2ecf20Sopenharmony_ci " movq %%r9, 16(%2);" 628c2ecf20Sopenharmony_ci " adcxq 24(%3), %%r10;" 638c2ecf20Sopenharmony_ci " movq %%r10, 24(%2);" 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci /* Return the carry bit in a register */ 668c2ecf20Sopenharmony_ci " adcx %%r11, %1;" 678c2ecf20Sopenharmony_ci : "+&r" (f2), "=&r" (carry_r) 688c2ecf20Sopenharmony_ci : "r" (out), "r" (f1) 698c2ecf20Sopenharmony_ci : "%r8", "%r9", "%r10", "%r11", "memory", "cc" 708c2ecf20Sopenharmony_ci ); 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci return carry_r; 738c2ecf20Sopenharmony_ci} 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci/* Computes the field addition of two field elements */ 768c2ecf20Sopenharmony_cistatic inline void fadd(u64 *out, const u64 *f1, const u64 *f2) 778c2ecf20Sopenharmony_ci{ 788c2ecf20Sopenharmony_ci asm volatile( 798c2ecf20Sopenharmony_ci /* Compute the raw addition of f1 + f2 */ 808c2ecf20Sopenharmony_ci " movq 0(%0), %%r8;" 818c2ecf20Sopenharmony_ci " addq 0(%2), %%r8;" 828c2ecf20Sopenharmony_ci " movq 8(%0), %%r9;" 838c2ecf20Sopenharmony_ci " adcxq 8(%2), %%r9;" 848c2ecf20Sopenharmony_ci " movq 16(%0), %%r10;" 858c2ecf20Sopenharmony_ci " adcxq 16(%2), %%r10;" 868c2ecf20Sopenharmony_ci " movq 24(%0), %%r11;" 878c2ecf20Sopenharmony_ci " adcxq 24(%2), %%r11;" 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci /* Wrap the result back into the field */ 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci /* Step 1: Compute carry*38 */ 928c2ecf20Sopenharmony_ci " mov $0, %%rax;" 938c2ecf20Sopenharmony_ci " mov $38, %0;" 948c2ecf20Sopenharmony_ci " cmovc %0, %%rax;" 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci /* Step 2: Add carry*38 to the original sum */ 978c2ecf20Sopenharmony_ci " xor %%ecx, %%ecx;" 988c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 998c2ecf20Sopenharmony_ci " adcx %%rcx, %%r9;" 1008c2ecf20Sopenharmony_ci " movq %%r9, 8(%1);" 1018c2ecf20Sopenharmony_ci " adcx %%rcx, %%r10;" 1028c2ecf20Sopenharmony_ci " movq %%r10, 16(%1);" 1038c2ecf20Sopenharmony_ci " adcx %%rcx, %%r11;" 1048c2ecf20Sopenharmony_ci " movq %%r11, 24(%1);" 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ 1078c2ecf20Sopenharmony_ci " mov $0, %%rax;" 1088c2ecf20Sopenharmony_ci " cmovc %0, %%rax;" 1098c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 1108c2ecf20Sopenharmony_ci " movq %%r8, 0(%1);" 1118c2ecf20Sopenharmony_ci : "+&r" (f2) 1128c2ecf20Sopenharmony_ci : "r" (out), "r" (f1) 1138c2ecf20Sopenharmony_ci : "%rax", "%rcx", "%r8", "%r9", "%r10", "%r11", "memory", "cc" 1148c2ecf20Sopenharmony_ci ); 1158c2ecf20Sopenharmony_ci} 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci/* Computes the field substraction of two field elements */ 1188c2ecf20Sopenharmony_cistatic inline void fsub(u64 *out, const u64 *f1, const u64 *f2) 1198c2ecf20Sopenharmony_ci{ 1208c2ecf20Sopenharmony_ci asm volatile( 1218c2ecf20Sopenharmony_ci /* Compute the raw substraction of f1-f2 */ 1228c2ecf20Sopenharmony_ci " movq 0(%1), %%r8;" 1238c2ecf20Sopenharmony_ci " subq 0(%2), %%r8;" 1248c2ecf20Sopenharmony_ci " movq 8(%1), %%r9;" 1258c2ecf20Sopenharmony_ci " sbbq 8(%2), %%r9;" 1268c2ecf20Sopenharmony_ci " movq 16(%1), %%r10;" 1278c2ecf20Sopenharmony_ci " sbbq 16(%2), %%r10;" 1288c2ecf20Sopenharmony_ci " movq 24(%1), %%r11;" 1298c2ecf20Sopenharmony_ci " sbbq 24(%2), %%r11;" 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci /* Wrap the result back into the field */ 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci /* Step 1: Compute carry*38 */ 1348c2ecf20Sopenharmony_ci " mov $0, %%rax;" 1358c2ecf20Sopenharmony_ci " mov $38, %%rcx;" 1368c2ecf20Sopenharmony_ci " cmovc %%rcx, %%rax;" 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci /* Step 2: Substract carry*38 from the original difference */ 1398c2ecf20Sopenharmony_ci " sub %%rax, %%r8;" 1408c2ecf20Sopenharmony_ci " sbb $0, %%r9;" 1418c2ecf20Sopenharmony_ci " sbb $0, %%r10;" 1428c2ecf20Sopenharmony_ci " sbb $0, %%r11;" 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ 1458c2ecf20Sopenharmony_ci " mov $0, %%rax;" 1468c2ecf20Sopenharmony_ci " cmovc %%rcx, %%rax;" 1478c2ecf20Sopenharmony_ci " sub %%rax, %%r8;" 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci /* Store the result */ 1508c2ecf20Sopenharmony_ci " movq %%r8, 0(%0);" 1518c2ecf20Sopenharmony_ci " movq %%r9, 8(%0);" 1528c2ecf20Sopenharmony_ci " movq %%r10, 16(%0);" 1538c2ecf20Sopenharmony_ci " movq %%r11, 24(%0);" 1548c2ecf20Sopenharmony_ci : 1558c2ecf20Sopenharmony_ci : "r" (out), "r" (f1), "r" (f2) 1568c2ecf20Sopenharmony_ci : "%rax", "%rcx", "%r8", "%r9", "%r10", "%r11", "memory", "cc" 1578c2ecf20Sopenharmony_ci ); 1588c2ecf20Sopenharmony_ci} 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci/* Computes a field multiplication: out <- f1 * f2 1618c2ecf20Sopenharmony_ci * Uses the 8-element buffer tmp for intermediate results */ 1628c2ecf20Sopenharmony_cistatic inline void fmul(u64 *out, const u64 *f1, const u64 *f2, u64 *tmp) 1638c2ecf20Sopenharmony_ci{ 1648c2ecf20Sopenharmony_ci asm volatile( 1658c2ecf20Sopenharmony_ci /* Compute the raw multiplication: tmp <- src1 * src2 */ 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci /* Compute src1[0] * src2 */ 1688c2ecf20Sopenharmony_ci " movq 0(%1), %%rdx;" 1698c2ecf20Sopenharmony_ci " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " movq %%r8, 0(%0);" 1708c2ecf20Sopenharmony_ci " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " movq %%r10, 8(%0);" 1718c2ecf20Sopenharmony_ci " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" 1728c2ecf20Sopenharmony_ci " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " mov $0, %%rax;" 1738c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" 1748c2ecf20Sopenharmony_ci /* Compute src1[1] * src2 */ 1758c2ecf20Sopenharmony_ci " movq 8(%1), %%rdx;" 1768c2ecf20Sopenharmony_ci " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 8(%0), %%r8;" " movq %%r8, 8(%0);" 1778c2ecf20Sopenharmony_ci " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 16(%0);" 1788c2ecf20Sopenharmony_ci " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" 1798c2ecf20Sopenharmony_ci " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" 1808c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" 1818c2ecf20Sopenharmony_ci /* Compute src1[2] * src2 */ 1828c2ecf20Sopenharmony_ci " movq 16(%1), %%rdx;" 1838c2ecf20Sopenharmony_ci " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 16(%0), %%r8;" " movq %%r8, 16(%0);" 1848c2ecf20Sopenharmony_ci " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 24(%0);" 1858c2ecf20Sopenharmony_ci " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" 1868c2ecf20Sopenharmony_ci " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" 1878c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" 1888c2ecf20Sopenharmony_ci /* Compute src1[3] * src2 */ 1898c2ecf20Sopenharmony_ci " movq 24(%1), %%rdx;" 1908c2ecf20Sopenharmony_ci " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 24(%0), %%r8;" " movq %%r8, 24(%0);" 1918c2ecf20Sopenharmony_ci " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 32(%0);" 1928c2ecf20Sopenharmony_ci " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " movq %%rbx, 40(%0);" " mov $0, %%r8;" 1938c2ecf20Sopenharmony_ci " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " movq %%r14, 48(%0);" " mov $0, %%rax;" 1948c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" " movq %%rax, 56(%0);" 1958c2ecf20Sopenharmony_ci /* Line up pointers */ 1968c2ecf20Sopenharmony_ci " mov %0, %1;" 1978c2ecf20Sopenharmony_ci " mov %2, %0;" 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci /* Wrap the result back into the field */ 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ 2028c2ecf20Sopenharmony_ci " mov $38, %%rdx;" 2038c2ecf20Sopenharmony_ci " mulxq 32(%1), %%r8, %%r13;" 2048c2ecf20Sopenharmony_ci " xor %k3, %k3;" 2058c2ecf20Sopenharmony_ci " adoxq 0(%1), %%r8;" 2068c2ecf20Sopenharmony_ci " mulxq 40(%1), %%r9, %%rbx;" 2078c2ecf20Sopenharmony_ci " adcx %%r13, %%r9;" 2088c2ecf20Sopenharmony_ci " adoxq 8(%1), %%r9;" 2098c2ecf20Sopenharmony_ci " mulxq 48(%1), %%r10, %%r13;" 2108c2ecf20Sopenharmony_ci " adcx %%rbx, %%r10;" 2118c2ecf20Sopenharmony_ci " adoxq 16(%1), %%r10;" 2128c2ecf20Sopenharmony_ci " mulxq 56(%1), %%r11, %%rax;" 2138c2ecf20Sopenharmony_ci " adcx %%r13, %%r11;" 2148c2ecf20Sopenharmony_ci " adoxq 24(%1), %%r11;" 2158c2ecf20Sopenharmony_ci " adcx %3, %%rax;" 2168c2ecf20Sopenharmony_ci " adox %3, %%rax;" 2178c2ecf20Sopenharmony_ci " imul %%rdx, %%rax;" 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci /* Step 2: Fold the carry back into dst */ 2208c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 2218c2ecf20Sopenharmony_ci " adcx %3, %%r9;" 2228c2ecf20Sopenharmony_ci " movq %%r9, 8(%0);" 2238c2ecf20Sopenharmony_ci " adcx %3, %%r10;" 2248c2ecf20Sopenharmony_ci " movq %%r10, 16(%0);" 2258c2ecf20Sopenharmony_ci " adcx %3, %%r11;" 2268c2ecf20Sopenharmony_ci " movq %%r11, 24(%0);" 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ 2298c2ecf20Sopenharmony_ci " mov $0, %%rax;" 2308c2ecf20Sopenharmony_ci " cmovc %%rdx, %%rax;" 2318c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 2328c2ecf20Sopenharmony_ci " movq %%r8, 0(%0);" 2338c2ecf20Sopenharmony_ci : "+&r" (tmp), "+&r" (f1), "+&r" (out), "+&r" (f2) 2348c2ecf20Sopenharmony_ci : 2358c2ecf20Sopenharmony_ci : "%rax", "%rdx", "%r8", "%r9", "%r10", "%r11", "%rbx", "%r13", "%r14", "memory", "cc" 2368c2ecf20Sopenharmony_ci ); 2378c2ecf20Sopenharmony_ci} 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci/* Computes two field multiplications: 2408c2ecf20Sopenharmony_ci * out[0] <- f1[0] * f2[0] 2418c2ecf20Sopenharmony_ci * out[1] <- f1[1] * f2[1] 2428c2ecf20Sopenharmony_ci * Uses the 16-element buffer tmp for intermediate results. */ 2438c2ecf20Sopenharmony_cistatic inline void fmul2(u64 *out, const u64 *f1, const u64 *f2, u64 *tmp) 2448c2ecf20Sopenharmony_ci{ 2458c2ecf20Sopenharmony_ci asm volatile( 2468c2ecf20Sopenharmony_ci /* Compute the raw multiplication tmp[0] <- f1[0] * f2[0] */ 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci /* Compute src1[0] * src2 */ 2498c2ecf20Sopenharmony_ci " movq 0(%1), %%rdx;" 2508c2ecf20Sopenharmony_ci " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " movq %%r8, 0(%0);" 2518c2ecf20Sopenharmony_ci " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " movq %%r10, 8(%0);" 2528c2ecf20Sopenharmony_ci " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" 2538c2ecf20Sopenharmony_ci " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " mov $0, %%rax;" 2548c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" 2558c2ecf20Sopenharmony_ci /* Compute src1[1] * src2 */ 2568c2ecf20Sopenharmony_ci " movq 8(%1), %%rdx;" 2578c2ecf20Sopenharmony_ci " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 8(%0), %%r8;" " movq %%r8, 8(%0);" 2588c2ecf20Sopenharmony_ci " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 16(%0);" 2598c2ecf20Sopenharmony_ci " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" 2608c2ecf20Sopenharmony_ci " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" 2618c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" 2628c2ecf20Sopenharmony_ci /* Compute src1[2] * src2 */ 2638c2ecf20Sopenharmony_ci " movq 16(%1), %%rdx;" 2648c2ecf20Sopenharmony_ci " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 16(%0), %%r8;" " movq %%r8, 16(%0);" 2658c2ecf20Sopenharmony_ci " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 24(%0);" 2668c2ecf20Sopenharmony_ci " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" 2678c2ecf20Sopenharmony_ci " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" 2688c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" 2698c2ecf20Sopenharmony_ci /* Compute src1[3] * src2 */ 2708c2ecf20Sopenharmony_ci " movq 24(%1), %%rdx;" 2718c2ecf20Sopenharmony_ci " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 24(%0), %%r8;" " movq %%r8, 24(%0);" 2728c2ecf20Sopenharmony_ci " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 32(%0);" 2738c2ecf20Sopenharmony_ci " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " movq %%rbx, 40(%0);" " mov $0, %%r8;" 2748c2ecf20Sopenharmony_ci " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " movq %%r14, 48(%0);" " mov $0, %%rax;" 2758c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" " movq %%rax, 56(%0);" 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci /* Compute the raw multiplication tmp[1] <- f1[1] * f2[1] */ 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci /* Compute src1[0] * src2 */ 2808c2ecf20Sopenharmony_ci " movq 32(%1), %%rdx;" 2818c2ecf20Sopenharmony_ci " mulxq 32(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " movq %%r8, 64(%0);" 2828c2ecf20Sopenharmony_ci " mulxq 40(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " movq %%r10, 72(%0);" 2838c2ecf20Sopenharmony_ci " mulxq 48(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" 2848c2ecf20Sopenharmony_ci " mulxq 56(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " mov $0, %%rax;" 2858c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" 2868c2ecf20Sopenharmony_ci /* Compute src1[1] * src2 */ 2878c2ecf20Sopenharmony_ci " movq 40(%1), %%rdx;" 2888c2ecf20Sopenharmony_ci " mulxq 32(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 72(%0), %%r8;" " movq %%r8, 72(%0);" 2898c2ecf20Sopenharmony_ci " mulxq 40(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 80(%0);" 2908c2ecf20Sopenharmony_ci " mulxq 48(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" 2918c2ecf20Sopenharmony_ci " mulxq 56(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" 2928c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" 2938c2ecf20Sopenharmony_ci /* Compute src1[2] * src2 */ 2948c2ecf20Sopenharmony_ci " movq 48(%1), %%rdx;" 2958c2ecf20Sopenharmony_ci " mulxq 32(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 80(%0), %%r8;" " movq %%r8, 80(%0);" 2968c2ecf20Sopenharmony_ci " mulxq 40(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 88(%0);" 2978c2ecf20Sopenharmony_ci " mulxq 48(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" 2988c2ecf20Sopenharmony_ci " mulxq 56(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" 2998c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" 3008c2ecf20Sopenharmony_ci /* Compute src1[3] * src2 */ 3018c2ecf20Sopenharmony_ci " movq 56(%1), %%rdx;" 3028c2ecf20Sopenharmony_ci " mulxq 32(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 88(%0), %%r8;" " movq %%r8, 88(%0);" 3038c2ecf20Sopenharmony_ci " mulxq 40(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 96(%0);" 3048c2ecf20Sopenharmony_ci " mulxq 48(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " movq %%rbx, 104(%0);" " mov $0, %%r8;" 3058c2ecf20Sopenharmony_ci " mulxq 56(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " movq %%r14, 112(%0);" " mov $0, %%rax;" 3068c2ecf20Sopenharmony_ci " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" " movq %%rax, 120(%0);" 3078c2ecf20Sopenharmony_ci /* Line up pointers */ 3088c2ecf20Sopenharmony_ci " mov %0, %1;" 3098c2ecf20Sopenharmony_ci " mov %2, %0;" 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci /* Wrap the results back into the field */ 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ 3148c2ecf20Sopenharmony_ci " mov $38, %%rdx;" 3158c2ecf20Sopenharmony_ci " mulxq 32(%1), %%r8, %%r13;" 3168c2ecf20Sopenharmony_ci " xor %k3, %k3;" 3178c2ecf20Sopenharmony_ci " adoxq 0(%1), %%r8;" 3188c2ecf20Sopenharmony_ci " mulxq 40(%1), %%r9, %%rbx;" 3198c2ecf20Sopenharmony_ci " adcx %%r13, %%r9;" 3208c2ecf20Sopenharmony_ci " adoxq 8(%1), %%r9;" 3218c2ecf20Sopenharmony_ci " mulxq 48(%1), %%r10, %%r13;" 3228c2ecf20Sopenharmony_ci " adcx %%rbx, %%r10;" 3238c2ecf20Sopenharmony_ci " adoxq 16(%1), %%r10;" 3248c2ecf20Sopenharmony_ci " mulxq 56(%1), %%r11, %%rax;" 3258c2ecf20Sopenharmony_ci " adcx %%r13, %%r11;" 3268c2ecf20Sopenharmony_ci " adoxq 24(%1), %%r11;" 3278c2ecf20Sopenharmony_ci " adcx %3, %%rax;" 3288c2ecf20Sopenharmony_ci " adox %3, %%rax;" 3298c2ecf20Sopenharmony_ci " imul %%rdx, %%rax;" 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ci /* Step 2: Fold the carry back into dst */ 3328c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 3338c2ecf20Sopenharmony_ci " adcx %3, %%r9;" 3348c2ecf20Sopenharmony_ci " movq %%r9, 8(%0);" 3358c2ecf20Sopenharmony_ci " adcx %3, %%r10;" 3368c2ecf20Sopenharmony_ci " movq %%r10, 16(%0);" 3378c2ecf20Sopenharmony_ci " adcx %3, %%r11;" 3388c2ecf20Sopenharmony_ci " movq %%r11, 24(%0);" 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ 3418c2ecf20Sopenharmony_ci " mov $0, %%rax;" 3428c2ecf20Sopenharmony_ci " cmovc %%rdx, %%rax;" 3438c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 3448c2ecf20Sopenharmony_ci " movq %%r8, 0(%0);" 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ci /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ 3478c2ecf20Sopenharmony_ci " mov $38, %%rdx;" 3488c2ecf20Sopenharmony_ci " mulxq 96(%1), %%r8, %%r13;" 3498c2ecf20Sopenharmony_ci " xor %k3, %k3;" 3508c2ecf20Sopenharmony_ci " adoxq 64(%1), %%r8;" 3518c2ecf20Sopenharmony_ci " mulxq 104(%1), %%r9, %%rbx;" 3528c2ecf20Sopenharmony_ci " adcx %%r13, %%r9;" 3538c2ecf20Sopenharmony_ci " adoxq 72(%1), %%r9;" 3548c2ecf20Sopenharmony_ci " mulxq 112(%1), %%r10, %%r13;" 3558c2ecf20Sopenharmony_ci " adcx %%rbx, %%r10;" 3568c2ecf20Sopenharmony_ci " adoxq 80(%1), %%r10;" 3578c2ecf20Sopenharmony_ci " mulxq 120(%1), %%r11, %%rax;" 3588c2ecf20Sopenharmony_ci " adcx %%r13, %%r11;" 3598c2ecf20Sopenharmony_ci " adoxq 88(%1), %%r11;" 3608c2ecf20Sopenharmony_ci " adcx %3, %%rax;" 3618c2ecf20Sopenharmony_ci " adox %3, %%rax;" 3628c2ecf20Sopenharmony_ci " imul %%rdx, %%rax;" 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ci /* Step 2: Fold the carry back into dst */ 3658c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 3668c2ecf20Sopenharmony_ci " adcx %3, %%r9;" 3678c2ecf20Sopenharmony_ci " movq %%r9, 40(%0);" 3688c2ecf20Sopenharmony_ci " adcx %3, %%r10;" 3698c2ecf20Sopenharmony_ci " movq %%r10, 48(%0);" 3708c2ecf20Sopenharmony_ci " adcx %3, %%r11;" 3718c2ecf20Sopenharmony_ci " movq %%r11, 56(%0);" 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_ci /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ 3748c2ecf20Sopenharmony_ci " mov $0, %%rax;" 3758c2ecf20Sopenharmony_ci " cmovc %%rdx, %%rax;" 3768c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 3778c2ecf20Sopenharmony_ci " movq %%r8, 32(%0);" 3788c2ecf20Sopenharmony_ci : "+&r" (tmp), "+&r" (f1), "+&r" (out), "+&r" (f2) 3798c2ecf20Sopenharmony_ci : 3808c2ecf20Sopenharmony_ci : "%rax", "%rdx", "%r8", "%r9", "%r10", "%r11", "%rbx", "%r13", "%r14", "memory", "cc" 3818c2ecf20Sopenharmony_ci ); 3828c2ecf20Sopenharmony_ci} 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci/* Computes the field multiplication of four-element f1 with value in f2 */ 3858c2ecf20Sopenharmony_cistatic inline void fmul_scalar(u64 *out, const u64 *f1, u64 f2) 3868c2ecf20Sopenharmony_ci{ 3878c2ecf20Sopenharmony_ci register u64 f2_r asm("rdx") = f2; 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci asm volatile( 3908c2ecf20Sopenharmony_ci /* Compute the raw multiplication of f1*f2 */ 3918c2ecf20Sopenharmony_ci " mulxq 0(%2), %%r8, %%rcx;" /* f1[0]*f2 */ 3928c2ecf20Sopenharmony_ci " mulxq 8(%2), %%r9, %%rbx;" /* f1[1]*f2 */ 3938c2ecf20Sopenharmony_ci " add %%rcx, %%r9;" 3948c2ecf20Sopenharmony_ci " mov $0, %%rcx;" 3958c2ecf20Sopenharmony_ci " mulxq 16(%2), %%r10, %%r13;" /* f1[2]*f2 */ 3968c2ecf20Sopenharmony_ci " adcx %%rbx, %%r10;" 3978c2ecf20Sopenharmony_ci " mulxq 24(%2), %%r11, %%rax;" /* f1[3]*f2 */ 3988c2ecf20Sopenharmony_ci " adcx %%r13, %%r11;" 3998c2ecf20Sopenharmony_ci " adcx %%rcx, %%rax;" 4008c2ecf20Sopenharmony_ci 4018c2ecf20Sopenharmony_ci /* Wrap the result back into the field */ 4028c2ecf20Sopenharmony_ci 4038c2ecf20Sopenharmony_ci /* Step 1: Compute carry*38 */ 4048c2ecf20Sopenharmony_ci " mov $38, %%rdx;" 4058c2ecf20Sopenharmony_ci " imul %%rdx, %%rax;" 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_ci /* Step 2: Fold the carry back into dst */ 4088c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 4098c2ecf20Sopenharmony_ci " adcx %%rcx, %%r9;" 4108c2ecf20Sopenharmony_ci " movq %%r9, 8(%1);" 4118c2ecf20Sopenharmony_ci " adcx %%rcx, %%r10;" 4128c2ecf20Sopenharmony_ci " movq %%r10, 16(%1);" 4138c2ecf20Sopenharmony_ci " adcx %%rcx, %%r11;" 4148c2ecf20Sopenharmony_ci " movq %%r11, 24(%1);" 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ci /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ 4178c2ecf20Sopenharmony_ci " mov $0, %%rax;" 4188c2ecf20Sopenharmony_ci " cmovc %%rdx, %%rax;" 4198c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 4208c2ecf20Sopenharmony_ci " movq %%r8, 0(%1);" 4218c2ecf20Sopenharmony_ci : "+&r" (f2_r) 4228c2ecf20Sopenharmony_ci : "r" (out), "r" (f1) 4238c2ecf20Sopenharmony_ci : "%rax", "%rcx", "%r8", "%r9", "%r10", "%r11", "%rbx", "%r13", "memory", "cc" 4248c2ecf20Sopenharmony_ci ); 4258c2ecf20Sopenharmony_ci} 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_ci/* Computes p1 <- bit ? p2 : p1 in constant time */ 4288c2ecf20Sopenharmony_cistatic inline void cswap2(u64 bit, const u64 *p1, const u64 *p2) 4298c2ecf20Sopenharmony_ci{ 4308c2ecf20Sopenharmony_ci asm volatile( 4318c2ecf20Sopenharmony_ci /* Invert the polarity of bit to match cmov expectations */ 4328c2ecf20Sopenharmony_ci " add $18446744073709551615, %0;" 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_ci /* cswap p1[0], p2[0] */ 4358c2ecf20Sopenharmony_ci " movq 0(%1), %%r8;" 4368c2ecf20Sopenharmony_ci " movq 0(%2), %%r9;" 4378c2ecf20Sopenharmony_ci " mov %%r8, %%r10;" 4388c2ecf20Sopenharmony_ci " cmovc %%r9, %%r8;" 4398c2ecf20Sopenharmony_ci " cmovc %%r10, %%r9;" 4408c2ecf20Sopenharmony_ci " movq %%r8, 0(%1);" 4418c2ecf20Sopenharmony_ci " movq %%r9, 0(%2);" 4428c2ecf20Sopenharmony_ci 4438c2ecf20Sopenharmony_ci /* cswap p1[1], p2[1] */ 4448c2ecf20Sopenharmony_ci " movq 8(%1), %%r8;" 4458c2ecf20Sopenharmony_ci " movq 8(%2), %%r9;" 4468c2ecf20Sopenharmony_ci " mov %%r8, %%r10;" 4478c2ecf20Sopenharmony_ci " cmovc %%r9, %%r8;" 4488c2ecf20Sopenharmony_ci " cmovc %%r10, %%r9;" 4498c2ecf20Sopenharmony_ci " movq %%r8, 8(%1);" 4508c2ecf20Sopenharmony_ci " movq %%r9, 8(%2);" 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci /* cswap p1[2], p2[2] */ 4538c2ecf20Sopenharmony_ci " movq 16(%1), %%r8;" 4548c2ecf20Sopenharmony_ci " movq 16(%2), %%r9;" 4558c2ecf20Sopenharmony_ci " mov %%r8, %%r10;" 4568c2ecf20Sopenharmony_ci " cmovc %%r9, %%r8;" 4578c2ecf20Sopenharmony_ci " cmovc %%r10, %%r9;" 4588c2ecf20Sopenharmony_ci " movq %%r8, 16(%1);" 4598c2ecf20Sopenharmony_ci " movq %%r9, 16(%2);" 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_ci /* cswap p1[3], p2[3] */ 4628c2ecf20Sopenharmony_ci " movq 24(%1), %%r8;" 4638c2ecf20Sopenharmony_ci " movq 24(%2), %%r9;" 4648c2ecf20Sopenharmony_ci " mov %%r8, %%r10;" 4658c2ecf20Sopenharmony_ci " cmovc %%r9, %%r8;" 4668c2ecf20Sopenharmony_ci " cmovc %%r10, %%r9;" 4678c2ecf20Sopenharmony_ci " movq %%r8, 24(%1);" 4688c2ecf20Sopenharmony_ci " movq %%r9, 24(%2);" 4698c2ecf20Sopenharmony_ci 4708c2ecf20Sopenharmony_ci /* cswap p1[4], p2[4] */ 4718c2ecf20Sopenharmony_ci " movq 32(%1), %%r8;" 4728c2ecf20Sopenharmony_ci " movq 32(%2), %%r9;" 4738c2ecf20Sopenharmony_ci " mov %%r8, %%r10;" 4748c2ecf20Sopenharmony_ci " cmovc %%r9, %%r8;" 4758c2ecf20Sopenharmony_ci " cmovc %%r10, %%r9;" 4768c2ecf20Sopenharmony_ci " movq %%r8, 32(%1);" 4778c2ecf20Sopenharmony_ci " movq %%r9, 32(%2);" 4788c2ecf20Sopenharmony_ci 4798c2ecf20Sopenharmony_ci /* cswap p1[5], p2[5] */ 4808c2ecf20Sopenharmony_ci " movq 40(%1), %%r8;" 4818c2ecf20Sopenharmony_ci " movq 40(%2), %%r9;" 4828c2ecf20Sopenharmony_ci " mov %%r8, %%r10;" 4838c2ecf20Sopenharmony_ci " cmovc %%r9, %%r8;" 4848c2ecf20Sopenharmony_ci " cmovc %%r10, %%r9;" 4858c2ecf20Sopenharmony_ci " movq %%r8, 40(%1);" 4868c2ecf20Sopenharmony_ci " movq %%r9, 40(%2);" 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_ci /* cswap p1[6], p2[6] */ 4898c2ecf20Sopenharmony_ci " movq 48(%1), %%r8;" 4908c2ecf20Sopenharmony_ci " movq 48(%2), %%r9;" 4918c2ecf20Sopenharmony_ci " mov %%r8, %%r10;" 4928c2ecf20Sopenharmony_ci " cmovc %%r9, %%r8;" 4938c2ecf20Sopenharmony_ci " cmovc %%r10, %%r9;" 4948c2ecf20Sopenharmony_ci " movq %%r8, 48(%1);" 4958c2ecf20Sopenharmony_ci " movq %%r9, 48(%2);" 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_ci /* cswap p1[7], p2[7] */ 4988c2ecf20Sopenharmony_ci " movq 56(%1), %%r8;" 4998c2ecf20Sopenharmony_ci " movq 56(%2), %%r9;" 5008c2ecf20Sopenharmony_ci " mov %%r8, %%r10;" 5018c2ecf20Sopenharmony_ci " cmovc %%r9, %%r8;" 5028c2ecf20Sopenharmony_ci " cmovc %%r10, %%r9;" 5038c2ecf20Sopenharmony_ci " movq %%r8, 56(%1);" 5048c2ecf20Sopenharmony_ci " movq %%r9, 56(%2);" 5058c2ecf20Sopenharmony_ci : "+&r" (bit) 5068c2ecf20Sopenharmony_ci : "r" (p1), "r" (p2) 5078c2ecf20Sopenharmony_ci : "%r8", "%r9", "%r10", "memory", "cc" 5088c2ecf20Sopenharmony_ci ); 5098c2ecf20Sopenharmony_ci} 5108c2ecf20Sopenharmony_ci 5118c2ecf20Sopenharmony_ci/* Computes the square of a field element: out <- f * f 5128c2ecf20Sopenharmony_ci * Uses the 8-element buffer tmp for intermediate results */ 5138c2ecf20Sopenharmony_cistatic inline void fsqr(u64 *out, const u64 *f, u64 *tmp) 5148c2ecf20Sopenharmony_ci{ 5158c2ecf20Sopenharmony_ci asm volatile( 5168c2ecf20Sopenharmony_ci /* Compute the raw multiplication: tmp <- f * f */ 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_ci /* Step 1: Compute all partial products */ 5198c2ecf20Sopenharmony_ci " movq 0(%1), %%rdx;" /* f[0] */ 5208c2ecf20Sopenharmony_ci " mulxq 8(%1), %%r8, %%r14;" " xor %%r15d, %%r15d;" /* f[1]*f[0] */ 5218c2ecf20Sopenharmony_ci " mulxq 16(%1), %%r9, %%r10;" " adcx %%r14, %%r9;" /* f[2]*f[0] */ 5228c2ecf20Sopenharmony_ci " mulxq 24(%1), %%rax, %%rcx;" " adcx %%rax, %%r10;" /* f[3]*f[0] */ 5238c2ecf20Sopenharmony_ci " movq 24(%1), %%rdx;" /* f[3] */ 5248c2ecf20Sopenharmony_ci " mulxq 8(%1), %%r11, %%rbx;" " adcx %%rcx, %%r11;" /* f[1]*f[3] */ 5258c2ecf20Sopenharmony_ci " mulxq 16(%1), %%rax, %%r13;" " adcx %%rax, %%rbx;" /* f[2]*f[3] */ 5268c2ecf20Sopenharmony_ci " movq 8(%1), %%rdx;" " adcx %%r15, %%r13;" /* f1 */ 5278c2ecf20Sopenharmony_ci " mulxq 16(%1), %%rax, %%rcx;" " mov $0, %%r14;" /* f[2]*f[1] */ 5288c2ecf20Sopenharmony_ci 5298c2ecf20Sopenharmony_ci /* Step 2: Compute two parallel carry chains */ 5308c2ecf20Sopenharmony_ci " xor %%r15d, %%r15d;" 5318c2ecf20Sopenharmony_ci " adox %%rax, %%r10;" 5328c2ecf20Sopenharmony_ci " adcx %%r8, %%r8;" 5338c2ecf20Sopenharmony_ci " adox %%rcx, %%r11;" 5348c2ecf20Sopenharmony_ci " adcx %%r9, %%r9;" 5358c2ecf20Sopenharmony_ci " adox %%r15, %%rbx;" 5368c2ecf20Sopenharmony_ci " adcx %%r10, %%r10;" 5378c2ecf20Sopenharmony_ci " adox %%r15, %%r13;" 5388c2ecf20Sopenharmony_ci " adcx %%r11, %%r11;" 5398c2ecf20Sopenharmony_ci " adox %%r15, %%r14;" 5408c2ecf20Sopenharmony_ci " adcx %%rbx, %%rbx;" 5418c2ecf20Sopenharmony_ci " adcx %%r13, %%r13;" 5428c2ecf20Sopenharmony_ci " adcx %%r14, %%r14;" 5438c2ecf20Sopenharmony_ci 5448c2ecf20Sopenharmony_ci /* Step 3: Compute intermediate squares */ 5458c2ecf20Sopenharmony_ci " movq 0(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[0]^2 */ 5468c2ecf20Sopenharmony_ci " movq %%rax, 0(%0);" 5478c2ecf20Sopenharmony_ci " add %%rcx, %%r8;" " movq %%r8, 8(%0);" 5488c2ecf20Sopenharmony_ci " movq 8(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[1]^2 */ 5498c2ecf20Sopenharmony_ci " adcx %%rax, %%r9;" " movq %%r9, 16(%0);" 5508c2ecf20Sopenharmony_ci " adcx %%rcx, %%r10;" " movq %%r10, 24(%0);" 5518c2ecf20Sopenharmony_ci " movq 16(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[2]^2 */ 5528c2ecf20Sopenharmony_ci " adcx %%rax, %%r11;" " movq %%r11, 32(%0);" 5538c2ecf20Sopenharmony_ci " adcx %%rcx, %%rbx;" " movq %%rbx, 40(%0);" 5548c2ecf20Sopenharmony_ci " movq 24(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[3]^2 */ 5558c2ecf20Sopenharmony_ci " adcx %%rax, %%r13;" " movq %%r13, 48(%0);" 5568c2ecf20Sopenharmony_ci " adcx %%rcx, %%r14;" " movq %%r14, 56(%0);" 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ci /* Line up pointers */ 5598c2ecf20Sopenharmony_ci " mov %0, %1;" 5608c2ecf20Sopenharmony_ci " mov %2, %0;" 5618c2ecf20Sopenharmony_ci 5628c2ecf20Sopenharmony_ci /* Wrap the result back into the field */ 5638c2ecf20Sopenharmony_ci 5648c2ecf20Sopenharmony_ci /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ 5658c2ecf20Sopenharmony_ci " mov $38, %%rdx;" 5668c2ecf20Sopenharmony_ci " mulxq 32(%1), %%r8, %%r13;" 5678c2ecf20Sopenharmony_ci " xor %%ecx, %%ecx;" 5688c2ecf20Sopenharmony_ci " adoxq 0(%1), %%r8;" 5698c2ecf20Sopenharmony_ci " mulxq 40(%1), %%r9, %%rbx;" 5708c2ecf20Sopenharmony_ci " adcx %%r13, %%r9;" 5718c2ecf20Sopenharmony_ci " adoxq 8(%1), %%r9;" 5728c2ecf20Sopenharmony_ci " mulxq 48(%1), %%r10, %%r13;" 5738c2ecf20Sopenharmony_ci " adcx %%rbx, %%r10;" 5748c2ecf20Sopenharmony_ci " adoxq 16(%1), %%r10;" 5758c2ecf20Sopenharmony_ci " mulxq 56(%1), %%r11, %%rax;" 5768c2ecf20Sopenharmony_ci " adcx %%r13, %%r11;" 5778c2ecf20Sopenharmony_ci " adoxq 24(%1), %%r11;" 5788c2ecf20Sopenharmony_ci " adcx %%rcx, %%rax;" 5798c2ecf20Sopenharmony_ci " adox %%rcx, %%rax;" 5808c2ecf20Sopenharmony_ci " imul %%rdx, %%rax;" 5818c2ecf20Sopenharmony_ci 5828c2ecf20Sopenharmony_ci /* Step 2: Fold the carry back into dst */ 5838c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 5848c2ecf20Sopenharmony_ci " adcx %%rcx, %%r9;" 5858c2ecf20Sopenharmony_ci " movq %%r9, 8(%0);" 5868c2ecf20Sopenharmony_ci " adcx %%rcx, %%r10;" 5878c2ecf20Sopenharmony_ci " movq %%r10, 16(%0);" 5888c2ecf20Sopenharmony_ci " adcx %%rcx, %%r11;" 5898c2ecf20Sopenharmony_ci " movq %%r11, 24(%0);" 5908c2ecf20Sopenharmony_ci 5918c2ecf20Sopenharmony_ci /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ 5928c2ecf20Sopenharmony_ci " mov $0, %%rax;" 5938c2ecf20Sopenharmony_ci " cmovc %%rdx, %%rax;" 5948c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 5958c2ecf20Sopenharmony_ci " movq %%r8, 0(%0);" 5968c2ecf20Sopenharmony_ci : "+&r" (tmp), "+&r" (f), "+&r" (out) 5978c2ecf20Sopenharmony_ci : 5988c2ecf20Sopenharmony_ci : "%rax", "%rcx", "%rdx", "%r8", "%r9", "%r10", "%r11", "%rbx", "%r13", "%r14", "%r15", "memory", "cc" 5998c2ecf20Sopenharmony_ci ); 6008c2ecf20Sopenharmony_ci} 6018c2ecf20Sopenharmony_ci 6028c2ecf20Sopenharmony_ci/* Computes two field squarings: 6038c2ecf20Sopenharmony_ci * out[0] <- f[0] * f[0] 6048c2ecf20Sopenharmony_ci * out[1] <- f[1] * f[1] 6058c2ecf20Sopenharmony_ci * Uses the 16-element buffer tmp for intermediate results */ 6068c2ecf20Sopenharmony_cistatic inline void fsqr2(u64 *out, const u64 *f, u64 *tmp) 6078c2ecf20Sopenharmony_ci{ 6088c2ecf20Sopenharmony_ci asm volatile( 6098c2ecf20Sopenharmony_ci /* Step 1: Compute all partial products */ 6108c2ecf20Sopenharmony_ci " movq 0(%1), %%rdx;" /* f[0] */ 6118c2ecf20Sopenharmony_ci " mulxq 8(%1), %%r8, %%r14;" " xor %%r15d, %%r15d;" /* f[1]*f[0] */ 6128c2ecf20Sopenharmony_ci " mulxq 16(%1), %%r9, %%r10;" " adcx %%r14, %%r9;" /* f[2]*f[0] */ 6138c2ecf20Sopenharmony_ci " mulxq 24(%1), %%rax, %%rcx;" " adcx %%rax, %%r10;" /* f[3]*f[0] */ 6148c2ecf20Sopenharmony_ci " movq 24(%1), %%rdx;" /* f[3] */ 6158c2ecf20Sopenharmony_ci " mulxq 8(%1), %%r11, %%rbx;" " adcx %%rcx, %%r11;" /* f[1]*f[3] */ 6168c2ecf20Sopenharmony_ci " mulxq 16(%1), %%rax, %%r13;" " adcx %%rax, %%rbx;" /* f[2]*f[3] */ 6178c2ecf20Sopenharmony_ci " movq 8(%1), %%rdx;" " adcx %%r15, %%r13;" /* f1 */ 6188c2ecf20Sopenharmony_ci " mulxq 16(%1), %%rax, %%rcx;" " mov $0, %%r14;" /* f[2]*f[1] */ 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_ci /* Step 2: Compute two parallel carry chains */ 6218c2ecf20Sopenharmony_ci " xor %%r15d, %%r15d;" 6228c2ecf20Sopenharmony_ci " adox %%rax, %%r10;" 6238c2ecf20Sopenharmony_ci " adcx %%r8, %%r8;" 6248c2ecf20Sopenharmony_ci " adox %%rcx, %%r11;" 6258c2ecf20Sopenharmony_ci " adcx %%r9, %%r9;" 6268c2ecf20Sopenharmony_ci " adox %%r15, %%rbx;" 6278c2ecf20Sopenharmony_ci " adcx %%r10, %%r10;" 6288c2ecf20Sopenharmony_ci " adox %%r15, %%r13;" 6298c2ecf20Sopenharmony_ci " adcx %%r11, %%r11;" 6308c2ecf20Sopenharmony_ci " adox %%r15, %%r14;" 6318c2ecf20Sopenharmony_ci " adcx %%rbx, %%rbx;" 6328c2ecf20Sopenharmony_ci " adcx %%r13, %%r13;" 6338c2ecf20Sopenharmony_ci " adcx %%r14, %%r14;" 6348c2ecf20Sopenharmony_ci 6358c2ecf20Sopenharmony_ci /* Step 3: Compute intermediate squares */ 6368c2ecf20Sopenharmony_ci " movq 0(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[0]^2 */ 6378c2ecf20Sopenharmony_ci " movq %%rax, 0(%0);" 6388c2ecf20Sopenharmony_ci " add %%rcx, %%r8;" " movq %%r8, 8(%0);" 6398c2ecf20Sopenharmony_ci " movq 8(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[1]^2 */ 6408c2ecf20Sopenharmony_ci " adcx %%rax, %%r9;" " movq %%r9, 16(%0);" 6418c2ecf20Sopenharmony_ci " adcx %%rcx, %%r10;" " movq %%r10, 24(%0);" 6428c2ecf20Sopenharmony_ci " movq 16(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[2]^2 */ 6438c2ecf20Sopenharmony_ci " adcx %%rax, %%r11;" " movq %%r11, 32(%0);" 6448c2ecf20Sopenharmony_ci " adcx %%rcx, %%rbx;" " movq %%rbx, 40(%0);" 6458c2ecf20Sopenharmony_ci " movq 24(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[3]^2 */ 6468c2ecf20Sopenharmony_ci " adcx %%rax, %%r13;" " movq %%r13, 48(%0);" 6478c2ecf20Sopenharmony_ci " adcx %%rcx, %%r14;" " movq %%r14, 56(%0);" 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_ci /* Step 1: Compute all partial products */ 6508c2ecf20Sopenharmony_ci " movq 32(%1), %%rdx;" /* f[0] */ 6518c2ecf20Sopenharmony_ci " mulxq 40(%1), %%r8, %%r14;" " xor %%r15d, %%r15d;" /* f[1]*f[0] */ 6528c2ecf20Sopenharmony_ci " mulxq 48(%1), %%r9, %%r10;" " adcx %%r14, %%r9;" /* f[2]*f[0] */ 6538c2ecf20Sopenharmony_ci " mulxq 56(%1), %%rax, %%rcx;" " adcx %%rax, %%r10;" /* f[3]*f[0] */ 6548c2ecf20Sopenharmony_ci " movq 56(%1), %%rdx;" /* f[3] */ 6558c2ecf20Sopenharmony_ci " mulxq 40(%1), %%r11, %%rbx;" " adcx %%rcx, %%r11;" /* f[1]*f[3] */ 6568c2ecf20Sopenharmony_ci " mulxq 48(%1), %%rax, %%r13;" " adcx %%rax, %%rbx;" /* f[2]*f[3] */ 6578c2ecf20Sopenharmony_ci " movq 40(%1), %%rdx;" " adcx %%r15, %%r13;" /* f1 */ 6588c2ecf20Sopenharmony_ci " mulxq 48(%1), %%rax, %%rcx;" " mov $0, %%r14;" /* f[2]*f[1] */ 6598c2ecf20Sopenharmony_ci 6608c2ecf20Sopenharmony_ci /* Step 2: Compute two parallel carry chains */ 6618c2ecf20Sopenharmony_ci " xor %%r15d, %%r15d;" 6628c2ecf20Sopenharmony_ci " adox %%rax, %%r10;" 6638c2ecf20Sopenharmony_ci " adcx %%r8, %%r8;" 6648c2ecf20Sopenharmony_ci " adox %%rcx, %%r11;" 6658c2ecf20Sopenharmony_ci " adcx %%r9, %%r9;" 6668c2ecf20Sopenharmony_ci " adox %%r15, %%rbx;" 6678c2ecf20Sopenharmony_ci " adcx %%r10, %%r10;" 6688c2ecf20Sopenharmony_ci " adox %%r15, %%r13;" 6698c2ecf20Sopenharmony_ci " adcx %%r11, %%r11;" 6708c2ecf20Sopenharmony_ci " adox %%r15, %%r14;" 6718c2ecf20Sopenharmony_ci " adcx %%rbx, %%rbx;" 6728c2ecf20Sopenharmony_ci " adcx %%r13, %%r13;" 6738c2ecf20Sopenharmony_ci " adcx %%r14, %%r14;" 6748c2ecf20Sopenharmony_ci 6758c2ecf20Sopenharmony_ci /* Step 3: Compute intermediate squares */ 6768c2ecf20Sopenharmony_ci " movq 32(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[0]^2 */ 6778c2ecf20Sopenharmony_ci " movq %%rax, 64(%0);" 6788c2ecf20Sopenharmony_ci " add %%rcx, %%r8;" " movq %%r8, 72(%0);" 6798c2ecf20Sopenharmony_ci " movq 40(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[1]^2 */ 6808c2ecf20Sopenharmony_ci " adcx %%rax, %%r9;" " movq %%r9, 80(%0);" 6818c2ecf20Sopenharmony_ci " adcx %%rcx, %%r10;" " movq %%r10, 88(%0);" 6828c2ecf20Sopenharmony_ci " movq 48(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[2]^2 */ 6838c2ecf20Sopenharmony_ci " adcx %%rax, %%r11;" " movq %%r11, 96(%0);" 6848c2ecf20Sopenharmony_ci " adcx %%rcx, %%rbx;" " movq %%rbx, 104(%0);" 6858c2ecf20Sopenharmony_ci " movq 56(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[3]^2 */ 6868c2ecf20Sopenharmony_ci " adcx %%rax, %%r13;" " movq %%r13, 112(%0);" 6878c2ecf20Sopenharmony_ci " adcx %%rcx, %%r14;" " movq %%r14, 120(%0);" 6888c2ecf20Sopenharmony_ci 6898c2ecf20Sopenharmony_ci /* Line up pointers */ 6908c2ecf20Sopenharmony_ci " mov %0, %1;" 6918c2ecf20Sopenharmony_ci " mov %2, %0;" 6928c2ecf20Sopenharmony_ci 6938c2ecf20Sopenharmony_ci /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ 6948c2ecf20Sopenharmony_ci " mov $38, %%rdx;" 6958c2ecf20Sopenharmony_ci " mulxq 32(%1), %%r8, %%r13;" 6968c2ecf20Sopenharmony_ci " xor %%ecx, %%ecx;" 6978c2ecf20Sopenharmony_ci " adoxq 0(%1), %%r8;" 6988c2ecf20Sopenharmony_ci " mulxq 40(%1), %%r9, %%rbx;" 6998c2ecf20Sopenharmony_ci " adcx %%r13, %%r9;" 7008c2ecf20Sopenharmony_ci " adoxq 8(%1), %%r9;" 7018c2ecf20Sopenharmony_ci " mulxq 48(%1), %%r10, %%r13;" 7028c2ecf20Sopenharmony_ci " adcx %%rbx, %%r10;" 7038c2ecf20Sopenharmony_ci " adoxq 16(%1), %%r10;" 7048c2ecf20Sopenharmony_ci " mulxq 56(%1), %%r11, %%rax;" 7058c2ecf20Sopenharmony_ci " adcx %%r13, %%r11;" 7068c2ecf20Sopenharmony_ci " adoxq 24(%1), %%r11;" 7078c2ecf20Sopenharmony_ci " adcx %%rcx, %%rax;" 7088c2ecf20Sopenharmony_ci " adox %%rcx, %%rax;" 7098c2ecf20Sopenharmony_ci " imul %%rdx, %%rax;" 7108c2ecf20Sopenharmony_ci 7118c2ecf20Sopenharmony_ci /* Step 2: Fold the carry back into dst */ 7128c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 7138c2ecf20Sopenharmony_ci " adcx %%rcx, %%r9;" 7148c2ecf20Sopenharmony_ci " movq %%r9, 8(%0);" 7158c2ecf20Sopenharmony_ci " adcx %%rcx, %%r10;" 7168c2ecf20Sopenharmony_ci " movq %%r10, 16(%0);" 7178c2ecf20Sopenharmony_ci " adcx %%rcx, %%r11;" 7188c2ecf20Sopenharmony_ci " movq %%r11, 24(%0);" 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_ci /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ 7218c2ecf20Sopenharmony_ci " mov $0, %%rax;" 7228c2ecf20Sopenharmony_ci " cmovc %%rdx, %%rax;" 7238c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 7248c2ecf20Sopenharmony_ci " movq %%r8, 0(%0);" 7258c2ecf20Sopenharmony_ci 7268c2ecf20Sopenharmony_ci /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ 7278c2ecf20Sopenharmony_ci " mov $38, %%rdx;" 7288c2ecf20Sopenharmony_ci " mulxq 96(%1), %%r8, %%r13;" 7298c2ecf20Sopenharmony_ci " xor %%ecx, %%ecx;" 7308c2ecf20Sopenharmony_ci " adoxq 64(%1), %%r8;" 7318c2ecf20Sopenharmony_ci " mulxq 104(%1), %%r9, %%rbx;" 7328c2ecf20Sopenharmony_ci " adcx %%r13, %%r9;" 7338c2ecf20Sopenharmony_ci " adoxq 72(%1), %%r9;" 7348c2ecf20Sopenharmony_ci " mulxq 112(%1), %%r10, %%r13;" 7358c2ecf20Sopenharmony_ci " adcx %%rbx, %%r10;" 7368c2ecf20Sopenharmony_ci " adoxq 80(%1), %%r10;" 7378c2ecf20Sopenharmony_ci " mulxq 120(%1), %%r11, %%rax;" 7388c2ecf20Sopenharmony_ci " adcx %%r13, %%r11;" 7398c2ecf20Sopenharmony_ci " adoxq 88(%1), %%r11;" 7408c2ecf20Sopenharmony_ci " adcx %%rcx, %%rax;" 7418c2ecf20Sopenharmony_ci " adox %%rcx, %%rax;" 7428c2ecf20Sopenharmony_ci " imul %%rdx, %%rax;" 7438c2ecf20Sopenharmony_ci 7448c2ecf20Sopenharmony_ci /* Step 2: Fold the carry back into dst */ 7458c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 7468c2ecf20Sopenharmony_ci " adcx %%rcx, %%r9;" 7478c2ecf20Sopenharmony_ci " movq %%r9, 40(%0);" 7488c2ecf20Sopenharmony_ci " adcx %%rcx, %%r10;" 7498c2ecf20Sopenharmony_ci " movq %%r10, 48(%0);" 7508c2ecf20Sopenharmony_ci " adcx %%rcx, %%r11;" 7518c2ecf20Sopenharmony_ci " movq %%r11, 56(%0);" 7528c2ecf20Sopenharmony_ci 7538c2ecf20Sopenharmony_ci /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ 7548c2ecf20Sopenharmony_ci " mov $0, %%rax;" 7558c2ecf20Sopenharmony_ci " cmovc %%rdx, %%rax;" 7568c2ecf20Sopenharmony_ci " add %%rax, %%r8;" 7578c2ecf20Sopenharmony_ci " movq %%r8, 32(%0);" 7588c2ecf20Sopenharmony_ci : "+&r" (tmp), "+&r" (f), "+&r" (out) 7598c2ecf20Sopenharmony_ci : 7608c2ecf20Sopenharmony_ci : "%rax", "%rcx", "%rdx", "%r8", "%r9", "%r10", "%r11", "%rbx", "%r13", "%r14", "%r15", "memory", "cc" 7618c2ecf20Sopenharmony_ci ); 7628c2ecf20Sopenharmony_ci} 7638c2ecf20Sopenharmony_ci 7648c2ecf20Sopenharmony_cistatic void point_add_and_double(u64 *q, u64 *p01_tmp1, u64 *tmp2) 7658c2ecf20Sopenharmony_ci{ 7668c2ecf20Sopenharmony_ci u64 *nq = p01_tmp1; 7678c2ecf20Sopenharmony_ci u64 *nq_p1 = p01_tmp1 + (u32)8U; 7688c2ecf20Sopenharmony_ci u64 *tmp1 = p01_tmp1 + (u32)16U; 7698c2ecf20Sopenharmony_ci u64 *x1 = q; 7708c2ecf20Sopenharmony_ci u64 *x2 = nq; 7718c2ecf20Sopenharmony_ci u64 *z2 = nq + (u32)4U; 7728c2ecf20Sopenharmony_ci u64 *z3 = nq_p1 + (u32)4U; 7738c2ecf20Sopenharmony_ci u64 *a = tmp1; 7748c2ecf20Sopenharmony_ci u64 *b = tmp1 + (u32)4U; 7758c2ecf20Sopenharmony_ci u64 *ab = tmp1; 7768c2ecf20Sopenharmony_ci u64 *dc = tmp1 + (u32)8U; 7778c2ecf20Sopenharmony_ci u64 *x3; 7788c2ecf20Sopenharmony_ci u64 *z31; 7798c2ecf20Sopenharmony_ci u64 *d0; 7808c2ecf20Sopenharmony_ci u64 *c0; 7818c2ecf20Sopenharmony_ci u64 *a1; 7828c2ecf20Sopenharmony_ci u64 *b1; 7838c2ecf20Sopenharmony_ci u64 *d; 7848c2ecf20Sopenharmony_ci u64 *c; 7858c2ecf20Sopenharmony_ci u64 *ab1; 7868c2ecf20Sopenharmony_ci u64 *dc1; 7878c2ecf20Sopenharmony_ci fadd(a, x2, z2); 7888c2ecf20Sopenharmony_ci fsub(b, x2, z2); 7898c2ecf20Sopenharmony_ci x3 = nq_p1; 7908c2ecf20Sopenharmony_ci z31 = nq_p1 + (u32)4U; 7918c2ecf20Sopenharmony_ci d0 = dc; 7928c2ecf20Sopenharmony_ci c0 = dc + (u32)4U; 7938c2ecf20Sopenharmony_ci fadd(c0, x3, z31); 7948c2ecf20Sopenharmony_ci fsub(d0, x3, z31); 7958c2ecf20Sopenharmony_ci fmul2(dc, dc, ab, tmp2); 7968c2ecf20Sopenharmony_ci fadd(x3, d0, c0); 7978c2ecf20Sopenharmony_ci fsub(z31, d0, c0); 7988c2ecf20Sopenharmony_ci a1 = tmp1; 7998c2ecf20Sopenharmony_ci b1 = tmp1 + (u32)4U; 8008c2ecf20Sopenharmony_ci d = tmp1 + (u32)8U; 8018c2ecf20Sopenharmony_ci c = tmp1 + (u32)12U; 8028c2ecf20Sopenharmony_ci ab1 = tmp1; 8038c2ecf20Sopenharmony_ci dc1 = tmp1 + (u32)8U; 8048c2ecf20Sopenharmony_ci fsqr2(dc1, ab1, tmp2); 8058c2ecf20Sopenharmony_ci fsqr2(nq_p1, nq_p1, tmp2); 8068c2ecf20Sopenharmony_ci a1[0U] = c[0U]; 8078c2ecf20Sopenharmony_ci a1[1U] = c[1U]; 8088c2ecf20Sopenharmony_ci a1[2U] = c[2U]; 8098c2ecf20Sopenharmony_ci a1[3U] = c[3U]; 8108c2ecf20Sopenharmony_ci fsub(c, d, c); 8118c2ecf20Sopenharmony_ci fmul_scalar(b1, c, (u64)121665U); 8128c2ecf20Sopenharmony_ci fadd(b1, b1, d); 8138c2ecf20Sopenharmony_ci fmul2(nq, dc1, ab1, tmp2); 8148c2ecf20Sopenharmony_ci fmul(z3, z3, x1, tmp2); 8158c2ecf20Sopenharmony_ci} 8168c2ecf20Sopenharmony_ci 8178c2ecf20Sopenharmony_cistatic void point_double(u64 *nq, u64 *tmp1, u64 *tmp2) 8188c2ecf20Sopenharmony_ci{ 8198c2ecf20Sopenharmony_ci u64 *x2 = nq; 8208c2ecf20Sopenharmony_ci u64 *z2 = nq + (u32)4U; 8218c2ecf20Sopenharmony_ci u64 *a = tmp1; 8228c2ecf20Sopenharmony_ci u64 *b = tmp1 + (u32)4U; 8238c2ecf20Sopenharmony_ci u64 *d = tmp1 + (u32)8U; 8248c2ecf20Sopenharmony_ci u64 *c = tmp1 + (u32)12U; 8258c2ecf20Sopenharmony_ci u64 *ab = tmp1; 8268c2ecf20Sopenharmony_ci u64 *dc = tmp1 + (u32)8U; 8278c2ecf20Sopenharmony_ci fadd(a, x2, z2); 8288c2ecf20Sopenharmony_ci fsub(b, x2, z2); 8298c2ecf20Sopenharmony_ci fsqr2(dc, ab, tmp2); 8308c2ecf20Sopenharmony_ci a[0U] = c[0U]; 8318c2ecf20Sopenharmony_ci a[1U] = c[1U]; 8328c2ecf20Sopenharmony_ci a[2U] = c[2U]; 8338c2ecf20Sopenharmony_ci a[3U] = c[3U]; 8348c2ecf20Sopenharmony_ci fsub(c, d, c); 8358c2ecf20Sopenharmony_ci fmul_scalar(b, c, (u64)121665U); 8368c2ecf20Sopenharmony_ci fadd(b, b, d); 8378c2ecf20Sopenharmony_ci fmul2(nq, dc, ab, tmp2); 8388c2ecf20Sopenharmony_ci} 8398c2ecf20Sopenharmony_ci 8408c2ecf20Sopenharmony_cistatic void montgomery_ladder(u64 *out, const u8 *key, u64 *init1) 8418c2ecf20Sopenharmony_ci{ 8428c2ecf20Sopenharmony_ci u64 tmp2[16U] = { 0U }; 8438c2ecf20Sopenharmony_ci u64 p01_tmp1_swap[33U] = { 0U }; 8448c2ecf20Sopenharmony_ci u64 *p0 = p01_tmp1_swap; 8458c2ecf20Sopenharmony_ci u64 *p01 = p01_tmp1_swap; 8468c2ecf20Sopenharmony_ci u64 *p03 = p01; 8478c2ecf20Sopenharmony_ci u64 *p11 = p01 + (u32)8U; 8488c2ecf20Sopenharmony_ci u64 *x0; 8498c2ecf20Sopenharmony_ci u64 *z0; 8508c2ecf20Sopenharmony_ci u64 *p01_tmp1; 8518c2ecf20Sopenharmony_ci u64 *p01_tmp11; 8528c2ecf20Sopenharmony_ci u64 *nq10; 8538c2ecf20Sopenharmony_ci u64 *nq_p11; 8548c2ecf20Sopenharmony_ci u64 *swap1; 8558c2ecf20Sopenharmony_ci u64 sw0; 8568c2ecf20Sopenharmony_ci u64 *nq1; 8578c2ecf20Sopenharmony_ci u64 *tmp1; 8588c2ecf20Sopenharmony_ci memcpy(p11, init1, (u32)8U * sizeof(init1[0U])); 8598c2ecf20Sopenharmony_ci x0 = p03; 8608c2ecf20Sopenharmony_ci z0 = p03 + (u32)4U; 8618c2ecf20Sopenharmony_ci x0[0U] = (u64)1U; 8628c2ecf20Sopenharmony_ci x0[1U] = (u64)0U; 8638c2ecf20Sopenharmony_ci x0[2U] = (u64)0U; 8648c2ecf20Sopenharmony_ci x0[3U] = (u64)0U; 8658c2ecf20Sopenharmony_ci z0[0U] = (u64)0U; 8668c2ecf20Sopenharmony_ci z0[1U] = (u64)0U; 8678c2ecf20Sopenharmony_ci z0[2U] = (u64)0U; 8688c2ecf20Sopenharmony_ci z0[3U] = (u64)0U; 8698c2ecf20Sopenharmony_ci p01_tmp1 = p01_tmp1_swap; 8708c2ecf20Sopenharmony_ci p01_tmp11 = p01_tmp1_swap; 8718c2ecf20Sopenharmony_ci nq10 = p01_tmp1_swap; 8728c2ecf20Sopenharmony_ci nq_p11 = p01_tmp1_swap + (u32)8U; 8738c2ecf20Sopenharmony_ci swap1 = p01_tmp1_swap + (u32)32U; 8748c2ecf20Sopenharmony_ci cswap2((u64)1U, nq10, nq_p11); 8758c2ecf20Sopenharmony_ci point_add_and_double(init1, p01_tmp11, tmp2); 8768c2ecf20Sopenharmony_ci swap1[0U] = (u64)1U; 8778c2ecf20Sopenharmony_ci { 8788c2ecf20Sopenharmony_ci u32 i; 8798c2ecf20Sopenharmony_ci for (i = (u32)0U; i < (u32)251U; i = i + (u32)1U) { 8808c2ecf20Sopenharmony_ci u64 *p01_tmp12 = p01_tmp1_swap; 8818c2ecf20Sopenharmony_ci u64 *swap2 = p01_tmp1_swap + (u32)32U; 8828c2ecf20Sopenharmony_ci u64 *nq2 = p01_tmp12; 8838c2ecf20Sopenharmony_ci u64 *nq_p12 = p01_tmp12 + (u32)8U; 8848c2ecf20Sopenharmony_ci u64 bit = (u64)(key[((u32)253U - i) / (u32)8U] >> ((u32)253U - i) % (u32)8U & (u8)1U); 8858c2ecf20Sopenharmony_ci u64 sw = swap2[0U] ^ bit; 8868c2ecf20Sopenharmony_ci cswap2(sw, nq2, nq_p12); 8878c2ecf20Sopenharmony_ci point_add_and_double(init1, p01_tmp12, tmp2); 8888c2ecf20Sopenharmony_ci swap2[0U] = bit; 8898c2ecf20Sopenharmony_ci } 8908c2ecf20Sopenharmony_ci } 8918c2ecf20Sopenharmony_ci sw0 = swap1[0U]; 8928c2ecf20Sopenharmony_ci cswap2(sw0, nq10, nq_p11); 8938c2ecf20Sopenharmony_ci nq1 = p01_tmp1; 8948c2ecf20Sopenharmony_ci tmp1 = p01_tmp1 + (u32)16U; 8958c2ecf20Sopenharmony_ci point_double(nq1, tmp1, tmp2); 8968c2ecf20Sopenharmony_ci point_double(nq1, tmp1, tmp2); 8978c2ecf20Sopenharmony_ci point_double(nq1, tmp1, tmp2); 8988c2ecf20Sopenharmony_ci memcpy(out, p0, (u32)8U * sizeof(p0[0U])); 8998c2ecf20Sopenharmony_ci 9008c2ecf20Sopenharmony_ci memzero_explicit(tmp2, sizeof(tmp2)); 9018c2ecf20Sopenharmony_ci memzero_explicit(p01_tmp1_swap, sizeof(p01_tmp1_swap)); 9028c2ecf20Sopenharmony_ci} 9038c2ecf20Sopenharmony_ci 9048c2ecf20Sopenharmony_cistatic void fsquare_times(u64 *o, const u64 *inp, u64 *tmp, u32 n1) 9058c2ecf20Sopenharmony_ci{ 9068c2ecf20Sopenharmony_ci u32 i; 9078c2ecf20Sopenharmony_ci fsqr(o, inp, tmp); 9088c2ecf20Sopenharmony_ci for (i = (u32)0U; i < n1 - (u32)1U; i = i + (u32)1U) 9098c2ecf20Sopenharmony_ci fsqr(o, o, tmp); 9108c2ecf20Sopenharmony_ci} 9118c2ecf20Sopenharmony_ci 9128c2ecf20Sopenharmony_cistatic void finv(u64 *o, const u64 *i, u64 *tmp) 9138c2ecf20Sopenharmony_ci{ 9148c2ecf20Sopenharmony_ci u64 t1[16U] = { 0U }; 9158c2ecf20Sopenharmony_ci u64 *a0 = t1; 9168c2ecf20Sopenharmony_ci u64 *b = t1 + (u32)4U; 9178c2ecf20Sopenharmony_ci u64 *c = t1 + (u32)8U; 9188c2ecf20Sopenharmony_ci u64 *t00 = t1 + (u32)12U; 9198c2ecf20Sopenharmony_ci u64 *tmp1 = tmp; 9208c2ecf20Sopenharmony_ci u64 *a; 9218c2ecf20Sopenharmony_ci u64 *t0; 9228c2ecf20Sopenharmony_ci fsquare_times(a0, i, tmp1, (u32)1U); 9238c2ecf20Sopenharmony_ci fsquare_times(t00, a0, tmp1, (u32)2U); 9248c2ecf20Sopenharmony_ci fmul(b, t00, i, tmp); 9258c2ecf20Sopenharmony_ci fmul(a0, b, a0, tmp); 9268c2ecf20Sopenharmony_ci fsquare_times(t00, a0, tmp1, (u32)1U); 9278c2ecf20Sopenharmony_ci fmul(b, t00, b, tmp); 9288c2ecf20Sopenharmony_ci fsquare_times(t00, b, tmp1, (u32)5U); 9298c2ecf20Sopenharmony_ci fmul(b, t00, b, tmp); 9308c2ecf20Sopenharmony_ci fsquare_times(t00, b, tmp1, (u32)10U); 9318c2ecf20Sopenharmony_ci fmul(c, t00, b, tmp); 9328c2ecf20Sopenharmony_ci fsquare_times(t00, c, tmp1, (u32)20U); 9338c2ecf20Sopenharmony_ci fmul(t00, t00, c, tmp); 9348c2ecf20Sopenharmony_ci fsquare_times(t00, t00, tmp1, (u32)10U); 9358c2ecf20Sopenharmony_ci fmul(b, t00, b, tmp); 9368c2ecf20Sopenharmony_ci fsquare_times(t00, b, tmp1, (u32)50U); 9378c2ecf20Sopenharmony_ci fmul(c, t00, b, tmp); 9388c2ecf20Sopenharmony_ci fsquare_times(t00, c, tmp1, (u32)100U); 9398c2ecf20Sopenharmony_ci fmul(t00, t00, c, tmp); 9408c2ecf20Sopenharmony_ci fsquare_times(t00, t00, tmp1, (u32)50U); 9418c2ecf20Sopenharmony_ci fmul(t00, t00, b, tmp); 9428c2ecf20Sopenharmony_ci fsquare_times(t00, t00, tmp1, (u32)5U); 9438c2ecf20Sopenharmony_ci a = t1; 9448c2ecf20Sopenharmony_ci t0 = t1 + (u32)12U; 9458c2ecf20Sopenharmony_ci fmul(o, t0, a, tmp); 9468c2ecf20Sopenharmony_ci} 9478c2ecf20Sopenharmony_ci 9488c2ecf20Sopenharmony_cistatic void store_felem(u64 *b, u64 *f) 9498c2ecf20Sopenharmony_ci{ 9508c2ecf20Sopenharmony_ci u64 f30 = f[3U]; 9518c2ecf20Sopenharmony_ci u64 top_bit0 = f30 >> (u32)63U; 9528c2ecf20Sopenharmony_ci u64 f31; 9538c2ecf20Sopenharmony_ci u64 top_bit; 9548c2ecf20Sopenharmony_ci u64 f0; 9558c2ecf20Sopenharmony_ci u64 f1; 9568c2ecf20Sopenharmony_ci u64 f2; 9578c2ecf20Sopenharmony_ci u64 f3; 9588c2ecf20Sopenharmony_ci u64 m0; 9598c2ecf20Sopenharmony_ci u64 m1; 9608c2ecf20Sopenharmony_ci u64 m2; 9618c2ecf20Sopenharmony_ci u64 m3; 9628c2ecf20Sopenharmony_ci u64 mask; 9638c2ecf20Sopenharmony_ci u64 f0_; 9648c2ecf20Sopenharmony_ci u64 f1_; 9658c2ecf20Sopenharmony_ci u64 f2_; 9668c2ecf20Sopenharmony_ci u64 f3_; 9678c2ecf20Sopenharmony_ci u64 o0; 9688c2ecf20Sopenharmony_ci u64 o1; 9698c2ecf20Sopenharmony_ci u64 o2; 9708c2ecf20Sopenharmony_ci u64 o3; 9718c2ecf20Sopenharmony_ci f[3U] = f30 & (u64)0x7fffffffffffffffU; 9728c2ecf20Sopenharmony_ci add_scalar(f, f, (u64)19U * top_bit0); 9738c2ecf20Sopenharmony_ci f31 = f[3U]; 9748c2ecf20Sopenharmony_ci top_bit = f31 >> (u32)63U; 9758c2ecf20Sopenharmony_ci f[3U] = f31 & (u64)0x7fffffffffffffffU; 9768c2ecf20Sopenharmony_ci add_scalar(f, f, (u64)19U * top_bit); 9778c2ecf20Sopenharmony_ci f0 = f[0U]; 9788c2ecf20Sopenharmony_ci f1 = f[1U]; 9798c2ecf20Sopenharmony_ci f2 = f[2U]; 9808c2ecf20Sopenharmony_ci f3 = f[3U]; 9818c2ecf20Sopenharmony_ci m0 = gte_mask(f0, (u64)0xffffffffffffffedU); 9828c2ecf20Sopenharmony_ci m1 = eq_mask(f1, (u64)0xffffffffffffffffU); 9838c2ecf20Sopenharmony_ci m2 = eq_mask(f2, (u64)0xffffffffffffffffU); 9848c2ecf20Sopenharmony_ci m3 = eq_mask(f3, (u64)0x7fffffffffffffffU); 9858c2ecf20Sopenharmony_ci mask = ((m0 & m1) & m2) & m3; 9868c2ecf20Sopenharmony_ci f0_ = f0 - (mask & (u64)0xffffffffffffffedU); 9878c2ecf20Sopenharmony_ci f1_ = f1 - (mask & (u64)0xffffffffffffffffU); 9888c2ecf20Sopenharmony_ci f2_ = f2 - (mask & (u64)0xffffffffffffffffU); 9898c2ecf20Sopenharmony_ci f3_ = f3 - (mask & (u64)0x7fffffffffffffffU); 9908c2ecf20Sopenharmony_ci o0 = f0_; 9918c2ecf20Sopenharmony_ci o1 = f1_; 9928c2ecf20Sopenharmony_ci o2 = f2_; 9938c2ecf20Sopenharmony_ci o3 = f3_; 9948c2ecf20Sopenharmony_ci b[0U] = o0; 9958c2ecf20Sopenharmony_ci b[1U] = o1; 9968c2ecf20Sopenharmony_ci b[2U] = o2; 9978c2ecf20Sopenharmony_ci b[3U] = o3; 9988c2ecf20Sopenharmony_ci} 9998c2ecf20Sopenharmony_ci 10008c2ecf20Sopenharmony_cistatic void encode_point(u8 *o, const u64 *i) 10018c2ecf20Sopenharmony_ci{ 10028c2ecf20Sopenharmony_ci const u64 *x = i; 10038c2ecf20Sopenharmony_ci const u64 *z = i + (u32)4U; 10048c2ecf20Sopenharmony_ci u64 tmp[4U] = { 0U }; 10058c2ecf20Sopenharmony_ci u64 tmp_w[16U] = { 0U }; 10068c2ecf20Sopenharmony_ci finv(tmp, z, tmp_w); 10078c2ecf20Sopenharmony_ci fmul(tmp, tmp, x, tmp_w); 10088c2ecf20Sopenharmony_ci store_felem((u64 *)o, tmp); 10098c2ecf20Sopenharmony_ci} 10108c2ecf20Sopenharmony_ci 10118c2ecf20Sopenharmony_cistatic void curve25519_ever64(u8 *out, const u8 *priv, const u8 *pub) 10128c2ecf20Sopenharmony_ci{ 10138c2ecf20Sopenharmony_ci u64 init1[8U] = { 0U }; 10148c2ecf20Sopenharmony_ci u64 tmp[4U] = { 0U }; 10158c2ecf20Sopenharmony_ci u64 tmp3; 10168c2ecf20Sopenharmony_ci u64 *x; 10178c2ecf20Sopenharmony_ci u64 *z; 10188c2ecf20Sopenharmony_ci { 10198c2ecf20Sopenharmony_ci u32 i; 10208c2ecf20Sopenharmony_ci for (i = (u32)0U; i < (u32)4U; i = i + (u32)1U) { 10218c2ecf20Sopenharmony_ci u64 *os = tmp; 10228c2ecf20Sopenharmony_ci const u8 *bj = pub + i * (u32)8U; 10238c2ecf20Sopenharmony_ci u64 u = *(u64 *)bj; 10248c2ecf20Sopenharmony_ci u64 r = u; 10258c2ecf20Sopenharmony_ci u64 x0 = r; 10268c2ecf20Sopenharmony_ci os[i] = x0; 10278c2ecf20Sopenharmony_ci } 10288c2ecf20Sopenharmony_ci } 10298c2ecf20Sopenharmony_ci tmp3 = tmp[3U]; 10308c2ecf20Sopenharmony_ci tmp[3U] = tmp3 & (u64)0x7fffffffffffffffU; 10318c2ecf20Sopenharmony_ci x = init1; 10328c2ecf20Sopenharmony_ci z = init1 + (u32)4U; 10338c2ecf20Sopenharmony_ci z[0U] = (u64)1U; 10348c2ecf20Sopenharmony_ci z[1U] = (u64)0U; 10358c2ecf20Sopenharmony_ci z[2U] = (u64)0U; 10368c2ecf20Sopenharmony_ci z[3U] = (u64)0U; 10378c2ecf20Sopenharmony_ci x[0U] = tmp[0U]; 10388c2ecf20Sopenharmony_ci x[1U] = tmp[1U]; 10398c2ecf20Sopenharmony_ci x[2U] = tmp[2U]; 10408c2ecf20Sopenharmony_ci x[3U] = tmp[3U]; 10418c2ecf20Sopenharmony_ci montgomery_ladder(init1, priv, init1); 10428c2ecf20Sopenharmony_ci encode_point(out, init1); 10438c2ecf20Sopenharmony_ci} 10448c2ecf20Sopenharmony_ci 10458c2ecf20Sopenharmony_ci/* The below constants were generated using this sage script: 10468c2ecf20Sopenharmony_ci * 10478c2ecf20Sopenharmony_ci * #!/usr/bin/env sage 10488c2ecf20Sopenharmony_ci * import sys 10498c2ecf20Sopenharmony_ci * from sage.all import * 10508c2ecf20Sopenharmony_ci * def limbs(n): 10518c2ecf20Sopenharmony_ci * n = int(n) 10528c2ecf20Sopenharmony_ci * l = ((n >> 0) % 2^64, (n >> 64) % 2^64, (n >> 128) % 2^64, (n >> 192) % 2^64) 10538c2ecf20Sopenharmony_ci * return "0x%016xULL, 0x%016xULL, 0x%016xULL, 0x%016xULL" % l 10548c2ecf20Sopenharmony_ci * ec = EllipticCurve(GF(2^255 - 19), [0, 486662, 0, 1, 0]) 10558c2ecf20Sopenharmony_ci * p_minus_s = (ec.lift_x(9) - ec.lift_x(1))[0] 10568c2ecf20Sopenharmony_ci * print("static const u64 p_minus_s[] = { %s };\n" % limbs(p_minus_s)) 10578c2ecf20Sopenharmony_ci * print("static const u64 table_ladder[] = {") 10588c2ecf20Sopenharmony_ci * p = ec.lift_x(9) 10598c2ecf20Sopenharmony_ci * for i in range(252): 10608c2ecf20Sopenharmony_ci * l = (p[0] + p[2]) / (p[0] - p[2]) 10618c2ecf20Sopenharmony_ci * print(("\t%s" + ("," if i != 251 else "")) % limbs(l)) 10628c2ecf20Sopenharmony_ci * p = p * 2 10638c2ecf20Sopenharmony_ci * print("};") 10648c2ecf20Sopenharmony_ci * 10658c2ecf20Sopenharmony_ci */ 10668c2ecf20Sopenharmony_ci 10678c2ecf20Sopenharmony_cistatic const u64 p_minus_s[] = { 0x816b1e0137d48290ULL, 0x440f6a51eb4d1207ULL, 0x52385f46dca2b71dULL, 0x215132111d8354cbULL }; 10688c2ecf20Sopenharmony_ci 10698c2ecf20Sopenharmony_cistatic const u64 table_ladder[] = { 10708c2ecf20Sopenharmony_ci 0xfffffffffffffff3ULL, 0xffffffffffffffffULL, 0xffffffffffffffffULL, 0x5fffffffffffffffULL, 10718c2ecf20Sopenharmony_ci 0x6b8220f416aafe96ULL, 0x82ebeb2b4f566a34ULL, 0xd5a9a5b075a5950fULL, 0x5142b2cf4b2488f4ULL, 10728c2ecf20Sopenharmony_ci 0x6aaebc750069680cULL, 0x89cf7820a0f99c41ULL, 0x2a58d9183b56d0f4ULL, 0x4b5aca80e36011a4ULL, 10738c2ecf20Sopenharmony_ci 0x329132348c29745dULL, 0xf4a2e616e1642fd7ULL, 0x1e45bb03ff67bc34ULL, 0x306912d0f42a9b4aULL, 10748c2ecf20Sopenharmony_ci 0xff886507e6af7154ULL, 0x04f50e13dfeec82fULL, 0xaa512fe82abab5ceULL, 0x174e251a68d5f222ULL, 10758c2ecf20Sopenharmony_ci 0xcf96700d82028898ULL, 0x1743e3370a2c02c5ULL, 0x379eec98b4e86eaaULL, 0x0c59888a51e0482eULL, 10768c2ecf20Sopenharmony_ci 0xfbcbf1d699b5d189ULL, 0xacaef0d58e9fdc84ULL, 0xc1c20d06231f7614ULL, 0x2938218da274f972ULL, 10778c2ecf20Sopenharmony_ci 0xf6af49beff1d7f18ULL, 0xcc541c22387ac9c2ULL, 0x96fcc9ef4015c56bULL, 0x69c1627c690913a9ULL, 10788c2ecf20Sopenharmony_ci 0x7a86fd2f4733db0eULL, 0xfdb8c4f29e087de9ULL, 0x095e4b1a8ea2a229ULL, 0x1ad7a7c829b37a79ULL, 10798c2ecf20Sopenharmony_ci 0x342d89cad17ea0c0ULL, 0x67bedda6cced2051ULL, 0x19ca31bf2bb42f74ULL, 0x3df7b4c84980acbbULL, 10808c2ecf20Sopenharmony_ci 0xa8c6444dc80ad883ULL, 0xb91e440366e3ab85ULL, 0xc215cda00164f6d8ULL, 0x3d867c6ef247e668ULL, 10818c2ecf20Sopenharmony_ci 0xc7dd582bcc3e658cULL, 0xfd2c4748ee0e5528ULL, 0xa0fd9b95cc9f4f71ULL, 0x7529d871b0675ddfULL, 10828c2ecf20Sopenharmony_ci 0xb8f568b42d3cbd78ULL, 0x1233011b91f3da82ULL, 0x2dce6ccd4a7c3b62ULL, 0x75e7fc8e9e498603ULL, 10838c2ecf20Sopenharmony_ci 0x2f4f13f1fcd0b6ecULL, 0xf1a8ca1f29ff7a45ULL, 0xc249c1a72981e29bULL, 0x6ebe0dbb8c83b56aULL, 10848c2ecf20Sopenharmony_ci 0x7114fa8d170bb222ULL, 0x65a2dcd5bf93935fULL, 0xbdc41f68b59c979aULL, 0x2f0eef79a2ce9289ULL, 10858c2ecf20Sopenharmony_ci 0x42ecbf0c083c37ceULL, 0x2930bc09ec496322ULL, 0xf294b0c19cfeac0dULL, 0x3780aa4bedfabb80ULL, 10868c2ecf20Sopenharmony_ci 0x56c17d3e7cead929ULL, 0xe7cb4beb2e5722c5ULL, 0x0ce931732dbfe15aULL, 0x41b883c7621052f8ULL, 10878c2ecf20Sopenharmony_ci 0xdbf75ca0c3d25350ULL, 0x2936be086eb1e351ULL, 0xc936e03cb4a9b212ULL, 0x1d45bf82322225aaULL, 10888c2ecf20Sopenharmony_ci 0xe81ab1036a024cc5ULL, 0xe212201c304c9a72ULL, 0xc5d73fba6832b1fcULL, 0x20ffdb5a4d839581ULL, 10898c2ecf20Sopenharmony_ci 0xa283d367be5d0fadULL, 0x6c2b25ca8b164475ULL, 0x9d4935467caaf22eULL, 0x5166408eee85ff49ULL, 10908c2ecf20Sopenharmony_ci 0x3c67baa2fab4e361ULL, 0xb3e433c67ef35cefULL, 0x5259729241159b1cULL, 0x6a621892d5b0ab33ULL, 10918c2ecf20Sopenharmony_ci 0x20b74a387555cdcbULL, 0x532aa10e1208923fULL, 0xeaa17b7762281dd1ULL, 0x61ab3443f05c44bfULL, 10928c2ecf20Sopenharmony_ci 0x257a6c422324def8ULL, 0x131c6c1017e3cf7fULL, 0x23758739f630a257ULL, 0x295a407a01a78580ULL, 10938c2ecf20Sopenharmony_ci 0xf8c443246d5da8d9ULL, 0x19d775450c52fa5dULL, 0x2afcfc92731bf83dULL, 0x7d10c8e81b2b4700ULL, 10948c2ecf20Sopenharmony_ci 0xc8e0271f70baa20bULL, 0x993748867ca63957ULL, 0x5412efb3cb7ed4bbULL, 0x3196d36173e62975ULL, 10958c2ecf20Sopenharmony_ci 0xde5bcad141c7dffcULL, 0x47cc8cd2b395c848ULL, 0xa34cd942e11af3cbULL, 0x0256dbf2d04ecec2ULL, 10968c2ecf20Sopenharmony_ci 0x875ab7e94b0e667fULL, 0xcad4dd83c0850d10ULL, 0x47f12e8f4e72c79fULL, 0x5f1a87bb8c85b19bULL, 10978c2ecf20Sopenharmony_ci 0x7ae9d0b6437f51b8ULL, 0x12c7ce5518879065ULL, 0x2ade09fe5cf77aeeULL, 0x23a05a2f7d2c5627ULL, 10988c2ecf20Sopenharmony_ci 0x5908e128f17c169aULL, 0xf77498dd8ad0852dULL, 0x74b4c4ceab102f64ULL, 0x183abadd10139845ULL, 10998c2ecf20Sopenharmony_ci 0xb165ba8daa92aaacULL, 0xd5c5ef9599386705ULL, 0xbe2f8f0cf8fc40d1ULL, 0x2701e635ee204514ULL, 11008c2ecf20Sopenharmony_ci 0x629fa80020156514ULL, 0xf223868764a8c1ceULL, 0x5b894fff0b3f060eULL, 0x60d9944cf708a3faULL, 11018c2ecf20Sopenharmony_ci 0xaeea001a1c7a201fULL, 0xebf16a633ee2ce63ULL, 0x6f7709594c7a07e1ULL, 0x79b958150d0208cbULL, 11028c2ecf20Sopenharmony_ci 0x24b55e5301d410e7ULL, 0xe3a34edff3fdc84dULL, 0xd88768e4904032d8ULL, 0x131384427b3aaeecULL, 11038c2ecf20Sopenharmony_ci 0x8405e51286234f14ULL, 0x14dc4739adb4c529ULL, 0xb8a2b5b250634ffdULL, 0x2fe2a94ad8a7ff93ULL, 11048c2ecf20Sopenharmony_ci 0xec5c57efe843faddULL, 0x2843ce40f0bb9918ULL, 0xa4b561d6cf3d6305ULL, 0x743629bde8fb777eULL, 11058c2ecf20Sopenharmony_ci 0x343edd46bbaf738fULL, 0xed981828b101a651ULL, 0xa401760b882c797aULL, 0x1fc223e28dc88730ULL, 11068c2ecf20Sopenharmony_ci 0x48604e91fc0fba0eULL, 0xb637f78f052c6fa4ULL, 0x91ccac3d09e9239cULL, 0x23f7eed4437a687cULL, 11078c2ecf20Sopenharmony_ci 0x5173b1118d9bd800ULL, 0x29d641b63189d4a7ULL, 0xfdbf177988bbc586ULL, 0x2959894fcad81df5ULL, 11088c2ecf20Sopenharmony_ci 0xaebc8ef3b4bbc899ULL, 0x4148995ab26992b9ULL, 0x24e20b0134f92cfbULL, 0x40d158894a05dee8ULL, 11098c2ecf20Sopenharmony_ci 0x46b00b1185af76f6ULL, 0x26bac77873187a79ULL, 0x3dc0bf95ab8fff5fULL, 0x2a608bd8945524d7ULL, 11108c2ecf20Sopenharmony_ci 0x26449588bd446302ULL, 0x7c4bc21c0388439cULL, 0x8e98a4f383bd11b2ULL, 0x26218d7bc9d876b9ULL, 11118c2ecf20Sopenharmony_ci 0xe3081542997c178aULL, 0x3c2d29a86fb6606fULL, 0x5c217736fa279374ULL, 0x7dde05734afeb1faULL, 11128c2ecf20Sopenharmony_ci 0x3bf10e3906d42babULL, 0xe4f7803e1980649cULL, 0xe6053bf89595bf7aULL, 0x394faf38da245530ULL, 11138c2ecf20Sopenharmony_ci 0x7a8efb58896928f4ULL, 0xfbc778e9cc6a113cULL, 0x72670ce330af596fULL, 0x48f222a81d3d6cf7ULL, 11148c2ecf20Sopenharmony_ci 0xf01fce410d72caa7ULL, 0x5a20ecc7213b5595ULL, 0x7bc21165c1fa1483ULL, 0x07f89ae31da8a741ULL, 11158c2ecf20Sopenharmony_ci 0x05d2c2b4c6830ff9ULL, 0xd43e330fc6316293ULL, 0xa5a5590a96d3a904ULL, 0x705edb91a65333b6ULL, 11168c2ecf20Sopenharmony_ci 0x048ee15e0bb9a5f7ULL, 0x3240cfca9e0aaf5dULL, 0x8f4b71ceedc4a40bULL, 0x621c0da3de544a6dULL, 11178c2ecf20Sopenharmony_ci 0x92872836a08c4091ULL, 0xce8375b010c91445ULL, 0x8a72eb524f276394ULL, 0x2667fcfa7ec83635ULL, 11188c2ecf20Sopenharmony_ci 0x7f4c173345e8752aULL, 0x061b47feee7079a5ULL, 0x25dd9afa9f86ff34ULL, 0x3780cef5425dc89cULL, 11198c2ecf20Sopenharmony_ci 0x1a46035a513bb4e9ULL, 0x3e1ef379ac575adaULL, 0xc78c5f1c5fa24b50ULL, 0x321a967634fd9f22ULL, 11208c2ecf20Sopenharmony_ci 0x946707b8826e27faULL, 0x3dca84d64c506fd0ULL, 0xc189218075e91436ULL, 0x6d9284169b3b8484ULL, 11218c2ecf20Sopenharmony_ci 0x3a67e840383f2ddfULL, 0x33eec9a30c4f9b75ULL, 0x3ec7c86fa783ef47ULL, 0x26ec449fbac9fbc4ULL, 11228c2ecf20Sopenharmony_ci 0x5c0f38cba09b9e7dULL, 0x81168cc762a3478cULL, 0x3e23b0d306fc121cULL, 0x5a238aa0a5efdcddULL, 11238c2ecf20Sopenharmony_ci 0x1ba26121c4ea43ffULL, 0x36f8c77f7c8832b5ULL, 0x88fbea0b0adcf99aULL, 0x5ca9938ec25bebf9ULL, 11248c2ecf20Sopenharmony_ci 0xd5436a5e51fccda0ULL, 0x1dbc4797c2cd893bULL, 0x19346a65d3224a08ULL, 0x0f5034e49b9af466ULL, 11258c2ecf20Sopenharmony_ci 0xf23c3967a1e0b96eULL, 0xe58b08fa867a4d88ULL, 0xfb2fabc6a7341679ULL, 0x2a75381eb6026946ULL, 11268c2ecf20Sopenharmony_ci 0xc80a3be4c19420acULL, 0x66b1f6c681f2b6dcULL, 0x7cf7036761e93388ULL, 0x25abbbd8a660a4c4ULL, 11278c2ecf20Sopenharmony_ci 0x91ea12ba14fd5198ULL, 0x684950fc4a3cffa9ULL, 0xf826842130f5ad28ULL, 0x3ea988f75301a441ULL, 11288c2ecf20Sopenharmony_ci 0xc978109a695f8c6fULL, 0x1746eb4a0530c3f3ULL, 0x444d6d77b4459995ULL, 0x75952b8c054e5cc7ULL, 11298c2ecf20Sopenharmony_ci 0xa3703f7915f4d6aaULL, 0x66c346202f2647d8ULL, 0xd01469df811d644bULL, 0x77fea47d81a5d71fULL, 11308c2ecf20Sopenharmony_ci 0xc5e9529ef57ca381ULL, 0x6eeeb4b9ce2f881aULL, 0xb6e91a28e8009bd6ULL, 0x4b80be3e9afc3fecULL, 11318c2ecf20Sopenharmony_ci 0x7e3773c526aed2c5ULL, 0x1b4afcb453c9a49dULL, 0xa920bdd7baffb24dULL, 0x7c54699f122d400eULL, 11328c2ecf20Sopenharmony_ci 0xef46c8e14fa94bc8ULL, 0xe0b074ce2952ed5eULL, 0xbea450e1dbd885d5ULL, 0x61b68649320f712cULL, 11338c2ecf20Sopenharmony_ci 0x8a485f7309ccbdd1ULL, 0xbd06320d7d4d1a2dULL, 0x25232973322dbef4ULL, 0x445dc4758c17f770ULL, 11348c2ecf20Sopenharmony_ci 0xdb0434177cc8933cULL, 0xed6fe82175ea059fULL, 0x1efebefdc053db34ULL, 0x4adbe867c65daf99ULL, 11358c2ecf20Sopenharmony_ci 0x3acd71a2a90609dfULL, 0xe5e991856dd04050ULL, 0x1ec69b688157c23cULL, 0x697427f6885cfe4dULL, 11368c2ecf20Sopenharmony_ci 0xd7be7b9b65e1a851ULL, 0xa03d28d522c536ddULL, 0x28399d658fd2b645ULL, 0x49e5b7e17c2641e1ULL, 11378c2ecf20Sopenharmony_ci 0x6f8c3a98700457a4ULL, 0x5078f0a25ebb6778ULL, 0xd13c3ccbc382960fULL, 0x2e003258a7df84b1ULL, 11388c2ecf20Sopenharmony_ci 0x8ad1f39be6296a1cULL, 0xc1eeaa652a5fbfb2ULL, 0x33ee0673fd26f3cbULL, 0x59256173a69d2cccULL, 11398c2ecf20Sopenharmony_ci 0x41ea07aa4e18fc41ULL, 0xd9fc19527c87a51eULL, 0xbdaacb805831ca6fULL, 0x445b652dc916694fULL, 11408c2ecf20Sopenharmony_ci 0xce92a3a7f2172315ULL, 0x1edc282de11b9964ULL, 0xa1823aafe04c314aULL, 0x790a2d94437cf586ULL, 11418c2ecf20Sopenharmony_ci 0x71c447fb93f6e009ULL, 0x8922a56722845276ULL, 0xbf70903b204f5169ULL, 0x2f7a89891ba319feULL, 11428c2ecf20Sopenharmony_ci 0x02a08eb577e2140cULL, 0xed9a4ed4427bdcf4ULL, 0x5253ec44e4323cd1ULL, 0x3e88363c14e9355bULL, 11438c2ecf20Sopenharmony_ci 0xaa66c14277110b8cULL, 0x1ae0391610a23390ULL, 0x2030bd12c93fc2a2ULL, 0x3ee141579555c7abULL, 11448c2ecf20Sopenharmony_ci 0x9214de3a6d6e7d41ULL, 0x3ccdd88607f17efeULL, 0x674f1288f8e11217ULL, 0x5682250f329f93d0ULL, 11458c2ecf20Sopenharmony_ci 0x6cf00b136d2e396eULL, 0x6e4cf86f1014debfULL, 0x5930b1b5bfcc4e83ULL, 0x047069b48aba16b6ULL, 11468c2ecf20Sopenharmony_ci 0x0d4ce4ab69b20793ULL, 0xb24db91a97d0fb9eULL, 0xcdfa50f54e00d01dULL, 0x221b1085368bddb5ULL, 11478c2ecf20Sopenharmony_ci 0xe7e59468b1e3d8d2ULL, 0x53c56563bd122f93ULL, 0xeee8a903e0663f09ULL, 0x61efa662cbbe3d42ULL, 11488c2ecf20Sopenharmony_ci 0x2cf8ddddde6eab2aULL, 0x9bf80ad51435f231ULL, 0x5deadacec9f04973ULL, 0x29275b5d41d29b27ULL, 11498c2ecf20Sopenharmony_ci 0xcfde0f0895ebf14fULL, 0xb9aab96b054905a7ULL, 0xcae80dd9a1c420fdULL, 0x0a63bf2f1673bbc7ULL, 11508c2ecf20Sopenharmony_ci 0x092f6e11958fbc8cULL, 0x672a81e804822fadULL, 0xcac8351560d52517ULL, 0x6f3f7722c8f192f8ULL, 11518c2ecf20Sopenharmony_ci 0xf8ba90ccc2e894b7ULL, 0x2c7557a438ff9f0dULL, 0x894d1d855ae52359ULL, 0x68e122157b743d69ULL, 11528c2ecf20Sopenharmony_ci 0xd87e5570cfb919f3ULL, 0x3f2cdecd95798db9ULL, 0x2121154710c0a2ceULL, 0x3c66a115246dc5b2ULL, 11538c2ecf20Sopenharmony_ci 0xcbedc562294ecb72ULL, 0xba7143c36a280b16ULL, 0x9610c2efd4078b67ULL, 0x6144735d946a4b1eULL, 11548c2ecf20Sopenharmony_ci 0x536f111ed75b3350ULL, 0x0211db8c2041d81bULL, 0xf93cb1000e10413cULL, 0x149dfd3c039e8876ULL, 11558c2ecf20Sopenharmony_ci 0xd479dde46b63155bULL, 0xb66e15e93c837976ULL, 0xdafde43b1f13e038ULL, 0x5fafda1a2e4b0b35ULL, 11568c2ecf20Sopenharmony_ci 0x3600bbdf17197581ULL, 0x3972050bbe3cd2c2ULL, 0x5938906dbdd5be86ULL, 0x34fce5e43f9b860fULL, 11578c2ecf20Sopenharmony_ci 0x75a8a4cd42d14d02ULL, 0x828dabc53441df65ULL, 0x33dcabedd2e131d3ULL, 0x3ebad76fb814d25fULL, 11588c2ecf20Sopenharmony_ci 0xd4906f566f70e10fULL, 0x5d12f7aa51690f5aULL, 0x45adb16e76cefcf2ULL, 0x01f768aead232999ULL, 11598c2ecf20Sopenharmony_ci 0x2b6cc77b6248febdULL, 0x3cd30628ec3aaffdULL, 0xce1c0b80d4ef486aULL, 0x4c3bff2ea6f66c23ULL, 11608c2ecf20Sopenharmony_ci 0x3f2ec4094aeaeb5fULL, 0x61b19b286e372ca7ULL, 0x5eefa966de2a701dULL, 0x23b20565de55e3efULL, 11618c2ecf20Sopenharmony_ci 0xe301ca5279d58557ULL, 0x07b2d4ce27c2874fULL, 0xa532cd8a9dcf1d67ULL, 0x2a52fee23f2bff56ULL, 11628c2ecf20Sopenharmony_ci 0x8624efb37cd8663dULL, 0xbbc7ac20ffbd7594ULL, 0x57b85e9c82d37445ULL, 0x7b3052cb86a6ec66ULL, 11638c2ecf20Sopenharmony_ci 0x3482f0ad2525e91eULL, 0x2cb68043d28edca0ULL, 0xaf4f6d052e1b003aULL, 0x185f8c2529781b0aULL, 11648c2ecf20Sopenharmony_ci 0xaa41de5bd80ce0d6ULL, 0x9407b2416853e9d6ULL, 0x563ec36e357f4c3aULL, 0x4cc4b8dd0e297bceULL, 11658c2ecf20Sopenharmony_ci 0xa2fc1a52ffb8730eULL, 0x1811f16e67058e37ULL, 0x10f9a366cddf4ee1ULL, 0x72f4a0c4a0b9f099ULL, 11668c2ecf20Sopenharmony_ci 0x8c16c06f663f4ea7ULL, 0x693b3af74e970fbaULL, 0x2102e7f1d69ec345ULL, 0x0ba53cbc968a8089ULL, 11678c2ecf20Sopenharmony_ci 0xca3d9dc7fea15537ULL, 0x4c6824bb51536493ULL, 0xb9886314844006b1ULL, 0x40d2a72ab454cc60ULL, 11688c2ecf20Sopenharmony_ci 0x5936a1b712570975ULL, 0x91b9d648debda657ULL, 0x3344094bb64330eaULL, 0x006ba10d12ee51d0ULL, 11698c2ecf20Sopenharmony_ci 0x19228468f5de5d58ULL, 0x0eb12f4c38cc05b0ULL, 0xa1039f9dd5601990ULL, 0x4502d4ce4fff0e0bULL, 11708c2ecf20Sopenharmony_ci 0xeb2054106837c189ULL, 0xd0f6544c6dd3b93cULL, 0x40727064c416d74fULL, 0x6e15c6114b502ef0ULL, 11718c2ecf20Sopenharmony_ci 0x4df2a398cfb1a76bULL, 0x11256c7419f2f6b1ULL, 0x4a497962066e6043ULL, 0x705b3aab41355b44ULL, 11728c2ecf20Sopenharmony_ci 0x365ef536d797b1d8ULL, 0x00076bd622ddf0dbULL, 0x3bbf33b0e0575a88ULL, 0x3777aa05c8e4ca4dULL, 11738c2ecf20Sopenharmony_ci 0x392745c85578db5fULL, 0x6fda4149dbae5ae2ULL, 0xb1f0b00b8adc9867ULL, 0x09963437d36f1da3ULL, 11748c2ecf20Sopenharmony_ci 0x7e824e90a5dc3853ULL, 0xccb5f6641f135cbdULL, 0x6736d86c87ce8fccULL, 0x625f3ce26604249fULL, 11758c2ecf20Sopenharmony_ci 0xaf8ac8059502f63fULL, 0x0c05e70a2e351469ULL, 0x35292e9c764b6305ULL, 0x1a394360c7e23ac3ULL, 11768c2ecf20Sopenharmony_ci 0xd5c6d53251183264ULL, 0x62065abd43c2b74fULL, 0xb5fbf5d03b973f9bULL, 0x13a3da3661206e5eULL, 11778c2ecf20Sopenharmony_ci 0xc6bd5837725d94e5ULL, 0x18e30912205016c5ULL, 0x2088ce1570033c68ULL, 0x7fba1f495c837987ULL, 11788c2ecf20Sopenharmony_ci 0x5a8c7423f2f9079dULL, 0x1735157b34023fc5ULL, 0xe4f9b49ad2fab351ULL, 0x6691ff72c878e33cULL, 11798c2ecf20Sopenharmony_ci 0x122c2adedc5eff3eULL, 0xf8dd4bf1d8956cf4ULL, 0xeb86205d9e9e5bdaULL, 0x049b92b9d975c743ULL, 11808c2ecf20Sopenharmony_ci 0xa5379730b0f6c05aULL, 0x72a0ffacc6f3a553ULL, 0xb0032c34b20dcd6dULL, 0x470e9dbc88d5164aULL, 11818c2ecf20Sopenharmony_ci 0xb19cf10ca237c047ULL, 0xb65466711f6c81a2ULL, 0xb3321bd16dd80b43ULL, 0x48c14f600c5fbe8eULL, 11828c2ecf20Sopenharmony_ci 0x66451c264aa6c803ULL, 0xb66e3904a4fa7da6ULL, 0xd45f19b0b3128395ULL, 0x31602627c3c9bc10ULL, 11838c2ecf20Sopenharmony_ci 0x3120dc4832e4e10dULL, 0xeb20c46756c717f7ULL, 0x00f52e3f67280294ULL, 0x566d4fc14730c509ULL, 11848c2ecf20Sopenharmony_ci 0x7e3a5d40fd837206ULL, 0xc1e926dc7159547aULL, 0x216730fba68d6095ULL, 0x22e8c3843f69cea7ULL, 11858c2ecf20Sopenharmony_ci 0x33d074e8930e4b2bULL, 0xb6e4350e84d15816ULL, 0x5534c26ad6ba2365ULL, 0x7773c12f89f1f3f3ULL, 11868c2ecf20Sopenharmony_ci 0x8cba404da57962aaULL, 0x5b9897a81999ce56ULL, 0x508e862f121692fcULL, 0x3a81907fa093c291ULL, 11878c2ecf20Sopenharmony_ci 0x0dded0ff4725a510ULL, 0x10d8cc10673fc503ULL, 0x5b9d151c9f1f4e89ULL, 0x32a5c1d5cb09a44cULL, 11888c2ecf20Sopenharmony_ci 0x1e0aa442b90541fbULL, 0x5f85eb7cc1b485dbULL, 0xbee595ce8a9df2e5ULL, 0x25e496c722422236ULL, 11898c2ecf20Sopenharmony_ci 0x5edf3c46cd0fe5b9ULL, 0x34e75a7ed2a43388ULL, 0xe488de11d761e352ULL, 0x0e878a01a085545cULL, 11908c2ecf20Sopenharmony_ci 0xba493c77e021bb04ULL, 0x2b4d1843c7df899aULL, 0x9ea37a487ae80d67ULL, 0x67a9958011e41794ULL, 11918c2ecf20Sopenharmony_ci 0x4b58051a6697b065ULL, 0x47e33f7d8d6ba6d4ULL, 0xbb4da8d483ca46c1ULL, 0x68becaa181c2db0dULL, 11928c2ecf20Sopenharmony_ci 0x8d8980e90b989aa5ULL, 0xf95eb14a2c93c99bULL, 0x51c6c7c4796e73a2ULL, 0x6e228363b5efb569ULL, 11938c2ecf20Sopenharmony_ci 0xc6bbc0b02dd624c8ULL, 0x777eb47dec8170eeULL, 0x3cde15a004cfafa9ULL, 0x1dc6bc087160bf9bULL, 11948c2ecf20Sopenharmony_ci 0x2e07e043eec34002ULL, 0x18e9fc677a68dc7fULL, 0xd8da03188bd15b9aULL, 0x48fbc3bb00568253ULL, 11958c2ecf20Sopenharmony_ci 0x57547d4cfb654ce1ULL, 0xd3565b82a058e2adULL, 0xf63eaf0bbf154478ULL, 0x47531ef114dfbb18ULL, 11968c2ecf20Sopenharmony_ci 0xe1ec630a4278c587ULL, 0x5507d546ca8e83f3ULL, 0x85e135c63adc0c2bULL, 0x0aa7efa85682844eULL, 11978c2ecf20Sopenharmony_ci 0x72691ba8b3e1f615ULL, 0x32b4e9701fbe3ffaULL, 0x97b6d92e39bb7868ULL, 0x2cfe53dea02e39e8ULL, 11988c2ecf20Sopenharmony_ci 0x687392cd85cd52b0ULL, 0x27ff66c910e29831ULL, 0x97134556a9832d06ULL, 0x269bb0360a84f8a0ULL, 11998c2ecf20Sopenharmony_ci 0x706e55457643f85cULL, 0x3734a48c9b597d1bULL, 0x7aee91e8c6efa472ULL, 0x5cd6abc198a9d9e0ULL, 12008c2ecf20Sopenharmony_ci 0x0e04de06cb3ce41aULL, 0xd8c6eb893402e138ULL, 0x904659bb686e3772ULL, 0x7215c371746ba8c8ULL, 12018c2ecf20Sopenharmony_ci 0xfd12a97eeae4a2d9ULL, 0x9514b7516394f2c5ULL, 0x266fd5809208f294ULL, 0x5c847085619a26b9ULL, 12028c2ecf20Sopenharmony_ci 0x52985410fed694eaULL, 0x3c905b934a2ed254ULL, 0x10bb47692d3be467ULL, 0x063b3d2d69e5e9e1ULL, 12038c2ecf20Sopenharmony_ci 0x472726eedda57debULL, 0xefb6c4ae10f41891ULL, 0x2b1641917b307614ULL, 0x117c554fc4f45b7cULL, 12048c2ecf20Sopenharmony_ci 0xc07cf3118f9d8812ULL, 0x01dbd82050017939ULL, 0xd7e803f4171b2827ULL, 0x1015e87487d225eaULL, 12058c2ecf20Sopenharmony_ci 0xc58de3fed23acc4dULL, 0x50db91c294a7be2dULL, 0x0b94d43d1c9cf457ULL, 0x6b1640fa6e37524aULL, 12068c2ecf20Sopenharmony_ci 0x692f346c5fda0d09ULL, 0x200b1c59fa4d3151ULL, 0xb8c46f760777a296ULL, 0x4b38395f3ffdfbcfULL, 12078c2ecf20Sopenharmony_ci 0x18d25e00be54d671ULL, 0x60d50582bec8aba6ULL, 0x87ad8f263b78b982ULL, 0x50fdf64e9cda0432ULL, 12088c2ecf20Sopenharmony_ci 0x90f567aac578dcf0ULL, 0xef1e9b0ef2a3133bULL, 0x0eebba9242d9de71ULL, 0x15473c9bf03101c7ULL, 12098c2ecf20Sopenharmony_ci 0x7c77e8ae56b78095ULL, 0xb678e7666e6f078eULL, 0x2da0b9615348ba1fULL, 0x7cf931c1ff733f0bULL, 12108c2ecf20Sopenharmony_ci 0x26b357f50a0a366cULL, 0xe9708cf42b87d732ULL, 0xc13aeea5f91cb2c0ULL, 0x35d90c991143bb4cULL, 12118c2ecf20Sopenharmony_ci 0x47c1c404a9a0d9dcULL, 0x659e58451972d251ULL, 0x3875a8c473b38c31ULL, 0x1fbd9ed379561f24ULL, 12128c2ecf20Sopenharmony_ci 0x11fabc6fd41ec28dULL, 0x7ef8dfe3cd2a2dcaULL, 0x72e73b5d8c404595ULL, 0x6135fa4954b72f27ULL, 12138c2ecf20Sopenharmony_ci 0xccfc32a2de24b69cULL, 0x3f55698c1f095d88ULL, 0xbe3350ed5ac3f929ULL, 0x5e9bf806ca477eebULL, 12148c2ecf20Sopenharmony_ci 0xe9ce8fb63c309f68ULL, 0x5376f63565e1f9f4ULL, 0xd1afcfb35a6393f1ULL, 0x6632a1ede5623506ULL, 12158c2ecf20Sopenharmony_ci 0x0b7d6c390c2ded4cULL, 0x56cb3281df04cb1fULL, 0x66305a1249ecc3c7ULL, 0x5d588b60a38ca72aULL, 12168c2ecf20Sopenharmony_ci 0xa6ecbf78e8e5f42dULL, 0x86eeb44b3c8a3eecULL, 0xec219c48fbd21604ULL, 0x1aaf1af517c36731ULL, 12178c2ecf20Sopenharmony_ci 0xc306a2836769bde7ULL, 0x208280622b1e2adbULL, 0x8027f51ffbff94a6ULL, 0x76cfa1ce1124f26bULL, 12188c2ecf20Sopenharmony_ci 0x18eb00562422abb6ULL, 0xf377c4d58f8c29c3ULL, 0x4dbbc207f531561aULL, 0x0253b7f082128a27ULL, 12198c2ecf20Sopenharmony_ci 0x3d1f091cb62c17e0ULL, 0x4860e1abd64628a9ULL, 0x52d17436309d4253ULL, 0x356f97e13efae576ULL, 12208c2ecf20Sopenharmony_ci 0xd351e11aa150535bULL, 0x3e6b45bb1dd878ccULL, 0x0c776128bed92c98ULL, 0x1d34ae93032885b8ULL, 12218c2ecf20Sopenharmony_ci 0x4ba0488ca85ba4c3ULL, 0x985348c33c9ce6ceULL, 0x66124c6f97bda770ULL, 0x0f81a0290654124aULL, 12228c2ecf20Sopenharmony_ci 0x9ed09ca6569b86fdULL, 0x811009fd18af9a2dULL, 0xff08d03f93d8c20aULL, 0x52a148199faef26bULL, 12238c2ecf20Sopenharmony_ci 0x3e03f9dc2d8d1b73ULL, 0x4205801873961a70ULL, 0xc0d987f041a35970ULL, 0x07aa1f15a1c0d549ULL, 12248c2ecf20Sopenharmony_ci 0xdfd46ce08cd27224ULL, 0x6d0a024f934e4239ULL, 0x808a7a6399897b59ULL, 0x0a4556e9e13d95a2ULL, 12258c2ecf20Sopenharmony_ci 0xd21a991fe9c13045ULL, 0x9b0e8548fe7751b8ULL, 0x5da643cb4bf30035ULL, 0x77db28d63940f721ULL, 12268c2ecf20Sopenharmony_ci 0xfc5eeb614adc9011ULL, 0x5229419ae8c411ebULL, 0x9ec3e7787d1dcf74ULL, 0x340d053e216e4cb5ULL, 12278c2ecf20Sopenharmony_ci 0xcac7af39b48df2b4ULL, 0xc0faec2871a10a94ULL, 0x140a69245ca575edULL, 0x0cf1c37134273a4cULL, 12288c2ecf20Sopenharmony_ci 0xc8ee306ac224b8a5ULL, 0x57eaee7ccb4930b0ULL, 0xa1e806bdaacbe74fULL, 0x7d9a62742eeb657dULL, 12298c2ecf20Sopenharmony_ci 0x9eb6b6ef546c4830ULL, 0x885cca1fddb36e2eULL, 0xe6b9f383ef0d7105ULL, 0x58654fef9d2e0412ULL, 12308c2ecf20Sopenharmony_ci 0xa905c4ffbe0e8e26ULL, 0x942de5df9b31816eULL, 0x497d723f802e88e1ULL, 0x30684dea602f408dULL, 12318c2ecf20Sopenharmony_ci 0x21e5a278a3e6cb34ULL, 0xaefb6e6f5b151dc4ULL, 0xb30b8e049d77ca15ULL, 0x28c3c9cf53b98981ULL, 12328c2ecf20Sopenharmony_ci 0x287fb721556cdd2aULL, 0x0d317ca897022274ULL, 0x7468c7423a543258ULL, 0x4a7f11464eb5642fULL, 12338c2ecf20Sopenharmony_ci 0xa237a4774d193aa6ULL, 0xd865986ea92129a1ULL, 0x24c515ecf87c1a88ULL, 0x604003575f39f5ebULL, 12348c2ecf20Sopenharmony_ci 0x47b9f189570a9b27ULL, 0x2b98cede465e4b78ULL, 0x026df551dbb85c20ULL, 0x74fcd91047e21901ULL, 12358c2ecf20Sopenharmony_ci 0x13e2a90a23c1bfa3ULL, 0x0cb0074e478519f6ULL, 0x5ff1cbbe3af6cf44ULL, 0x67fe5438be812dbeULL, 12368c2ecf20Sopenharmony_ci 0xd13cf64fa40f05b0ULL, 0x054dfb2f32283787ULL, 0x4173915b7f0d2aeaULL, 0x482f144f1f610d4eULL, 12378c2ecf20Sopenharmony_ci 0xf6210201b47f8234ULL, 0x5d0ae1929e70b990ULL, 0xdcd7f455b049567cULL, 0x7e93d0f1f0916f01ULL, 12388c2ecf20Sopenharmony_ci 0xdd79cbf18a7db4faULL, 0xbe8391bf6f74c62fULL, 0x027145d14b8291bdULL, 0x585a73ea2cbf1705ULL, 12398c2ecf20Sopenharmony_ci 0x485ca03e928a0db2ULL, 0x10fc01a5742857e7ULL, 0x2f482edbd6d551a7ULL, 0x0f0433b5048fdb8aULL, 12408c2ecf20Sopenharmony_ci 0x60da2e8dd7dc6247ULL, 0x88b4c9d38cd4819aULL, 0x13033ac001f66697ULL, 0x273b24fe3b367d75ULL, 12418c2ecf20Sopenharmony_ci 0xc6e8f66a31b3b9d4ULL, 0x281514a494df49d5ULL, 0xd1726fdfc8b23da7ULL, 0x4b3ae7d103dee548ULL, 12428c2ecf20Sopenharmony_ci 0xc6256e19ce4b9d7eULL, 0xff5c5cf186e3c61cULL, 0xacc63ca34b8ec145ULL, 0x74621888fee66574ULL, 12438c2ecf20Sopenharmony_ci 0x956f409645290a1eULL, 0xef0bf8e3263a962eULL, 0xed6a50eb5ec2647bULL, 0x0694283a9dca7502ULL, 12448c2ecf20Sopenharmony_ci 0x769b963643a2dcd1ULL, 0x42b7c8ea09fc5353ULL, 0x4f002aee13397eabULL, 0x63005e2c19b7d63aULL, 12458c2ecf20Sopenharmony_ci 0xca6736da63023beaULL, 0x966c7f6db12a99b7ULL, 0xace09390c537c5e1ULL, 0x0b696063a1aa89eeULL, 12468c2ecf20Sopenharmony_ci 0xebb03e97288c56e5ULL, 0x432a9f9f938c8be8ULL, 0xa6a5a93d5b717f71ULL, 0x1a5fb4c3e18f9d97ULL, 12478c2ecf20Sopenharmony_ci 0x1c94e7ad1c60cdceULL, 0xee202a43fc02c4a0ULL, 0x8dafe4d867c46a20ULL, 0x0a10263c8ac27b58ULL, 12488c2ecf20Sopenharmony_ci 0xd0dea9dfe4432a4aULL, 0x856af87bbe9277c5ULL, 0xce8472acc212c71aULL, 0x6f151b6d9bbb1e91ULL, 12498c2ecf20Sopenharmony_ci 0x26776c527ceed56aULL, 0x7d211cb7fbf8faecULL, 0x37ae66a6fd4609ccULL, 0x1f81b702d2770c42ULL, 12508c2ecf20Sopenharmony_ci 0x2fb0b057eac58392ULL, 0xe1dd89fe29744e9dULL, 0xc964f8eb17beb4f8ULL, 0x29571073c9a2d41eULL, 12518c2ecf20Sopenharmony_ci 0xa948a18981c0e254ULL, 0x2df6369b65b22830ULL, 0xa33eb2d75fcfd3c6ULL, 0x078cd6ec4199a01fULL, 12528c2ecf20Sopenharmony_ci 0x4a584a41ad900d2fULL, 0x32142b78e2c74c52ULL, 0x68c4e8338431c978ULL, 0x7f69ea9008689fc2ULL, 12538c2ecf20Sopenharmony_ci 0x52f2c81e46a38265ULL, 0xfd78072d04a832fdULL, 0x8cd7d5fa25359e94ULL, 0x4de71b7454cc29d2ULL, 12548c2ecf20Sopenharmony_ci 0x42eb60ad1eda6ac9ULL, 0x0aad37dfdbc09c3aULL, 0x81004b71e33cc191ULL, 0x44e6be345122803cULL, 12558c2ecf20Sopenharmony_ci 0x03fe8388ba1920dbULL, 0xf5d57c32150db008ULL, 0x49c8c4281af60c29ULL, 0x21edb518de701aeeULL, 12568c2ecf20Sopenharmony_ci 0x7fb63e418f06dc99ULL, 0xa4460d99c166d7b8ULL, 0x24dd5248ce520a83ULL, 0x5ec3ad712b928358ULL, 12578c2ecf20Sopenharmony_ci 0x15022a5fbd17930fULL, 0xa4f64a77d82570e3ULL, 0x12bc8d6915783712ULL, 0x498194c0fc620abbULL, 12588c2ecf20Sopenharmony_ci 0x38a2d9d255686c82ULL, 0x785c6bd9193e21f0ULL, 0xe4d5c81ab24a5484ULL, 0x56307860b2e20989ULL, 12598c2ecf20Sopenharmony_ci 0x429d55f78b4d74c4ULL, 0x22f1834643350131ULL, 0x1e60c24598c71fffULL, 0x59f2f014979983efULL, 12608c2ecf20Sopenharmony_ci 0x46a47d56eb494a44ULL, 0x3e22a854d636a18eULL, 0xb346e15274491c3bULL, 0x2ceafd4e5390cde7ULL, 12618c2ecf20Sopenharmony_ci 0xba8a8538be0d6675ULL, 0x4b9074bb50818e23ULL, 0xcbdab89085d304c3ULL, 0x61a24fe0e56192c4ULL, 12628c2ecf20Sopenharmony_ci 0xcb7615e6db525bcbULL, 0xdd7d8c35a567e4caULL, 0xe6b4153acafcdd69ULL, 0x2d668e097f3c9766ULL, 12638c2ecf20Sopenharmony_ci 0xa57e7e265ce55ef0ULL, 0x5d9f4e527cd4b967ULL, 0xfbc83606492fd1e5ULL, 0x090d52beb7c3f7aeULL, 12648c2ecf20Sopenharmony_ci 0x09b9515a1e7b4d7cULL, 0x1f266a2599da44c0ULL, 0xa1c49548e2c55504ULL, 0x7ef04287126f15ccULL, 12658c2ecf20Sopenharmony_ci 0xfed1659dbd30ef15ULL, 0x8b4ab9eec4e0277bULL, 0x884d6236a5df3291ULL, 0x1fd96ea6bf5cf788ULL, 12668c2ecf20Sopenharmony_ci 0x42a161981f190d9aULL, 0x61d849507e6052c1ULL, 0x9fe113bf285a2cd5ULL, 0x7c22d676dbad85d8ULL, 12678c2ecf20Sopenharmony_ci 0x82e770ed2bfbd27dULL, 0x4c05b2ece996f5a5ULL, 0xcd40a9c2b0900150ULL, 0x5895319213d9bf64ULL, 12688c2ecf20Sopenharmony_ci 0xe7cc5d703fea2e08ULL, 0xb50c491258e2188cULL, 0xcce30baa48205bf0ULL, 0x537c659ccfa32d62ULL, 12698c2ecf20Sopenharmony_ci 0x37b6623a98cfc088ULL, 0xfe9bed1fa4d6aca4ULL, 0x04d29b8e56a8d1b0ULL, 0x725f71c40b519575ULL, 12708c2ecf20Sopenharmony_ci 0x28c7f89cd0339ce6ULL, 0x8367b14469ddc18bULL, 0x883ada83a6a1652cULL, 0x585f1974034d6c17ULL, 12718c2ecf20Sopenharmony_ci 0x89cfb266f1b19188ULL, 0xe63b4863e7c35217ULL, 0xd88c9da6b4c0526aULL, 0x3e035c9df0954635ULL, 12728c2ecf20Sopenharmony_ci 0xdd9d5412fb45de9dULL, 0xdd684532e4cff40dULL, 0x4b5c999b151d671cULL, 0x2d8c2cc811e7f690ULL, 12738c2ecf20Sopenharmony_ci 0x7f54be1d90055d40ULL, 0xa464c5df464aaf40ULL, 0x33979624f0e917beULL, 0x2c018dc527356b30ULL, 12748c2ecf20Sopenharmony_ci 0xa5415024e330b3d4ULL, 0x73ff3d96691652d3ULL, 0x94ec42c4ef9b59f1ULL, 0x0747201618d08e5aULL, 12758c2ecf20Sopenharmony_ci 0x4d6ca48aca411c53ULL, 0x66415f2fcfa66119ULL, 0x9c4dd40051e227ffULL, 0x59810bc09a02f7ebULL, 12768c2ecf20Sopenharmony_ci 0x2a7eb171b3dc101dULL, 0x441c5ab99ffef68eULL, 0x32025c9b93b359eaULL, 0x5e8ce0a71e9d112fULL, 12778c2ecf20Sopenharmony_ci 0xbfcccb92429503fdULL, 0xd271ba752f095d55ULL, 0x345ead5e972d091eULL, 0x18c8df11a83103baULL, 12788c2ecf20Sopenharmony_ci 0x90cd949a9aed0f4cULL, 0xc5d1f4cb6660e37eULL, 0xb8cac52d56c52e0bULL, 0x6e42e400c5808e0dULL, 12798c2ecf20Sopenharmony_ci 0xa3b46966eeaefd23ULL, 0x0c4f1f0be39ecdcaULL, 0x189dc8c9d683a51dULL, 0x51f27f054c09351bULL, 12808c2ecf20Sopenharmony_ci 0x4c487ccd2a320682ULL, 0x587ea95bb3df1c96ULL, 0xc8ccf79e555cb8e8ULL, 0x547dc829a206d73dULL, 12818c2ecf20Sopenharmony_ci 0xb822a6cd80c39b06ULL, 0xe96d54732000d4c6ULL, 0x28535b6f91463b4dULL, 0x228f4660e2486e1dULL, 12828c2ecf20Sopenharmony_ci 0x98799538de8d3abfULL, 0x8cd8330045ebca6eULL, 0x79952a008221e738ULL, 0x4322e1a7535cd2bbULL, 12838c2ecf20Sopenharmony_ci 0xb114c11819d1801cULL, 0x2016e4d84f3f5ec7ULL, 0xdd0e2df409260f4cULL, 0x5ec362c0ae5f7266ULL, 12848c2ecf20Sopenharmony_ci 0xc0462b18b8b2b4eeULL, 0x7cc8d950274d1afbULL, 0xf25f7105436b02d2ULL, 0x43bbf8dcbff9ccd3ULL, 12858c2ecf20Sopenharmony_ci 0xb6ad1767a039e9dfULL, 0xb0714da8f69d3583ULL, 0x5e55fa18b42931f5ULL, 0x4ed5558f33c60961ULL, 12868c2ecf20Sopenharmony_ci 0x1fe37901c647a5ddULL, 0x593ddf1f8081d357ULL, 0x0249a4fd813fd7a6ULL, 0x69acca274e9caf61ULL, 12878c2ecf20Sopenharmony_ci 0x047ba3ea330721c9ULL, 0x83423fc20e7e1ea0ULL, 0x1df4c0af01314a60ULL, 0x09a62dab89289527ULL, 12888c2ecf20Sopenharmony_ci 0xa5b325a49cc6cb00ULL, 0xe94b5dc654b56cb6ULL, 0x3be28779adc994a0ULL, 0x4296e8f8ba3a4aadULL, 12898c2ecf20Sopenharmony_ci 0x328689761e451eabULL, 0x2e4d598bff59594aULL, 0x49b96853d7a7084aULL, 0x4980a319601420a8ULL, 12908c2ecf20Sopenharmony_ci 0x9565b9e12f552c42ULL, 0x8a5318db7100fe96ULL, 0x05c90b4d43add0d7ULL, 0x538b4cd66a5d4edaULL, 12918c2ecf20Sopenharmony_ci 0xf4e94fc3e89f039fULL, 0x592c9af26f618045ULL, 0x08a36eb5fd4b9550ULL, 0x25fffaf6c2ed1419ULL, 12928c2ecf20Sopenharmony_ci 0x34434459cc79d354ULL, 0xeeecbfb4b1d5476bULL, 0xddeb34a061615d99ULL, 0x5129cecceb64b773ULL, 12938c2ecf20Sopenharmony_ci 0xee43215894993520ULL, 0x772f9c7cf14c0b3bULL, 0xd2e2fce306bedad5ULL, 0x715f42b546f06a97ULL, 12948c2ecf20Sopenharmony_ci 0x434ecdceda5b5f1aULL, 0x0da17115a49741a9ULL, 0x680bd77c73edad2eULL, 0x487c02354edd9041ULL, 12958c2ecf20Sopenharmony_ci 0xb8efeff3a70ed9c4ULL, 0x56a32aa3e857e302ULL, 0xdf3a68bd48a2a5a0ULL, 0x07f650b73176c444ULL, 12968c2ecf20Sopenharmony_ci 0xe38b9b1626e0ccb1ULL, 0x79e053c18b09fb36ULL, 0x56d90319c9f94964ULL, 0x1ca941e7ac9ff5c4ULL, 12978c2ecf20Sopenharmony_ci 0x49c4df29162fa0bbULL, 0x8488cf3282b33305ULL, 0x95dfda14cabb437dULL, 0x3391f78264d5ad86ULL, 12988c2ecf20Sopenharmony_ci 0x729ae06ae2b5095dULL, 0xd58a58d73259a946ULL, 0xe9834262d13921edULL, 0x27fedafaa54bb592ULL, 12998c2ecf20Sopenharmony_ci 0xa99dc5b829ad48bbULL, 0x5f025742499ee260ULL, 0x802c8ecd5d7513fdULL, 0x78ceb3ef3f6dd938ULL, 13008c2ecf20Sopenharmony_ci 0xc342f44f8a135d94ULL, 0x7b9edb44828cdda3ULL, 0x9436d11a0537cfe7ULL, 0x5064b164ec1ab4c8ULL, 13018c2ecf20Sopenharmony_ci 0x7020eccfd37eb2fcULL, 0x1f31ea3ed90d25fcULL, 0x1b930d7bdfa1bb34ULL, 0x5344467a48113044ULL, 13028c2ecf20Sopenharmony_ci 0x70073170f25e6dfbULL, 0xe385dc1a50114cc8ULL, 0x2348698ac8fc4f00ULL, 0x2a77a55284dd40d8ULL, 13038c2ecf20Sopenharmony_ci 0xfe06afe0c98c6ce4ULL, 0xc235df96dddfd6e4ULL, 0x1428d01e33bf1ed3ULL, 0x785768ec9300bdafULL, 13048c2ecf20Sopenharmony_ci 0x9702e57a91deb63bULL, 0x61bdb8bfe5ce8b80ULL, 0x645b426f3d1d58acULL, 0x4804a82227a557bcULL, 13058c2ecf20Sopenharmony_ci 0x8e57048ab44d2601ULL, 0x68d6501a4b3a6935ULL, 0xc39c9ec3f9e1c293ULL, 0x4172f257d4de63e2ULL, 13068c2ecf20Sopenharmony_ci 0xd368b450330c6401ULL, 0x040d3017418f2391ULL, 0x2c34bb6090b7d90dULL, 0x16f649228fdfd51fULL, 13078c2ecf20Sopenharmony_ci 0xbea6818e2b928ef5ULL, 0xe28ccf91cdc11e72ULL, 0x594aaa68e77a36cdULL, 0x313034806c7ffd0fULL, 13088c2ecf20Sopenharmony_ci 0x8a9d27ac2249bd65ULL, 0x19a3b464018e9512ULL, 0xc26ccff352b37ec7ULL, 0x056f68341d797b21ULL, 13098c2ecf20Sopenharmony_ci 0x5e79d6757efd2327ULL, 0xfabdbcb6553afe15ULL, 0xd3e7222c6eaf5a60ULL, 0x7046c76d4dae743bULL, 13108c2ecf20Sopenharmony_ci 0x660be872b18d4a55ULL, 0x19992518574e1496ULL, 0xc103053a302bdcbbULL, 0x3ed8e9800b218e8eULL, 13118c2ecf20Sopenharmony_ci 0x7b0b9239fa75e03eULL, 0xefe9fb684633c083ULL, 0x98a35fbe391a7793ULL, 0x6065510fe2d0fe34ULL, 13128c2ecf20Sopenharmony_ci 0x55cb668548abad0cULL, 0xb4584548da87e527ULL, 0x2c43ecea0107c1ddULL, 0x526028809372de35ULL, 13138c2ecf20Sopenharmony_ci 0x3415c56af9213b1fULL, 0x5bee1a4d017e98dbULL, 0x13f6b105b5cf709bULL, 0x5ff20e3482b29ab6ULL, 13148c2ecf20Sopenharmony_ci 0x0aa29c75cc2e6c90ULL, 0xfc7d73ca3a70e206ULL, 0x899fc38fc4b5c515ULL, 0x250386b124ffc207ULL, 13158c2ecf20Sopenharmony_ci 0x54ea28d5ae3d2b56ULL, 0x9913149dd6de60ceULL, 0x16694fc58f06d6c1ULL, 0x46b23975eb018fc7ULL, 13168c2ecf20Sopenharmony_ci 0x470a6a0fb4b7b4e2ULL, 0x5d92475a8f7253deULL, 0xabeee5b52fbd3adbULL, 0x7fa20801a0806968ULL, 13178c2ecf20Sopenharmony_ci 0x76f3faf19f7714d2ULL, 0xb3e840c12f4660c3ULL, 0x0fb4cd8df212744eULL, 0x4b065a251d3a2dd2ULL, 13188c2ecf20Sopenharmony_ci 0x5cebde383d77cd4aULL, 0x6adf39df882c9cb1ULL, 0xa2dd242eb09af759ULL, 0x3147c0e50e5f6422ULL, 13198c2ecf20Sopenharmony_ci 0x164ca5101d1350dbULL, 0xf8d13479c33fc962ULL, 0xe640ce4d13e5da08ULL, 0x4bdee0c45061f8baULL, 13208c2ecf20Sopenharmony_ci 0xd7c46dc1a4edb1c9ULL, 0x5514d7b6437fd98aULL, 0x58942f6bb2a1c00bULL, 0x2dffb2ab1d70710eULL, 13218c2ecf20Sopenharmony_ci 0xccdfcf2fc18b6d68ULL, 0xa8ebcba8b7806167ULL, 0x980697f95e2937e3ULL, 0x02fbba1cd0126e8cULL 13228c2ecf20Sopenharmony_ci}; 13238c2ecf20Sopenharmony_ci 13248c2ecf20Sopenharmony_cistatic void curve25519_ever64_base(u8 *out, const u8 *priv) 13258c2ecf20Sopenharmony_ci{ 13268c2ecf20Sopenharmony_ci u64 swap = 1; 13278c2ecf20Sopenharmony_ci int i, j, k; 13288c2ecf20Sopenharmony_ci u64 tmp[16 + 32 + 4]; 13298c2ecf20Sopenharmony_ci u64 *x1 = &tmp[0]; 13308c2ecf20Sopenharmony_ci u64 *z1 = &tmp[4]; 13318c2ecf20Sopenharmony_ci u64 *x2 = &tmp[8]; 13328c2ecf20Sopenharmony_ci u64 *z2 = &tmp[12]; 13338c2ecf20Sopenharmony_ci u64 *xz1 = &tmp[0]; 13348c2ecf20Sopenharmony_ci u64 *xz2 = &tmp[8]; 13358c2ecf20Sopenharmony_ci u64 *a = &tmp[0 + 16]; 13368c2ecf20Sopenharmony_ci u64 *b = &tmp[4 + 16]; 13378c2ecf20Sopenharmony_ci u64 *c = &tmp[8 + 16]; 13388c2ecf20Sopenharmony_ci u64 *ab = &tmp[0 + 16]; 13398c2ecf20Sopenharmony_ci u64 *abcd = &tmp[0 + 16]; 13408c2ecf20Sopenharmony_ci u64 *ef = &tmp[16 + 16]; 13418c2ecf20Sopenharmony_ci u64 *efgh = &tmp[16 + 16]; 13428c2ecf20Sopenharmony_ci u64 *key = &tmp[0 + 16 + 32]; 13438c2ecf20Sopenharmony_ci 13448c2ecf20Sopenharmony_ci memcpy(key, priv, 32); 13458c2ecf20Sopenharmony_ci ((u8 *)key)[0] &= 248; 13468c2ecf20Sopenharmony_ci ((u8 *)key)[31] = (((u8 *)key)[31] & 127) | 64; 13478c2ecf20Sopenharmony_ci 13488c2ecf20Sopenharmony_ci x1[0] = 1, x1[1] = x1[2] = x1[3] = 0; 13498c2ecf20Sopenharmony_ci z1[0] = 1, z1[1] = z1[2] = z1[3] = 0; 13508c2ecf20Sopenharmony_ci z2[0] = 1, z2[1] = z2[2] = z2[3] = 0; 13518c2ecf20Sopenharmony_ci memcpy(x2, p_minus_s, sizeof(p_minus_s)); 13528c2ecf20Sopenharmony_ci 13538c2ecf20Sopenharmony_ci j = 3; 13548c2ecf20Sopenharmony_ci for (i = 0; i < 4; ++i) { 13558c2ecf20Sopenharmony_ci while (j < (const int[]){ 64, 64, 64, 63 }[i]) { 13568c2ecf20Sopenharmony_ci u64 bit = (key[i] >> j) & 1; 13578c2ecf20Sopenharmony_ci k = (64 * i + j - 3); 13588c2ecf20Sopenharmony_ci swap = swap ^ bit; 13598c2ecf20Sopenharmony_ci cswap2(swap, xz1, xz2); 13608c2ecf20Sopenharmony_ci swap = bit; 13618c2ecf20Sopenharmony_ci fsub(b, x1, z1); 13628c2ecf20Sopenharmony_ci fadd(a, x1, z1); 13638c2ecf20Sopenharmony_ci fmul(c, &table_ladder[4 * k], b, ef); 13648c2ecf20Sopenharmony_ci fsub(b, a, c); 13658c2ecf20Sopenharmony_ci fadd(a, a, c); 13668c2ecf20Sopenharmony_ci fsqr2(ab, ab, efgh); 13678c2ecf20Sopenharmony_ci fmul2(xz1, xz2, ab, efgh); 13688c2ecf20Sopenharmony_ci ++j; 13698c2ecf20Sopenharmony_ci } 13708c2ecf20Sopenharmony_ci j = 0; 13718c2ecf20Sopenharmony_ci } 13728c2ecf20Sopenharmony_ci 13738c2ecf20Sopenharmony_ci point_double(xz1, abcd, efgh); 13748c2ecf20Sopenharmony_ci point_double(xz1, abcd, efgh); 13758c2ecf20Sopenharmony_ci point_double(xz1, abcd, efgh); 13768c2ecf20Sopenharmony_ci encode_point(out, xz1); 13778c2ecf20Sopenharmony_ci 13788c2ecf20Sopenharmony_ci memzero_explicit(tmp, sizeof(tmp)); 13798c2ecf20Sopenharmony_ci} 13808c2ecf20Sopenharmony_ci 13818c2ecf20Sopenharmony_cistatic __ro_after_init DEFINE_STATIC_KEY_FALSE(curve25519_use_bmi2_adx); 13828c2ecf20Sopenharmony_ci 13838c2ecf20Sopenharmony_civoid curve25519_arch(u8 mypublic[CURVE25519_KEY_SIZE], 13848c2ecf20Sopenharmony_ci const u8 secret[CURVE25519_KEY_SIZE], 13858c2ecf20Sopenharmony_ci const u8 basepoint[CURVE25519_KEY_SIZE]) 13868c2ecf20Sopenharmony_ci{ 13878c2ecf20Sopenharmony_ci if (static_branch_likely(&curve25519_use_bmi2_adx)) 13888c2ecf20Sopenharmony_ci curve25519_ever64(mypublic, secret, basepoint); 13898c2ecf20Sopenharmony_ci else 13908c2ecf20Sopenharmony_ci curve25519_generic(mypublic, secret, basepoint); 13918c2ecf20Sopenharmony_ci} 13928c2ecf20Sopenharmony_ciEXPORT_SYMBOL(curve25519_arch); 13938c2ecf20Sopenharmony_ci 13948c2ecf20Sopenharmony_civoid curve25519_base_arch(u8 pub[CURVE25519_KEY_SIZE], 13958c2ecf20Sopenharmony_ci const u8 secret[CURVE25519_KEY_SIZE]) 13968c2ecf20Sopenharmony_ci{ 13978c2ecf20Sopenharmony_ci if (static_branch_likely(&curve25519_use_bmi2_adx)) 13988c2ecf20Sopenharmony_ci curve25519_ever64_base(pub, secret); 13998c2ecf20Sopenharmony_ci else 14008c2ecf20Sopenharmony_ci curve25519_generic(pub, secret, curve25519_base_point); 14018c2ecf20Sopenharmony_ci} 14028c2ecf20Sopenharmony_ciEXPORT_SYMBOL(curve25519_base_arch); 14038c2ecf20Sopenharmony_ci 14048c2ecf20Sopenharmony_cistatic int curve25519_set_secret(struct crypto_kpp *tfm, const void *buf, 14058c2ecf20Sopenharmony_ci unsigned int len) 14068c2ecf20Sopenharmony_ci{ 14078c2ecf20Sopenharmony_ci u8 *secret = kpp_tfm_ctx(tfm); 14088c2ecf20Sopenharmony_ci 14098c2ecf20Sopenharmony_ci if (!len) 14108c2ecf20Sopenharmony_ci curve25519_generate_secret(secret); 14118c2ecf20Sopenharmony_ci else if (len == CURVE25519_KEY_SIZE && 14128c2ecf20Sopenharmony_ci crypto_memneq(buf, curve25519_null_point, CURVE25519_KEY_SIZE)) 14138c2ecf20Sopenharmony_ci memcpy(secret, buf, CURVE25519_KEY_SIZE); 14148c2ecf20Sopenharmony_ci else 14158c2ecf20Sopenharmony_ci return -EINVAL; 14168c2ecf20Sopenharmony_ci return 0; 14178c2ecf20Sopenharmony_ci} 14188c2ecf20Sopenharmony_ci 14198c2ecf20Sopenharmony_cistatic int curve25519_generate_public_key(struct kpp_request *req) 14208c2ecf20Sopenharmony_ci{ 14218c2ecf20Sopenharmony_ci struct crypto_kpp *tfm = crypto_kpp_reqtfm(req); 14228c2ecf20Sopenharmony_ci const u8 *secret = kpp_tfm_ctx(tfm); 14238c2ecf20Sopenharmony_ci u8 buf[CURVE25519_KEY_SIZE]; 14248c2ecf20Sopenharmony_ci int copied, nbytes; 14258c2ecf20Sopenharmony_ci 14268c2ecf20Sopenharmony_ci if (req->src) 14278c2ecf20Sopenharmony_ci return -EINVAL; 14288c2ecf20Sopenharmony_ci 14298c2ecf20Sopenharmony_ci curve25519_base_arch(buf, secret); 14308c2ecf20Sopenharmony_ci 14318c2ecf20Sopenharmony_ci /* might want less than we've got */ 14328c2ecf20Sopenharmony_ci nbytes = min_t(size_t, CURVE25519_KEY_SIZE, req->dst_len); 14338c2ecf20Sopenharmony_ci copied = sg_copy_from_buffer(req->dst, sg_nents_for_len(req->dst, 14348c2ecf20Sopenharmony_ci nbytes), 14358c2ecf20Sopenharmony_ci buf, nbytes); 14368c2ecf20Sopenharmony_ci if (copied != nbytes) 14378c2ecf20Sopenharmony_ci return -EINVAL; 14388c2ecf20Sopenharmony_ci return 0; 14398c2ecf20Sopenharmony_ci} 14408c2ecf20Sopenharmony_ci 14418c2ecf20Sopenharmony_cistatic int curve25519_compute_shared_secret(struct kpp_request *req) 14428c2ecf20Sopenharmony_ci{ 14438c2ecf20Sopenharmony_ci struct crypto_kpp *tfm = crypto_kpp_reqtfm(req); 14448c2ecf20Sopenharmony_ci const u8 *secret = kpp_tfm_ctx(tfm); 14458c2ecf20Sopenharmony_ci u8 public_key[CURVE25519_KEY_SIZE]; 14468c2ecf20Sopenharmony_ci u8 buf[CURVE25519_KEY_SIZE]; 14478c2ecf20Sopenharmony_ci int copied, nbytes; 14488c2ecf20Sopenharmony_ci 14498c2ecf20Sopenharmony_ci if (!req->src) 14508c2ecf20Sopenharmony_ci return -EINVAL; 14518c2ecf20Sopenharmony_ci 14528c2ecf20Sopenharmony_ci copied = sg_copy_to_buffer(req->src, 14538c2ecf20Sopenharmony_ci sg_nents_for_len(req->src, 14548c2ecf20Sopenharmony_ci CURVE25519_KEY_SIZE), 14558c2ecf20Sopenharmony_ci public_key, CURVE25519_KEY_SIZE); 14568c2ecf20Sopenharmony_ci if (copied != CURVE25519_KEY_SIZE) 14578c2ecf20Sopenharmony_ci return -EINVAL; 14588c2ecf20Sopenharmony_ci 14598c2ecf20Sopenharmony_ci curve25519_arch(buf, secret, public_key); 14608c2ecf20Sopenharmony_ci 14618c2ecf20Sopenharmony_ci /* might want less than we've got */ 14628c2ecf20Sopenharmony_ci nbytes = min_t(size_t, CURVE25519_KEY_SIZE, req->dst_len); 14638c2ecf20Sopenharmony_ci copied = sg_copy_from_buffer(req->dst, sg_nents_for_len(req->dst, 14648c2ecf20Sopenharmony_ci nbytes), 14658c2ecf20Sopenharmony_ci buf, nbytes); 14668c2ecf20Sopenharmony_ci if (copied != nbytes) 14678c2ecf20Sopenharmony_ci return -EINVAL; 14688c2ecf20Sopenharmony_ci return 0; 14698c2ecf20Sopenharmony_ci} 14708c2ecf20Sopenharmony_ci 14718c2ecf20Sopenharmony_cistatic unsigned int curve25519_max_size(struct crypto_kpp *tfm) 14728c2ecf20Sopenharmony_ci{ 14738c2ecf20Sopenharmony_ci return CURVE25519_KEY_SIZE; 14748c2ecf20Sopenharmony_ci} 14758c2ecf20Sopenharmony_ci 14768c2ecf20Sopenharmony_cistatic struct kpp_alg curve25519_alg = { 14778c2ecf20Sopenharmony_ci .base.cra_name = "curve25519", 14788c2ecf20Sopenharmony_ci .base.cra_driver_name = "curve25519-x86", 14798c2ecf20Sopenharmony_ci .base.cra_priority = 200, 14808c2ecf20Sopenharmony_ci .base.cra_module = THIS_MODULE, 14818c2ecf20Sopenharmony_ci .base.cra_ctxsize = CURVE25519_KEY_SIZE, 14828c2ecf20Sopenharmony_ci 14838c2ecf20Sopenharmony_ci .set_secret = curve25519_set_secret, 14848c2ecf20Sopenharmony_ci .generate_public_key = curve25519_generate_public_key, 14858c2ecf20Sopenharmony_ci .compute_shared_secret = curve25519_compute_shared_secret, 14868c2ecf20Sopenharmony_ci .max_size = curve25519_max_size, 14878c2ecf20Sopenharmony_ci}; 14888c2ecf20Sopenharmony_ci 14898c2ecf20Sopenharmony_ci 14908c2ecf20Sopenharmony_cistatic int __init curve25519_mod_init(void) 14918c2ecf20Sopenharmony_ci{ 14928c2ecf20Sopenharmony_ci if (boot_cpu_has(X86_FEATURE_BMI2) && boot_cpu_has(X86_FEATURE_ADX)) 14938c2ecf20Sopenharmony_ci static_branch_enable(&curve25519_use_bmi2_adx); 14948c2ecf20Sopenharmony_ci else 14958c2ecf20Sopenharmony_ci return 0; 14968c2ecf20Sopenharmony_ci return IS_REACHABLE(CONFIG_CRYPTO_KPP) ? 14978c2ecf20Sopenharmony_ci crypto_register_kpp(&curve25519_alg) : 0; 14988c2ecf20Sopenharmony_ci} 14998c2ecf20Sopenharmony_ci 15008c2ecf20Sopenharmony_cistatic void __exit curve25519_mod_exit(void) 15018c2ecf20Sopenharmony_ci{ 15028c2ecf20Sopenharmony_ci if (IS_REACHABLE(CONFIG_CRYPTO_KPP) && 15038c2ecf20Sopenharmony_ci static_branch_likely(&curve25519_use_bmi2_adx)) 15048c2ecf20Sopenharmony_ci crypto_unregister_kpp(&curve25519_alg); 15058c2ecf20Sopenharmony_ci} 15068c2ecf20Sopenharmony_ci 15078c2ecf20Sopenharmony_cimodule_init(curve25519_mod_init); 15088c2ecf20Sopenharmony_cimodule_exit(curve25519_mod_exit); 15098c2ecf20Sopenharmony_ci 15108c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("curve25519"); 15118c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("curve25519-x86"); 15128c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2"); 15138c2ecf20Sopenharmony_ciMODULE_AUTHOR("Jason A. Donenfeld <Jason@zx2c4.com>"); 1514