repo_id
stringlengths
5
115
size
int64
590
5.01M
file_path
stringlengths
4
212
content
stringlengths
590
5.01M
wlsfx/bnbb
2,160
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/bignum_double_p25519.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Double modulo p_25519, z := (2 * x) mod p_25519, assuming x reduced // Input x[4]; output z[4] // // extern void bignum_double_p25519(uint64_t z[static 4], // const uint64_t x[static 4]); // // Standard ARM ABI: X0 = z, X1 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_double_p25519) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_double_p25519) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_double_p25519) .text .balign 4 #define z x0 #define x x1 #define d0 x2 #define d1 x3 #define d2 x4 #define d3 x5 #define c0 x6 #define c1 x7 #define c2 x8 #define c3 x9 S2N_BN_SYMBOL(bignum_double_p25519): CFI_START // Double by adding as [d3; d2; d1; d0] = 2 * x; since we assume // x < 2^255 - 19 this result fits in 256 bits ldp d0, d1, [x] adds d0, d0, d0 adcs d1, d1, d1 ldp d2, d3, [x, #16] adcs d2, d2, d2 adc d3, d3, d3 // Now 2 * x >= 2^255 - 19 <=> 2 * x + (2^255 + 19) >= 2^256 // Form [c3; c2; c1; c0] = (2 * x) + (2^255 + 19), with CF for the comparison mov c3, #0x8000000000000000 adds c0, d0, #19 adcs c1, d1, xzr adcs c2, d2, xzr adcs c3, d3, c3 // If the comparison holds, select [c3; c2; c1; c0]. There's no need to mask // it since in this case it is ((2 * x) + (2^255 + 19)) - 2^256 because the // top carry is lost, which is the desired (2 * x) - (2^255 - 19). csel d0, d0, c0, cc csel d1, d1, c1, cc csel d2, d2, c2, cc csel d3, d3, c3, cc // Store the result stp d0, d1, [z] stp d2, d3, [z, #16] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_double_p25519) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
17,636
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/bignum_invsqrt_p25519.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Inverse square root modulo p_25519 = 2^255 - 19 // Input x[4]; output function return (Legendre symbol) and z[4] // // extern int64_t bignum_invsqrt_p25519(uint64_t z[static 4],const uint64_t x[static 4]); // // Given a 4-digit input x, returns a modular inverse square root mod p_25519, // i.e. a z such that x * z^2 == 1 (mod p_25519), whenever one exists. The // inverse square root z is chosen so that its LSB is even (note that p_25519-z // is another possibility). The function return is the Legendre/Jacobi symbol // (x//p_25519), which indicates whether indeed x has a modular inverse square // root and hence whether the result is meaningful: // // 0: x is divisible by p_25519 so trivially there is no inverse square root // +1: x is coprime to p_25519 and z is indeed an inverse square root // -1: x is coprime to p_25519 but there is no (inverse or direct) square root // // Standard ARM ABI: X0 = z, X1 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_invsqrt_p25519) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_invsqrt_p25519) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_invsqrt_p25519) .text .balign 4 // Size in bytes of a 64-bit word #define N 8 // Pointer-offset pairs for temporaries on stack #define a sp, #0 #define b sp, #(4*N) #define s sp, #(8*N) #define t sp, #(12*N) // Other temporary variables in register #define res x19 // Total size to reserve on the stack #define NSPACE 16*N // Loading large constants #define movbig(nn,n3,n2,n1,n0) \ movz nn, n0 __LF \ movk nn, n1, lsl #16 __LF \ movk nn, n2, lsl #32 __LF \ movk nn, n3, lsl #48 // Macros wrapping up calls to the local subroutines #define mulp(dest,src1,src2) \ add x0, dest __LF \ add x1, src1 __LF \ add x2, src2 __LF \ CFI_BL(Lbignum_invsqrt_p25519_mul_p25519) #define nsqr(dest,n,src) \ add x0, dest __LF \ mov x1, n __LF \ add x2, src __LF \ CFI_BL(Lbignum_invsqrt_p25519_nsqr_p25519) S2N_BN_SYMBOL(bignum_invsqrt_p25519): CFI_START // Save registers and make room for temporaries CFI_PUSH2(x19,x30) CFI_DEC_SP(NSPACE) // Save the return pointer for the end so we can overwrite x0 later mov res, x0 // Set up reduced version of the input argument a = x mod p_25519. Then // get the candidate inverse square root s = a^{252-3} ldp x2, x3, [x1] ldp x4, x5, [x1, #16] mov x7, #19 lsr x6, x5, #63 madd x6, x7, x6, x7 adds x2, x2, x6 adcs x3, x3, xzr adcs x4, x4, xzr orr x5, x5, #0x8000000000000000 adcs x5, x5, xzr csel x6, x7, xzr, lo subs x2, x2, x6 sbcs x3, x3, xzr sbcs x4, x4, xzr sbc x5, x5, xzr and x5, x5, #0x7fffffffffffffff stp x2, x3, [a] stp x4, x5, [a+16] // Power 2^2 - 1 = 3 nsqr(t,1,a) mulp(t,t,a) // Power 2^4 - 1 = 15 nsqr(s,2,t) mulp(t,s,t) // Power 2^5 - 1 = 31 nsqr(s,1,t) mulp(b,s,a) // Power 2^10 - 1 nsqr(s,5,b) mulp(t,s,b) // Power 2^20 - 1 nsqr(s,10,t) mulp(t,s,t) // Power 2^25 - 1 nsqr(s,5,t) mulp(b,s,b) // Power 2^50 - 1 nsqr(s,25,b) mulp(t,s,b) // Power 2^100 - 1 nsqr(s,50,t) mulp(t,s,t) // Power 2^125 - 1 nsqr(s,25,t) mulp(b,s,b) // Power 2^250 - 1 nsqr(s,125,b) mulp(b,s,b) // Power 2^252 - 3 nsqr(s,2,b) mulp(s,s,a) // s = a^{2^252-3} is now one candidate inverse square root. // Generate the other one t = s * j_25519 where j_25519 = sqrt(-1) movbig(x0, #0xc4ee, #0x1b27, #0x4a0e, #0xa0b0) movbig(x1, #0x2f43, #0x1806, #0xad2f, #0xe478) movbig(x2, #0x2b4d, #0x0099, #0x3dfb, #0xd7a7) movbig(x3, #0x2b83, #0x2480, #0x4fc1, #0xdf0b) stp x0, x1, [t] stp x2, x3, [t+16] mulp(t,s,t) // Now multiplex between them according to whether a * s^2 = 1 nsqr(b,1,s) mulp(b,a,b) ldp x10, x11, [b] eor x10, x10, #1 ldp x12, x13, [b+16] orr x10, x10, x11 orr x12, x12, x13 orr x10, x10, x12 cmp x10, xzr ldp x10, x11, [s] ldp x14, x15, [t] csel x10, x10, x14, eq csel x11, x11, x15, eq ldp x12, x13, [s+16] ldp x16, x17, [t+16] csel x12, x12, x16, eq csel x13, x13, x17, eq // For definiteness, choose "positive" (LSB=0) inverse square root mov x14, #-19 subs x14, x14, x10 mov x16, #-1 sbcs x15, x16, x11 mov x17, #0x7FFFFFFFFFFFFFFF sbcs x16, x16, x12 sbc x17, x17, x13 tst x10, #1 csel x10, x10, x14, eq csel x11, x11, x15, eq csel x12, x12, x16, eq csel x13, x13, x17, eq mov x2, res stp x10, x11, [x2] stp x12, x13, [x2, #16] // Determine if it is is indeed an inverse square root, also distinguishing // the degenerate x * z^2 == 0 (mod p_25519) case, which is equivalent to // x == 0 (mod p_25519). Hence return the Legendre-Jacobi symbol as required. add x0, b mov x1, #1 CFI_BL(Lbignum_invsqrt_p25519_nsqr_p25519) mulp(b,a,b) ldp x10, x11, [b] eor x14, x10, #1 ldp x12, x13, [b+16] orr x10, x10, x11 orr x14, x14, x11 orr x12, x12, x13 orr x10, x10, x12 orr x14, x14, x12 cmp x14, xzr mov x0, #1 cneg x0, x0, ne cmp x10, xzr csel x0, x0, xzr, ne // Restore stack and registers CFI_INC_SP(NSPACE) CFI_POP2(x19,x30) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_invsqrt_p25519) // ************************************************************* // Local z = x * y // ************************************************************* S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_invsqrt_p25519_mul_p25519) Lbignum_invsqrt_p25519_mul_p25519: CFI_START ldp x3, x4, [x1] ldp x5, x6, [x2] umull x7, w3, w5 lsr x17, x3, #32 umull x15, w17, w5 lsr x16, x5, #32 umull x8, w16, w17 umull x16, w3, w16 adds x7, x7, x15, lsl #32 lsr x15, x15, #32 adc x8, x8, x15 adds x7, x7, x16, lsl #32 lsr x16, x16, #32 adc x8, x8, x16 mul x9, x4, x6 umulh x10, x4, x6 subs x4, x4, x3 cneg x4, x4, lo csetm x16, lo adds x9, x9, x8 adc x10, x10, xzr subs x3, x5, x6 cneg x3, x3, lo cinv x16, x16, lo mul x15, x4, x3 umulh x3, x4, x3 adds x8, x7, x9 adcs x9, x9, x10 adc x10, x10, xzr cmn x16, #1 eor x15, x15, x16 adcs x8, x15, x8 eor x3, x3, x16 adcs x9, x3, x9 adc x10, x10, x16 ldp x3, x4, [x1, #16] ldp x5, x6, [x2, #16] umull x11, w3, w5 lsr x17, x3, #32 umull x15, w17, w5 lsr x16, x5, #32 umull x12, w16, w17 umull x16, w3, w16 adds x11, x11, x15, lsl #32 lsr x15, x15, #32 adc x12, x12, x15 adds x11, x11, x16, lsl #32 lsr x16, x16, #32 adc x12, x12, x16 mul x13, x4, x6 umulh x14, x4, x6 subs x4, x4, x3 cneg x4, x4, lo csetm x16, lo adds x13, x13, x12 adc x14, x14, xzr subs x3, x5, x6 cneg x3, x3, lo cinv x16, x16, lo mul x15, x4, x3 umulh x3, x4, x3 adds x12, x11, x13 adcs x13, x13, x14 adc x14, x14, xzr cmn x16, #1 eor x15, x15, x16 adcs x12, x15, x12 eor x3, x3, x16 adcs x13, x3, x13 adc x14, x14, x16 ldp x3, x4, [x1, #16] ldp x15, x16, [x1] subs x3, x3, x15 sbcs x4, x4, x16 csetm x16, lo ldp x15, x17, [x2] subs x5, x15, x5 sbcs x6, x17, x6 csetm x17, lo eor x3, x3, x16 subs x3, x3, x16 eor x4, x4, x16 sbc x4, x4, x16 eor x5, x5, x17 subs x5, x5, x17 eor x6, x6, x17 sbc x6, x6, x17 eor x16, x17, x16 adds x11, x11, x9 adcs x12, x12, x10 adcs x13, x13, xzr adc x14, x14, xzr mul x2, x3, x5 umulh x17, x3, x5 mul x15, x4, x6 umulh x1, x4, x6 subs x4, x4, x3 cneg x4, x4, lo csetm x9, lo adds x15, x15, x17 adc x1, x1, xzr subs x6, x5, x6 cneg x6, x6, lo cinv x9, x9, lo mul x5, x4, x6 umulh x6, x4, x6 adds x17, x2, x15 adcs x15, x15, x1 adc x1, x1, xzr cmn x9, #1 eor x5, x5, x9 adcs x17, x5, x17 eor x6, x6, x9 adcs x15, x6, x15 adc x1, x1, x9 adds x9, x11, x7 adcs x10, x12, x8 adcs x11, x13, x11 adcs x12, x14, x12 adcs x13, x13, xzr adc x14, x14, xzr cmn x16, #1 eor x2, x2, x16 adcs x9, x2, x9 eor x17, x17, x16 adcs x10, x17, x10 eor x15, x15, x16 adcs x11, x15, x11 eor x1, x1, x16 adcs x12, x1, x12 adcs x13, x13, x16 adc x14, x14, x16 mov x3, #38 umull x4, w11, w3 add x4, x4, w7, uxtw lsr x7, x7, #32 lsr x11, x11, #32 umaddl x11, w11, w3, x7 mov x7, x4 umull x4, w12, w3 add x4, x4, w8, uxtw lsr x8, x8, #32 lsr x12, x12, #32 umaddl x12, w12, w3, x8 mov x8, x4 umull x4, w13, w3 add x4, x4, w9, uxtw lsr x9, x9, #32 lsr x13, x13, #32 umaddl x13, w13, w3, x9 mov x9, x4 umull x4, w14, w3 add x4, x4, w10, uxtw lsr x10, x10, #32 lsr x14, x14, #32 umaddl x14, w14, w3, x10 mov x10, x4 lsr x17, x14, #31 mov x5, #19 umaddl x5, w5, w17, x5 add x7, x7, x5 adds x7, x7, x11, lsl #32 extr x3, x12, x11, #32 adcs x8, x8, x3 extr x3, x13, x12, #32 adcs x9, x9, x3 extr x3, x14, x13, #32 lsl x5, x17, #63 eor x10, x10, x5 adc x10, x10, x3 mov x3, #19 tst x10, #0x8000000000000000 csel x3, x3, xzr, pl subs x7, x7, x3 sbcs x8, x8, xzr sbcs x9, x9, xzr sbc x10, x10, xzr and x10, x10, #0x7fffffffffffffff stp x7, x8, [x0] stp x9, x10, [x0, #16] CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_invsqrt_p25519_mul_p25519) // ************************************************************* // Local z = 2^n * x // ************************************************************* S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_invsqrt_p25519_nsqr_p25519) Lbignum_invsqrt_p25519_nsqr_p25519: CFI_START // Copy input argument into [x13;x12;x11;x10] ldp x10, x11, [x2] ldp x12, x13, [x2, #16] // Main squaring loop, accumulating in [x13;x12;x11;x10] consistently and // only ensuring the intermediates are < 2 * p_25519 = 2^256 - 38 Lbignum_invsqrt_p25519_loop: umull x2, w10, w10 lsr x14, x10, #32 umull x3, w14, w14 umull x14, w10, w14 adds x2, x2, x14, lsl #33 lsr x14, x14, #31 adc x3, x3, x14 umull x4, w11, w11 lsr x14, x11, #32 umull x5, w14, w14 umull x14, w11, w14 mul x15, x10, x11 umulh x16, x10, x11 adds x4, x4, x14, lsl #33 lsr x14, x14, #31 adc x5, x5, x14 adds x15, x15, x15 adcs x16, x16, x16 adc x5, x5, xzr adds x3, x3, x15 adcs x4, x4, x16 adc x5, x5, xzr umull x6, w12, w12 lsr x14, x12, #32 umull x7, w14, w14 umull x14, w12, w14 adds x6, x6, x14, lsl #33 lsr x14, x14, #31 adc x7, x7, x14 umull x8, w13, w13 lsr x14, x13, #32 umull x9, w14, w14 umull x14, w13, w14 mul x15, x12, x13 umulh x16, x12, x13 adds x8, x8, x14, lsl #33 lsr x14, x14, #31 adc x9, x9, x14 adds x15, x15, x15 adcs x16, x16, x16 adc x9, x9, xzr adds x7, x7, x15 adcs x8, x8, x16 adc x9, x9, xzr subs x10, x10, x12 sbcs x11, x11, x13 csetm x16, lo eor x10, x10, x16 subs x10, x10, x16 eor x11, x11, x16 sbc x11, x11, x16 adds x6, x6, x4 adcs x7, x7, x5 adcs x8, x8, xzr adc x9, x9, xzr umull x12, w10, w10 lsr x5, x10, #32 umull x13, w5, w5 umull x5, w10, w5 adds x12, x12, x5, lsl #33 lsr x5, x5, #31 adc x13, x13, x5 umull x15, w11, w11 lsr x5, x11, #32 umull x14, w5, w5 umull x5, w11, w5 mul x4, x10, x11 umulh x16, x10, x11 adds x15, x15, x5, lsl #33 lsr x5, x5, #31 adc x14, x14, x5 adds x4, x4, x4 adcs x16, x16, x16 adc x14, x14, xzr adds x13, x13, x4 adcs x15, x15, x16 adc x14, x14, xzr adds x4, x2, x6 adcs x5, x3, x7 adcs x6, x6, x8 adcs x7, x7, x9 csetm x16, lo subs x4, x4, x12 sbcs x5, x5, x13 sbcs x6, x6, x15 sbcs x7, x7, x14 adcs x8, x8, x16 adc x9, x9, x16 mov x10, #38 umull x12, w6, w10 add x12, x12, w2, uxtw lsr x2, x2, #32 lsr x6, x6, #32 umaddl x6, w6, w10, x2 mov x2, x12 umull x12, w7, w10 add x12, x12, w3, uxtw lsr x3, x3, #32 lsr x7, x7, #32 umaddl x7, w7, w10, x3 mov x3, x12 umull x12, w8, w10 add x12, x12, w4, uxtw lsr x4, x4, #32 lsr x8, x8, #32 umaddl x8, w8, w10, x4 mov x4, x12 umull x12, w9, w10 add x12, x12, w5, uxtw lsr x5, x5, #32 lsr x9, x9, #32 umaddl x9, w9, w10, x5 mov x5, x12 lsr x13, x9, #31 mov x11, #19 umull x11, w11, w13 add x2, x2, x11 adds x10, x2, x6, lsl #32 extr x12, x7, x6, #32 adcs x11, x3, x12 extr x12, x8, x7, #32 adcs x12, x4, x12 extr x14, x9, x8, #32 lsl x15, x13, #63 eor x5, x5, x15 adc x13, x5, x14 // Loop as applicable subs x1, x1, #1 bne Lbignum_invsqrt_p25519_loop // We know the intermediate result x < 2^256 - 38, and now we do strict // modular reduction mod 2^255 - 19. Note x < 2^255 - 19 <=> x + 19 < 2^255 // which is equivalent to a "pl" condition. adds x6, x10, #19 adcs x7, x11, xzr adcs x8, x12, xzr adcs x9, x13, xzr csel x10, x10, x6, pl csel x11, x11, x7, pl csel x12, x12, x8, pl csel x13, x13, x9, pl bic x13, x13, #0x8000000000000000 // Copy result back into destination and return stp x10, x11, [x0] stp x12, x13, [x0, #16] CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_invsqrt_p25519_nsqr_p25519) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack, "", %progbits #endif
wlsfx/bnbb
108,356
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_scalarmuldouble.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Double scalar multiplication for edwards25519, fresh and base point // Input scalar[4], point[8], bscalar[4]; output res[8] // // extern void edwards25519_scalarmuldouble // (uint64_t res[static 8],const uint64_t scalar[static 4], // const uint64_t point[static 8],const uint64_t bscalar[static 4]); // // Given scalar = n, point = P and bscalar = m, returns in res // the point (X,Y) = n * P + m * B where B = (...,4/5) is // the standard basepoint for the edwards25519 (Ed25519) curve. // // Both 256-bit coordinates of the input point P are implicitly // reduced modulo 2^255-19 if they are not already in reduced form, // but the conventional usage is that they *are* already reduced. // The scalars can be arbitrary 256-bit numbers but may also be // considered as implicitly reduced modulo the group order. // // Standard ARM ABI: X0 = res, X1 = scalar, X2 = point, X3 = bscalar // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(edwards25519_scalarmuldouble) S2N_BN_FUNCTION_TYPE_DIRECTIVE(edwards25519_scalarmuldouble) S2N_BN_SYM_PRIVACY_DIRECTIVE(edwards25519_scalarmuldouble) .text .balign 4 // Size of individual field elements #define NUMSIZE 32 // Stable home for the input result argument during the whole body #define res x25 // Additional pointer variables for local subroutines #define p0 x22 #define p1 x23 #define p2 x24 // Other variables that are only needed prior to the modular inverse. #define i x19 #define bf x20 #define cf x21 // Pointer-offset pairs for result and temporaries on stack with some aliasing. #define resx res, #(0*NUMSIZE) #define resy res, #(1*NUMSIZE) #define scalar sp, #(0*NUMSIZE) #define bscalar sp, #(1*NUMSIZE) #define btabent sp, #(2*NUMSIZE) #define acc sp, #(5*NUMSIZE) #define acc_x sp, #(5*NUMSIZE) #define acc_y sp, #(6*NUMSIZE) #define acc_z sp, #(7*NUMSIZE) #define acc_w sp, #(8*NUMSIZE) #define tabent sp, #(9*NUMSIZE) #define tab sp, #(13*NUMSIZE) // Total size to reserve on the stack (excluding local subroutines) #define NSPACE 45*NUMSIZE // Sub-references used in local subroutines with local stack #define x_0 p0, #0 #define y_0 p0, #NUMSIZE #define z_0 p0, #(2*NUMSIZE) #define w_0 p0, #(3*NUMSIZE) #define x_1 p1, #0 #define y_1 p1, #NUMSIZE #define z_1 p1, #(2*NUMSIZE) #define w_1 p1, #(3*NUMSIZE) #define x_2 p2, #0 #define y_2 p2, #NUMSIZE #define z_2 p2, #(2*NUMSIZE) #define w_2 p2, #(3*NUMSIZE) #define t0 sp, #(0*NUMSIZE) #define t1 sp, #(1*NUMSIZE) #define t2 sp, #(2*NUMSIZE) #define t3 sp, #(3*NUMSIZE) #define t4 sp, #(4*NUMSIZE) #define t5 sp, #(5*NUMSIZE) // Load 64-bit immediate into a register #define movbig(nn,n3,n2,n1,n0) \ movz nn, n0 __LF \ movk nn, n1, lsl #16 __LF \ movk nn, n2, lsl #32 __LF \ movk nn, n3, lsl #48 // Macro wrapping up the basic field operation bignum_mul_p25519, only // trivially different from a pure function call to that subroutine. #define mul_p25519(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x5, x6, [P2] __LF \ umull x7, w3, w5 __LF \ lsr x0, x3, #32 __LF \ umull x15, w0, w5 __LF \ lsr x16, x5, #32 __LF \ umull x8, w16, w0 __LF \ umull x16, w3, w16 __LF \ adds x7, x7, x15, lsl #32 __LF \ lsr x15, x15, #32 __LF \ adc x8, x8, x15 __LF \ adds x7, x7, x16, lsl #32 __LF \ lsr x16, x16, #32 __LF \ adc x8, x8, x16 __LF \ mul x9, x4, x6 __LF \ umulh x10, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x16, cc __LF \ adds x9, x9, x8 __LF \ adc x10, x10, xzr __LF \ subs x3, x5, x6 __LF \ cneg x3, x3, cc __LF \ cinv x16, x16, cc __LF \ mul x15, x4, x3 __LF \ umulh x3, x4, x3 __LF \ adds x8, x7, x9 __LF \ adcs x9, x9, x10 __LF \ adc x10, x10, xzr __LF \ cmn x16, #0x1 __LF \ eor x15, x15, x16 __LF \ adcs x8, x15, x8 __LF \ eor x3, x3, x16 __LF \ adcs x9, x3, x9 __LF \ adc x10, x10, x16 __LF \ ldp x3, x4, [P1+16] __LF \ ldp x5, x6, [P2+16] __LF \ umull x11, w3, w5 __LF \ lsr x0, x3, #32 __LF \ umull x15, w0, w5 __LF \ lsr x16, x5, #32 __LF \ umull x12, w16, w0 __LF \ umull x16, w3, w16 __LF \ adds x11, x11, x15, lsl #32 __LF \ lsr x15, x15, #32 __LF \ adc x12, x12, x15 __LF \ adds x11, x11, x16, lsl #32 __LF \ lsr x16, x16, #32 __LF \ adc x12, x12, x16 __LF \ mul x13, x4, x6 __LF \ umulh x14, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x16, cc __LF \ adds x13, x13, x12 __LF \ adc x14, x14, xzr __LF \ subs x3, x5, x6 __LF \ cneg x3, x3, cc __LF \ cinv x16, x16, cc __LF \ mul x15, x4, x3 __LF \ umulh x3, x4, x3 __LF \ adds x12, x11, x13 __LF \ adcs x13, x13, x14 __LF \ adc x14, x14, xzr __LF \ cmn x16, #0x1 __LF \ eor x15, x15, x16 __LF \ adcs x12, x15, x12 __LF \ eor x3, x3, x16 __LF \ adcs x13, x3, x13 __LF \ adc x14, x14, x16 __LF \ ldp x3, x4, [P1+16] __LF \ ldp x15, x16, [P1] __LF \ subs x3, x3, x15 __LF \ sbcs x4, x4, x16 __LF \ csetm x16, cc __LF \ ldp x15, x0, [P2] __LF \ subs x5, x15, x5 __LF \ sbcs x6, x0, x6 __LF \ csetm x0, cc __LF \ eor x3, x3, x16 __LF \ subs x3, x3, x16 __LF \ eor x4, x4, x16 __LF \ sbc x4, x4, x16 __LF \ eor x5, x5, x0 __LF \ subs x5, x5, x0 __LF \ eor x6, x6, x0 __LF \ sbc x6, x6, x0 __LF \ eor x16, x0, x16 __LF \ adds x11, x11, x9 __LF \ adcs x12, x12, x10 __LF \ adcs x13, x13, xzr __LF \ adc x14, x14, xzr __LF \ mul x2, x3, x5 __LF \ umulh x0, x3, x5 __LF \ mul x15, x4, x6 __LF \ umulh x1, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x9, cc __LF \ adds x15, x15, x0 __LF \ adc x1, x1, xzr __LF \ subs x6, x5, x6 __LF \ cneg x6, x6, cc __LF \ cinv x9, x9, cc __LF \ mul x5, x4, x6 __LF \ umulh x6, x4, x6 __LF \ adds x0, x2, x15 __LF \ adcs x15, x15, x1 __LF \ adc x1, x1, xzr __LF \ cmn x9, #0x1 __LF \ eor x5, x5, x9 __LF \ adcs x0, x5, x0 __LF \ eor x6, x6, x9 __LF \ adcs x15, x6, x15 __LF \ adc x1, x1, x9 __LF \ adds x9, x11, x7 __LF \ adcs x10, x12, x8 __LF \ adcs x11, x13, x11 __LF \ adcs x12, x14, x12 __LF \ adcs x13, x13, xzr __LF \ adc x14, x14, xzr __LF \ cmn x16, #0x1 __LF \ eor x2, x2, x16 __LF \ adcs x9, x2, x9 __LF \ eor x0, x0, x16 __LF \ adcs x10, x0, x10 __LF \ eor x15, x15, x16 __LF \ adcs x11, x15, x11 __LF \ eor x1, x1, x16 __LF \ adcs x12, x1, x12 __LF \ adcs x13, x13, x16 __LF \ adc x14, x14, x16 __LF \ mov x3, #0x26 __LF \ umull x4, w11, w3 __LF \ add x4, x4, w7, uxtw __LF \ lsr x7, x7, #32 __LF \ lsr x11, x11, #32 __LF \ umaddl x11, w11, w3, x7 __LF \ mov x7, x4 __LF \ umull x4, w12, w3 __LF \ add x4, x4, w8, uxtw __LF \ lsr x8, x8, #32 __LF \ lsr x12, x12, #32 __LF \ umaddl x12, w12, w3, x8 __LF \ mov x8, x4 __LF \ umull x4, w13, w3 __LF \ add x4, x4, w9, uxtw __LF \ lsr x9, x9, #32 __LF \ lsr x13, x13, #32 __LF \ umaddl x13, w13, w3, x9 __LF \ mov x9, x4 __LF \ umull x4, w14, w3 __LF \ add x4, x4, w10, uxtw __LF \ lsr x10, x10, #32 __LF \ lsr x14, x14, #32 __LF \ umaddl x14, w14, w3, x10 __LF \ mov x10, x4 __LF \ lsr x0, x14, #31 __LF \ mov x5, #0x13 __LF \ umaddl x5, w5, w0, x5 __LF \ add x7, x7, x5 __LF \ adds x7, x7, x11, lsl #32 __LF \ extr x3, x12, x11, #32 __LF \ adcs x8, x8, x3 __LF \ extr x3, x13, x12, #32 __LF \ adcs x9, x9, x3 __LF \ extr x3, x14, x13, #32 __LF \ lsl x5, x0, #63 __LF \ eor x10, x10, x5 __LF \ adc x10, x10, x3 __LF \ mov x3, #0x13 __LF \ tst x10, #0x8000000000000000 __LF \ csel x3, x3, xzr, pl __LF \ subs x7, x7, x3 __LF \ sbcs x8, x8, xzr __LF \ sbcs x9, x9, xzr __LF \ sbc x10, x10, xzr __LF \ and x10, x10, #0x7fffffffffffffff __LF \ stp x7, x8, [P0] __LF \ stp x9, x10, [P0+16] // A version of multiplication that only guarantees output < 2 * p_25519. // This basically skips the +1 and final correction in quotient estimation. #define mul_4(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x5, x6, [P2] __LF \ umull x7, w3, w5 __LF \ lsr x0, x3, #32 __LF \ umull x15, w0, w5 __LF \ lsr x16, x5, #32 __LF \ umull x8, w16, w0 __LF \ umull x16, w3, w16 __LF \ adds x7, x7, x15, lsl #32 __LF \ lsr x15, x15, #32 __LF \ adc x8, x8, x15 __LF \ adds x7, x7, x16, lsl #32 __LF \ lsr x16, x16, #32 __LF \ adc x8, x8, x16 __LF \ mul x9, x4, x6 __LF \ umulh x10, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x16, cc __LF \ adds x9, x9, x8 __LF \ adc x10, x10, xzr __LF \ subs x3, x5, x6 __LF \ cneg x3, x3, cc __LF \ cinv x16, x16, cc __LF \ mul x15, x4, x3 __LF \ umulh x3, x4, x3 __LF \ adds x8, x7, x9 __LF \ adcs x9, x9, x10 __LF \ adc x10, x10, xzr __LF \ cmn x16, #0x1 __LF \ eor x15, x15, x16 __LF \ adcs x8, x15, x8 __LF \ eor x3, x3, x16 __LF \ adcs x9, x3, x9 __LF \ adc x10, x10, x16 __LF \ ldp x3, x4, [P1+16] __LF \ ldp x5, x6, [P2+16] __LF \ umull x11, w3, w5 __LF \ lsr x0, x3, #32 __LF \ umull x15, w0, w5 __LF \ lsr x16, x5, #32 __LF \ umull x12, w16, w0 __LF \ umull x16, w3, w16 __LF \ adds x11, x11, x15, lsl #32 __LF \ lsr x15, x15, #32 __LF \ adc x12, x12, x15 __LF \ adds x11, x11, x16, lsl #32 __LF \ lsr x16, x16, #32 __LF \ adc x12, x12, x16 __LF \ mul x13, x4, x6 __LF \ umulh x14, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x16, cc __LF \ adds x13, x13, x12 __LF \ adc x14, x14, xzr __LF \ subs x3, x5, x6 __LF \ cneg x3, x3, cc __LF \ cinv x16, x16, cc __LF \ mul x15, x4, x3 __LF \ umulh x3, x4, x3 __LF \ adds x12, x11, x13 __LF \ adcs x13, x13, x14 __LF \ adc x14, x14, xzr __LF \ cmn x16, #0x1 __LF \ eor x15, x15, x16 __LF \ adcs x12, x15, x12 __LF \ eor x3, x3, x16 __LF \ adcs x13, x3, x13 __LF \ adc x14, x14, x16 __LF \ ldp x3, x4, [P1+16] __LF \ ldp x15, x16, [P1] __LF \ subs x3, x3, x15 __LF \ sbcs x4, x4, x16 __LF \ csetm x16, cc __LF \ ldp x15, x0, [P2] __LF \ subs x5, x15, x5 __LF \ sbcs x6, x0, x6 __LF \ csetm x0, cc __LF \ eor x3, x3, x16 __LF \ subs x3, x3, x16 __LF \ eor x4, x4, x16 __LF \ sbc x4, x4, x16 __LF \ eor x5, x5, x0 __LF \ subs x5, x5, x0 __LF \ eor x6, x6, x0 __LF \ sbc x6, x6, x0 __LF \ eor x16, x0, x16 __LF \ adds x11, x11, x9 __LF \ adcs x12, x12, x10 __LF \ adcs x13, x13, xzr __LF \ adc x14, x14, xzr __LF \ mul x2, x3, x5 __LF \ umulh x0, x3, x5 __LF \ mul x15, x4, x6 __LF \ umulh x1, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x9, cc __LF \ adds x15, x15, x0 __LF \ adc x1, x1, xzr __LF \ subs x6, x5, x6 __LF \ cneg x6, x6, cc __LF \ cinv x9, x9, cc __LF \ mul x5, x4, x6 __LF \ umulh x6, x4, x6 __LF \ adds x0, x2, x15 __LF \ adcs x15, x15, x1 __LF \ adc x1, x1, xzr __LF \ cmn x9, #0x1 __LF \ eor x5, x5, x9 __LF \ adcs x0, x5, x0 __LF \ eor x6, x6, x9 __LF \ adcs x15, x6, x15 __LF \ adc x1, x1, x9 __LF \ adds x9, x11, x7 __LF \ adcs x10, x12, x8 __LF \ adcs x11, x13, x11 __LF \ adcs x12, x14, x12 __LF \ adcs x13, x13, xzr __LF \ adc x14, x14, xzr __LF \ cmn x16, #0x1 __LF \ eor x2, x2, x16 __LF \ adcs x9, x2, x9 __LF \ eor x0, x0, x16 __LF \ adcs x10, x0, x10 __LF \ eor x15, x15, x16 __LF \ adcs x11, x15, x11 __LF \ eor x1, x1, x16 __LF \ adcs x12, x1, x12 __LF \ adcs x13, x13, x16 __LF \ adc x14, x14, x16 __LF \ mov x3, #0x26 __LF \ umull x4, w11, w3 __LF \ add x4, x4, w7, uxtw __LF \ lsr x7, x7, #32 __LF \ lsr x11, x11, #32 __LF \ umaddl x11, w11, w3, x7 __LF \ mov x7, x4 __LF \ umull x4, w12, w3 __LF \ add x4, x4, w8, uxtw __LF \ lsr x8, x8, #32 __LF \ lsr x12, x12, #32 __LF \ umaddl x12, w12, w3, x8 __LF \ mov x8, x4 __LF \ umull x4, w13, w3 __LF \ add x4, x4, w9, uxtw __LF \ lsr x9, x9, #32 __LF \ lsr x13, x13, #32 __LF \ umaddl x13, w13, w3, x9 __LF \ mov x9, x4 __LF \ umull x4, w14, w3 __LF \ add x4, x4, w10, uxtw __LF \ lsr x10, x10, #32 __LF \ lsr x14, x14, #32 __LF \ umaddl x14, w14, w3, x10 __LF \ mov x10, x4 __LF \ lsr x0, x14, #31 __LF \ mov x5, #0x13 __LF \ umull x5, w5, w0 __LF \ add x7, x7, x5 __LF \ adds x7, x7, x11, lsl #32 __LF \ extr x3, x12, x11, #32 __LF \ adcs x8, x8, x3 __LF \ extr x3, x13, x12, #32 __LF \ adcs x9, x9, x3 __LF \ extr x3, x14, x13, #32 __LF \ lsl x5, x0, #63 __LF \ eor x10, x10, x5 __LF \ adc x10, x10, x3 __LF \ stp x7, x8, [P0] __LF \ stp x9, x10, [P0+16] // Squaring just giving a result < 2 * p_25519, which is done by // basically skipping the +1 in the quotient estimate and the final // optional correction. #define sqr_4(P0,P1) \ ldp x10, x11, [P1] __LF \ ldp x12, x13, [P1+16] __LF \ umull x2, w10, w10 __LF \ lsr x14, x10, #32 __LF \ umull x3, w14, w14 __LF \ umull x14, w10, w14 __LF \ adds x2, x2, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x3, x3, x14 __LF \ umull x4, w11, w11 __LF \ lsr x14, x11, #32 __LF \ umull x5, w14, w14 __LF \ umull x14, w11, w14 __LF \ mul x15, x10, x11 __LF \ umulh x16, x10, x11 __LF \ adds x4, x4, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x5, x5, x14 __LF \ adds x15, x15, x15 __LF \ adcs x16, x16, x16 __LF \ adc x5, x5, xzr __LF \ adds x3, x3, x15 __LF \ adcs x4, x4, x16 __LF \ adc x5, x5, xzr __LF \ umull x6, w12, w12 __LF \ lsr x14, x12, #32 __LF \ umull x7, w14, w14 __LF \ umull x14, w12, w14 __LF \ adds x6, x6, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x7, x7, x14 __LF \ umull x8, w13, w13 __LF \ lsr x14, x13, #32 __LF \ umull x9, w14, w14 __LF \ umull x14, w13, w14 __LF \ mul x15, x12, x13 __LF \ umulh x16, x12, x13 __LF \ adds x8, x8, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x9, x9, x14 __LF \ adds x15, x15, x15 __LF \ adcs x16, x16, x16 __LF \ adc x9, x9, xzr __LF \ adds x7, x7, x15 __LF \ adcs x8, x8, x16 __LF \ adc x9, x9, xzr __LF \ subs x10, x10, x12 __LF \ sbcs x11, x11, x13 __LF \ csetm x16, cc __LF \ eor x10, x10, x16 __LF \ subs x10, x10, x16 __LF \ eor x11, x11, x16 __LF \ sbc x11, x11, x16 __LF \ adds x6, x6, x4 __LF \ adcs x7, x7, x5 __LF \ adcs x8, x8, xzr __LF \ adc x9, x9, xzr __LF \ umull x12, w10, w10 __LF \ lsr x5, x10, #32 __LF \ umull x13, w5, w5 __LF \ umull x5, w10, w5 __LF \ adds x12, x12, x5, lsl #33 __LF \ lsr x5, x5, #31 __LF \ adc x13, x13, x5 __LF \ umull x15, w11, w11 __LF \ lsr x5, x11, #32 __LF \ umull x14, w5, w5 __LF \ umull x5, w11, w5 __LF \ mul x4, x10, x11 __LF \ umulh x16, x10, x11 __LF \ adds x15, x15, x5, lsl #33 __LF \ lsr x5, x5, #31 __LF \ adc x14, x14, x5 __LF \ adds x4, x4, x4 __LF \ adcs x16, x16, x16 __LF \ adc x14, x14, xzr __LF \ adds x13, x13, x4 __LF \ adcs x15, x15, x16 __LF \ adc x14, x14, xzr __LF \ adds x4, x2, x6 __LF \ adcs x5, x3, x7 __LF \ adcs x6, x6, x8 __LF \ adcs x7, x7, x9 __LF \ csetm x16, cc __LF \ subs x4, x4, x12 __LF \ sbcs x5, x5, x13 __LF \ sbcs x6, x6, x15 __LF \ sbcs x7, x7, x14 __LF \ adcs x8, x8, x16 __LF \ adc x9, x9, x16 __LF \ mov x10, #0x26 __LF \ umull x12, w6, w10 __LF \ add x12, x12, w2, uxtw __LF \ lsr x2, x2, #32 __LF \ lsr x6, x6, #32 __LF \ umaddl x6, w6, w10, x2 __LF \ mov x2, x12 __LF \ umull x12, w7, w10 __LF \ add x12, x12, w3, uxtw __LF \ lsr x3, x3, #32 __LF \ lsr x7, x7, #32 __LF \ umaddl x7, w7, w10, x3 __LF \ mov x3, x12 __LF \ umull x12, w8, w10 __LF \ add x12, x12, w4, uxtw __LF \ lsr x4, x4, #32 __LF \ lsr x8, x8, #32 __LF \ umaddl x8, w8, w10, x4 __LF \ mov x4, x12 __LF \ umull x12, w9, w10 __LF \ add x12, x12, w5, uxtw __LF \ lsr x5, x5, #32 __LF \ lsr x9, x9, #32 __LF \ umaddl x9, w9, w10, x5 __LF \ mov x5, x12 __LF \ lsr x13, x9, #31 __LF \ mov x11, #0x13 __LF \ umull x11, w11, w13 __LF \ add x2, x2, x11 __LF \ adds x2, x2, x6, lsl #32 __LF \ extr x10, x7, x6, #32 __LF \ adcs x3, x3, x10 __LF \ extr x10, x8, x7, #32 __LF \ adcs x4, x4, x10 __LF \ extr x10, x9, x8, #32 __LF \ lsl x11, x13, #63 __LF \ eor x5, x5, x11 __LF \ adc x5, x5, x10 __LF \ stp x2, x3, [P0] __LF \ stp x4, x5, [P0+16] // Modular subtraction with double modulus 2 * p_25519 = 2^256 - 38 #define sub_twice4(P0,P1,P2) \ ldp x5, x6, [P1] __LF \ ldp x4, x3, [P2] __LF \ subs x5, x5, x4 __LF \ sbcs x6, x6, x3 __LF \ ldp x7, x8, [P1+16] __LF \ ldp x4, x3, [P2+16] __LF \ sbcs x7, x7, x4 __LF \ sbcs x8, x8, x3 __LF \ mov x4, #38 __LF \ csel x3, x4, xzr, lo __LF \ subs x5, x5, x3 __LF \ sbcs x6, x6, xzr __LF \ sbcs x7, x7, xzr __LF \ sbc x8, x8, xzr __LF \ stp x5, x6, [P0] __LF \ stp x7, x8, [P0+16] // Modular addition and doubling with double modulus 2 * p_25519 = 2^256 - 38. // This only ensures that the result fits in 4 digits, not that it is reduced // even w.r.t. double modulus. The result is always correct modulo provided // the sum of the inputs is < 2^256 + 2^256 - 38, so in particular provided // at least one of them is reduced double modulo. #define add_twice4(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x7, x8, [P2] __LF \ adds x3, x3, x7 __LF \ adcs x4, x4, x8 __LF \ ldp x5, x6, [P1+16] __LF \ ldp x7, x8, [P2+16] __LF \ adcs x5, x5, x7 __LF \ adcs x6, x6, x8 __LF \ mov x9, #38 __LF \ csel x9, x9, xzr, cs __LF \ adds x3, x3, x9 __LF \ adcs x4, x4, xzr __LF \ adcs x5, x5, xzr __LF \ adc x6, x6, xzr __LF \ stp x3, x4, [P0] __LF \ stp x5, x6, [P0+16] #define double_twice4(P0,P1) \ ldp x3, x4, [P1] __LF \ adds x3, x3, x3 __LF \ adcs x4, x4, x4 __LF \ ldp x5, x6, [P1+16] __LF \ adcs x5, x5, x5 __LF \ adcs x6, x6, x6 __LF \ mov x9, #38 __LF \ csel x9, x9, xzr, cs __LF \ adds x3, x3, x9 __LF \ adcs x4, x4, xzr __LF \ adcs x5, x5, xzr __LF \ adc x6, x6, xzr __LF \ stp x3, x4, [P0] __LF \ stp x5, x6, [P0+16] // Load the constant k_25519 = 2 * d_25519 using immediate operations #define load_k25519(P0) \ movz x0, #0xf159 __LF \ movz x1, #0xb156 __LF \ movz x2, #0xd130 __LF \ movz x3, #0xfce7 __LF \ movk x0, #0x26b2, lsl #16 __LF \ movk x1, #0x8283, lsl #16 __LF \ movk x2, #0xeef3, lsl #16 __LF \ movk x3, #0x56df, lsl #16 __LF \ movk x0, #0x9b94, lsl #32 __LF \ movk x1, #0x149a, lsl #32 __LF \ movk x2, #0x80f2, lsl #32 __LF \ movk x3, #0xd9dc, lsl #32 __LF \ movk x0, #0xebd6, lsl #48 __LF \ movk x1, #0x00e0, lsl #48 __LF \ movk x2, #0x198e, lsl #48 __LF \ movk x3, #0x2406, lsl #48 __LF \ stp x0, x1, [P0] __LF \ stp x2, x3, [P0+16] S2N_BN_SYMBOL(edwards25519_scalarmuldouble): CFI_START // Save regs and make room for temporaries CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x24) CFI_PUSH2(x25,x30) CFI_DEC_SP(NSPACE) // Move the output pointer to a stable place mov res, x0 // Copy scalars while recoding all 4-bit nybbles except the top // one (bits 252..255) into signed 4-bit digits. This is essentially // done just by adding the recoding constant 0x0888..888, after // which all digits except the first have an implicit bias of -8, // so 0 -> -8, 1 -> -7, ... 7 -> -1, 8 -> 0, 9 -> 1, ... 15 -> 7. // (We could literally create 2s complement signed nybbles by // XORing with the same constant 0x0888..888 afterwards, but it // doesn't seem to make the end usage any simpler.) // // In order to ensure that the unrecoded top nybble (bits 252..255) // does not become > 8 as a result of carries lower down from the // recoding, we first (conceptually) subtract the group order iff // the top digit of the scalar is > 2^63. In the implementation the // reduction and recoding are combined by optionally using the // modified recoding constant 0x0888...888 + (2^256 - group_order). movbig(x4,#0xc7f5, #0x6fb5, #0xa0d9, #0xe920) movbig(x5,#0xe190, #0xb993, #0x70cb, #0xa1d5) mov x7, #0x8888888888888888 sub x6, x7, #1 bic x8, x7, #0xF000000000000000 ldp x10, x11, [x3] ldp x12, x13, [x3, #16] mov x3, 0x8000000000000000 cmp x3, x13 csel x14, x7, x4, cs csel x15, x7, x5, cs csel x16, x7, x6, cs csel x17, x8, x7, cs adds x10, x10, x14 adcs x11, x11, x15 adcs x12, x12, x16 adc x13, x13, x17 stp x10, x11, [bscalar] stp x12, x13, [bscalar+16] ldp x10, x11, [x1] ldp x12, x13, [x1, #16] mov x3, 0x8000000000000000 cmp x3, x13 csel x14, x7, x4, cs csel x15, x7, x5, cs csel x16, x7, x6, cs csel x17, x8, x7, cs adds x10, x10, x14 adcs x11, x11, x15 adcs x12, x12, x16 adc x13, x13, x17 stp x10, x11, [scalar] stp x12, x13, [scalar+16] // Create table of multiples 1..8 of the general input point at "tab". // Reduce the input coordinates x and y modulo 2^256 - 38 first, for the // sake of definiteness; this is the reduction that will be maintained. // We could slightly optimize the additions because we know the input // point is affine (so Z = 1), but it doesn't seem worth the complication. ldp x10, x11, [x2] ldp x12, x13, [x2, #16] adds x14, x10, #38 adcs x15, x11, xzr adcs x16, x12, xzr adcs x17, x13, xzr csel x10, x14, x10, cs csel x11, x15, x11, cs csel x12, x16, x12, cs csel x13, x17, x13, cs stp x10, x11, [tab] stp x12, x13, [tab+16] ldp x10, x11, [x2, #32] ldp x12, x13, [x2, #48] adds x14, x10, #38 adcs x15, x11, xzr adcs x16, x12, xzr adcs x17, x13, xzr csel x10, x14, x10, cs csel x11, x15, x11, cs csel x12, x16, x12, cs csel x13, x17, x13, cs stp x10, x11, [tab+32] stp x12, x13, [tab+48] mov x1, #1 stp x1, xzr, [tab+64] stp xzr, xzr, [tab+80] add p0, tab+96 add p1, tab add p2, tab+32 mul_4(x_0,x_1,x_2) // Multiple 2 add p0, tab+1*128 add p1, tab CFI_BL(Ledwards25519_scalarmuldouble_epdouble) // Multiple 3 add p0, tab+2*128 add p1, tab add p2, tab+1*128 CFI_BL(Ledwards25519_scalarmuldouble_epadd) // Multiple 4 add p0, tab+3*128 add p1, tab+1*128 CFI_BL(Ledwards25519_scalarmuldouble_epdouble) // Multiple 5 add p0, tab+4*128 add p1, tab add p2, tab+3*128 CFI_BL(Ledwards25519_scalarmuldouble_epadd) // Multiple 6 add p0, tab+5*128 add p1, tab+2*128 CFI_BL(Ledwards25519_scalarmuldouble_epdouble) // Multiple 7 add p0, tab+6*128 add p1, tab add p2, tab+5*128 CFI_BL(Ledwards25519_scalarmuldouble_epadd) // Multiple 8 add p0, tab+7*128 add p1, tab+3*128 CFI_BL(Ledwards25519_scalarmuldouble_epdouble) // Handle the initialization, starting the loop counter at i = 252 // and initializing acc to the sum of the table entries for the // top nybbles of the scalars (the ones with no implicit -8 bias). mov i, #252 // Index for btable entry... ldr x0, [bscalar+24] lsr bf, x0, #60 // ...and constant-time indexing based on that index #if defined(__ELF__) adrp x14, S2N_BN_SYMBOL(edwards25519_scalarmuldouble_constant) add x14, x14, :lo12:S2N_BN_SYMBOL(edwards25519_scalarmuldouble_constant) #else adrp x14, S2N_BN_SYMBOL(edwards25519_scalarmuldouble_constant)@PAGE add x14, x14, S2N_BN_SYMBOL(edwards25519_scalarmuldouble_constant)@PAGEOFF #endif mov x0, #1 mov x1, xzr mov x2, xzr mov x3, xzr mov x4, #1 mov x5, xzr mov x6, xzr mov x7, xzr mov x8, xzr mov x9, xzr mov x10, xzr mov x11, xzr cmp bf, #1 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #2 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #3 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #4 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #5 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #6 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #7 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #8 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne stp x0, x1, [btabent] stp x2, x3, [btabent+16] stp x4, x5, [btabent+32] stp x6, x7, [btabent+48] stp x8, x9, [btabent+64] stp x10, x11, [btabent+80] // Index for table entry... ldr x0, [scalar+24] lsr bf, x0, #60 // ...and constant-time indexing based on that index add p0, tab mov x0, xzr mov x1, xzr mov x2, xzr mov x3, xzr mov x4, #1 mov x5, xzr mov x6, xzr mov x7, xzr mov x8, #1 mov x9, xzr mov x10, xzr mov x11, xzr mov x12, xzr mov x13, xzr mov x14, xzr mov x15, xzr cmp bf, #1 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #2 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #3 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #4 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #5 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #6 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #7 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #8 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne stp x0, x1, [tabent] stp x2, x3, [tabent+16] stp x4, x5, [tabent+32] stp x6, x7, [tabent+48] stp x8, x9, [tabent+64] stp x10, x11, [tabent+80] stp x12, x13, [tabent+96] stp x14, x15, [tabent+112] // Add those elements to initialize the accumulator for bit position 252 add p0, acc add p1, tabent add p2, btabent CFI_BL(Ledwards25519_scalarmuldouble_pepadd) // Main loop with acc = [scalar/2^i] * point + [bscalar/2^i] * basepoint // Start with i = 252 for bits 248..251 and go down four at a time to 3..0 Ledwards25519_scalarmuldouble_loop: sub i, i, #4 // Double to acc' = 2 * acc add p0, acc add p1, acc CFI_BL(Ledwards25519_scalarmuldouble_pdouble) // Get btable entry, first getting the adjusted bitfield... lsr x0, i, #6 add x1, bscalar ldr x2, [x1, x0, lsl #3] lsr x3, x2, i and x0, x3, #15 subs bf, x0, #8 cneg bf, bf, cc csetm cf, cc // ... then doing constant-time lookup with the appropriate index... #if defined(__ELF__) adrp x14, S2N_BN_SYMBOL(edwards25519_scalarmuldouble_constant) add x14, x14, :lo12:S2N_BN_SYMBOL(edwards25519_scalarmuldouble_constant) #else adrp x14, S2N_BN_SYMBOL(edwards25519_scalarmuldouble_constant)@PAGE add x14, x14, S2N_BN_SYMBOL(edwards25519_scalarmuldouble_constant)@PAGEOFF #endif mov x0, #1 mov x1, xzr mov x2, xzr mov x3, xzr mov x4, #1 mov x5, xzr mov x6, xzr mov x7, xzr mov x8, xzr mov x9, xzr mov x10, xzr mov x11, xzr cmp bf, #1 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #2 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #3 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #4 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #5 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #6 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #7 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add x14, x14, #96 cmp bf, #8 ldp x12, x13, [x14] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [x14, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [x14, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [x14, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [x14, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [x14, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne // ... then optionally negating before storing. The table entry // is in precomputed form and we currently have // // [x3;x2;x1;x0] = y - x // [x7;x6;x5;x4] = x + y // [x11;x10;x9;x8] = 2 * d * x * y // // Negation for Edwards curves is -(x,y) = (-x,y), which in this modified // form amounts to swapping the first two fields and negating the third. // The negation does not always fully reduce even mod 2^256-38 in the zero // case, instead giving -0 = 2^256-38. But that is fine since the result is // always fed to a multiplication inside the "pepadd" function below that // handles any 256-bit input. cmp cf, xzr csel x12, x0, x4, eq csel x4, x0, x4, ne csel x13, x1, x5, eq csel x5, x1, x5, ne csel x14, x2, x6, eq csel x6, x2, x6, ne csel x15, x3, x7, eq csel x7, x3, x7, ne eor x8, x8, cf eor x9, x9, cf eor x10, x10, cf eor x11, x11, cf mov x0, #37 and x0, x0, cf subs x8, x8, x0 sbcs x9, x9, xzr sbcs x10, x10, xzr sbc x11, x11, xzr stp x12, x13, [btabent] stp x14, x15, [btabent+16] stp x4, x5, [btabent+32] stp x6, x7, [btabent+48] stp x8, x9, [btabent+64] stp x10, x11, [btabent+80] // Get table entry, first getting the adjusted bitfield... lsr x0, i, #6 ldr x1, [sp, x0, lsl #3] lsr x2, x1, i and x0, x2, #15 subs bf, x0, #8 cneg bf, bf, cc csetm cf, cc // ... then getting the unadjusted table entry add p0, tab mov x0, xzr mov x1, xzr mov x2, xzr mov x3, xzr mov x4, #1 mov x5, xzr mov x6, xzr mov x7, xzr mov x8, #1 mov x9, xzr mov x10, xzr mov x11, xzr mov x12, xzr mov x13, xzr mov x14, xzr mov x15, xzr cmp bf, #1 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #2 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #3 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #4 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #5 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #6 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #7 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne add p0, p0, #128 cmp bf, #8 ldp x16, x17, [p0] csel x0, x0, x16, ne csel x1, x1, x17, ne ldp x16, x17, [p0, #16] csel x2, x2, x16, ne csel x3, x3, x17, ne ldp x16, x17, [p0, #32] csel x4, x4, x16, ne csel x5, x5, x17, ne ldp x16, x17, [p0, #48] csel x6, x6, x16, ne csel x7, x7, x17, ne ldp x16, x17, [p0, #64] csel x8, x8, x16, ne csel x9, x9, x17, ne ldp x16, x17, [p0, #80] csel x10, x10, x16, ne csel x11, x11, x17, ne ldp x16, x17, [p0, #96] csel x12, x12, x16, ne csel x13, x13, x17, ne ldp x16, x17, [p0, #112] csel x14, x14, x16, ne csel x15, x15, x17, ne // ... then optionally negating before storing. This time the table // entry is extended-projective, and is in registers thus: // // [x3;x2;x1;x0] = X // [x7;x6;x5;x4] = Y // [x11;x10;x9;x8] = Z // [x15;x14;x13;x12] = W // // This time we just need to negate the X and the W fields. // The crude way negation is done can result in values of X or W // (when initially zero before negation) being exactly equal to // 2^256-38, but the "pepadd" function handles that correctly. eor x0, x0, cf eor x1, x1, cf eor x2, x2, cf eor x3, x3, cf mov x16, #37 and x16, x16, cf subs x0, x0, x16 sbcs x1, x1, xzr sbcs x2, x2, xzr sbc x3, x3, xzr eor x12, x12, cf eor x13, x13, cf eor x14, x14, cf eor x15, x15, cf subs x12, x12, x16 sbcs x13, x13, xzr sbcs x14, x14, xzr sbc x15, x15, xzr stp x0, x1, [tabent] stp x2, x3, [tabent+16] stp x4, x5, [tabent+32] stp x6, x7, [tabent+48] stp x8, x9, [tabent+64] stp x10, x11, [tabent+80] stp x12, x13, [tabent+96] stp x14, x15, [tabent+112] // Double to acc' = 4 * acc add p0, acc add p1, acc CFI_BL(Ledwards25519_scalarmuldouble_pdouble) // Add tabent := tabent + btabent add p0, tabent add p1, tabent add p2, btabent CFI_BL(Ledwards25519_scalarmuldouble_pepadd) // Double to acc' = 8 * acc add p0, acc add p1, acc CFI_BL(Ledwards25519_scalarmuldouble_pdouble) // Double to acc' = 16 * acc add p0, acc add p1, acc CFI_BL(Ledwards25519_scalarmuldouble_epdouble) // Add table entry, acc := acc + tabent add p0, acc add p1, acc add p2, tabent CFI_BL(Ledwards25519_scalarmuldouble_epadd) // Loop down cbnz i, Ledwards25519_scalarmuldouble_loop // Modular inverse setup add x0, tabent add x1, acc+64 // Inline copy of bignum_inv_p25519, identical except for stripping out // the prologue and epilogue saving and restoring registers and making // and reclaiming room on the stack. For more details and explanations see // "arm/curve25519/bignum_inv_p25519.S". Note that the stack it uses for // its own temporaries is 128 bytes, so it has no effect on variables // that are needed in the rest of our computation here: res, acc, tabent. mov x20, x0 mov x10, #0xffffffffffffffed mov x11, #0xffffffffffffffff stp x10, x11, [sp] mov x12, #0x7fffffffffffffff stp x11, x12, [sp, #16] ldp x2, x3, [x1] ldp x4, x5, [x1, #16] mov x7, #0x13 lsr x6, x5, #63 madd x6, x7, x6, x7 adds x2, x2, x6 adcs x3, x3, xzr adcs x4, x4, xzr orr x5, x5, #0x8000000000000000 adcs x5, x5, xzr csel x6, x7, xzr, cc subs x2, x2, x6 sbcs x3, x3, xzr sbcs x4, x4, xzr sbc x5, x5, xzr and x5, x5, #0x7fffffffffffffff stp x2, x3, [sp, #32] stp x4, x5, [sp, #48] stp xzr, xzr, [sp, #64] stp xzr, xzr, [sp, #80] mov x10, #0x2099 movk x10, #0x7502, lsl #16 movk x10, #0x9e23, lsl #32 movk x10, #0xa0f9, lsl #48 mov x11, #0x2595 movk x11, #0x1d13, lsl #16 movk x11, #0x8f3f, lsl #32 movk x11, #0xa8c6, lsl #48 mov x12, #0x5242 movk x12, #0x5ac, lsl #16 movk x12, #0x8938, lsl #32 movk x12, #0x6c6c, lsl #48 mov x13, #0x615 movk x13, #0x4177, lsl #16 movk x13, #0x8b2, lsl #32 movk x13, #0x2765, lsl #48 stp x10, x11, [sp, #96] stp x12, x13, [sp, #112] mov x21, #0xa mov x22, #0x1 b Ledwards25519_scalarmuldouble_invmidloop Ledwards25519_scalarmuldouble_invloop: cmp x10, xzr csetm x14, mi cneg x10, x10, mi cmp x11, xzr csetm x15, mi cneg x11, x11, mi cmp x12, xzr csetm x16, mi cneg x12, x12, mi cmp x13, xzr csetm x17, mi cneg x13, x13, mi and x0, x10, x14 and x1, x11, x15 add x9, x0, x1 and x0, x12, x16 and x1, x13, x17 add x19, x0, x1 ldr x7, [sp] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x4, x9, x0 adc x2, xzr, x1 ldr x8, [sp, #32] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x4, x4, x0 adc x2, x2, x1 eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x5, x19, x0 adc x3, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x5, x5, x0 adc x3, x3, x1 ldr x7, [sp, #8] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x2, x2, x0 adc x6, xzr, x1 ldr x8, [sp, #40] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x2, x2, x0 adc x6, x6, x1 extr x4, x2, x4, #59 str x4, [sp] eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x3, x3, x0 adc x4, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x3, x3, x0 adc x4, x4, x1 extr x5, x3, x5, #59 str x5, [sp, #32] ldr x7, [sp, #16] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x6, x6, x0 adc x5, xzr, x1 ldr x8, [sp, #48] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x6, x6, x0 adc x5, x5, x1 extr x2, x6, x2, #59 str x2, [sp, #8] eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x4, x4, x0 adc x2, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x4, x4, x0 adc x2, x2, x1 extr x3, x4, x3, #59 str x3, [sp, #40] ldr x7, [sp, #24] eor x1, x7, x14 asr x3, x1, #63 and x3, x3, x10 neg x3, x3 mul x0, x1, x10 umulh x1, x1, x10 adds x5, x5, x0 adc x3, x3, x1 ldr x8, [sp, #56] eor x1, x8, x15 asr x0, x1, #63 and x0, x0, x11 sub x3, x3, x0 mul x0, x1, x11 umulh x1, x1, x11 adds x5, x5, x0 adc x3, x3, x1 extr x6, x5, x6, #59 str x6, [sp, #16] extr x5, x3, x5, #59 str x5, [sp, #24] eor x1, x7, x16 asr x5, x1, #63 and x5, x5, x12 neg x5, x5 mul x0, x1, x12 umulh x1, x1, x12 adds x2, x2, x0 adc x5, x5, x1 eor x1, x8, x17 asr x0, x1, #63 and x0, x0, x13 sub x5, x5, x0 mul x0, x1, x13 umulh x1, x1, x13 adds x2, x2, x0 adc x5, x5, x1 extr x4, x2, x4, #59 str x4, [sp, #48] extr x2, x5, x2, #59 str x2, [sp, #56] ldr x7, [sp, #64] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x4, x9, x0 adc x2, xzr, x1 ldr x8, [sp, #96] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x4, x4, x0 str x4, [sp, #64] adc x2, x2, x1 eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x5, x19, x0 adc x3, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x5, x5, x0 str x5, [sp, #96] adc x3, x3, x1 ldr x7, [sp, #72] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x2, x2, x0 adc x6, xzr, x1 ldr x8, [sp, #104] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x2, x2, x0 str x2, [sp, #72] adc x6, x6, x1 eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x3, x3, x0 adc x4, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x3, x3, x0 str x3, [sp, #104] adc x4, x4, x1 ldr x7, [sp, #80] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x6, x6, x0 adc x5, xzr, x1 ldr x8, [sp, #112] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x6, x6, x0 str x6, [sp, #80] adc x5, x5, x1 eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x4, x4, x0 adc x2, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x4, x4, x0 str x4, [sp, #112] adc x2, x2, x1 ldr x7, [sp, #88] eor x1, x7, x14 and x3, x14, x10 neg x3, x3 mul x0, x1, x10 umulh x1, x1, x10 adds x5, x5, x0 adc x3, x3, x1 ldr x8, [sp, #120] eor x1, x8, x15 and x0, x15, x11 sub x3, x3, x0 mul x0, x1, x11 umulh x1, x1, x11 adds x5, x5, x0 adc x3, x3, x1 extr x6, x3, x5, #63 ldp x0, x1, [sp, #64] add x6, x6, x3, asr #63 mov x3, #0x13 mul x4, x6, x3 add x5, x5, x6, lsl #63 smulh x3, x6, x3 ldr x6, [sp, #80] adds x0, x0, x4 adcs x1, x1, x3 asr x3, x3, #63 adcs x6, x6, x3 adc x5, x5, x3 stp x0, x1, [sp, #64] stp x6, x5, [sp, #80] eor x1, x7, x16 and x5, x16, x12 neg x5, x5 mul x0, x1, x12 umulh x1, x1, x12 adds x2, x2, x0 adc x5, x5, x1 eor x1, x8, x17 and x0, x17, x13 sub x5, x5, x0 mul x0, x1, x13 umulh x1, x1, x13 adds x2, x2, x0 adc x5, x5, x1 extr x6, x5, x2, #63 ldp x0, x1, [sp, #96] add x6, x6, x5, asr #63 mov x5, #0x13 mul x4, x6, x5 add x2, x2, x6, lsl #63 smulh x5, x6, x5 ldr x3, [sp, #112] adds x0, x0, x4 adcs x1, x1, x5 asr x5, x5, #63 adcs x3, x3, x5 adc x2, x2, x5 stp x0, x1, [sp, #96] stp x3, x2, [sp, #112] Ledwards25519_scalarmuldouble_invmidloop: mov x1, x22 ldr x2, [sp] ldr x3, [sp, #32] and x4, x2, #0xfffff orr x4, x4, #0xfffffe0000000000 and x5, x3, #0xfffff orr x5, x5, #0xc000000000000000 tst x5, #0x1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 asr x5, x5, #1 add x8, x4, #0x100, lsl #12 sbfx x8, x8, #21, #21 mov x11, #0x100000 add x11, x11, x11, lsl #21 add x9, x4, x11 asr x9, x9, #42 add x10, x5, #0x100, lsl #12 sbfx x10, x10, #21, #21 add x11, x5, x11 asr x11, x11, #42 mul x6, x8, x2 mul x7, x9, x3 mul x2, x10, x2 mul x3, x11, x3 add x4, x6, x7 add x5, x2, x3 asr x2, x4, #20 asr x3, x5, #20 and x4, x2, #0xfffff orr x4, x4, #0xfffffe0000000000 and x5, x3, #0xfffff orr x5, x5, #0xc000000000000000 tst x5, #0x1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 asr x5, x5, #1 add x12, x4, #0x100, lsl #12 sbfx x12, x12, #21, #21 mov x15, #0x100000 add x15, x15, x15, lsl #21 add x13, x4, x15 asr x13, x13, #42 add x14, x5, #0x100, lsl #12 sbfx x14, x14, #21, #21 add x15, x5, x15 asr x15, x15, #42 mul x6, x12, x2 mul x7, x13, x3 mul x2, x14, x2 mul x3, x15, x3 add x4, x6, x7 add x5, x2, x3 asr x2, x4, #20 asr x3, x5, #20 and x4, x2, #0xfffff orr x4, x4, #0xfffffe0000000000 and x5, x3, #0xfffff orr x5, x5, #0xc000000000000000 tst x5, #0x1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 mul x2, x12, x8 mul x3, x12, x9 mul x6, x14, x8 mul x7, x14, x9 madd x8, x13, x10, x2 madd x9, x13, x11, x3 madd x16, x15, x10, x6 madd x17, x15, x11, x7 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 asr x5, x5, #1 add x12, x4, #0x100, lsl #12 sbfx x12, x12, #22, #21 mov x15, #0x100000 add x15, x15, x15, lsl #21 add x13, x4, x15 asr x13, x13, #43 add x14, x5, #0x100, lsl #12 sbfx x14, x14, #22, #21 add x15, x5, x15 asr x15, x15, #43 mneg x2, x12, x8 mneg x3, x12, x9 mneg x4, x14, x8 mneg x5, x14, x9 msub x10, x13, x16, x2 msub x11, x13, x17, x3 msub x12, x15, x16, x4 msub x13, x15, x17, x5 mov x22, x1 subs x21, x21, #0x1 b.ne Ledwards25519_scalarmuldouble_invloop ldr x0, [sp] ldr x1, [sp, #32] mul x0, x0, x10 madd x1, x1, x11, x0 asr x0, x1, #63 cmp x10, xzr csetm x14, mi cneg x10, x10, mi eor x14, x14, x0 cmp x11, xzr csetm x15, mi cneg x11, x11, mi eor x15, x15, x0 cmp x12, xzr csetm x16, mi cneg x12, x12, mi eor x16, x16, x0 cmp x13, xzr csetm x17, mi cneg x13, x13, mi eor x17, x17, x0 and x0, x10, x14 and x1, x11, x15 add x9, x0, x1 ldr x7, [sp, #64] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x4, x9, x0 adc x2, xzr, x1 ldr x8, [sp, #96] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x4, x4, x0 str x4, [sp, #64] adc x2, x2, x1 ldr x7, [sp, #72] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x2, x2, x0 adc x6, xzr, x1 ldr x8, [sp, #104] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x2, x2, x0 str x2, [sp, #72] adc x6, x6, x1 ldr x7, [sp, #80] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x6, x6, x0 adc x5, xzr, x1 ldr x8, [sp, #112] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x6, x6, x0 str x6, [sp, #80] adc x5, x5, x1 ldr x7, [sp, #88] eor x1, x7, x14 and x3, x14, x10 neg x3, x3 mul x0, x1, x10 umulh x1, x1, x10 adds x5, x5, x0 adc x3, x3, x1 ldr x8, [sp, #120] eor x1, x8, x15 and x0, x15, x11 sub x3, x3, x0 mul x0, x1, x11 umulh x1, x1, x11 adds x5, x5, x0 adc x3, x3, x1 extr x6, x3, x5, #63 ldp x0, x1, [sp, #64] tst x3, x3 cinc x6, x6, pl mov x3, #0x13 mul x4, x6, x3 add x5, x5, x6, lsl #63 smulh x6, x6, x3 ldr x2, [sp, #80] adds x0, x0, x4 adcs x1, x1, x6 asr x6, x6, #63 adcs x2, x2, x6 adcs x5, x5, x6 csel x3, x3, xzr, mi subs x0, x0, x3 sbcs x1, x1, xzr sbcs x2, x2, xzr sbc x5, x5, xzr and x5, x5, #0x7fffffffffffffff mov x4, x20 stp x0, x1, [x4] stp x2, x5, [x4, #16] // Store result. Note that these are the only reductions mod 2^255-19 mov p0, res add p1, acc add p2, tabent mul_p25519(x_0,x_1,x_2) add p0, res, #32 add p1, acc+32 add p2, tabent mul_p25519(x_0,x_1,x_2) // Restore stack and registers CFI_INC_SP(NSPACE) CFI_POP2(x25,x30) CFI_POP2(x23,x24) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(edwards25519_scalarmuldouble) // **************************************************************************** // Localized versions of subroutines. // These are close to the standalone functions "edwards25519_epdouble" etc., // but are only maintaining reduction modulo 2^256 - 38, not 2^255 - 19. // **************************************************************************** S2N_BN_FUNCTION_TYPE_DIRECTIVE(Ledwards25519_scalarmuldouble_epdouble) Ledwards25519_scalarmuldouble_epdouble: CFI_START CFI_DEC_SP(5*NUMSIZE) add_twice4(t0,x_1,y_1) sqr_4(t1,z_1) sqr_4(t2,x_1) sqr_4(t3,y_1) double_twice4(t1,t1) sqr_4(t0,t0) add_twice4(t4,t2,t3) sub_twice4(t2,t2,t3) add_twice4(t3,t1,t2) sub_twice4(t1,t4,t0) mul_4(y_0,t2,t4) mul_4(z_0,t3,t2) mul_4(w_0,t1,t4) mul_4(x_0,t1,t3) CFI_INC_SP(5*NUMSIZE) CFI_RET S2N_BN_SIZE_DIRECTIVE(Ledwards25519_scalarmuldouble_epdouble) S2N_BN_FUNCTION_TYPE_DIRECTIVE(Ledwards25519_scalarmuldouble_pdouble) Ledwards25519_scalarmuldouble_pdouble: CFI_START CFI_DEC_SP(5*NUMSIZE) add_twice4(t0,x_1,y_1) sqr_4(t1,z_1) sqr_4(t2,x_1) sqr_4(t3,y_1) double_twice4(t1,t1) sqr_4(t0,t0) add_twice4(t4,t2,t3) sub_twice4(t2,t2,t3) add_twice4(t3,t1,t2) sub_twice4(t1,t4,t0) mul_4(y_0,t2,t4) mul_4(z_0,t3,t2) mul_4(x_0,t1,t3) CFI_INC_SP(5*NUMSIZE) CFI_RET S2N_BN_SIZE_DIRECTIVE(Ledwards25519_scalarmuldouble_pdouble) S2N_BN_FUNCTION_TYPE_DIRECTIVE(Ledwards25519_scalarmuldouble_epadd) Ledwards25519_scalarmuldouble_epadd: CFI_START CFI_DEC_SP(6*NUMSIZE) mul_4(t0,w_1,w_2) sub_twice4(t1,y_1,x_1) sub_twice4(t2,y_2,x_2) add_twice4(t3,y_1,x_1) add_twice4(t4,y_2,x_2) double_twice4(t5,z_2) mul_4(t1,t1,t2) mul_4(t3,t3,t4) load_k25519(t2) mul_4(t2,t2,t0) mul_4(t4,z_1,t5) sub_twice4(t0,t3,t1) add_twice4(t5,t3,t1) sub_twice4(t1,t4,t2) add_twice4(t3,t4,t2) mul_4(w_0,t0,t5) mul_4(x_0,t0,t1) mul_4(y_0,t3,t5) mul_4(z_0,t1,t3) CFI_INC_SP(6*NUMSIZE) CFI_RET S2N_BN_SIZE_DIRECTIVE(Ledwards25519_scalarmuldouble_epadd) S2N_BN_FUNCTION_TYPE_DIRECTIVE(Ledwards25519_scalarmuldouble_pepadd) Ledwards25519_scalarmuldouble_pepadd: CFI_START CFI_DEC_SP(6*NUMSIZE) double_twice4(t0,z_1); sub_twice4(t1,y_1,x_1); add_twice4(t2,y_1,x_1); mul_4(t3,w_1,z_2); mul_4(t1,t1,x_2); mul_4(t2,t2,y_2); sub_twice4(t4,t0,t3); add_twice4(t0,t0,t3); sub_twice4(t5,t2,t1); add_twice4(t1,t2,t1); mul_4(z_0,t4,t0); mul_4(x_0,t5,t4); mul_4(y_0,t0,t1); mul_4(w_0,t5,t1); CFI_INC_SP(6*NUMSIZE) CFI_RET S2N_BN_SIZE_DIRECTIVE(Ledwards25519_scalarmuldouble_pepadd) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack, "", %progbits #endif // **************************************************************************** // The precomputed data (all read-only). // **************************************************************************** #if defined(__ELF__) .section .rodata .type S2N_BN_SYMBOL(edwards25519_scalarmuldouble_constant), %object .size S2N_BN_SYMBOL(edwards25519_scalarmuldouble_constant), 768 #elif defined(__APPLE__) .const_data #endif // Precomputed table of multiples of generator for edwards25519 // all in precomputed extended-projective (y-x,x+y,2*d*x*y) triples. S2N_BN_SYMBOL(edwards25519_scalarmuldouble_constant): // 1 * G .quad 0x9d103905d740913e .quad 0xfd399f05d140beb3 .quad 0xa5c18434688f8a09 .quad 0x44fd2f9298f81267 .quad 0x2fbc93c6f58c3b85 .quad 0xcf932dc6fb8c0e19 .quad 0x270b4898643d42c2 .quad 0x07cf9d3a33d4ba65 .quad 0xabc91205877aaa68 .quad 0x26d9e823ccaac49e .quad 0x5a1b7dcbdd43598c .quad 0x6f117b689f0c65a8 // 2 * G .quad 0x8a99a56042b4d5a8 .quad 0x8f2b810c4e60acf6 .quad 0xe09e236bb16e37aa .quad 0x6bb595a669c92555 .quad 0x9224e7fc933c71d7 .quad 0x9f469d967a0ff5b5 .quad 0x5aa69a65e1d60702 .quad 0x590c063fa87d2e2e .quad 0x43faa8b3a59b7a5f .quad 0x36c16bdd5d9acf78 .quad 0x500fa0840b3d6a31 .quad 0x701af5b13ea50b73 // 3 * G .quad 0x56611fe8a4fcd265 .quad 0x3bd353fde5c1ba7d .quad 0x8131f31a214bd6bd .quad 0x2ab91587555bda62 .quad 0xaf25b0a84cee9730 .quad 0x025a8430e8864b8a .quad 0xc11b50029f016732 .quad 0x7a164e1b9a80f8f4 .quad 0x14ae933f0dd0d889 .quad 0x589423221c35da62 .quad 0xd170e5458cf2db4c .quad 0x5a2826af12b9b4c6 // 4 * G .quad 0x95fe050a056818bf .quad 0x327e89715660faa9 .quad 0xc3e8e3cd06a05073 .quad 0x27933f4c7445a49a .quad 0x287351b98efc099f .quad 0x6765c6f47dfd2538 .quad 0xca348d3dfb0a9265 .quad 0x680e910321e58727 .quad 0x5a13fbe9c476ff09 .quad 0x6e9e39457b5cc172 .quad 0x5ddbdcf9102b4494 .quad 0x7f9d0cbf63553e2b // 5 * G .quad 0x7f9182c3a447d6ba .quad 0xd50014d14b2729b7 .quad 0xe33cf11cb864a087 .quad 0x154a7e73eb1b55f3 .quad 0xa212bc4408a5bb33 .quad 0x8d5048c3c75eed02 .quad 0xdd1beb0c5abfec44 .quad 0x2945ccf146e206eb .quad 0xbcbbdbf1812a8285 .quad 0x270e0807d0bdd1fc .quad 0xb41b670b1bbda72d .quad 0x43aabe696b3bb69a // 6 * G .quad 0x499806b67b7d8ca4 .quad 0x575be28427d22739 .quad 0xbb085ce7204553b9 .quad 0x38b64c41ae417884 .quad 0x3a0ceeeb77157131 .quad 0x9b27158900c8af88 .quad 0x8065b668da59a736 .quad 0x51e57bb6a2cc38bd .quad 0x85ac326702ea4b71 .quad 0xbe70e00341a1bb01 .quad 0x53e4a24b083bc144 .quad 0x10b8e91a9f0d61e3 // 7 * G .quad 0xba6f2c9aaa3221b1 .quad 0x6ca021533bba23a7 .quad 0x9dea764f92192c3a .quad 0x1d6edd5d2e5317e0 .quad 0x6b1a5cd0944ea3bf .quad 0x7470353ab39dc0d2 .quad 0x71b2528228542e49 .quad 0x461bea69283c927e .quad 0xf1836dc801b8b3a2 .quad 0xb3035f47053ea49a .quad 0x529c41ba5877adf3 .quad 0x7a9fbb1c6a0f90a7 // 8 * G .quad 0xe2a75dedf39234d9 .quad 0x963d7680e1b558f9 .quad 0x2c2741ac6e3c23fb .quad 0x3a9024a1320e01c3 .quad 0x59b7596604dd3e8f .quad 0x6cb30377e288702c .quad 0xb1339c665ed9c323 .quad 0x0915e76061bce52f .quad 0xe7c1f5d9c9a2911a .quad 0xb8a371788bcca7d7 .quad 0x636412190eb62a32 .quad 0x26907c5c2ecc4e95
wlsfx/bnbb
5,106
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/bignum_mul_p25519_alt.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply modulo p_25519, z := (x * y) mod p_25519 // Inputs x[4], y[4]; output z[4] // // extern void bignum_mul_p25519_alt(uint64_t z[static 4], // const uint64_t x[static 4], // const uint64_t y[static 4]); // // Standard ARM ABI: X0 = z, X1 = x, X2 = y // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul_p25519_alt) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mul_p25519_alt) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul_p25519_alt) .text .balign 4 #define z x0 #define x x1 #define y x2 #define a0 x3 #define a1 x4 #define a2 x5 #define a3 x6 #define b0 x7 #define b1 x8 #define b2 x9 #define b3 x10 #define l x11 #define u0 x12 #define u1 x13 #define u2 x14 #define u3 x15 #define u4 x16 // These alias to the input arguments when no longer needed #define u5 a0 #define u6 a1 #define u7 a2 #define c b0 #define q b1 #define h b2 S2N_BN_SYMBOL(bignum_mul_p25519_alt): CFI_START // Load operands and set up row 0 = [u4;...;u0] = a0 * [b3;...;b0] ldp a0, a1, [x] ldp b0, b1, [y] mul u0, a0, b0 umulh u1, a0, b0 mul l, a0, b1 umulh u2, a0, b1 adds u1, u1, l ldp b2, b3, [y, #16] mul l, a0, b2 umulh u3, a0, b2 adcs u2, u2, l mul l, a0, b3 umulh u4, a0, b3 adcs u3, u3, l adc u4, u4, xzr ldp a2, a3, [x, #16] // Row 1 = [u5;...;u0] = [a1;a0] * [b3;...;b0] mul l, a1, b0 adds u1, u1, l mul l, a1, b1 adcs u2, u2, l mul l, a1, b2 adcs u3, u3, l mul l, a1, b3 adcs u4, u4, l umulh u5, a1, b3 adc u5, u5, xzr umulh l, a1, b0 adds u2, u2, l umulh l, a1, b1 adcs u3, u3, l umulh l, a1, b2 adcs u4, u4, l adc u5, u5, xzr // Row 2 = [u6;...;u0] = [a2;a1;a0] * [b3;...;b0] mul l, a2, b0 adds u2, u2, l mul l, a2, b1 adcs u3, u3, l mul l, a2, b2 adcs u4, u4, l mul l, a2, b3 adcs u5, u5, l umulh u6, a2, b3 adc u6, u6, xzr umulh l, a2, b0 adds u3, u3, l umulh l, a2, b1 adcs u4, u4, l umulh l, a2, b2 adcs u5, u5, l adc u6, u6, xzr // Row 3 = [u7;...;u0] = [a3;...a0] * [b3;...;b0] mul l, a3, b0 adds u3, u3, l mul l, a3, b1 adcs u4, u4, l mul l, a3, b2 adcs u5, u5, l mul l, a3, b3 adcs u6, u6, l umulh u7, a3, b3 adc u7, u7, xzr umulh l, a3, b0 adds u4, u4, l umulh l, a3, b1 adcs u5, u5, l umulh l, a3, b2 adcs u6, u6, l adc u7, u7, xzr // Now we have the full 8-digit product 2^256 * h + l where // h = [u7,u6,u5,u4] and l = [u3,u2,u1,u0] // and this is == 38 * h + l (mod p_25519) mov c, #38 mul l, c, u4 umulh h, c, u4 adds u0, u0, l mul l, c, u5 umulh u5, c, u5 adcs u1, u1, l mul l, c, u6 umulh u6, c, u6 adcs u2, u2, l mul l, c, u7 umulh u7, c, u7 adcs u3, u3, l cset u4, cs // Compute the top part deferring the [u5,h] addition till the following // carry chain. This is enough to get a good quotient estimate and saves // a couple of instructions. adds u3, u3, u6 adc u4, u4, u7 // Now we have reduced to 5 digits, 2^255 * H + L = [u4,u3,u2,u1,u0] // Use q = H + 1 as the initial quotient estimate, either right or 1 too big. adds xzr, u3, u3 orr u3, u3, #0x8000000000000000 adc q, u4, u4 mov c, #19 madd l, c, q, c adds u0, u0, l adcs u1, u1, h adcs u2, u2, u5 adcs u3, u3, xzr // Now the effective answer is 2^256 * (CF - 1) + [u3,u2,u1,u0] // So we correct if CF = 0 by subtracting 19, either way masking to // 255 bits, i.e. by effectively adding p_25519 to the "full" answer csel c, c, xzr, cc subs u0, u0, c sbcs u1, u1, xzr sbcs u2, u2, xzr sbc u3, u3, xzr bic u3, u3, #0x8000000000000000 // Write back and return stp u0, u1, [x0] stp u2, u3, [x0, #16] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mul_p25519_alt) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
45,282
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/curve25519_ladderstep.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Montgomery ladder step on pairs of (X,Z)-projective curve25519 points // // extern void curve25519_ladderstep // (uint64_t rr[16],const uint64_t point[8],const uint64_t pp[16],uint64_t b); // // If point = (X,1) and pp = (n * (X,1),[n+1] * (X,1)) then the output // rr = (n' * (X,1),[n'+1] * (X,1)) where n' = 2 * n + b, with input // b assumed to be 0 or 1; in this setting, each pair (X,Z) is assumed to // be a projective y-free representation of an affine curve25519 point // (X/Z,y), with the initial "differential" point having Z = 1 and X its // affine x coordinate. In other words, the ladderstep operation is a // combination of doubling, differential addition and optional swapping. // // Standard ARM ABI: X0 = rr, X1 = point, X2 = pp, X3 = b // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(curve25519_ladderstep) S2N_BN_FUNCTION_TYPE_DIRECTIVE(curve25519_ladderstep) S2N_BN_SYM_PRIVACY_DIRECTIVE(curve25519_ladderstep) .text .balign 4 // Size of individual field elements #define NUMSIZE 32 // Stable homes for input arguments during main code sequence #define rr x17 #define point x19 #define pp x20 #define b x21 // Pointer-offset pairs for inputs and outputs #define x point, #0 #define z point, #NUMSIZE #define xn pp, #0 #define zn pp, #NUMSIZE #define xm pp, #(2*NUMSIZE) #define zm pp, #(3*NUMSIZE) #define res0 rr, #0 #define res1 rr, #NUMSIZE #define res2 rr, #(2*NUMSIZE) #define res3 rr, #(3*NUMSIZE) // Pointer-offset pairs for temporaries on stack #define sm sp, #(0*NUMSIZE) #define sn sp, #(1*NUMSIZE) #define dm sp, #(2*NUMSIZE) #define dn sp, #(3*NUMSIZE) #define dmsn sp, #(4*NUMSIZE) #define dnsm sp, #(5*NUMSIZE) #define s sp, #(6*NUMSIZE) #define d sp, #(7*NUMSIZE) #define p sp, #(8*NUMSIZE) // More, but aliases to above #define sumx sm #define sumz sn #define dubx dm #define dubz dn #define e dubz #define spro dnsm #define dpro sumz // Total size to reserve on the stack #define NSPACE 9*NUMSIZE // Macros wrapping up the basic field operations bignum_mul_p25519 // and bignum_sqr_p25519, only trivially different from pure function // call to those subroutines. #define mul_p25519(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x5, x6, [P2] __LF \ umull x7, w3, w5 __LF \ lsr x0, x3, #32 __LF \ umull x15, w0, w5 __LF \ lsr x16, x5, #32 __LF \ umull x8, w16, w0 __LF \ umull x16, w3, w16 __LF \ adds x7, x7, x15, lsl #32 __LF \ lsr x15, x15, #32 __LF \ adc x8, x8, x15 __LF \ adds x7, x7, x16, lsl #32 __LF \ lsr x16, x16, #32 __LF \ adc x8, x8, x16 __LF \ mul x9, x4, x6 __LF \ umulh x10, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x16, cc __LF \ adds x9, x9, x8 __LF \ adc x10, x10, xzr __LF \ subs x3, x5, x6 __LF \ cneg x3, x3, cc __LF \ cinv x16, x16, cc __LF \ mul x15, x4, x3 __LF \ umulh x3, x4, x3 __LF \ adds x8, x7, x9 __LF \ adcs x9, x9, x10 __LF \ adc x10, x10, xzr __LF \ cmn x16, #0x1 __LF \ eor x15, x15, x16 __LF \ adcs x8, x15, x8 __LF \ eor x3, x3, x16 __LF \ adcs x9, x3, x9 __LF \ adc x10, x10, x16 __LF \ ldp x3, x4, [P1+16] __LF \ ldp x5, x6, [P2+16] __LF \ umull x11, w3, w5 __LF \ lsr x0, x3, #32 __LF \ umull x15, w0, w5 __LF \ lsr x16, x5, #32 __LF \ umull x12, w16, w0 __LF \ umull x16, w3, w16 __LF \ adds x11, x11, x15, lsl #32 __LF \ lsr x15, x15, #32 __LF \ adc x12, x12, x15 __LF \ adds x11, x11, x16, lsl #32 __LF \ lsr x16, x16, #32 __LF \ adc x12, x12, x16 __LF \ mul x13, x4, x6 __LF \ umulh x14, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x16, cc __LF \ adds x13, x13, x12 __LF \ adc x14, x14, xzr __LF \ subs x3, x5, x6 __LF \ cneg x3, x3, cc __LF \ cinv x16, x16, cc __LF \ mul x15, x4, x3 __LF \ umulh x3, x4, x3 __LF \ adds x12, x11, x13 __LF \ adcs x13, x13, x14 __LF \ adc x14, x14, xzr __LF \ cmn x16, #0x1 __LF \ eor x15, x15, x16 __LF \ adcs x12, x15, x12 __LF \ eor x3, x3, x16 __LF \ adcs x13, x3, x13 __LF \ adc x14, x14, x16 __LF \ ldp x3, x4, [P1+16] __LF \ ldp x15, x16, [P1] __LF \ subs x3, x3, x15 __LF \ sbcs x4, x4, x16 __LF \ csetm x16, cc __LF \ ldp x15, x0, [P2] __LF \ subs x5, x15, x5 __LF \ sbcs x6, x0, x6 __LF \ csetm x0, cc __LF \ eor x3, x3, x16 __LF \ subs x3, x3, x16 __LF \ eor x4, x4, x16 __LF \ sbc x4, x4, x16 __LF \ eor x5, x5, x0 __LF \ subs x5, x5, x0 __LF \ eor x6, x6, x0 __LF \ sbc x6, x6, x0 __LF \ eor x16, x0, x16 __LF \ adds x11, x11, x9 __LF \ adcs x12, x12, x10 __LF \ adcs x13, x13, xzr __LF \ adc x14, x14, xzr __LF \ mul x2, x3, x5 __LF \ umulh x0, x3, x5 __LF \ mul x15, x4, x6 __LF \ umulh x1, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x9, cc __LF \ adds x15, x15, x0 __LF \ adc x1, x1, xzr __LF \ subs x6, x5, x6 __LF \ cneg x6, x6, cc __LF \ cinv x9, x9, cc __LF \ mul x5, x4, x6 __LF \ umulh x6, x4, x6 __LF \ adds x0, x2, x15 __LF \ adcs x15, x15, x1 __LF \ adc x1, x1, xzr __LF \ cmn x9, #0x1 __LF \ eor x5, x5, x9 __LF \ adcs x0, x5, x0 __LF \ eor x6, x6, x9 __LF \ adcs x15, x6, x15 __LF \ adc x1, x1, x9 __LF \ adds x9, x11, x7 __LF \ adcs x10, x12, x8 __LF \ adcs x11, x13, x11 __LF \ adcs x12, x14, x12 __LF \ adcs x13, x13, xzr __LF \ adc x14, x14, xzr __LF \ cmn x16, #0x1 __LF \ eor x2, x2, x16 __LF \ adcs x9, x2, x9 __LF \ eor x0, x0, x16 __LF \ adcs x10, x0, x10 __LF \ eor x15, x15, x16 __LF \ adcs x11, x15, x11 __LF \ eor x1, x1, x16 __LF \ adcs x12, x1, x12 __LF \ adcs x13, x13, x16 __LF \ adc x14, x14, x16 __LF \ mov x3, #0x26 __LF \ umull x4, w11, w3 __LF \ add x4, x4, w7, uxtw __LF \ lsr x7, x7, #32 __LF \ lsr x11, x11, #32 __LF \ umaddl x11, w11, w3, x7 __LF \ mov x7, x4 __LF \ umull x4, w12, w3 __LF \ add x4, x4, w8, uxtw __LF \ lsr x8, x8, #32 __LF \ lsr x12, x12, #32 __LF \ umaddl x12, w12, w3, x8 __LF \ mov x8, x4 __LF \ umull x4, w13, w3 __LF \ add x4, x4, w9, uxtw __LF \ lsr x9, x9, #32 __LF \ lsr x13, x13, #32 __LF \ umaddl x13, w13, w3, x9 __LF \ mov x9, x4 __LF \ umull x4, w14, w3 __LF \ add x4, x4, w10, uxtw __LF \ lsr x10, x10, #32 __LF \ lsr x14, x14, #32 __LF \ umaddl x14, w14, w3, x10 __LF \ mov x10, x4 __LF \ lsr x0, x14, #31 __LF \ mov x5, #0x13 __LF \ umaddl x5, w5, w0, x5 __LF \ add x7, x7, x5 __LF \ adds x7, x7, x11, lsl #32 __LF \ extr x3, x12, x11, #32 __LF \ adcs x8, x8, x3 __LF \ extr x3, x13, x12, #32 __LF \ adcs x9, x9, x3 __LF \ extr x3, x14, x13, #32 __LF \ lsl x5, x0, #63 __LF \ eor x10, x10, x5 __LF \ adc x10, x10, x3 __LF \ mov x3, #0x13 __LF \ tst x10, #0x8000000000000000 __LF \ csel x3, x3, xzr, pl __LF \ subs x7, x7, x3 __LF \ sbcs x8, x8, xzr __LF \ sbcs x9, x9, xzr __LF \ sbc x10, x10, xzr __LF \ and x10, x10, #0x7fffffffffffffff __LF \ stp x7, x8, [P0] __LF \ stp x9, x10, [P0+16] #define sqr_p25519(P0,P1) \ ldp x10, x11, [P1] __LF \ ldp x12, x13, [P1+16] __LF \ umull x2, w10, w10 __LF \ lsr x14, x10, #32 __LF \ umull x3, w14, w14 __LF \ umull x14, w10, w14 __LF \ adds x2, x2, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x3, x3, x14 __LF \ umull x4, w11, w11 __LF \ lsr x14, x11, #32 __LF \ umull x5, w14, w14 __LF \ umull x14, w11, w14 __LF \ mul x15, x10, x11 __LF \ umulh x16, x10, x11 __LF \ adds x4, x4, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x5, x5, x14 __LF \ adds x15, x15, x15 __LF \ adcs x16, x16, x16 __LF \ adc x5, x5, xzr __LF \ adds x3, x3, x15 __LF \ adcs x4, x4, x16 __LF \ adc x5, x5, xzr __LF \ umull x6, w12, w12 __LF \ lsr x14, x12, #32 __LF \ umull x7, w14, w14 __LF \ umull x14, w12, w14 __LF \ adds x6, x6, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x7, x7, x14 __LF \ umull x8, w13, w13 __LF \ lsr x14, x13, #32 __LF \ umull x9, w14, w14 __LF \ umull x14, w13, w14 __LF \ mul x15, x12, x13 __LF \ umulh x16, x12, x13 __LF \ adds x8, x8, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x9, x9, x14 __LF \ adds x15, x15, x15 __LF \ adcs x16, x16, x16 __LF \ adc x9, x9, xzr __LF \ adds x7, x7, x15 __LF \ adcs x8, x8, x16 __LF \ adc x9, x9, xzr __LF \ subs x10, x10, x12 __LF \ sbcs x11, x11, x13 __LF \ csetm x16, cc __LF \ eor x10, x10, x16 __LF \ subs x10, x10, x16 __LF \ eor x11, x11, x16 __LF \ sbc x11, x11, x16 __LF \ adds x6, x6, x4 __LF \ adcs x7, x7, x5 __LF \ adcs x8, x8, xzr __LF \ adc x9, x9, xzr __LF \ umull x12, w10, w10 __LF \ lsr x5, x10, #32 __LF \ umull x13, w5, w5 __LF \ umull x5, w10, w5 __LF \ adds x12, x12, x5, lsl #33 __LF \ lsr x5, x5, #31 __LF \ adc x13, x13, x5 __LF \ umull x15, w11, w11 __LF \ lsr x5, x11, #32 __LF \ umull x14, w5, w5 __LF \ umull x5, w11, w5 __LF \ mul x4, x10, x11 __LF \ umulh x16, x10, x11 __LF \ adds x15, x15, x5, lsl #33 __LF \ lsr x5, x5, #31 __LF \ adc x14, x14, x5 __LF \ adds x4, x4, x4 __LF \ adcs x16, x16, x16 __LF \ adc x14, x14, xzr __LF \ adds x13, x13, x4 __LF \ adcs x15, x15, x16 __LF \ adc x14, x14, xzr __LF \ adds x4, x2, x6 __LF \ adcs x5, x3, x7 __LF \ adcs x6, x6, x8 __LF \ adcs x7, x7, x9 __LF \ csetm x16, cc __LF \ subs x4, x4, x12 __LF \ sbcs x5, x5, x13 __LF \ sbcs x6, x6, x15 __LF \ sbcs x7, x7, x14 __LF \ adcs x8, x8, x16 __LF \ adc x9, x9, x16 __LF \ mov x10, #0x26 __LF \ umull x12, w6, w10 __LF \ add x12, x12, w2, uxtw __LF \ lsr x2, x2, #32 __LF \ lsr x6, x6, #32 __LF \ umaddl x6, w6, w10, x2 __LF \ mov x2, x12 __LF \ umull x12, w7, w10 __LF \ add x12, x12, w3, uxtw __LF \ lsr x3, x3, #32 __LF \ lsr x7, x7, #32 __LF \ umaddl x7, w7, w10, x3 __LF \ mov x3, x12 __LF \ umull x12, w8, w10 __LF \ add x12, x12, w4, uxtw __LF \ lsr x4, x4, #32 __LF \ lsr x8, x8, #32 __LF \ umaddl x8, w8, w10, x4 __LF \ mov x4, x12 __LF \ umull x12, w9, w10 __LF \ add x12, x12, w5, uxtw __LF \ lsr x5, x5, #32 __LF \ lsr x9, x9, #32 __LF \ umaddl x9, w9, w10, x5 __LF \ mov x5, x12 __LF \ lsr x13, x9, #31 __LF \ mov x11, #0x13 __LF \ umaddl x11, w11, w13, x11 __LF \ add x2, x2, x11 __LF \ adds x2, x2, x6, lsl #32 __LF \ extr x10, x7, x6, #32 __LF \ adcs x3, x3, x10 __LF \ extr x10, x8, x7, #32 __LF \ adcs x4, x4, x10 __LF \ extr x10, x9, x8, #32 __LF \ lsl x11, x13, #63 __LF \ eor x5, x5, x11 __LF \ adc x5, x5, x10 __LF \ mov x10, #0x13 __LF \ tst x5, #0x8000000000000000 __LF \ csel x10, x10, xzr, pl __LF \ subs x2, x2, x10 __LF \ sbcs x3, x3, xzr __LF \ sbcs x4, x4, xzr __LF \ sbc x5, x5, xzr __LF \ and x5, x5, #0x7fffffffffffffff __LF \ stp x2, x3, [P0] __LF \ stp x4, x5, [P0+16] // A version of multiplication that only guarantees output < 2 * p_25519. // This basically skips the +1 and final correction in quotient estimation. #define mul_4(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x5, x6, [P2] __LF \ umull x7, w3, w5 __LF \ lsr x0, x3, #32 __LF \ umull x15, w0, w5 __LF \ lsr x16, x5, #32 __LF \ umull x8, w16, w0 __LF \ umull x16, w3, w16 __LF \ adds x7, x7, x15, lsl #32 __LF \ lsr x15, x15, #32 __LF \ adc x8, x8, x15 __LF \ adds x7, x7, x16, lsl #32 __LF \ lsr x16, x16, #32 __LF \ adc x8, x8, x16 __LF \ mul x9, x4, x6 __LF \ umulh x10, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x16, cc __LF \ adds x9, x9, x8 __LF \ adc x10, x10, xzr __LF \ subs x3, x5, x6 __LF \ cneg x3, x3, cc __LF \ cinv x16, x16, cc __LF \ mul x15, x4, x3 __LF \ umulh x3, x4, x3 __LF \ adds x8, x7, x9 __LF \ adcs x9, x9, x10 __LF \ adc x10, x10, xzr __LF \ cmn x16, #0x1 __LF \ eor x15, x15, x16 __LF \ adcs x8, x15, x8 __LF \ eor x3, x3, x16 __LF \ adcs x9, x3, x9 __LF \ adc x10, x10, x16 __LF \ ldp x3, x4, [P1+16] __LF \ ldp x5, x6, [P2+16] __LF \ umull x11, w3, w5 __LF \ lsr x0, x3, #32 __LF \ umull x15, w0, w5 __LF \ lsr x16, x5, #32 __LF \ umull x12, w16, w0 __LF \ umull x16, w3, w16 __LF \ adds x11, x11, x15, lsl #32 __LF \ lsr x15, x15, #32 __LF \ adc x12, x12, x15 __LF \ adds x11, x11, x16, lsl #32 __LF \ lsr x16, x16, #32 __LF \ adc x12, x12, x16 __LF \ mul x13, x4, x6 __LF \ umulh x14, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x16, cc __LF \ adds x13, x13, x12 __LF \ adc x14, x14, xzr __LF \ subs x3, x5, x6 __LF \ cneg x3, x3, cc __LF \ cinv x16, x16, cc __LF \ mul x15, x4, x3 __LF \ umulh x3, x4, x3 __LF \ adds x12, x11, x13 __LF \ adcs x13, x13, x14 __LF \ adc x14, x14, xzr __LF \ cmn x16, #0x1 __LF \ eor x15, x15, x16 __LF \ adcs x12, x15, x12 __LF \ eor x3, x3, x16 __LF \ adcs x13, x3, x13 __LF \ adc x14, x14, x16 __LF \ ldp x3, x4, [P1+16] __LF \ ldp x15, x16, [P1] __LF \ subs x3, x3, x15 __LF \ sbcs x4, x4, x16 __LF \ csetm x16, cc __LF \ ldp x15, x0, [P2] __LF \ subs x5, x15, x5 __LF \ sbcs x6, x0, x6 __LF \ csetm x0, cc __LF \ eor x3, x3, x16 __LF \ subs x3, x3, x16 __LF \ eor x4, x4, x16 __LF \ sbc x4, x4, x16 __LF \ eor x5, x5, x0 __LF \ subs x5, x5, x0 __LF \ eor x6, x6, x0 __LF \ sbc x6, x6, x0 __LF \ eor x16, x0, x16 __LF \ adds x11, x11, x9 __LF \ adcs x12, x12, x10 __LF \ adcs x13, x13, xzr __LF \ adc x14, x14, xzr __LF \ mul x2, x3, x5 __LF \ umulh x0, x3, x5 __LF \ mul x15, x4, x6 __LF \ umulh x1, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x9, cc __LF \ adds x15, x15, x0 __LF \ adc x1, x1, xzr __LF \ subs x6, x5, x6 __LF \ cneg x6, x6, cc __LF \ cinv x9, x9, cc __LF \ mul x5, x4, x6 __LF \ umulh x6, x4, x6 __LF \ adds x0, x2, x15 __LF \ adcs x15, x15, x1 __LF \ adc x1, x1, xzr __LF \ cmn x9, #0x1 __LF \ eor x5, x5, x9 __LF \ adcs x0, x5, x0 __LF \ eor x6, x6, x9 __LF \ adcs x15, x6, x15 __LF \ adc x1, x1, x9 __LF \ adds x9, x11, x7 __LF \ adcs x10, x12, x8 __LF \ adcs x11, x13, x11 __LF \ adcs x12, x14, x12 __LF \ adcs x13, x13, xzr __LF \ adc x14, x14, xzr __LF \ cmn x16, #0x1 __LF \ eor x2, x2, x16 __LF \ adcs x9, x2, x9 __LF \ eor x0, x0, x16 __LF \ adcs x10, x0, x10 __LF \ eor x15, x15, x16 __LF \ adcs x11, x15, x11 __LF \ eor x1, x1, x16 __LF \ adcs x12, x1, x12 __LF \ adcs x13, x13, x16 __LF \ adc x14, x14, x16 __LF \ mov x3, #0x26 __LF \ umull x4, w11, w3 __LF \ add x4, x4, w7, uxtw __LF \ lsr x7, x7, #32 __LF \ lsr x11, x11, #32 __LF \ umaddl x11, w11, w3, x7 __LF \ mov x7, x4 __LF \ umull x4, w12, w3 __LF \ add x4, x4, w8, uxtw __LF \ lsr x8, x8, #32 __LF \ lsr x12, x12, #32 __LF \ umaddl x12, w12, w3, x8 __LF \ mov x8, x4 __LF \ umull x4, w13, w3 __LF \ add x4, x4, w9, uxtw __LF \ lsr x9, x9, #32 __LF \ lsr x13, x13, #32 __LF \ umaddl x13, w13, w3, x9 __LF \ mov x9, x4 __LF \ umull x4, w14, w3 __LF \ add x4, x4, w10, uxtw __LF \ lsr x10, x10, #32 __LF \ lsr x14, x14, #32 __LF \ umaddl x14, w14, w3, x10 __LF \ mov x10, x4 __LF \ lsr x0, x14, #31 __LF \ mov x5, #0x13 __LF \ umull x5, w5, w0 __LF \ add x7, x7, x5 __LF \ adds x7, x7, x11, lsl #32 __LF \ extr x3, x12, x11, #32 __LF \ adcs x8, x8, x3 __LF \ extr x3, x13, x12, #32 __LF \ adcs x9, x9, x3 __LF \ extr x3, x14, x13, #32 __LF \ lsl x5, x0, #63 __LF \ eor x10, x10, x5 __LF \ adc x10, x10, x3 __LF \ stp x7, x8, [P0] __LF \ stp x9, x10, [P0+16] // Squaring just giving a result < 2 * p_25519, which is done by // basically skipping the +1 in the quotient estimate and the final // optional correction. #define sqr_4(P0,P1) \ ldp x10, x11, [P1] __LF \ ldp x12, x13, [P1+16] __LF \ umull x2, w10, w10 __LF \ lsr x14, x10, #32 __LF \ umull x3, w14, w14 __LF \ umull x14, w10, w14 __LF \ adds x2, x2, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x3, x3, x14 __LF \ umull x4, w11, w11 __LF \ lsr x14, x11, #32 __LF \ umull x5, w14, w14 __LF \ umull x14, w11, w14 __LF \ mul x15, x10, x11 __LF \ umulh x16, x10, x11 __LF \ adds x4, x4, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x5, x5, x14 __LF \ adds x15, x15, x15 __LF \ adcs x16, x16, x16 __LF \ adc x5, x5, xzr __LF \ adds x3, x3, x15 __LF \ adcs x4, x4, x16 __LF \ adc x5, x5, xzr __LF \ umull x6, w12, w12 __LF \ lsr x14, x12, #32 __LF \ umull x7, w14, w14 __LF \ umull x14, w12, w14 __LF \ adds x6, x6, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x7, x7, x14 __LF \ umull x8, w13, w13 __LF \ lsr x14, x13, #32 __LF \ umull x9, w14, w14 __LF \ umull x14, w13, w14 __LF \ mul x15, x12, x13 __LF \ umulh x16, x12, x13 __LF \ adds x8, x8, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x9, x9, x14 __LF \ adds x15, x15, x15 __LF \ adcs x16, x16, x16 __LF \ adc x9, x9, xzr __LF \ adds x7, x7, x15 __LF \ adcs x8, x8, x16 __LF \ adc x9, x9, xzr __LF \ subs x10, x10, x12 __LF \ sbcs x11, x11, x13 __LF \ csetm x16, cc __LF \ eor x10, x10, x16 __LF \ subs x10, x10, x16 __LF \ eor x11, x11, x16 __LF \ sbc x11, x11, x16 __LF \ adds x6, x6, x4 __LF \ adcs x7, x7, x5 __LF \ adcs x8, x8, xzr __LF \ adc x9, x9, xzr __LF \ umull x12, w10, w10 __LF \ lsr x5, x10, #32 __LF \ umull x13, w5, w5 __LF \ umull x5, w10, w5 __LF \ adds x12, x12, x5, lsl #33 __LF \ lsr x5, x5, #31 __LF \ adc x13, x13, x5 __LF \ umull x15, w11, w11 __LF \ lsr x5, x11, #32 __LF \ umull x14, w5, w5 __LF \ umull x5, w11, w5 __LF \ mul x4, x10, x11 __LF \ umulh x16, x10, x11 __LF \ adds x15, x15, x5, lsl #33 __LF \ lsr x5, x5, #31 __LF \ adc x14, x14, x5 __LF \ adds x4, x4, x4 __LF \ adcs x16, x16, x16 __LF \ adc x14, x14, xzr __LF \ adds x13, x13, x4 __LF \ adcs x15, x15, x16 __LF \ adc x14, x14, xzr __LF \ adds x4, x2, x6 __LF \ adcs x5, x3, x7 __LF \ adcs x6, x6, x8 __LF \ adcs x7, x7, x9 __LF \ csetm x16, cc __LF \ subs x4, x4, x12 __LF \ sbcs x5, x5, x13 __LF \ sbcs x6, x6, x15 __LF \ sbcs x7, x7, x14 __LF \ adcs x8, x8, x16 __LF \ adc x9, x9, x16 __LF \ mov x10, #0x26 __LF \ umull x12, w6, w10 __LF \ add x12, x12, w2, uxtw __LF \ lsr x2, x2, #32 __LF \ lsr x6, x6, #32 __LF \ umaddl x6, w6, w10, x2 __LF \ mov x2, x12 __LF \ umull x12, w7, w10 __LF \ add x12, x12, w3, uxtw __LF \ lsr x3, x3, #32 __LF \ lsr x7, x7, #32 __LF \ umaddl x7, w7, w10, x3 __LF \ mov x3, x12 __LF \ umull x12, w8, w10 __LF \ add x12, x12, w4, uxtw __LF \ lsr x4, x4, #32 __LF \ lsr x8, x8, #32 __LF \ umaddl x8, w8, w10, x4 __LF \ mov x4, x12 __LF \ umull x12, w9, w10 __LF \ add x12, x12, w5, uxtw __LF \ lsr x5, x5, #32 __LF \ lsr x9, x9, #32 __LF \ umaddl x9, w9, w10, x5 __LF \ mov x5, x12 __LF \ lsr x13, x9, #31 __LF \ mov x11, #0x13 __LF \ umull x11, w11, w13 __LF \ add x2, x2, x11 __LF \ adds x2, x2, x6, lsl #32 __LF \ extr x10, x7, x6, #32 __LF \ adcs x3, x3, x10 __LF \ extr x10, x8, x7, #32 __LF \ adcs x4, x4, x10 __LF \ extr x10, x9, x8, #32 __LF \ lsl x11, x13, #63 __LF \ eor x5, x5, x11 __LF \ adc x5, x5, x10 __LF \ stp x2, x3, [P0] __LF \ stp x4, x5, [P0+16] // Plain 4-digit add without any normalization // With inputs < p_25519 (indeed < 2^255) it still gives a 4-digit result #define add_4(p0,p1,p2) \ ldp x0, x1, [p1] __LF \ ldp x4, x5, [p2] __LF \ adds x0, x0, x4 __LF \ adcs x1, x1, x5 __LF \ ldp x2, x3, [p1+16] __LF \ ldp x6, x7, [p2+16] __LF \ adcs x2, x2, x6 __LF \ adc x3, x3, x7 __LF \ stp x0, x1, [p0] __LF \ stp x2, x3, [p0+16] // Subtraction of a pair of numbers < p_25519 just sufficient // to give a 4-digit result. It actually always does (x - z) + (2^255-19) // which in turn is done by (x - z) - (2^255+19) discarding the 2^256 // implicitly #define sub_4(p0,p1,p2) \ ldp x5, x6, [p1] __LF \ ldp x4, x3, [p2] __LF \ subs x5, x5, x4 __LF \ sbcs x6, x6, x3 __LF \ ldp x7, x8, [p1+16] __LF \ ldp x4, x3, [p2+16] __LF \ sbcs x7, x7, x4 __LF \ sbcs x8, x8, x3 __LF \ mov x3, #19 __LF \ subs x5, x5, x3 __LF \ sbcs x6, x6, xzr __LF \ sbcs x7, x7, xzr __LF \ mov x4, #0x8000000000000000 __LF \ sbc x8, x8, x4 __LF \ stp x5, x6, [p0] __LF \ stp x7, x8, [p0+16] // Modular addition with double modulus 2 * p_25519 = 2^256 - 38. // This only ensures that the result fits in 4 digits, not that it is reduced // even w.r.t. double modulus. The result is always correct modulo provided // the sum of the inputs is < 2^256 + 2^256 - 38, so in particular provided // at least one of them is reduced double modulo. #define add_twice4(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x7, x8, [P2] __LF \ adds x3, x3, x7 __LF \ adcs x4, x4, x8 __LF \ ldp x5, x6, [P1+16] __LF \ ldp x7, x8, [P2+16] __LF \ adcs x5, x5, x7 __LF \ adcs x6, x6, x8 __LF \ mov x9, #38 __LF \ csel x9, x9, xzr, cs __LF \ adds x3, x3, x9 __LF \ adcs x4, x4, xzr __LF \ adcs x5, x5, xzr __LF \ adc x6, x6, xzr __LF \ stp x3, x4, [P0] __LF \ stp x5, x6, [P0+16] // Modular subtraction with double modulus 2 * p_25519 = 2^256 - 38 #define sub_twice4(p0,p1,p2) \ ldp x5, x6, [p1] __LF \ ldp x4, x3, [p2] __LF \ subs x5, x5, x4 __LF \ sbcs x6, x6, x3 __LF \ ldp x7, x8, [p1+16] __LF \ ldp x4, x3, [p2+16] __LF \ sbcs x7, x7, x4 __LF \ sbcs x8, x8, x3 __LF \ mov x4, #38 __LF \ csel x3, x4, xzr, lo __LF \ subs x5, x5, x3 __LF \ sbcs x6, x6, xzr __LF \ sbcs x7, x7, xzr __LF \ sbc x8, x8, xzr __LF \ stp x5, x6, [p0] __LF \ stp x7, x8, [p0+16] // Combined z = c * x + y with reduction only < 2 * p_25519 // where c is initially in the X1 register. It is assumed // that 19 * (c * x + y) < 2^60 * 2^256 so we don't need a // high mul in the final part. #define cmadd_4(p0,p2,p3) \ ldp x7, x8, [p2] __LF \ ldp x9, x10, [p2+16] __LF \ mul x3, x1, x7 __LF \ mul x4, x1, x8 __LF \ mul x5, x1, x9 __LF \ mul x6, x1, x10 __LF \ umulh x7, x1, x7 __LF \ umulh x8, x1, x8 __LF \ umulh x9, x1, x9 __LF \ umulh x10, x1, x10 __LF \ adds x4, x4, x7 __LF \ adcs x5, x5, x8 __LF \ adcs x6, x6, x9 __LF \ adc x10, x10, xzr __LF \ ldp x7, x8, [p3] __LF \ adds x3, x3, x7 __LF \ adcs x4, x4, x8 __LF \ ldp x7, x8, [p3+16] __LF \ adcs x5, x5, x7 __LF \ adcs x6, x6, x8 __LF \ adc x10, x10, xzr __LF \ cmn x6, x6 __LF \ bic x6, x6, #0x8000000000000000 __LF \ adc x8, x10, x10 __LF \ mov x9, #19 __LF \ mul x7, x8, x9 __LF \ adds x3, x3, x7 __LF \ adcs x4, x4, xzr __LF \ adcs x5, x5, xzr __LF \ adc x6, x6, xzr __LF \ stp x3, x4, [p0] __LF \ stp x5, x6, [p0+16] // Multiplex: z := if NZ then x else y #define mux_4(p0,p1,p2) \ ldp x0, x1, [p1] __LF \ ldp x2, x3, [p2] __LF \ csel x0, x0, x2, ne __LF \ csel x1, x1, x3, ne __LF \ stp x0, x1, [p0] __LF \ ldp x0, x1, [p1+16] __LF \ ldp x2, x3, [p2+16] __LF \ csel x0, x0, x2, ne __LF \ csel x1, x1, x3, ne __LF \ stp x0, x1, [p0+16] // Paired multiplex: (w,z) := if NZ then (y,x) else (x,y) #define muxpair_4(p0,p1,p2,p3) \ ldp x0, x1, [p2] __LF \ ldp x2, x3, [p3] __LF \ csel x4, x0, x2, eq __LF \ csel x6, x0, x2, ne __LF \ csel x5, x1, x3, eq __LF \ csel x7, x1, x3, ne __LF \ stp x4, x5, [p0] __LF \ stp x6, x7, [p1] __LF \ ldp x0, x1, [p2+16] __LF \ ldp x2, x3, [p3+16] __LF \ csel x4, x0, x2, eq __LF \ csel x6, x0, x2, ne __LF \ csel x5, x1, x3, eq __LF \ csel x7, x1, x3, ne __LF \ stp x4, x5, [p0+16] __LF \ stp x6, x7, [p1+16] S2N_BN_SYMBOL(curve25519_ladderstep): CFI_START // Save regs and make room for temporaries CFI_PUSH2(x19,x30) CFI_PUSH2(x20,x21) CFI_DEC_SP(NSPACE) // Move the input arguments to stable places mov rr, x0 mov point, x1 mov pp, x2 mov b, x3 // sm = xm + zm; sn = xn + zn; dm = xm - zm; dn = xn - zn // The adds don't need any normalization as they're fed to muls // Just make sure the subs fit in 4 digits sub_4(dm, xm, zm) add_4(sn, xn, zn) sub_4(dn, xn, zn) add_4(sm, xm, zm) // ADDING: dmsn = dm * sn; dnsm = sm * dn // DOUBLING: mux d = xt - zt and s = xt + zt for appropriate choice of (xt,zt) mul_4(dmsn,dm,sn) cmp b, xzr mux_4(d,dm,dn) mux_4(s,sm,sn) mul_4(dnsm,sm,dn) // DOUBLING: d = (xt - zt)^2 normalized only to 4 digits sqr_4(d,d) // ADDING: dpro = (dmsn - dnsm)^2, spro = (dmsn + dnsm)^2 // DOUBLING: s = (xt + zt)^2, normalized only to 4 digits sub_twice4(dpro,dmsn,dnsm) sqr_4(s,s) add_twice4(spro,dmsn,dnsm) sqr_4(dpro,dpro) // DOUBLING: p = 4 * xt * zt = s - d sub_twice4(p,s,d) // ADDING: sumx = (dmsn + dnsm)^2 sqr_p25519(sumx,spro) // DOUBLING: e = 121666 * p + d mov x1, 0xdb42 orr x1, x1, 0x10000 cmadd_4(e,p,d) // DOUBLING: dubx = (xt + zt)^2 * (xt - zt)^2 = s * d mul_p25519(dubx,s,d) // ADDING: sumz = x * (dmsn - dnsm)^2 mul_p25519(sumz,dpro,x) // DOUBLING: dubz = (4 * xt * zt) * ((xt - zt)^2 + 121666 * (4 * xt * zt)) // = p * (d + 121666 * p) mul_p25519(dubz,p,e) // Multiplex the outputs cmp b, xzr muxpair_4(res0,res2,dubx,sumx) muxpair_4(res1,res3,dubz,sumz) // Restore stack and registers CFI_INC_SP(NSPACE) CFI_POP2(x20,x21) CFI_POP2(x19,x30) CFI_RET S2N_BN_SIZE_DIRECTIVE(curve25519_ladderstep) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack, "", %progbits #endif
wlsfx/bnbb
5,382
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/bignum_mod_n25519.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Reduce modulo basepoint order, z := x mod n_25519 // Input x[k]; output z[4] // // extern void bignum_mod_n25519(uint64_t z[static 4], uint64_t k, // const uint64_t *x); // // Reduction is modulo the order of the curve25519/edwards25519 basepoint, // which is n_25519 = 2^252 + 27742317777372353535851937790883648493 // // Standard ARM ABI: X0 = z, X1 = k, X2 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mod_n25519) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mod_n25519) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mod_n25519) .text .balign 4 #define z x0 #define k x1 #define x x2 #define m0 x3 #define m1 x4 #define m2 x5 #define m3 x6 #define t0 x7 #define t1 x8 #define t2 x9 #define t3 x10 #define n0 x11 #define n1 x12 // These two are aliased: we only load d when finished with q #define q x13 #define d x13 // Loading large constants #define movbig(nn,n3,n2,n1,n0) \ movz nn, n0 __LF \ movk nn, n1, lsl #16 __LF \ movk nn, n2, lsl #32 __LF \ movk nn, n3, lsl #48 S2N_BN_SYMBOL(bignum_mod_n25519): CFI_START // If the input is already <= 3 words long, go to a trivial "copy" path cmp k, #4 bcc Lbignum_mod_n25519_short // Otherwise load the top 4 digits (top-down) and reduce k by 4 // This [m3;m2;m1;m0] is the initial x where we begin reduction. sub k, k, #4 lsl t0, k, #3 add t0, t0, x ldp m2, m3, [t0, #16] ldp m0, m1, [t0] // Load the complicated two words of n_25519 = 2^252 + [n1; n0] movbig( n0, #0x5812, #0x631a, #0x5cf5, #0xd3ed) movbig( n1, #0x14de, #0xf9de, #0xa2f7, #0x9cd6) // Get the quotient estimate q = floor(x/2^252). // Also delete it from m3, in effect doing x' = x - q * 2^252 lsr q, m3, #60 and m3, m3, #0x0FFFFFFFFFFFFFFF // Multiply [t2;t1;t0] = q * [n1;n0] mul t0, n0, q mul t1, n1, q umulh t2, n0, q adds t1, t1, t2 umulh t2, n1, q adc t2, t2, xzr // Subtract [m3;m2;m1;m0] = x' - q * [n1;n0] = x - q * n_25519 subs m0, m0, t0 sbcs m1, m1, t1 sbcs m2, m2, t2 sbcs m3, m3, xzr // If this borrows (CF = 0 because of inversion), add back n_25519. // The masked n3 digit exploits the fact that bit 60 of n0 is set. csel t0, n0, xzr, cc csel t1, n1, xzr, cc adds m0, m0, t0 adcs m1, m1, t1 and t0, t0, #0x1000000000000000 adcs m2, m2, xzr adc m3, m3, t0 // Now do (k-4) iterations of 5->4 word modular reduction. Each one // is similar to the sequence above except for the more refined quotient // estimation process. cbz k, Lbignum_mod_n25519_writeback Lbignum_mod_n25519_loop: // Assume that the new 5-digit x is 2^64 * previous_x + next_digit. // Get the quotient estimate q = max (floor(x/2^252)) (2^64 - 1) // and first compute x' = x - 2^252 * q. extr q, m3, m2, #60 and m2, m2, #0x0FFFFFFFFFFFFFFF sub q, q, m3, lsr #60 and m3, m3, #0xF000000000000000 add m2, m2, m3 // Multiply [t2;t1;t0] = q * [n1;n0] mul t0, n0, q mul t1, n1, q umulh t2, n0, q adds t1, t1, t2 umulh t2, n1, q adc t2, t2, xzr // Decrement k and load the next digit (note that d aliases to q) sub k, k, #1 ldr d, [x, k, lsl #3] // Subtract [t3;t2;t1;t0] = x' - q * [n1;n0] = x - q * n_25519 subs t0, d, t0 sbcs t1, m0, t1 sbcs t2, m1, t2 sbcs t3, m2, xzr // If this borrows (CF = 0 because of inversion), add back n_25519. // The masked n3 digit exploits the fact that bit 60 of n1 is set. csel m0, n0, xzr, cc csel m1, n1, xzr, cc adds m0, t0, m0 and m3, m1, #0x1000000000000000 adcs m1, t1, m1 adcs m2, t2, xzr adc m3, t3, m3 cbnz k, Lbignum_mod_n25519_loop // Finally write back [m3;m2;m1;m0] and return Lbignum_mod_n25519_writeback: stp m0, m1, [z] stp m2, m3, [z, #16] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mod_n25519) // Short case: just copy the input with zero-padding Lbignum_mod_n25519_short: mov m0, xzr mov m1, xzr mov m2, xzr mov m3, xzr cbz k, Lbignum_mod_n25519_writeback ldr m0, [x] subs k, k, #1 beq Lbignum_mod_n25519_writeback ldr m1, [x, #8] subs k, k, #1 beq Lbignum_mod_n25519_writeback ldr m2, [x, #16] b Lbignum_mod_n25519_writeback #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
288,557
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_scalarmulbase_alt.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Scalar multiplication for the edwards25519 standard basepoint // Input scalar[4]; output res[8] // // extern void edwards25519_scalarmulbase_alt // (uint64_t res[static 8],const uint64_t scalar[static 4]); // // Given a scalar n, returns point (X,Y) = n * B where B = (...,4/5) is // the standard basepoint for the edwards25519 (Ed25519) curve. // // Standard ARM ABI: X0 = res, X1 = scalar // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(edwards25519_scalarmulbase_alt) S2N_BN_FUNCTION_TYPE_DIRECTIVE(edwards25519_scalarmulbase_alt) S2N_BN_SYM_PRIVACY_DIRECTIVE(edwards25519_scalarmulbase_alt) .text .balign 4 // Size of individual field elements #define NUMSIZE 32 // Stable home for the input result argument during the whole body #define res x23 // Other variables that are only needed prior to the modular inverse. #define tab x19 #define i x20 #define bias x21 #define bf x22 #define ix x22 // Pointer-offset pairs for result and temporaries on stack with some aliasing. #define resx res, #(0*NUMSIZE) #define resy res, #(1*NUMSIZE) #define scalar sp, #(0*NUMSIZE) #define tabent sp, #(1*NUMSIZE) #define ymx_2 sp, #(1*NUMSIZE) #define xpy_2 sp, #(2*NUMSIZE) #define kxy_2 sp, #(3*NUMSIZE) #define acc sp, #(4*NUMSIZE) #define x_1 sp, #(4*NUMSIZE) #define y_1 sp, #(5*NUMSIZE) #define z_1 sp, #(6*NUMSIZE) #define w_1 sp, #(7*NUMSIZE) #define x_3 sp, #(4*NUMSIZE) #define y_3 sp, #(5*NUMSIZE) #define z_3 sp, #(6*NUMSIZE) #define w_3 sp, #(7*NUMSIZE) #define tmpspace sp, #(8*NUMSIZE) #define t0 sp, #(8*NUMSIZE) #define t1 sp, #(9*NUMSIZE) #define t2 sp, #(10*NUMSIZE) #define t3 sp, #(11*NUMSIZE) #define t4 sp, #(12*NUMSIZE) #define t5 sp, #(13*NUMSIZE) // Total size to reserve on the stack #define NSPACE 14*NUMSIZE // Load 64-bit immediate into a register #define movbig(nn,n3,n2,n1,n0) \ movz nn, n0 __LF \ movk nn, n1, lsl #16 __LF \ movk nn, n2, lsl #32 __LF \ movk nn, n3, lsl #48 // Macro wrapping up the basic field operation bignum_mul_p25519_alt, only // trivially different from a pure function call to that subroutine. #define mul_p25519(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x7, x8, [P2] __LF \ mul x12, x3, x7 __LF \ umulh x13, x3, x7 __LF \ mul x11, x3, x8 __LF \ umulh x14, x3, x8 __LF \ adds x13, x13, x11 __LF \ ldp x9, x10, [P2+16] __LF \ mul x11, x3, x9 __LF \ umulh x15, x3, x9 __LF \ adcs x14, x14, x11 __LF \ mul x11, x3, x10 __LF \ umulh x16, x3, x10 __LF \ adcs x15, x15, x11 __LF \ adc x16, x16, xzr __LF \ ldp x5, x6, [P1+16] __LF \ mul x11, x4, x7 __LF \ adds x13, x13, x11 __LF \ mul x11, x4, x8 __LF \ adcs x14, x14, x11 __LF \ mul x11, x4, x9 __LF \ adcs x15, x15, x11 __LF \ mul x11, x4, x10 __LF \ adcs x16, x16, x11 __LF \ umulh x3, x4, x10 __LF \ adc x3, x3, xzr __LF \ umulh x11, x4, x7 __LF \ adds x14, x14, x11 __LF \ umulh x11, x4, x8 __LF \ adcs x15, x15, x11 __LF \ umulh x11, x4, x9 __LF \ adcs x16, x16, x11 __LF \ adc x3, x3, xzr __LF \ mul x11, x5, x7 __LF \ adds x14, x14, x11 __LF \ mul x11, x5, x8 __LF \ adcs x15, x15, x11 __LF \ mul x11, x5, x9 __LF \ adcs x16, x16, x11 __LF \ mul x11, x5, x10 __LF \ adcs x3, x3, x11 __LF \ umulh x4, x5, x10 __LF \ adc x4, x4, xzr __LF \ umulh x11, x5, x7 __LF \ adds x15, x15, x11 __LF \ umulh x11, x5, x8 __LF \ adcs x16, x16, x11 __LF \ umulh x11, x5, x9 __LF \ adcs x3, x3, x11 __LF \ adc x4, x4, xzr __LF \ mul x11, x6, x7 __LF \ adds x15, x15, x11 __LF \ mul x11, x6, x8 __LF \ adcs x16, x16, x11 __LF \ mul x11, x6, x9 __LF \ adcs x3, x3, x11 __LF \ mul x11, x6, x10 __LF \ adcs x4, x4, x11 __LF \ umulh x5, x6, x10 __LF \ adc x5, x5, xzr __LF \ umulh x11, x6, x7 __LF \ adds x16, x16, x11 __LF \ umulh x11, x6, x8 __LF \ adcs x3, x3, x11 __LF \ umulh x11, x6, x9 __LF \ adcs x4, x4, x11 __LF \ adc x5, x5, xzr __LF \ mov x7, #0x26 __LF \ mul x11, x7, x16 __LF \ umulh x9, x7, x16 __LF \ adds x12, x12, x11 __LF \ mul x11, x7, x3 __LF \ umulh x3, x7, x3 __LF \ adcs x13, x13, x11 __LF \ mul x11, x7, x4 __LF \ umulh x4, x7, x4 __LF \ adcs x14, x14, x11 __LF \ mul x11, x7, x5 __LF \ umulh x5, x7, x5 __LF \ adcs x15, x15, x11 __LF \ cset x16, cs __LF \ adds x15, x15, x4 __LF \ adc x16, x16, x5 __LF \ cmn x15, x15 __LF \ orr x15, x15, #0x8000000000000000 __LF \ adc x8, x16, x16 __LF \ mov x7, #0x13 __LF \ madd x11, x7, x8, x7 __LF \ adds x12, x12, x11 __LF \ adcs x13, x13, x9 __LF \ adcs x14, x14, x3 __LF \ adcs x15, x15, xzr __LF \ csel x7, x7, xzr, cc __LF \ subs x12, x12, x7 __LF \ sbcs x13, x13, xzr __LF \ sbcs x14, x14, xzr __LF \ sbc x15, x15, xzr __LF \ and x15, x15, #0x7fffffffffffffff __LF \ stp x12, x13, [P0] __LF \ stp x14, x15, [P0+16] // A version of multiplication that only guarantees output < 2 * p_25519. // This basically skips the +1 and final correction in quotient estimation. #define mul_4(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x7, x8, [P2] __LF \ mul x12, x3, x7 __LF \ umulh x13, x3, x7 __LF \ mul x11, x3, x8 __LF \ umulh x14, x3, x8 __LF \ adds x13, x13, x11 __LF \ ldp x9, x10, [P2+16] __LF \ mul x11, x3, x9 __LF \ umulh x15, x3, x9 __LF \ adcs x14, x14, x11 __LF \ mul x11, x3, x10 __LF \ umulh x16, x3, x10 __LF \ adcs x15, x15, x11 __LF \ adc x16, x16, xzr __LF \ ldp x5, x6, [P1+16] __LF \ mul x11, x4, x7 __LF \ adds x13, x13, x11 __LF \ mul x11, x4, x8 __LF \ adcs x14, x14, x11 __LF \ mul x11, x4, x9 __LF \ adcs x15, x15, x11 __LF \ mul x11, x4, x10 __LF \ adcs x16, x16, x11 __LF \ umulh x3, x4, x10 __LF \ adc x3, x3, xzr __LF \ umulh x11, x4, x7 __LF \ adds x14, x14, x11 __LF \ umulh x11, x4, x8 __LF \ adcs x15, x15, x11 __LF \ umulh x11, x4, x9 __LF \ adcs x16, x16, x11 __LF \ adc x3, x3, xzr __LF \ mul x11, x5, x7 __LF \ adds x14, x14, x11 __LF \ mul x11, x5, x8 __LF \ adcs x15, x15, x11 __LF \ mul x11, x5, x9 __LF \ adcs x16, x16, x11 __LF \ mul x11, x5, x10 __LF \ adcs x3, x3, x11 __LF \ umulh x4, x5, x10 __LF \ adc x4, x4, xzr __LF \ umulh x11, x5, x7 __LF \ adds x15, x15, x11 __LF \ umulh x11, x5, x8 __LF \ adcs x16, x16, x11 __LF \ umulh x11, x5, x9 __LF \ adcs x3, x3, x11 __LF \ adc x4, x4, xzr __LF \ mul x11, x6, x7 __LF \ adds x15, x15, x11 __LF \ mul x11, x6, x8 __LF \ adcs x16, x16, x11 __LF \ mul x11, x6, x9 __LF \ adcs x3, x3, x11 __LF \ mul x11, x6, x10 __LF \ adcs x4, x4, x11 __LF \ umulh x5, x6, x10 __LF \ adc x5, x5, xzr __LF \ umulh x11, x6, x7 __LF \ adds x16, x16, x11 __LF \ umulh x11, x6, x8 __LF \ adcs x3, x3, x11 __LF \ umulh x11, x6, x9 __LF \ adcs x4, x4, x11 __LF \ adc x5, x5, xzr __LF \ mov x7, #0x26 __LF \ mul x11, x7, x16 __LF \ umulh x9, x7, x16 __LF \ adds x12, x12, x11 __LF \ mul x11, x7, x3 __LF \ umulh x3, x7, x3 __LF \ adcs x13, x13, x11 __LF \ mul x11, x7, x4 __LF \ umulh x4, x7, x4 __LF \ adcs x14, x14, x11 __LF \ mul x11, x7, x5 __LF \ umulh x5, x7, x5 __LF \ adcs x15, x15, x11 __LF \ cset x16, cs __LF \ adds x15, x15, x4 __LF \ adc x16, x16, x5 __LF \ cmn x15, x15 __LF \ bic x15, x15, #0x8000000000000000 __LF \ adc x8, x16, x16 __LF \ mov x7, #0x13 __LF \ mul x11, x7, x8 __LF \ adds x12, x12, x11 __LF \ adcs x13, x13, x9 __LF \ adcs x14, x14, x3 __LF \ adc x15, x15, xzr __LF \ stp x12, x13, [P0] __LF \ stp x14, x15, [P0+16] // Modular subtraction with double modulus 2 * p_25519 = 2^256 - 38 #define sub_twice4(P0,P1,P2) \ ldp x5, x6, [P1] __LF \ ldp x4, x3, [P2] __LF \ subs x5, x5, x4 __LF \ sbcs x6, x6, x3 __LF \ ldp x7, x8, [P1+16] __LF \ ldp x4, x3, [P2+16] __LF \ sbcs x7, x7, x4 __LF \ sbcs x8, x8, x3 __LF \ mov x4, #38 __LF \ csel x3, x4, xzr, lo __LF \ subs x5, x5, x3 __LF \ sbcs x6, x6, xzr __LF \ sbcs x7, x7, xzr __LF \ sbc x8, x8, xzr __LF \ stp x5, x6, [P0] __LF \ stp x7, x8, [P0+16] // Modular addition and doubling with double modulus 2 * p_25519 = 2^256 - 38. // This only ensures that the result fits in 4 digits, not that it is reduced // even w.r.t. double modulus. The result is always correct modulo provided // the sum of the inputs is < 2^256 + 2^256 - 38, so in particular provided // at least one of them is reduced double modulo. #define add_twice4(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x7, x8, [P2] __LF \ adds x3, x3, x7 __LF \ adcs x4, x4, x8 __LF \ ldp x5, x6, [P1+16] __LF \ ldp x7, x8, [P2+16] __LF \ adcs x5, x5, x7 __LF \ adcs x6, x6, x8 __LF \ mov x9, #38 __LF \ csel x9, x9, xzr, cs __LF \ adds x3, x3, x9 __LF \ adcs x4, x4, xzr __LF \ adcs x5, x5, xzr __LF \ adc x6, x6, xzr __LF \ stp x3, x4, [P0] __LF \ stp x5, x6, [P0+16] #define double_twice4(P0,P1) \ ldp x3, x4, [P1] __LF \ adds x3, x3, x3 __LF \ adcs x4, x4, x4 __LF \ ldp x5, x6, [P1+16] __LF \ adcs x5, x5, x5 __LF \ adcs x6, x6, x6 __LF \ mov x9, #38 __LF \ csel x9, x9, xzr, cs __LF \ adds x3, x3, x9 __LF \ adcs x4, x4, xzr __LF \ adcs x5, x5, xzr __LF \ adc x6, x6, xzr __LF \ stp x3, x4, [P0] __LF \ stp x5, x6, [P0+16] S2N_BN_SYMBOL(edwards25519_scalarmulbase_alt): CFI_START // Save regs and make room for temporaries CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x24) CFI_DEC_SP(NSPACE) // Move the output pointer to a stable place mov res, x0 // Copy the input scalar x to its local variable while reducing it // modulo 2^252 + m where m = 27742317777372353535851937790883648493; // this is the order of the basepoint so this doesn't change the result. // First do q = floor(x/2^252) and x' = x - q * (2^252 + m), which gives // an initial result -15 * m <= x' < 2^252 ldp x10, x11, [x1] ldp x12, x13, [x1, #16] lsr x9, x13, #60 movbig(x0,#0x5812,#0x631a,#0x5cf5,#0xd3ed); movbig(x1,#0x14de,#0xf9de,#0xa2f7,#0x9cd6); mul x2, x9, x0 mul x3, x9, x1 umulh x4, x9, x0 umulh x5, x9, x1 adds x3, x3, x4 adc x4, x5, xzr lsl x5, x9, #60 subs x10, x10, x2 sbcs x11, x11, x3 sbcs x12, x12, x4 sbcs x13, x13, x5 // If x' < 0 then just directly negate it; this makes sure the // reduced argument is strictly 0 <= x' < 2^252, but now we need // to record (done via bit 255 of the reduced scalar, which is // ignored in the main loop) when we negated so we can flip // the sign of the eventual point to compensate. csetm x9, cc adds xzr, x9, x9 eor x10, x10, x9 adcs x10, x10, xzr eor x11, x11, x9 adcs x11, x11, xzr eor x12, x12, x9 adcs x12, x12, xzr eor x13, x13, x9 adc x13, x13, xzr and x9, x9, #0x8000000000000000 orr x13, x13, x9 // And before we store the scalar, test and reset bit 251 to // initialize the main loop just below. stp x10, x11, [scalar] tst x13, #0x0800000000000000 bic x13, x13, #0x0800000000000000 stp x12, x13, [scalar+16] // The main part of the computation is in extended-projective coordinates // (X,Y,Z,T), representing an affine point on the edwards25519 curve // (x,y) via x = X/Z, y = Y/Z and x * y = T/Z (so X * Y = T * Z). // In comments B means the standard basepoint (x,4/5) = // (0x216....f25d51a,0x6666..666658). // // Initialize accumulator "acc" to either 0 or 2^251 * B depending on // bit 251 of the (reduced) scalar. That leaves bits 0..250 to handle. #if defined(__ELF__) adrp tab, S2N_BN_SYMBOL(edwards25519_scalarmulbase_alt_constant) add tab, tab, :lo12:S2N_BN_SYMBOL(edwards25519_scalarmulbase_alt_constant) #else adrp tab, S2N_BN_SYMBOL(edwards25519_scalarmulbase_alt_constant)@PAGE add tab, tab, S2N_BN_SYMBOL(edwards25519_scalarmulbase_alt_constant)@PAGEOFF #endif ldp x0, x1, [tab] ldp x2, x3, [tab, #96] csel x0, x0, x2, eq csel x1, x1, x3, eq stp x0, x1, [acc] ldp x0, x1, [tab, #1*16] ldp x2, x3, [tab, #(96+1*16)] csel x0, x0, x2, eq csel x1, x1, x3, eq stp x0, x1, [acc+1*16] ldp x0, x1, [tab, #2*16] ldp x2, x3, [tab, #(96+2*16)] csel x0, x0, x2, eq csel x1, x1, x3, eq stp x0, x1, [acc+2*16] ldp x0, x1, [tab, #3*16] ldp x2, x3, [tab, #(96+3*16)] csel x0, x0, x2, eq csel x1, x1, x3, eq stp x0, x1, [acc+3*16] mov x0, #1 stp x0, xzr, [acc+4*16] stp xzr, xzr, [acc+5*16] ldp x0, x1, [tab, #4*16] ldp x2, x3, [tab, #(96+4*16)] csel x0, x0, x2, eq csel x1, x1, x3, eq stp x0, x1, [acc+6*16] ldp x0, x1, [tab, #5*16] ldp x2, x3, [tab, #(96+5*16)] csel x0, x0, x2, eq csel x1, x1, x3, eq stp x0, x1, [acc+7*16] // The counter "i" tracks the bit position for which the scalar has // already been absorbed, starting at 0 and going up in chunks of 4. // // The pointer "tab" points at the current block of the table for // multiples (2^i * j) * B at the current bit position i; 1 <= j <= 8. // // The bias is always either 0 and 1 and needs to be added to the // partially processed scalar implicitly. This is used to absorb 4 bits // of scalar per iteration from 3-bit table indexing by exploiting // negation: (16 * h + l) * B = (16 * (h + 1) - (16 - l)) * B is used // when l >= 9. Note that we can't have any bias left over at the // end because we made sure bit 251 is clear in the reduced scalar. mov i, 0 add tab, tab, #192 mov bias, xzr // Start of the main loop, repeated 63 times for i = 0, 4, 8, ..., 248 Ledwards25519_scalarmulbase_alt_scalarloop: // Look at the next 4-bit field "bf", adding the previous bias as well. // Choose the table index "ix" as bf when bf <= 8 and 16 - bf for bf >= 9, // setting the bias to 1 for the next iteration in the latter case. lsr x0, i, #6 ldr x2, [sp, x0, lsl #3] // Exploiting scalar = sp exactly lsr x2, x2, i and x2, x2, #15 add bf, x2, bias cmp bf, 9 cset bias, cs mov x0, 16 sub x0, x0, bf cmp bias, xzr csel ix, x0, bf, ne // Perform constant-time lookup in the table to get element number "ix". // The table entry for the affine point (x,y) is actually a triple // (y - x,x + y,2 * d * x * y) to precompute parts of the addition. // Note that "ix" can be 0, so we set up the appropriate identity first. mov x0, #1 mov x1, xzr mov x2, xzr mov x3, xzr mov x4, #1 mov x5, xzr mov x6, xzr mov x7, xzr mov x8, xzr mov x9, xzr mov x10, xzr mov x11, xzr cmp ix, #1 ldp x12, x13, [tab] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [tab, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [tab, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [tab, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [tab, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [tab, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add tab, tab, #96 cmp ix, #2 ldp x12, x13, [tab] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [tab, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [tab, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [tab, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [tab, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [tab, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add tab, tab, #96 cmp ix, #3 ldp x12, x13, [tab] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [tab, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [tab, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [tab, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [tab, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [tab, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add tab, tab, #96 cmp ix, #4 ldp x12, x13, [tab] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [tab, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [tab, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [tab, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [tab, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [tab, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add tab, tab, #96 cmp ix, #5 ldp x12, x13, [tab] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [tab, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [tab, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [tab, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [tab, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [tab, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add tab, tab, #96 cmp ix, #6 ldp x12, x13, [tab] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [tab, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [tab, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [tab, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [tab, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [tab, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add tab, tab, #96 cmp ix, #7 ldp x12, x13, [tab] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [tab, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [tab, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [tab, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [tab, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [tab, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add tab, tab, #96 cmp ix, #8 ldp x12, x13, [tab] csel x0, x0, x12, ne csel x1, x1, x13, ne ldp x12, x13, [tab, #16] csel x2, x2, x12, ne csel x3, x3, x13, ne ldp x12, x13, [tab, #32] csel x4, x4, x12, ne csel x5, x5, x13, ne ldp x12, x13, [tab, #48] csel x6, x6, x12, ne csel x7, x7, x13, ne ldp x12, x13, [tab, #64] csel x8, x8, x12, ne csel x9, x9, x13, ne ldp x12, x13, [tab, #80] csel x10, x10, x12, ne csel x11, x11, x13, ne add tab, tab, #96 // We now have the triple from the table in registers as follows // // [x3;x2;x1;x0] = y - x // [x7;x6;x5;x4] = x + y // [x11;x10;x9;x8] = 2 * d * x * y // // In case bias = 1 we need to negate this. For Edwards curves // -(x,y) = (-x,y), i.e. we need to negate the x coordinate. // In this processed encoding, that amounts to swapping the // first two fields and negating the third. // // The optional negation here also pretends bias = 0 whenever // ix = 0 so that it doesn't need to handle the case of zero // inputs, since no non-trivial table entries are zero. Note // that in the zero case the whole negation is trivial, and // so indeed is the swapping. cmp bias, #0 csel x12, x0, x4, eq csel x13, x1, x5, eq csel x14, x2, x6, eq csel x15, x3, x7, eq stp x12, x13, [tabent] stp x14, x15, [tabent+16] csel x12, x0, x4, ne csel x13, x1, x5, ne csel x14, x2, x6, ne csel x15, x3, x7, ne stp x12, x13, [tabent+32] stp x14, x15, [tabent+48] mov x0, #-19 subs x0, x0, x8 mov x2, #-1 sbcs x1, x2, x9 sbcs x2, x2, x10 mov x3, #0x7FFFFFFFFFFFFFFF sbc x3, x3, x11 cmp ix, xzr ccmp bias, xzr, #4, ne csel x0, x0, x8, ne csel x1, x1, x9, ne stp x0, x1, [tabent+64] csel x2, x2, x10, ne csel x3, x3, x11, ne stp x2, x3, [tabent+80] // Extended-projective and precomputed mixed addition. // This is effectively the same as calling the standalone // function edwards25519_pepadd_alt(acc,acc,tabent), but we // only retain slightly weaker normalization < 2 * p_25519 // throughout the inner loop, so the computation is // slightly different, and faster overall. double_twice4(t0,z_1) sub_twice4(t1,y_1,x_1) add_twice4(t2,y_1,x_1) mul_4(t3,w_1,kxy_2) mul_4(t1,t1,ymx_2) mul_4(t2,t2,xpy_2) sub_twice4(t4,t0,t3) add_twice4(t0,t0,t3) sub_twice4(t5,t2,t1) add_twice4(t1,t2,t1) mul_4(z_3,t4,t0) mul_4(x_3,t5,t4) mul_4(y_3,t0,t1) mul_4(w_3,t5,t1) // End of the main loop; move on by 4 bits. add i, i, 4 cmp i, 252 bcc Ledwards25519_scalarmulbase_alt_scalarloop // Insert the optional negation of the projective X coordinate, and // so by extension the final affine x coordinate x = X/Z and thus // the point P = (x,y). We only know X < 2 * p_25519, so we do the // negation as 2 * p_25519 - X to keep it nonnegative. From this // point on we don't need any normalization of the coordinates // except for making sure that they fit in 4 digits. ldp x0, x1, [x_3] ldp x2, x3, [x_3+16] mov x4, #0xffffffffffffffda subs x4, x4, x0 mov x7, #0xffffffffffffffff sbcs x5, x7, x1 sbcs x6, x7, x2 sbc x7, x7, x3 ldr x10, [scalar+24] tst x10, #0x8000000000000000 csel x0, x4, x0, ne csel x1, x5, x1, ne csel x2, x6, x2, ne csel x3, x7, x3, ne stp x0, x1, [x_3] stp x2, x3, [x_3+16] // Now we need to map out of the extended-projective representation // (X,Y,Z,W) back to the affine form (x,y) = (X/Z,Y/Z). This means // first calling the modular inverse to get w_3 = 1/z_3. add x0, w_3 add x1, z_3 // Inline copy of bignum_inv_p25519, identical except for stripping out // the prologue and epilogue saving and restoring registers and making // and reclaiming room on the stack. For more details and explanations see // "arm/curve25519/bignum_inv_p25519.S". Note that the stack it uses for // its own temporaries is 128 bytes, so it has no effect on variables // that are needed in the rest of our computation here: res, w_3, x_3 // and y_3. mov x20, x0 mov x10, #0xffffffffffffffed mov x11, #0xffffffffffffffff stp x10, x11, [sp] mov x12, #0x7fffffffffffffff stp x11, x12, [sp, #16] ldp x2, x3, [x1] ldp x4, x5, [x1, #16] mov x7, #0x13 lsr x6, x5, #63 madd x6, x7, x6, x7 adds x2, x2, x6 adcs x3, x3, xzr adcs x4, x4, xzr orr x5, x5, #0x8000000000000000 adcs x5, x5, xzr csel x6, x7, xzr, cc subs x2, x2, x6 sbcs x3, x3, xzr sbcs x4, x4, xzr sbc x5, x5, xzr and x5, x5, #0x7fffffffffffffff stp x2, x3, [sp, #32] stp x4, x5, [sp, #48] stp xzr, xzr, [sp, #64] stp xzr, xzr, [sp, #80] mov x10, #0x2099 movk x10, #0x7502, lsl #16 movk x10, #0x9e23, lsl #32 movk x10, #0xa0f9, lsl #48 mov x11, #0x2595 movk x11, #0x1d13, lsl #16 movk x11, #0x8f3f, lsl #32 movk x11, #0xa8c6, lsl #48 mov x12, #0x5242 movk x12, #0x5ac, lsl #16 movk x12, #0x8938, lsl #32 movk x12, #0x6c6c, lsl #48 mov x13, #0x615 movk x13, #0x4177, lsl #16 movk x13, #0x8b2, lsl #32 movk x13, #0x2765, lsl #48 stp x10, x11, [sp, #96] stp x12, x13, [sp, #112] mov x21, #0xa mov x22, #0x1 b Ledwards25519_scalarmulbase_alt_invmidloop Ledwards25519_scalarmulbase_alt_invloop: cmp x10, xzr csetm x14, mi cneg x10, x10, mi cmp x11, xzr csetm x15, mi cneg x11, x11, mi cmp x12, xzr csetm x16, mi cneg x12, x12, mi cmp x13, xzr csetm x17, mi cneg x13, x13, mi and x0, x10, x14 and x1, x11, x15 add x9, x0, x1 and x0, x12, x16 and x1, x13, x17 add x19, x0, x1 ldr x7, [sp] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x4, x9, x0 adc x2, xzr, x1 ldr x8, [sp, #32] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x4, x4, x0 adc x2, x2, x1 eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x5, x19, x0 adc x3, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x5, x5, x0 adc x3, x3, x1 ldr x7, [sp, #8] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x2, x2, x0 adc x6, xzr, x1 ldr x8, [sp, #40] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x2, x2, x0 adc x6, x6, x1 extr x4, x2, x4, #59 str x4, [sp] eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x3, x3, x0 adc x4, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x3, x3, x0 adc x4, x4, x1 extr x5, x3, x5, #59 str x5, [sp, #32] ldr x7, [sp, #16] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x6, x6, x0 adc x5, xzr, x1 ldr x8, [sp, #48] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x6, x6, x0 adc x5, x5, x1 extr x2, x6, x2, #59 str x2, [sp, #8] eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x4, x4, x0 adc x2, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x4, x4, x0 adc x2, x2, x1 extr x3, x4, x3, #59 str x3, [sp, #40] ldr x7, [sp, #24] eor x1, x7, x14 asr x3, x1, #63 and x3, x3, x10 neg x3, x3 mul x0, x1, x10 umulh x1, x1, x10 adds x5, x5, x0 adc x3, x3, x1 ldr x8, [sp, #56] eor x1, x8, x15 asr x0, x1, #63 and x0, x0, x11 sub x3, x3, x0 mul x0, x1, x11 umulh x1, x1, x11 adds x5, x5, x0 adc x3, x3, x1 extr x6, x5, x6, #59 str x6, [sp, #16] extr x5, x3, x5, #59 str x5, [sp, #24] eor x1, x7, x16 asr x5, x1, #63 and x5, x5, x12 neg x5, x5 mul x0, x1, x12 umulh x1, x1, x12 adds x2, x2, x0 adc x5, x5, x1 eor x1, x8, x17 asr x0, x1, #63 and x0, x0, x13 sub x5, x5, x0 mul x0, x1, x13 umulh x1, x1, x13 adds x2, x2, x0 adc x5, x5, x1 extr x4, x2, x4, #59 str x4, [sp, #48] extr x2, x5, x2, #59 str x2, [sp, #56] ldr x7, [sp, #64] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x4, x9, x0 adc x2, xzr, x1 ldr x8, [sp, #96] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x4, x4, x0 str x4, [sp, #64] adc x2, x2, x1 eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x5, x19, x0 adc x3, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x5, x5, x0 str x5, [sp, #96] adc x3, x3, x1 ldr x7, [sp, #72] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x2, x2, x0 adc x6, xzr, x1 ldr x8, [sp, #104] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x2, x2, x0 str x2, [sp, #72] adc x6, x6, x1 eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x3, x3, x0 adc x4, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x3, x3, x0 str x3, [sp, #104] adc x4, x4, x1 ldr x7, [sp, #80] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x6, x6, x0 adc x5, xzr, x1 ldr x8, [sp, #112] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x6, x6, x0 str x6, [sp, #80] adc x5, x5, x1 eor x1, x7, x16 mul x0, x1, x12 umulh x1, x1, x12 adds x4, x4, x0 adc x2, xzr, x1 eor x1, x8, x17 mul x0, x1, x13 umulh x1, x1, x13 adds x4, x4, x0 str x4, [sp, #112] adc x2, x2, x1 ldr x7, [sp, #88] eor x1, x7, x14 and x3, x14, x10 neg x3, x3 mul x0, x1, x10 umulh x1, x1, x10 adds x5, x5, x0 adc x3, x3, x1 ldr x8, [sp, #120] eor x1, x8, x15 and x0, x15, x11 sub x3, x3, x0 mul x0, x1, x11 umulh x1, x1, x11 adds x5, x5, x0 adc x3, x3, x1 extr x6, x3, x5, #63 ldp x0, x1, [sp, #64] add x6, x6, x3, asr #63 mov x3, #0x13 mul x4, x6, x3 add x5, x5, x6, lsl #63 smulh x3, x6, x3 ldr x6, [sp, #80] adds x0, x0, x4 adcs x1, x1, x3 asr x3, x3, #63 adcs x6, x6, x3 adc x5, x5, x3 stp x0, x1, [sp, #64] stp x6, x5, [sp, #80] eor x1, x7, x16 and x5, x16, x12 neg x5, x5 mul x0, x1, x12 umulh x1, x1, x12 adds x2, x2, x0 adc x5, x5, x1 eor x1, x8, x17 and x0, x17, x13 sub x5, x5, x0 mul x0, x1, x13 umulh x1, x1, x13 adds x2, x2, x0 adc x5, x5, x1 extr x6, x5, x2, #63 ldp x0, x1, [sp, #96] add x6, x6, x5, asr #63 mov x5, #0x13 mul x4, x6, x5 add x2, x2, x6, lsl #63 smulh x5, x6, x5 ldr x3, [sp, #112] adds x0, x0, x4 adcs x1, x1, x5 asr x5, x5, #63 adcs x3, x3, x5 adc x2, x2, x5 stp x0, x1, [sp, #96] stp x3, x2, [sp, #112] Ledwards25519_scalarmulbase_alt_invmidloop: mov x1, x22 ldr x2, [sp] ldr x3, [sp, #32] and x4, x2, #0xfffff orr x4, x4, #0xfffffe0000000000 and x5, x3, #0xfffff orr x5, x5, #0xc000000000000000 tst x5, #0x1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 asr x5, x5, #1 add x8, x4, #0x100, lsl #12 sbfx x8, x8, #21, #21 mov x11, #0x100000 add x11, x11, x11, lsl #21 add x9, x4, x11 asr x9, x9, #42 add x10, x5, #0x100, lsl #12 sbfx x10, x10, #21, #21 add x11, x5, x11 asr x11, x11, #42 mul x6, x8, x2 mul x7, x9, x3 mul x2, x10, x2 mul x3, x11, x3 add x4, x6, x7 add x5, x2, x3 asr x2, x4, #20 asr x3, x5, #20 and x4, x2, #0xfffff orr x4, x4, #0xfffffe0000000000 and x5, x3, #0xfffff orr x5, x5, #0xc000000000000000 tst x5, #0x1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 asr x5, x5, #1 add x12, x4, #0x100, lsl #12 sbfx x12, x12, #21, #21 mov x15, #0x100000 add x15, x15, x15, lsl #21 add x13, x4, x15 asr x13, x13, #42 add x14, x5, #0x100, lsl #12 sbfx x14, x14, #21, #21 add x15, x5, x15 asr x15, x15, #42 mul x6, x12, x2 mul x7, x13, x3 mul x2, x14, x2 mul x3, x15, x3 add x4, x6, x7 add x5, x2, x3 asr x2, x4, #20 asr x3, x5, #20 and x4, x2, #0xfffff orr x4, x4, #0xfffffe0000000000 and x5, x3, #0xfffff orr x5, x5, #0xc000000000000000 tst x5, #0x1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 mul x2, x12, x8 mul x3, x12, x9 mul x6, x14, x8 mul x7, x14, x9 madd x8, x13, x10, x2 madd x9, x13, x11, x3 madd x16, x15, x10, x6 madd x17, x15, x11, x7 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 tst x5, #0x2 asr x5, x5, #1 csel x6, x4, xzr, ne ccmp x1, xzr, #0x8, ne cneg x1, x1, ge cneg x6, x6, ge csel x4, x5, x4, ge add x5, x5, x6 add x1, x1, #0x2 asr x5, x5, #1 add x12, x4, #0x100, lsl #12 sbfx x12, x12, #22, #21 mov x15, #0x100000 add x15, x15, x15, lsl #21 add x13, x4, x15 asr x13, x13, #43 add x14, x5, #0x100, lsl #12 sbfx x14, x14, #22, #21 add x15, x5, x15 asr x15, x15, #43 mneg x2, x12, x8 mneg x3, x12, x9 mneg x4, x14, x8 mneg x5, x14, x9 msub x10, x13, x16, x2 msub x11, x13, x17, x3 msub x12, x15, x16, x4 msub x13, x15, x17, x5 mov x22, x1 subs x21, x21, #0x1 b.ne Ledwards25519_scalarmulbase_alt_invloop ldr x0, [sp] ldr x1, [sp, #32] mul x0, x0, x10 madd x1, x1, x11, x0 asr x0, x1, #63 cmp x10, xzr csetm x14, mi cneg x10, x10, mi eor x14, x14, x0 cmp x11, xzr csetm x15, mi cneg x11, x11, mi eor x15, x15, x0 cmp x12, xzr csetm x16, mi cneg x12, x12, mi eor x16, x16, x0 cmp x13, xzr csetm x17, mi cneg x13, x13, mi eor x17, x17, x0 and x0, x10, x14 and x1, x11, x15 add x9, x0, x1 ldr x7, [sp, #64] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x4, x9, x0 adc x2, xzr, x1 ldr x8, [sp, #96] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x4, x4, x0 str x4, [sp, #64] adc x2, x2, x1 ldr x7, [sp, #72] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x2, x2, x0 adc x6, xzr, x1 ldr x8, [sp, #104] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x2, x2, x0 str x2, [sp, #72] adc x6, x6, x1 ldr x7, [sp, #80] eor x1, x7, x14 mul x0, x1, x10 umulh x1, x1, x10 adds x6, x6, x0 adc x5, xzr, x1 ldr x8, [sp, #112] eor x1, x8, x15 mul x0, x1, x11 umulh x1, x1, x11 adds x6, x6, x0 str x6, [sp, #80] adc x5, x5, x1 ldr x7, [sp, #88] eor x1, x7, x14 and x3, x14, x10 neg x3, x3 mul x0, x1, x10 umulh x1, x1, x10 adds x5, x5, x0 adc x3, x3, x1 ldr x8, [sp, #120] eor x1, x8, x15 and x0, x15, x11 sub x3, x3, x0 mul x0, x1, x11 umulh x1, x1, x11 adds x5, x5, x0 adc x3, x3, x1 extr x6, x3, x5, #63 ldp x0, x1, [sp, #64] tst x3, x3 cinc x6, x6, pl mov x3, #0x13 mul x4, x6, x3 add x5, x5, x6, lsl #63 smulh x6, x6, x3 ldr x2, [sp, #80] adds x0, x0, x4 adcs x1, x1, x6 asr x6, x6, #63 adcs x2, x2, x6 adcs x5, x5, x6 csel x3, x3, xzr, mi subs x0, x0, x3 sbcs x1, x1, xzr sbcs x2, x2, xzr sbc x5, x5, xzr and x5, x5, #0x7fffffffffffffff mov x4, x20 stp x0, x1, [x4] stp x2, x5, [x4, #16] // The final result is x = X * inv(Z), y = Y * inv(Z). // These are the only operations in the whole computation that // fully reduce modulo p_25519 since now we want the canonical // answer as output. mul_p25519(resx,x_3,w_3) mul_p25519(resy,y_3,w_3) // Restore stack and registers CFI_INC_SP(NSPACE) CFI_POP2(x23,x24) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(edwards25519_scalarmulbase_alt) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack, "", %progbits #endif // **************************************************************************** // The precomputed data (all read-only). // **************************************************************************** #if defined(__ELF__) .section .rodata .type S2N_BN_SYMBOL(edwards25519_scalarmulbase_alt_constant), %object .size S2N_BN_SYMBOL(edwards25519_scalarmulbase_alt_constant), 48576 #elif defined(__APPLE__) .const_data #endif S2N_BN_SYMBOL(edwards25519_scalarmulbase_alt_constant): // 0 * B = 0 and 2^251 * B in extended-projective coordinates // but with Z = 1 assumed and hence left out, so they are (X,Y,T) only. .quad 0x0000000000000000 .quad 0x0000000000000000 .quad 0x0000000000000000 .quad 0x0000000000000000 .quad 0x0000000000000001 .quad 0x0000000000000000 .quad 0x0000000000000000 .quad 0x0000000000000000 .quad 0x0000000000000000 .quad 0x0000000000000000 .quad 0x0000000000000000 .quad 0x0000000000000000 .quad 0x525f946d7c7220e7 .quad 0x4636b0b2f1e35444 .quad 0x796e9d70e892ae0f .quad 0x03dec05fa937adb1 .quad 0x6d1c271cc6375515 .quad 0x462588c4a4ca4f14 .quad 0x691129fee55afc39 .quad 0x15949f784d8472f5 .quad 0xbd89e510afad0049 .quad 0x4d1f08c073b9860e .quad 0x07716e8b2d00af9d .quad 0x70d685f68f859714 // Precomputed table of multiples of generator for edwards25519 // all in precomputed extended-projective (y-x,x+y,2*d*x*y) triples. // 2^0 * 1 * G .quad 0x9d103905d740913e .quad 0xfd399f05d140beb3 .quad 0xa5c18434688f8a09 .quad 0x44fd2f9298f81267 .quad 0x2fbc93c6f58c3b85 .quad 0xcf932dc6fb8c0e19 .quad 0x270b4898643d42c2 .quad 0x07cf9d3a33d4ba65 .quad 0xabc91205877aaa68 .quad 0x26d9e823ccaac49e .quad 0x5a1b7dcbdd43598c .quad 0x6f117b689f0c65a8 // 2^0 * 2 * G .quad 0x8a99a56042b4d5a8 .quad 0x8f2b810c4e60acf6 .quad 0xe09e236bb16e37aa .quad 0x6bb595a669c92555 .quad 0x9224e7fc933c71d7 .quad 0x9f469d967a0ff5b5 .quad 0x5aa69a65e1d60702 .quad 0x590c063fa87d2e2e .quad 0x43faa8b3a59b7a5f .quad 0x36c16bdd5d9acf78 .quad 0x500fa0840b3d6a31 .quad 0x701af5b13ea50b73 // 2^0 * 3 * G .quad 0x56611fe8a4fcd265 .quad 0x3bd353fde5c1ba7d .quad 0x8131f31a214bd6bd .quad 0x2ab91587555bda62 .quad 0xaf25b0a84cee9730 .quad 0x025a8430e8864b8a .quad 0xc11b50029f016732 .quad 0x7a164e1b9a80f8f4 .quad 0x14ae933f0dd0d889 .quad 0x589423221c35da62 .quad 0xd170e5458cf2db4c .quad 0x5a2826af12b9b4c6 // 2^0 * 4 * G .quad 0x95fe050a056818bf .quad 0x327e89715660faa9 .quad 0xc3e8e3cd06a05073 .quad 0x27933f4c7445a49a .quad 0x287351b98efc099f .quad 0x6765c6f47dfd2538 .quad 0xca348d3dfb0a9265 .quad 0x680e910321e58727 .quad 0x5a13fbe9c476ff09 .quad 0x6e9e39457b5cc172 .quad 0x5ddbdcf9102b4494 .quad 0x7f9d0cbf63553e2b // 2^0 * 5 * G .quad 0x7f9182c3a447d6ba .quad 0xd50014d14b2729b7 .quad 0xe33cf11cb864a087 .quad 0x154a7e73eb1b55f3 .quad 0xa212bc4408a5bb33 .quad 0x8d5048c3c75eed02 .quad 0xdd1beb0c5abfec44 .quad 0x2945ccf146e206eb .quad 0xbcbbdbf1812a8285 .quad 0x270e0807d0bdd1fc .quad 0xb41b670b1bbda72d .quad 0x43aabe696b3bb69a // 2^0 * 6 * G .quad 0x499806b67b7d8ca4 .quad 0x575be28427d22739 .quad 0xbb085ce7204553b9 .quad 0x38b64c41ae417884 .quad 0x3a0ceeeb77157131 .quad 0x9b27158900c8af88 .quad 0x8065b668da59a736 .quad 0x51e57bb6a2cc38bd .quad 0x85ac326702ea4b71 .quad 0xbe70e00341a1bb01 .quad 0x53e4a24b083bc144 .quad 0x10b8e91a9f0d61e3 // 2^0 * 7 * G .quad 0xba6f2c9aaa3221b1 .quad 0x6ca021533bba23a7 .quad 0x9dea764f92192c3a .quad 0x1d6edd5d2e5317e0 .quad 0x6b1a5cd0944ea3bf .quad 0x7470353ab39dc0d2 .quad 0x71b2528228542e49 .quad 0x461bea69283c927e .quad 0xf1836dc801b8b3a2 .quad 0xb3035f47053ea49a .quad 0x529c41ba5877adf3 .quad 0x7a9fbb1c6a0f90a7 // 2^0 * 8 * G .quad 0xe2a75dedf39234d9 .quad 0x963d7680e1b558f9 .quad 0x2c2741ac6e3c23fb .quad 0x3a9024a1320e01c3 .quad 0x59b7596604dd3e8f .quad 0x6cb30377e288702c .quad 0xb1339c665ed9c323 .quad 0x0915e76061bce52f .quad 0xe7c1f5d9c9a2911a .quad 0xb8a371788bcca7d7 .quad 0x636412190eb62a32 .quad 0x26907c5c2ecc4e95 // 2^4 * 1 * B .quad 0x7ec851ca553e2df3 .quad 0xa71284cba64878b3 .quad 0xe6b5e4193288d1e7 .quad 0x4cf210ec5a9a8883 .quad 0x322d04a52d9021f6 .quad 0xb9c19f3375c6bf9c .quad 0x587a3a4342d20b09 .quad 0x143b1cf8aa64fe61 .quad 0x9f867c7d968acaab .quad 0x5f54258e27092729 .quad 0xd0a7d34bea180975 .quad 0x21b546a3374126e1 // 2^4 * 2 * B .quad 0xa94ff858a2888343 .quad 0xce0ed4565313ed3c .quad 0xf55c3dcfb5bf34fa .quad 0x0a653ca5c9eab371 .quad 0x490a7a45d185218f .quad 0x9a15377846049335 .quad 0x0060ea09cc31e1f6 .quad 0x7e041577f86ee965 .quad 0x66b2a496ce5b67f3 .quad 0xff5492d8bd569796 .quad 0x503cec294a592cd0 .quad 0x566943650813acb2 // 2^4 * 3 * B .quad 0xb818db0c26620798 .quad 0x5d5c31d9606e354a .quad 0x0982fa4f00a8cdc7 .quad 0x17e12bcd4653e2d4 .quad 0x5672f9eb1dabb69d .quad 0xba70b535afe853fc .quad 0x47ac0f752796d66d .quad 0x32a5351794117275 .quad 0xd3a644a6df648437 .quad 0x703b6559880fbfdd .quad 0xcb852540ad3a1aa5 .quad 0x0900b3f78e4c6468 // 2^4 * 4 * B .quad 0x0a851b9f679d651b .quad 0xe108cb61033342f2 .quad 0xd601f57fe88b30a3 .quad 0x371f3acaed2dd714 .quad 0xed280fbec816ad31 .quad 0x52d9595bd8e6efe3 .quad 0x0fe71772f6c623f5 .quad 0x4314030b051e293c .quad 0xd560005efbf0bcad .quad 0x8eb70f2ed1870c5e .quad 0x201f9033d084e6a0 .quad 0x4c3a5ae1ce7b6670 // 2^4 * 5 * B .quad 0x4138a434dcb8fa95 .quad 0x870cf67d6c96840b .quad 0xde388574297be82c .quad 0x7c814db27262a55a .quad 0xbaf875e4c93da0dd .quad 0xb93282a771b9294d .quad 0x80d63fb7f4c6c460 .quad 0x6de9c73dea66c181 .quad 0x478904d5a04df8f2 .quad 0xfafbae4ab10142d3 .quad 0xf6c8ac63555d0998 .quad 0x5aac4a412f90b104 // 2^4 * 6 * B .quad 0xc64f326b3ac92908 .quad 0x5551b282e663e1e0 .quad 0x476b35f54a1a4b83 .quad 0x1b9da3fe189f68c2 .quad 0x603a0d0abd7f5134 .quad 0x8089c932e1d3ae46 .quad 0xdf2591398798bd63 .quad 0x1c145cd274ba0235 .quad 0x32e8386475f3d743 .quad 0x365b8baf6ae5d9ef .quad 0x825238b6385b681e .quad 0x234929c1167d65e1 // 2^4 * 7 * B .quad 0x984decaba077ade8 .quad 0x383f77ad19eb389d .quad 0xc7ec6b7e2954d794 .quad 0x59c77b3aeb7c3a7a .quad 0x48145cc21d099fcf .quad 0x4535c192cc28d7e5 .quad 0x80e7c1e548247e01 .quad 0x4a5f28743b2973ee .quad 0xd3add725225ccf62 .quad 0x911a3381b2152c5d .quad 0xd8b39fad5b08f87d .quad 0x6f05606b4799fe3b // 2^4 * 8 * B .quad 0x9ffe9e92177ba962 .quad 0x98aee71d0de5cae1 .quad 0x3ff4ae942d831044 .quad 0x714de12e58533ac8 .quad 0x5b433149f91b6483 .quad 0xadb5dc655a2cbf62 .quad 0x87fa8412632827b3 .quad 0x60895e91ab49f8d8 .quad 0xe9ecf2ed0cf86c18 .quad 0xb46d06120735dfd4 .quad 0xbc9da09804b96be7 .quad 0x73e2e62fd96dc26b // 2^8 * 1 * B .quad 0xed5b635449aa515e .quad 0xa865c49f0bc6823a .quad 0x850c1fe95b42d1c4 .quad 0x30d76d6f03d315b9 .quad 0x2eccdd0e632f9c1d .quad 0x51d0b69676893115 .quad 0x52dfb76ba8637a58 .quad 0x6dd37d49a00eef39 .quad 0x6c4444172106e4c7 .quad 0xfb53d680928d7f69 .quad 0xb4739ea4694d3f26 .quad 0x10c697112e864bb0 // 2^8 * 2 * B .quad 0x6493c4277dbe5fde .quad 0x265d4fad19ad7ea2 .quad 0x0e00dfc846304590 .quad 0x25e61cabed66fe09 .quad 0x0ca62aa08358c805 .quad 0x6a3d4ae37a204247 .quad 0x7464d3a63b11eddc .quad 0x03bf9baf550806ef .quad 0x3f13e128cc586604 .quad 0x6f5873ecb459747e .quad 0xa0b63dedcc1268f5 .quad 0x566d78634586e22c // 2^8 * 3 * B .quad 0x1637a49f9cc10834 .quad 0xbc8e56d5a89bc451 .quad 0x1cb5ec0f7f7fd2db .quad 0x33975bca5ecc35d9 .quad 0xa1054285c65a2fd0 .quad 0x6c64112af31667c3 .quad 0x680ae240731aee58 .quad 0x14fba5f34793b22a .quad 0x3cd746166985f7d4 .quad 0x593e5e84c9c80057 .quad 0x2fc3f2b67b61131e .quad 0x14829cea83fc526c // 2^8 * 4 * B .quad 0xff437b8497dd95c2 .quad 0x6c744e30aa4eb5a7 .quad 0x9e0c5d613c85e88b .quad 0x2fd9c71e5f758173 .quad 0x21e70b2f4e71ecb8 .quad 0xe656ddb940a477e3 .quad 0xbf6556cece1d4f80 .quad 0x05fc3bc4535d7b7e .quad 0x24b8b3ae52afdedd .quad 0x3495638ced3b30cf .quad 0x33a4bc83a9be8195 .quad 0x373767475c651f04 // 2^8 * 5 * B .quad 0x2fba99fd40d1add9 .quad 0xb307166f96f4d027 .quad 0x4363f05215f03bae .quad 0x1fbea56c3b18f999 .quad 0x634095cb14246590 .quad 0xef12144016c15535 .quad 0x9e38140c8910bc60 .quad 0x6bf5905730907c8c .quad 0x0fa778f1e1415b8a .quad 0x06409ff7bac3a77e .quad 0x6f52d7b89aa29a50 .quad 0x02521cf67a635a56 // 2^8 * 6 * B .quad 0x513fee0b0a9d5294 .quad 0x8f98e75c0fdf5a66 .quad 0xd4618688bfe107ce .quad 0x3fa00a7e71382ced .quad 0xb1146720772f5ee4 .quad 0xe8f894b196079ace .quad 0x4af8224d00ac824a .quad 0x001753d9f7cd6cc4 .quad 0x3c69232d963ddb34 .quad 0x1dde87dab4973858 .quad 0xaad7d1f9a091f285 .quad 0x12b5fe2fa048edb6 // 2^8 * 7 * B .quad 0x71f0fbc496fce34d .quad 0x73b9826badf35bed .quad 0xd2047261ff28c561 .quad 0x749b76f96fb1206f .quad 0xdf2b7c26ad6f1e92 .quad 0x4b66d323504b8913 .quad 0x8c409dc0751c8bc3 .quad 0x6f7e93c20796c7b8 .quad 0x1f5af604aea6ae05 .quad 0xc12351f1bee49c99 .quad 0x61a808b5eeff6b66 .quad 0x0fcec10f01e02151 // 2^8 * 8 * B .quad 0x644d58a649fe1e44 .quad 0x21fcaea231ad777e .quad 0x02441c5a887fd0d2 .quad 0x4901aa7183c511f3 .quad 0x3df2d29dc4244e45 .quad 0x2b020e7493d8de0a .quad 0x6cc8067e820c214d .quad 0x413779166feab90a .quad 0x08b1b7548c1af8f0 .quad 0xce0f7a7c246299b4 .quad 0xf760b0f91e06d939 .quad 0x41bb887b726d1213 // 2^12 * 1 * B .quad 0x9267806c567c49d8 .quad 0x066d04ccca791e6a .quad 0xa69f5645e3cc394b .quad 0x5c95b686a0788cd2 .quad 0x97d980e0aa39f7d2 .quad 0x35d0384252c6b51c .quad 0x7d43f49307cd55aa .quad 0x56bd36cfb78ac362 .quad 0x2ac519c10d14a954 .quad 0xeaf474b494b5fa90 .quad 0xe6af8382a9f87a5a .quad 0x0dea6db1879be094 // 2^12 * 2 * B .quad 0xaa66bf547344e5ab .quad 0xda1258888f1b4309 .quad 0x5e87d2b3fd564b2f .quad 0x5b2c78885483b1dd .quad 0x15baeb74d6a8797a .quad 0x7ef55cf1fac41732 .quad 0x29001f5a3c8b05c5 .quad 0x0ad7cc8752eaccfb .quad 0x52151362793408cf .quad 0xeb0f170319963d94 .quad 0xa833b2fa883d9466 .quad 0x093a7fa775003c78 // 2^12 * 3 * B .quad 0xe5107de63a16d7be .quad 0xa377ffdc9af332cf .quad 0x70d5bf18440b677f .quad 0x6a252b19a4a31403 .quad 0xb8e9604460a91286 .quad 0x7f3fd8047778d3de .quad 0x67d01e31bf8a5e2d .quad 0x7b038a06c27b653e .quad 0x9ed919d5d36990f3 .quad 0x5213aebbdb4eb9f2 .quad 0xc708ea054cb99135 .quad 0x58ded57f72260e56 // 2^12 * 4 * B .quad 0x78e79dade9413d77 .quad 0xf257f9d59729e67d .quad 0x59db910ee37aa7e6 .quad 0x6aa11b5bbb9e039c .quad 0xda6d53265b0fd48b .quad 0x8960823193bfa988 .quad 0xd78ac93261d57e28 .quad 0x79f2942d3a5c8143 .quad 0x97da2f25b6c88de9 .quad 0x251ba7eaacf20169 .quad 0x09b44f87ef4eb4e4 .quad 0x7d90ab1bbc6a7da5 // 2^12 * 5 * B .quad 0x9acca683a7016bfe .quad 0x90505f4df2c50b6d .quad 0x6b610d5fcce435aa .quad 0x19a10d446198ff96 .quad 0x1a07a3f496b3c397 .quad 0x11ceaa188f4e2532 .quad 0x7d9498d5a7751bf0 .quad 0x19ed161f508dd8a0 .quad 0x560a2cd687dce6ca .quad 0x7f3568c48664cf4d .quad 0x8741e95222803a38 .quad 0x483bdab1595653fc // 2^12 * 6 * B .quad 0xfa780f148734fa49 .quad 0x106f0b70360534e0 .quad 0x2210776fe3e307bd .quad 0x3286c109dde6a0fe .quad 0xd6cf4d0ab4da80f6 .quad 0x82483e45f8307fe0 .quad 0x05005269ae6f9da4 .quad 0x1c7052909cf7877a .quad 0x32ee7de2874e98d4 .quad 0x14c362e9b97e0c60 .quad 0x5781dcde6a60a38a .quad 0x217dd5eaaa7aa840 // 2^12 * 7 * B .quad 0x9db7c4d0248e1eb0 .quad 0xe07697e14d74bf52 .quad 0x1e6a9b173c562354 .quad 0x7fa7c21f795a4965 .quad 0x8bdf1fb9be8c0ec8 .quad 0x00bae7f8e30a0282 .quad 0x4963991dad6c4f6c .quad 0x07058a6e5df6f60a .quad 0xe9eb02c4db31f67f .quad 0xed25fd8910bcfb2b .quad 0x46c8131f5c5cddb4 .quad 0x33b21c13a0cb9bce // 2^12 * 8 * B .quad 0x360692f8087d8e31 .quad 0xf4dcc637d27163f7 .quad 0x25a4e62065ea5963 .quad 0x659bf72e5ac160d9 .quad 0x9aafb9b05ee38c5b .quad 0xbf9d2d4e071a13c7 .quad 0x8eee6e6de933290a .quad 0x1c3bab17ae109717 .quad 0x1c9ab216c7cab7b0 .quad 0x7d65d37407bbc3cc .quad 0x52744750504a58d5 .quad 0x09f2606b131a2990 // 2^16 * 1 * B .quad 0x40e87d44744346be .quad 0x1d48dad415b52b25 .quad 0x7c3a8a18a13b603e .quad 0x4eb728c12fcdbdf7 .quad 0x7e234c597c6691ae .quad 0x64889d3d0a85b4c8 .quad 0xdae2c90c354afae7 .quad 0x0a871e070c6a9e1d .quad 0x3301b5994bbc8989 .quad 0x736bae3a5bdd4260 .quad 0x0d61ade219d59e3c .quad 0x3ee7300f2685d464 // 2^16 * 2 * B .quad 0xf5d255e49e7dd6b7 .quad 0x8016115c610b1eac .quad 0x3c99975d92e187ca .quad 0x13815762979125c2 .quad 0x43fa7947841e7518 .quad 0xe5c6fa59639c46d7 .quad 0xa1065e1de3052b74 .quad 0x7d47c6a2cfb89030 .quad 0x3fdad0148ef0d6e0 .quad 0x9d3e749a91546f3c .quad 0x71ec621026bb8157 .quad 0x148cf58d34c9ec80 // 2^16 * 3 * B .quad 0x46a492f67934f027 .quad 0x469984bef6840aa9 .quad 0x5ca1bc2a89611854 .quad 0x3ff2fa1ebd5dbbd4 .quad 0xe2572f7d9ae4756d .quad 0x56c345bb88f3487f .quad 0x9fd10b6d6960a88d .quad 0x278febad4eaea1b9 .quad 0xb1aa681f8c933966 .quad 0x8c21949c20290c98 .quad 0x39115291219d3c52 .quad 0x4104dd02fe9c677b // 2^16 * 4 * B .quad 0x72b2bf5e1124422a .quad 0xa1fa0c3398a33ab5 .quad 0x94cb6101fa52b666 .quad 0x2c863b00afaf53d5 .quad 0x81214e06db096ab8 .quad 0x21a8b6c90ce44f35 .quad 0x6524c12a409e2af5 .quad 0x0165b5a48efca481 .quad 0xf190a474a0846a76 .quad 0x12eff984cd2f7cc0 .quad 0x695e290658aa2b8f .quad 0x591b67d9bffec8b8 // 2^16 * 5 * B .quad 0x312f0d1c80b49bfa .quad 0x5979515eabf3ec8a .quad 0x727033c09ef01c88 .quad 0x3de02ec7ca8f7bcb .quad 0x99b9b3719f18b55d .quad 0xe465e5faa18c641e .quad 0x61081136c29f05ed .quad 0x489b4f867030128b .quad 0xd232102d3aeb92ef .quad 0xe16253b46116a861 .quad 0x3d7eabe7190baa24 .quad 0x49f5fbba496cbebf // 2^16 * 6 * B .quad 0x30949a108a5bcfd4 .quad 0xdc40dd70bc6473eb .quad 0x92c294c1307c0d1c .quad 0x5604a86dcbfa6e74 .quad 0x155d628c1e9c572e .quad 0x8a4d86acc5884741 .quad 0x91a352f6515763eb .quad 0x06a1a6c28867515b .quad 0x7288d1d47c1764b6 .quad 0x72541140e0418b51 .quad 0x9f031a6018acf6d1 .quad 0x20989e89fe2742c6 // 2^16 * 7 * B .quad 0x499777fd3a2dcc7f .quad 0x32857c2ca54fd892 .quad 0xa279d864d207e3a0 .quad 0x0403ed1d0ca67e29 .quad 0x1674278b85eaec2e .quad 0x5621dc077acb2bdf .quad 0x640a4c1661cbf45a .quad 0x730b9950f70595d3 .quad 0xc94b2d35874ec552 .quad 0xc5e6c8cf98246f8d .quad 0xf7cb46fa16c035ce .quad 0x5bd7454308303dcc // 2^16 * 8 * B .quad 0x7f9ad19528b24cc2 .quad 0x7f6b54656335c181 .quad 0x66b8b66e4fc07236 .quad 0x133a78007380ad83 .quad 0x85c4932115e7792a .quad 0xc64c89a2bdcdddc9 .quad 0x9d1e3da8ada3d762 .quad 0x5bb7db123067f82c .quad 0x0961f467c6ca62be .quad 0x04ec21d6211952ee .quad 0x182360779bd54770 .quad 0x740dca6d58f0e0d2 // 2^20 * 1 * B .quad 0x50b70bf5d3f0af0b .quad 0x4feaf48ae32e71f7 .quad 0x60e84ed3a55bbd34 .quad 0x00ed489b3f50d1ed .quad 0x3906c72aed261ae5 .quad 0x9ab68fd988e100f7 .quad 0xf5e9059af3360197 .quad 0x0e53dc78bf2b6d47 .quad 0xb90829bf7971877a .quad 0x5e4444636d17e631 .quad 0x4d05c52e18276893 .quad 0x27632d9a5a4a4af5 // 2^20 * 2 * B .quad 0xd11ff05154b260ce .quad 0xd86dc38e72f95270 .quad 0x601fcd0d267cc138 .quad 0x2b67916429e90ccd .quad 0xa98285d187eaffdb .quad 0xa5b4fbbbd8d0a864 .quad 0xb658f27f022663f7 .quad 0x3bbc2b22d99ce282 .quad 0xb917c952583c0a58 .quad 0x653ff9b80fe4c6f3 .quad 0x9b0da7d7bcdf3c0c .quad 0x43a0eeb6ab54d60e // 2^20 * 3 * B .quad 0x396966a46d4a5487 .quad 0xf811a18aac2bb3ba .quad 0x66e4685b5628b26b .quad 0x70a477029d929b92 .quad 0x3ac6322357875fe8 .quad 0xd9d4f4ecf5fbcb8f .quad 0x8dee8493382bb620 .quad 0x50c5eaa14c799fdc .quad 0xdd0edc8bd6f2fb3c .quad 0x54c63aa79cc7b7a0 .quad 0xae0b032b2c8d9f1a .quad 0x6f9ce107602967fb // 2^20 * 4 * B .quad 0xad1054b1cde1c22a .quad 0xc4a8e90248eb32df .quad 0x5f3e7b33accdc0ea .quad 0x72364713fc79963e .quad 0x139693063520e0b5 .quad 0x437fcf7c88ea03fe .quad 0xf7d4c40bd3c959bc .quad 0x699154d1f893ded9 .quad 0x315d5c75b4b27526 .quad 0xcccb842d0236daa5 .quad 0x22f0c8a3345fee8e .quad 0x73975a617d39dbed // 2^20 * 5 * B .quad 0xe4024df96375da10 .quad 0x78d3251a1830c870 .quad 0x902b1948658cd91c .quad 0x7e18b10b29b7438a .quad 0x6f37f392f4433e46 .quad 0x0e19b9a11f566b18 .quad 0x220fb78a1fd1d662 .quad 0x362a4258a381c94d .quad 0x9071d9132b6beb2f .quad 0x0f26e9ad28418247 .quad 0xeab91ec9bdec925d .quad 0x4be65bc8f48af2de // 2^20 * 6 * B .quad 0x78487feba36e7028 .quad 0x5f3f13001dd8ce34 .quad 0x934fb12d4b30c489 .quad 0x056c244d397f0a2b .quad 0x1d50fba257c26234 .quad 0x7bd4823adeb0678b .quad 0xc2b0dc6ea6538af5 .quad 0x5665eec6351da73e .quad 0xdb3ee00943bfb210 .quad 0x4972018720800ac2 .quad 0x26ab5d6173bd8667 .quad 0x20b209c2ab204938 // 2^20 * 7 * B .quad 0x549e342ac07fb34b .quad 0x02d8220821373d93 .quad 0xbc262d70acd1f567 .quad 0x7a92c9fdfbcac784 .quad 0x1fcca94516bd3289 .quad 0x448d65aa41420428 .quad 0x59c3b7b216a55d62 .quad 0x49992cc64e612cd8 .quad 0x65bd1bea70f801de .quad 0x1befb7c0fe49e28a .quad 0xa86306cdb1b2ae4a .quad 0x3b7ac0cd265c2a09 // 2^20 * 8 * B .quad 0x822bee438c01bcec .quad 0x530cb525c0fbc73b .quad 0x48519034c1953fe9 .quad 0x265cc261e09a0f5b .quad 0xf0d54e4f22ed39a7 .quad 0xa2aae91e5608150a .quad 0xf421b2e9eddae875 .quad 0x31bc531d6b7de992 .quad 0xdf3d134da980f971 .quad 0x7a4fb8d1221a22a7 .quad 0x3df7d42035aad6d8 .quad 0x2a14edcc6a1a125e // 2^24 * 1 * B .quad 0xdf48ee0752cfce4e .quad 0xc3fffaf306ec08b7 .quad 0x05710b2ab95459c4 .quad 0x161d25fa963ea38d .quad 0x231a8c570478433c .quad 0xb7b5270ec281439d .quad 0xdbaa99eae3d9079f .quad 0x2c03f5256c2b03d9 .quad 0x790f18757b53a47d .quad 0x307b0130cf0c5879 .quad 0x31903d77257ef7f9 .quad 0x699468bdbd96bbaf // 2^24 * 2 * B .quad 0xbd1f2f46f4dafecf .quad 0x7cef0114a47fd6f7 .quad 0xd31ffdda4a47b37f .quad 0x525219a473905785 .quad 0xd8dd3de66aa91948 .quad 0x485064c22fc0d2cc .quad 0x9b48246634fdea2f .quad 0x293e1c4e6c4a2e3a .quad 0x376e134b925112e1 .quad 0x703778b5dca15da0 .quad 0xb04589af461c3111 .quad 0x5b605c447f032823 // 2^24 * 3 * B .quad 0xb965805920c47c89 .quad 0xe7f0100c923b8fcc .quad 0x0001256502e2ef77 .quad 0x24a76dcea8aeb3ee .quad 0x3be9fec6f0e7f04c .quad 0x866a579e75e34962 .quad 0x5542ef161e1de61a .quad 0x2f12fef4cc5abdd5 .quad 0x0a4522b2dfc0c740 .quad 0x10d06e7f40c9a407 .quad 0xc6cf144178cff668 .quad 0x5e607b2518a43790 // 2^24 * 4 * B .quad 0x58b31d8f6cdf1818 .quad 0x35cfa74fc36258a2 .quad 0xe1b3ff4f66e61d6e .quad 0x5067acab6ccdd5f7 .quad 0xa02c431ca596cf14 .quad 0xe3c42d40aed3e400 .quad 0xd24526802e0f26db .quad 0x201f33139e457068 .quad 0xfd527f6b08039d51 .quad 0x18b14964017c0006 .quad 0xd5220eb02e25a4a8 .quad 0x397cba8862460375 // 2^24 * 5 * B .quad 0x30c13093f05959b2 .quad 0xe23aa18de9a97976 .quad 0x222fd491721d5e26 .quad 0x2339d320766e6c3a .quad 0x7815c3fbc81379e7 .quad 0xa6619420dde12af1 .quad 0xffa9c0f885a8fdd5 .quad 0x771b4022c1e1c252 .quad 0xd87dd986513a2fa7 .quad 0xf5ac9b71f9d4cf08 .quad 0xd06bc31b1ea283b3 .quad 0x331a189219971a76 // 2^24 * 6 * B .quad 0xf5166f45fb4f80c6 .quad 0x9c36c7de61c775cf .quad 0xe3d4e81b9041d91c .quad 0x31167c6b83bdfe21 .quad 0x26512f3a9d7572af .quad 0x5bcbe28868074a9e .quad 0x84edc1c11180f7c4 .quad 0x1ac9619ff649a67b .quad 0xf22b3842524b1068 .quad 0x5068343bee9ce987 .quad 0xfc9d71844a6250c8 .quad 0x612436341f08b111 // 2^24 * 7 * B .quad 0xd99d41db874e898d .quad 0x09fea5f16c07dc20 .quad 0x793d2c67d00f9bbc .quad 0x46ebe2309e5eff40 .quad 0x8b6349e31a2d2638 .quad 0x9ddfb7009bd3fd35 .quad 0x7f8bf1b8a3a06ba4 .quad 0x1522aa3178d90445 .quad 0x2c382f5369614938 .quad 0xdafe409ab72d6d10 .quad 0xe8c83391b646f227 .quad 0x45fe70f50524306c // 2^24 * 8 * B .quad 0xda4875a6960c0b8c .quad 0x5b68d076ef0e2f20 .quad 0x07fb51cf3d0b8fd4 .quad 0x428d1623a0e392d4 .quad 0x62f24920c8951491 .quad 0x05f007c83f630ca2 .quad 0x6fbb45d2f5c9d4b8 .quad 0x16619f6db57a2245 .quad 0x084f4a4401a308fd .quad 0xa82219c376a5caac .quad 0xdeb8de4643d1bc7d .quad 0x1d81592d60bd38c6 // 2^28 * 1 * B .quad 0xd833d7beec2a4c38 .quad 0x2c9162830acc20ed .quad 0xe93a47aa92df7581 .quad 0x702d67a3333c4a81 .quad 0x3a4a369a2f89c8a1 .quad 0x63137a1d7c8de80d .quad 0xbcac008a78eda015 .quad 0x2cb8b3a5b483b03f .quad 0x36e417cbcb1b90a1 .quad 0x33b3ddaa7f11794e .quad 0x3f510808885bc607 .quad 0x24141dc0e6a8020d // 2^28 * 2 * B .quad 0x59f73c773fefee9d .quad 0xb3f1ef89c1cf989d .quad 0xe35dfb42e02e545f .quad 0x5766120b47a1b47c .quad 0x91925dccbd83157d .quad 0x3ca1205322cc8094 .quad 0x28e57f183f90d6e4 .quad 0x1a4714cede2e767b .quad 0xdb20ba0fb8b6b7ff .quad 0xb732c3b677511fa1 .quad 0xa92b51c099f02d89 .quad 0x4f3875ad489ca5f1 // 2^28 * 3 * B .quad 0xc7fc762f4932ab22 .quad 0x7ac0edf72f4c3c1b .quad 0x5f6b55aa9aa895e8 .quad 0x3680274dad0a0081 .quad 0x79ed13f6ee73eec0 .quad 0xa5c6526d69110bb1 .quad 0xe48928c38603860c .quad 0x722a1446fd7059f5 .quad 0xd0959fe9a8cf8819 .quad 0xd0a995508475a99c .quad 0x6eac173320b09cc5 .quad 0x628ecf04331b1095 // 2^28 * 4 * B .quad 0x98bcb118a9d0ddbc .quad 0xee449e3408b4802b .quad 0x87089226b8a6b104 .quad 0x685f349a45c7915d .quad 0x9b41acf85c74ccf1 .quad 0xb673318108265251 .quad 0x99c92aed11adb147 .quad 0x7a47d70d34ecb40f .quad 0x60a0c4cbcc43a4f5 .quad 0x775c66ca3677bea9 .quad 0xa17aa1752ff8f5ed .quad 0x11ded9020e01fdc0 // 2^28 * 5 * B .quad 0x890e7809caefe704 .quad 0x8728296de30e8c6c .quad 0x4c5cd2a392aeb1c9 .quad 0x194263d15771531f .quad 0x471f95b03bea93b7 .quad 0x0552d7d43313abd3 .quad 0xbd9370e2e17e3f7b .quad 0x7b120f1db20e5bec .quad 0x17d2fb3d86502d7a .quad 0xb564d84450a69352 .quad 0x7da962c8a60ed75d .quad 0x00d0f85b318736aa // 2^28 * 6 * B .quad 0x978b142e777c84fd .quad 0xf402644705a8c062 .quad 0xa67ad51be7e612c7 .quad 0x2f7b459698dd6a33 .quad 0xa6753c1efd7621c1 .quad 0x69c0b4a7445671f5 .quad 0x971f527405b23c11 .quad 0x387bc74851a8c7cd .quad 0x81894b4d4a52a9a8 .quad 0xadd93e12f6b8832f .quad 0x184d8548b61bd638 .quad 0x3f1c62dbd6c9f6cd // 2^28 * 7 * B .quad 0x2e8f1f0091910c1f .quad 0xa4df4fe0bff2e12c .quad 0x60c6560aee927438 .quad 0x6338283facefc8fa .quad 0x3fad3e40148f693d .quad 0x052656e194eb9a72 .quad 0x2f4dcbfd184f4e2f .quad 0x406f8db1c482e18b .quad 0x9e630d2c7f191ee4 .quad 0x4fbf8301bc3ff670 .quad 0x787d8e4e7afb73c4 .quad 0x50d83d5be8f58fa5 // 2^28 * 8 * B .quad 0x85683916c11a1897 .quad 0x2d69a4efe506d008 .quad 0x39af1378f664bd01 .quad 0x65942131361517c6 .quad 0xc0accf90b4d3b66d .quad 0xa7059de561732e60 .quad 0x033d1f7870c6b0ba .quad 0x584161cd26d946e4 .quad 0xbbf2b1a072d27ca2 .quad 0xbf393c59fbdec704 .quad 0xe98dbbcee262b81e .quad 0x02eebd0b3029b589 // 2^32 * 1 * B .quad 0x61368756a60dac5f .quad 0x17e02f6aebabdc57 .quad 0x7f193f2d4cce0f7d .quad 0x20234a7789ecdcf0 .quad 0x8765b69f7b85c5e8 .quad 0x6ff0678bd168bab2 .quad 0x3a70e77c1d330f9b .quad 0x3a5f6d51b0af8e7c .quad 0x76d20db67178b252 .quad 0x071c34f9d51ed160 .quad 0xf62a4a20b3e41170 .quad 0x7cd682353cffe366 // 2^32 * 2 * B .quad 0x0be1a45bd887fab6 .quad 0x2a846a32ba403b6e .quad 0xd9921012e96e6000 .quad 0x2838c8863bdc0943 .quad 0xa665cd6068acf4f3 .quad 0x42d92d183cd7e3d3 .quad 0x5759389d336025d9 .quad 0x3ef0253b2b2cd8ff .quad 0xd16bb0cf4a465030 .quad 0xfa496b4115c577ab .quad 0x82cfae8af4ab419d .quad 0x21dcb8a606a82812 // 2^32 * 3 * B .quad 0x5c6004468c9d9fc8 .quad 0x2540096ed42aa3cb .quad 0x125b4d4c12ee2f9c .quad 0x0bc3d08194a31dab .quad 0x9a8d00fabe7731ba .quad 0x8203607e629e1889 .quad 0xb2cc023743f3d97f .quad 0x5d840dbf6c6f678b .quad 0x706e380d309fe18b .quad 0x6eb02da6b9e165c7 .quad 0x57bbba997dae20ab .quad 0x3a4276232ac196dd // 2^32 * 4 * B .quad 0x4b42432c8a7084fa .quad 0x898a19e3dfb9e545 .quad 0xbe9f00219c58e45d .quad 0x1ff177cea16debd1 .quad 0x3bf8c172db447ecb .quad 0x5fcfc41fc6282dbd .quad 0x80acffc075aa15fe .quad 0x0770c9e824e1a9f9 .quad 0xcf61d99a45b5b5fd .quad 0x860984e91b3a7924 .quad 0xe7300919303e3e89 .quad 0x39f264fd41500b1e // 2^32 * 5 * B .quad 0xa7ad3417dbe7e29c .quad 0xbd94376a2b9c139c .quad 0xa0e91b8e93597ba9 .quad 0x1712d73468889840 .quad 0xd19b4aabfe097be1 .quad 0xa46dfce1dfe01929 .quad 0xc3c908942ca6f1ff .quad 0x65c621272c35f14e .quad 0xe72b89f8ce3193dd .quad 0x4d103356a125c0bb .quad 0x0419a93d2e1cfe83 .quad 0x22f9800ab19ce272 // 2^32 * 6 * B .quad 0x605a368a3e9ef8cb .quad 0xe3e9c022a5504715 .quad 0x553d48b05f24248f .quad 0x13f416cd647626e5 .quad 0x42029fdd9a6efdac .quad 0xb912cebe34a54941 .quad 0x640f64b987bdf37b .quad 0x4171a4d38598cab4 .quad 0xfa2758aa99c94c8c .quad 0x23006f6fb000b807 .quad 0xfbd291ddadda5392 .quad 0x508214fa574bd1ab // 2^32 * 7 * B .quad 0xc20269153ed6fe4b .quad 0xa65a6739511d77c4 .quad 0xcbde26462c14af94 .quad 0x22f960ec6faba74b .quad 0x461a15bb53d003d6 .quad 0xb2102888bcf3c965 .quad 0x27c576756c683a5a .quad 0x3a7758a4c86cb447 .quad 0x548111f693ae5076 .quad 0x1dae21df1dfd54a6 .quad 0x12248c90f3115e65 .quad 0x5d9fd15f8de7f494 // 2^32 * 8 * B .quad 0x031408d36d63727f .quad 0x6a379aefd7c7b533 .quad 0xa9e18fc5ccaee24b .quad 0x332f35914f8fbed3 .quad 0x3f244d2aeed7521e .quad 0x8e3a9028432e9615 .quad 0xe164ba772e9c16d4 .quad 0x3bc187fa47eb98d8 .quad 0x6d470115ea86c20c .quad 0x998ab7cb6c46d125 .quad 0xd77832b53a660188 .quad 0x450d81ce906fba03 // 2^36 * 1 * B .quad 0xf8ae4d2ad8453902 .quad 0x7018058ee8db2d1d .quad 0xaab3995fc7d2c11e .quad 0x53b16d2324ccca79 .quad 0x23264d66b2cae0b5 .quad 0x7dbaed33ebca6576 .quad 0x030ebed6f0d24ac8 .quad 0x2a887f78f7635510 .quad 0x2a23b9e75c012d4f .quad 0x0c974651cae1f2ea .quad 0x2fb63273675d70ca .quad 0x0ba7250b864403f5 // 2^36 * 2 * B .quad 0xbb0d18fd029c6421 .quad 0xbc2d142189298f02 .quad 0x8347f8e68b250e96 .quad 0x7b9f2fe8032d71c9 .quad 0xdd63589386f86d9c .quad 0x61699176e13a85a4 .quad 0x2e5111954eaa7d57 .quad 0x32c21b57fb60bdfb .quad 0xd87823cd319e0780 .quad 0xefc4cfc1897775c5 .quad 0x4854fb129a0ab3f7 .quad 0x12c49d417238c371 // 2^36 * 3 * B .quad 0x0950b533ffe83769 .quad 0x21861c1d8e1d6bd1 .quad 0xf022d8381302e510 .quad 0x2509200c6391cab4 .quad 0x09b3a01783799542 .quad 0x626dd08faad5ee3f .quad 0xba00bceeeb70149f .quad 0x1421b246a0a444c9 .quad 0x4aa43a8e8c24a7c7 .quad 0x04c1f540d8f05ef5 .quad 0xadba5e0c0b3eb9dc .quad 0x2ab5504448a49ce3 // 2^36 * 4 * B .quad 0x2ed227266f0f5dec .quad 0x9824ee415ed50824 .quad 0x807bec7c9468d415 .quad 0x7093bae1b521e23f .quad 0xdc07ac631c5d3afa .quad 0x58615171f9df8c6c .quad 0x72a079d89d73e2b0 .quad 0x7301f4ceb4eae15d .quad 0x6409e759d6722c41 .quad 0xa674e1cf72bf729b .quad 0xbc0a24eb3c21e569 .quad 0x390167d24ebacb23 // 2^36 * 5 * B .quad 0x27f58e3bba353f1c .quad 0x4c47764dbf6a4361 .quad 0xafbbc4e56e562650 .quad 0x07db2ee6aae1a45d .quad 0xd7bb054ba2f2120b .quad 0xe2b9ceaeb10589b7 .quad 0x3fe8bac8f3c0edbe .quad 0x4cbd40767112cb69 .quad 0x0b603cc029c58176 .quad 0x5988e3825cb15d61 .quad 0x2bb61413dcf0ad8d .quad 0x7b8eec6c74183287 // 2^36 * 6 * B .quad 0xe4ca40782cd27cb0 .quad 0xdaf9c323fbe967bd .quad 0xb29bd34a8ad41e9e .quad 0x72810497626ede4d .quad 0x32fee570fc386b73 .quad 0xda8b0141da3a8cc7 .quad 0x975ffd0ac8968359 .quad 0x6ee809a1b132a855 .quad 0x9444bb31fcfd863a .quad 0x2fe3690a3e4e48c5 .quad 0xdc29c867d088fa25 .quad 0x13bd1e38d173292e // 2^36 * 7 * B .quad 0xd32b4cd8696149b5 .quad 0xe55937d781d8aab7 .quad 0x0bcb2127ae122b94 .quad 0x41e86fcfb14099b0 .quad 0x223fb5cf1dfac521 .quad 0x325c25316f554450 .quad 0x030b98d7659177ac .quad 0x1ed018b64f88a4bd .quad 0x3630dfa1b802a6b0 .quad 0x880f874742ad3bd5 .quad 0x0af90d6ceec5a4d4 .quad 0x746a247a37cdc5d9 // 2^36 * 8 * B .quad 0xd531b8bd2b7b9af6 .quad 0x5005093537fc5b51 .quad 0x232fcf25c593546d .quad 0x20a365142bb40f49 .quad 0x6eccd85278d941ed .quad 0x2254ae83d22f7843 .quad 0xc522d02e7bbfcdb7 .quad 0x681e3351bff0e4e2 .quad 0x8b64b59d83034f45 .quad 0x2f8b71f21fa20efb .quad 0x69249495ba6550e4 .quad 0x539ef98e45d5472b // 2^40 * 1 * B .quad 0x6e7bb6a1a6205275 .quad 0xaa4f21d7413c8e83 .quad 0x6f56d155e88f5cb2 .quad 0x2de25d4ba6345be1 .quad 0xd074d8961cae743f .quad 0xf86d18f5ee1c63ed .quad 0x97bdc55be7f4ed29 .quad 0x4cbad279663ab108 .quad 0x80d19024a0d71fcd .quad 0xc525c20afb288af8 .quad 0xb1a3974b5f3a6419 .quad 0x7d7fbcefe2007233 // 2^40 * 2 * B .quad 0xfaef1e6a266b2801 .quad 0x866c68c4d5739f16 .quad 0xf68a2fbc1b03762c .quad 0x5975435e87b75a8d .quad 0xcd7c5dc5f3c29094 .quad 0xc781a29a2a9105ab .quad 0x80c61d36421c3058 .quad 0x4f9cd196dcd8d4d7 .quad 0x199297d86a7b3768 .quad 0xd0d058241ad17a63 .quad 0xba029cad5c1c0c17 .quad 0x7ccdd084387a0307 // 2^40 * 3 * B .quad 0xdca6422c6d260417 .quad 0xae153d50948240bd .quad 0xa9c0c1b4fb68c677 .quad 0x428bd0ed61d0cf53 .quad 0x9b0c84186760cc93 .quad 0xcdae007a1ab32a99 .quad 0xa88dec86620bda18 .quad 0x3593ca848190ca44 .quad 0x9213189a5e849aa7 .quad 0xd4d8c33565d8facd .quad 0x8c52545b53fdbbd1 .quad 0x27398308da2d63e6 // 2^40 * 4 * B .quad 0x42c38d28435ed413 .quad 0xbd50f3603278ccc9 .quad 0xbb07ab1a79da03ef .quad 0x269597aebe8c3355 .quad 0xb9a10e4c0a702453 .quad 0x0fa25866d57d1bde .quad 0xffb9d9b5cd27daf7 .quad 0x572c2945492c33fd .quad 0xc77fc745d6cd30be .quad 0xe4dfe8d3e3baaefb .quad 0xa22c8830aa5dda0c .quad 0x7f985498c05bca80 // 2^40 * 5 * B .quad 0x3849ce889f0be117 .quad 0x8005ad1b7b54a288 .quad 0x3da3c39f23fc921c .quad 0x76c2ec470a31f304 .quad 0xd35615520fbf6363 .quad 0x08045a45cf4dfba6 .quad 0xeec24fbc873fa0c2 .quad 0x30f2653cd69b12e7 .quad 0x8a08c938aac10c85 .quad 0x46179b60db276bcb .quad 0xa920c01e0e6fac70 .quad 0x2f1273f1596473da // 2^40 * 6 * B .quad 0x4739fc7c8ae01e11 .quad 0xfd5274904a6aab9f .quad 0x41d98a8287728f2e .quad 0x5d9e572ad85b69f2 .quad 0x30488bd755a70bc0 .quad 0x06d6b5a4f1d442e7 .quad 0xead1a69ebc596162 .quad 0x38ac1997edc5f784 .quad 0x0666b517a751b13b .quad 0x747d06867e9b858c .quad 0xacacc011454dde49 .quad 0x22dfcd9cbfe9e69c // 2^40 * 7 * B .quad 0x8ddbd2e0c30d0cd9 .quad 0xad8e665facbb4333 .quad 0x8f6b258c322a961f .quad 0x6b2916c05448c1c7 .quad 0x56ec59b4103be0a1 .quad 0x2ee3baecd259f969 .quad 0x797cb29413f5cd32 .quad 0x0fe9877824cde472 .quad 0x7edb34d10aba913b .quad 0x4ea3cd822e6dac0e .quad 0x66083dff6578f815 .quad 0x4c303f307ff00a17 // 2^40 * 8 * B .quad 0xd30a3bd617b28c85 .quad 0xc5d377b739773bea .quad 0xc6c6e78c1e6a5cbf .quad 0x0d61b8f78b2ab7c4 .quad 0x29fc03580dd94500 .quad 0xecd27aa46fbbec93 .quad 0x130a155fc2e2a7f8 .quad 0x416b151ab706a1d5 .quad 0x56a8d7efe9c136b0 .quad 0xbd07e5cd58e44b20 .quad 0xafe62fda1b57e0ab .quad 0x191a2af74277e8d2 // 2^44 * 1 * B .quad 0xd550095bab6f4985 .quad 0x04f4cd5b4fbfaf1a .quad 0x9d8e2ed12a0c7540 .quad 0x2bc24e04b2212286 .quad 0x09d4b60b2fe09a14 .quad 0xc384f0afdbb1747e .quad 0x58e2ea8978b5fd6e .quad 0x519ef577b5e09b0a .quad 0x1863d7d91124cca9 .quad 0x7ac08145b88a708e .quad 0x2bcd7309857031f5 .quad 0x62337a6e8ab8fae5 // 2^44 * 2 * B .quad 0x4bcef17f06ffca16 .quad 0xde06e1db692ae16a .quad 0x0753702d614f42b0 .quad 0x5f6041b45b9212d0 .quad 0xd1ab324e1b3a1273 .quad 0x18947cf181055340 .quad 0x3b5d9567a98c196e .quad 0x7fa00425802e1e68 .quad 0x7d531574028c2705 .quad 0x80317d69db0d75fe .quad 0x30fface8ef8c8ddd .quad 0x7e9de97bb6c3e998 // 2^44 * 3 * B .quad 0x1558967b9e6585a3 .quad 0x97c99ce098e98b92 .quad 0x10af149b6eb3adad .quad 0x42181fe8f4d38cfa .quad 0xf004be62a24d40dd .quad 0xba0659910452d41f .quad 0x81c45ee162a44234 .quad 0x4cb829d8a22266ef .quad 0x1dbcaa8407b86681 .quad 0x081f001e8b26753b .quad 0x3cd7ce6a84048e81 .quad 0x78af11633f25f22c // 2^44 * 4 * B .quad 0x8416ebd40b50babc .quad 0x1508722628208bee .quad 0xa3148fafb9c1c36d .quad 0x0d07daacd32d7d5d .quad 0x3241c00e7d65318c .quad 0xe6bee5dcd0e86de7 .quad 0x118b2dc2fbc08c26 .quad 0x680d04a7fc603dc3 .quad 0xf9c2414a695aa3eb .quad 0xdaa42c4c05a68f21 .quad 0x7c6c23987f93963e .quad 0x210e8cd30c3954e3 // 2^44 * 5 * B .quad 0xac4201f210a71c06 .quad 0x6a65e0aef3bfb021 .quad 0xbc42c35c393632f7 .quad 0x56ea8db1865f0742 .quad 0x2b50f16137fe6c26 .quad 0xe102bcd856e404d8 .quad 0x12b0f1414c561f6b .quad 0x51b17bc8d028ec91 .quad 0xfff5fb4bcf535119 .quad 0xf4989d79df1108a0 .quad 0xbdfcea659a3ba325 .quad 0x18a11f1174d1a6f2 // 2^44 * 6 * B .quad 0x407375ab3f6bba29 .quad 0x9ec3b6d8991e482e .quad 0x99c80e82e55f92e9 .quad 0x307c13b6fb0c0ae1 .quad 0xfbd63cdad27a5f2c .quad 0xf00fc4bc8aa106d7 .quad 0x53fb5c1a8e64a430 .quad 0x04eaabe50c1a2e85 .quad 0x24751021cb8ab5e7 .quad 0xfc2344495c5010eb .quad 0x5f1e717b4e5610a1 .quad 0x44da5f18c2710cd5 // 2^44 * 7 * B .quad 0x033cc55ff1b82eb5 .quad 0xb15ae36d411cae52 .quad 0xba40b6198ffbacd3 .quad 0x768edce1532e861f .quad 0x9156fe6b89d8eacc .quad 0xe6b79451e23126a1 .quad 0xbd7463d93944eb4e .quad 0x726373f6767203ae .quad 0xe305ca72eb7ef68a .quad 0x662cf31f70eadb23 .quad 0x18f026fdb4c45b68 .quad 0x513b5384b5d2ecbd // 2^44 * 8 * B .quad 0x46d46280c729989e .quad 0x4b93fbd05368a5dd .quad 0x63df3f81d1765a89 .quad 0x34cebd64b9a0a223 .quad 0x5e2702878af34ceb .quad 0x900b0409b946d6ae .quad 0x6512ebf7dabd8512 .quad 0x61d9b76988258f81 .quad 0xa6c5a71349b7d94b .quad 0xa3f3d15823eb9446 .quad 0x0416fbd277484834 .quad 0x69d45e6f2c70812f // 2^48 * 1 * B .quad 0xce16f74bc53c1431 .quad 0x2b9725ce2072edde .quad 0xb8b9c36fb5b23ee7 .quad 0x7e2e0e450b5cc908 .quad 0x9fe62b434f460efb .quad 0xded303d4a63607d6 .quad 0xf052210eb7a0da24 .quad 0x237e7dbe00545b93 .quad 0x013575ed6701b430 .quad 0x231094e69f0bfd10 .quad 0x75320f1583e47f22 .quad 0x71afa699b11155e3 // 2^48 * 2 * B .quad 0x65ce6f9b3953b61d .quad 0xc65839eaafa141e6 .quad 0x0f435ffda9f759fe .quad 0x021142e9c2b1c28e .quad 0xea423c1c473b50d6 .quad 0x51e87a1f3b38ef10 .quad 0x9b84bf5fb2c9be95 .quad 0x00731fbc78f89a1c .quad 0xe430c71848f81880 .quad 0xbf960c225ecec119 .quad 0xb6dae0836bba15e3 .quad 0x4c4d6f3347e15808 // 2^48 * 3 * B .quad 0x18f7eccfc17d1fc9 .quad 0x6c75f5a651403c14 .quad 0xdbde712bf7ee0cdf .quad 0x193fddaaa7e47a22 .quad 0x2f0cddfc988f1970 .quad 0x6b916227b0b9f51b .quad 0x6ec7b6c4779176be .quad 0x38bf9500a88f9fa8 .quad 0x1fd2c93c37e8876f .quad 0xa2f61e5a18d1462c .quad 0x5080f58239241276 .quad 0x6a6fb99ebf0d4969 // 2^48 * 4 * B .quad 0x6a46c1bb560855eb .quad 0x2416bb38f893f09d .quad 0xd71d11378f71acc1 .quad 0x75f76914a31896ea .quad 0xeeb122b5b6e423c6 .quad 0x939d7010f286ff8e .quad 0x90a92a831dcf5d8c .quad 0x136fda9f42c5eb10 .quad 0xf94cdfb1a305bdd1 .quad 0x0f364b9d9ff82c08 .quad 0x2a87d8a5c3bb588a .quad 0x022183510be8dcba // 2^48 * 5 * B .quad 0x4af766385ead2d14 .quad 0xa08ed880ca7c5830 .quad 0x0d13a6e610211e3d .quad 0x6a071ce17b806c03 .quad 0x9d5a710143307a7f .quad 0xb063de9ec47da45f .quad 0x22bbfe52be927ad3 .quad 0x1387c441fd40426c .quad 0xb5d3c3d187978af8 .quad 0x722b5a3d7f0e4413 .quad 0x0d7b4848bb477ca0 .quad 0x3171b26aaf1edc92 // 2^48 * 6 * B .quad 0xa92f319097564ca8 .quad 0xff7bb84c2275e119 .quad 0x4f55fe37a4875150 .quad 0x221fd4873cf0835a .quad 0xa60db7d8b28a47d1 .quad 0xa6bf14d61770a4f1 .quad 0xd4a1f89353ddbd58 .quad 0x6c514a63344243e9 .quad 0x2322204f3a156341 .quad 0xfb73e0e9ba0a032d .quad 0xfce0dd4c410f030e .quad 0x48daa596fb924aaa // 2^48 * 7 * B .quad 0x6eca8e665ca59cc7 .quad 0xa847254b2e38aca0 .quad 0x31afc708d21e17ce .quad 0x676dd6fccad84af7 .quad 0x14f61d5dc84c9793 .quad 0x9941f9e3ef418206 .quad 0xcdf5b88f346277ac .quad 0x58c837fa0e8a79a9 .quad 0x0cf9688596fc9058 .quad 0x1ddcbbf37b56a01b .quad 0xdcc2e77d4935d66a .quad 0x1c4f73f2c6a57f0a // 2^48 * 8 * B .quad 0x0e7a4fbd305fa0bb .quad 0x829d4ce054c663ad .quad 0xf421c3832fe33848 .quad 0x795ac80d1bf64c42 .quad 0xb36e706efc7c3484 .quad 0x73dfc9b4c3c1cf61 .quad 0xeb1d79c9781cc7e5 .quad 0x70459adb7daf675c .quad 0x1b91db4991b42bb3 .quad 0x572696234b02dcca .quad 0x9fdf9ee51f8c78dc .quad 0x5fe162848ce21fd3 // 2^52 * 1 * B .quad 0xe2790aae4d077c41 .quad 0x8b938270db7469a3 .quad 0x6eb632dc8abd16a2 .quad 0x720814ecaa064b72 .quad 0x315c29c795115389 .quad 0xd7e0e507862f74ce .quad 0x0c4a762185927432 .quad 0x72de6c984a25a1e4 .quad 0xae9ab553bf6aa310 .quad 0x050a50a9806d6e1b .quad 0x92bb7403adff5139 .quad 0x0394d27645be618b // 2^52 * 2 * B .quad 0x4d572251857eedf4 .quad 0xe3724edde19e93c5 .quad 0x8a71420e0b797035 .quad 0x3b3c833687abe743 .quad 0xf5396425b23545a4 .quad 0x15a7a27e98fbb296 .quad 0xab6c52bc636fdd86 .quad 0x79d995a8419334ee .quad 0xcd8a8ea61195dd75 .quad 0xa504d8a81dd9a82f .quad 0x540dca81a35879b6 .quad 0x60dd16a379c86a8a // 2^52 * 3 * B .quad 0x35a2c8487381e559 .quad 0x596ffea6d78082cb .quad 0xcb9771ebdba7b653 .quad 0x5a08b5019b4da685 .quad 0x3501d6f8153e47b8 .quad 0xb7a9675414a2f60c .quad 0x112ee8b6455d9523 .quad 0x4e62a3c18112ea8a .quad 0xc8d4ac04516ab786 .quad 0x595af3215295b23d .quad 0xd6edd234db0230c1 .quad 0x0929efe8825b41cc // 2^52 * 4 * B .quad 0x5f0601d1cbd0f2d3 .quad 0x736e412f6132bb7f .quad 0x83604432238dde87 .quad 0x1e3a5272f5c0753c .quad 0x8b3172b7ad56651d .quad 0x01581b7a3fabd717 .quad 0x2dc94df6424df6e4 .quad 0x30376e5d2c29284f .quad 0xd2918da78159a59c .quad 0x6bdc1cd93f0713f3 .quad 0x565f7a934acd6590 .quad 0x53daacec4cb4c128 // 2^52 * 5 * B .quad 0x4ca73bd79cc8a7d6 .quad 0x4d4a738f47e9a9b2 .quad 0xf4cbf12942f5fe00 .quad 0x01a13ff9bdbf0752 .quad 0x99852bc3852cfdb0 .quad 0x2cc12e9559d6ed0b .quad 0x70f9e2bf9b5ac27b .quad 0x4f3b8c117959ae99 .quad 0x55b6c9c82ff26412 .quad 0x1ac4a8c91fb667a8 .quad 0xd527bfcfeb778bf2 .quad 0x303337da7012a3be // 2^52 * 6 * B .quad 0x955422228c1c9d7c .quad 0x01fac1371a9b340f .quad 0x7e8d9177925b48d7 .quad 0x53f8ad5661b3e31b .quad 0x976d3ccbfad2fdd1 .quad 0xcb88839737a640a8 .quad 0x2ff00c1d6734cb25 .quad 0x269ff4dc789c2d2b .quad 0x0c003fbdc08d678d .quad 0x4d982fa37ead2b17 .quad 0xc07e6bcdb2e582f1 .quad 0x296c7291df412a44 // 2^52 * 7 * B .quad 0x7903de2b33daf397 .quad 0xd0ff0619c9a624b3 .quad 0x8a1d252b555b3e18 .quad 0x2b6d581c52e0b7c0 .quad 0xdfb23205dab8b59e .quad 0x465aeaa0c8092250 .quad 0xd133c1189a725d18 .quad 0x2327370261f117d1 .quad 0x3d0543d3623e7986 .quad 0x679414c2c278a354 .quad 0xae43f0cc726196f6 .quad 0x7836c41f8245eaba // 2^52 * 8 * B .quad 0xe7a254db49e95a81 .quad 0x5192d5d008b0ad73 .quad 0x4d20e5b1d00afc07 .quad 0x5d55f8012cf25f38 .quad 0xca651e848011937c .quad 0xc6b0c46e6ef41a28 .quad 0xb7021ba75f3f8d52 .quad 0x119dff99ead7b9fd .quad 0x43eadfcbf4b31d4d .quad 0xc6503f7411148892 .quad 0xfeee68c5060d3b17 .quad 0x329293b3dd4a0ac8 // 2^56 * 1 * B .quad 0x4e59214fe194961a .quad 0x49be7dc70d71cd4f .quad 0x9300cfd23b50f22d .quad 0x4789d446fc917232 .quad 0x2879852d5d7cb208 .quad 0xb8dedd70687df2e7 .quad 0xdc0bffab21687891 .quad 0x2b44c043677daa35 .quad 0x1a1c87ab074eb78e .quad 0xfac6d18e99daf467 .quad 0x3eacbbcd484f9067 .quad 0x60c52eef2bb9a4e4 // 2^56 * 2 * B .quad 0x0b5d89bc3bfd8bf1 .quad 0xb06b9237c9f3551a .quad 0x0e4c16b0d53028f5 .quad 0x10bc9c312ccfcaab .quad 0x702bc5c27cae6d11 .quad 0x44c7699b54a48cab .quad 0xefbc4056ba492eb2 .quad 0x70d77248d9b6676d .quad 0xaa8ae84b3ec2a05b .quad 0x98699ef4ed1781e0 .quad 0x794513e4708e85d1 .quad 0x63755bd3a976f413 // 2^56 * 3 * B .quad 0xb55fa03e2ad10853 .quad 0x356f75909ee63569 .quad 0x9ff9f1fdbe69b890 .quad 0x0d8cc1c48bc16f84 .quad 0x3dc7101897f1acb7 .quad 0x5dda7d5ec165bbd8 .quad 0x508e5b9c0fa1020f .quad 0x2763751737c52a56 .quad 0x029402d36eb419a9 .quad 0xf0b44e7e77b460a5 .quad 0xcfa86230d43c4956 .quad 0x70c2dd8a7ad166e7 // 2^56 * 4 * B .quad 0x656194509f6fec0e .quad 0xee2e7ea946c6518d .quad 0x9733c1f367e09b5c .quad 0x2e0fac6363948495 .quad 0x91d4967db8ed7e13 .quad 0x74252f0ad776817a .quad 0xe40982e00d852564 .quad 0x32b8613816a53ce5 .quad 0x79e7f7bee448cd64 .quad 0x6ac83a67087886d0 .quad 0xf89fd4d9a0e4db2e .quad 0x4179215c735a4f41 // 2^56 * 5 * B .quad 0x8c7094e7d7dced2a .quad 0x97fb8ac347d39c70 .quad 0xe13be033a906d902 .quad 0x700344a30cd99d76 .quad 0xe4ae33b9286bcd34 .quad 0xb7ef7eb6559dd6dc .quad 0x278b141fb3d38e1f .quad 0x31fa85662241c286 .quad 0xaf826c422e3622f4 .quad 0xc12029879833502d .quad 0x9bc1b7e12b389123 .quad 0x24bb2312a9952489 // 2^56 * 6 * B .quad 0xb1a8ed1732de67c3 .quad 0x3cb49418461b4948 .quad 0x8ebd434376cfbcd2 .quad 0x0fee3e871e188008 .quad 0x41f80c2af5f85c6b .quad 0x687284c304fa6794 .quad 0x8945df99a3ba1bad .quad 0x0d1d2af9ffeb5d16 .quad 0xa9da8aa132621edf .quad 0x30b822a159226579 .quad 0x4004197ba79ac193 .quad 0x16acd79718531d76 // 2^56 * 7 * B .quad 0x72df72af2d9b1d3d .quad 0x63462a36a432245a .quad 0x3ecea07916b39637 .quad 0x123e0ef6b9302309 .quad 0xc959c6c57887b6ad .quad 0x94e19ead5f90feba .quad 0x16e24e62a342f504 .quad 0x164ed34b18161700 .quad 0x487ed94c192fe69a .quad 0x61ae2cea3a911513 .quad 0x877bf6d3b9a4de27 .quad 0x78da0fc61073f3eb // 2^56 * 8 * B .quad 0x5bf15d28e52bc66a .quad 0x2c47e31870f01a8e .quad 0x2419afbc06c28bdd .quad 0x2d25deeb256b173a .quad 0xa29f80f1680c3a94 .quad 0x71f77e151ae9e7e6 .quad 0x1100f15848017973 .quad 0x054aa4b316b38ddd .quad 0xdfc8468d19267cb8 .quad 0x0b28789c66e54daf .quad 0x2aeb1d2a666eec17 .quad 0x134610a6ab7da760 // 2^60 * 1 * B .quad 0xcaf55ec27c59b23f .quad 0x99aeed3e154d04f2 .quad 0x68441d72e14141f4 .quad 0x140345133932a0a2 .quad 0xd91430e0dc028c3c .quad 0x0eb955a85217c771 .quad 0x4b09e1ed2c99a1fa .quad 0x42881af2bd6a743c .quad 0x7bfec69aab5cad3d .quad 0xc23e8cd34cb2cfad .quad 0x685dd14bfb37d6a2 .quad 0x0ad6d64415677a18 // 2^60 * 2 * B .quad 0x781a439e417becb5 .quad 0x4ac5938cd10e0266 .quad 0x5da385110692ac24 .quad 0x11b065a2ade31233 .quad 0x7914892847927e9f .quad 0x33dad6ef370aa877 .quad 0x1f8f24fa11122703 .quad 0x5265ac2f2adf9592 .quad 0x405fdd309afcb346 .quad 0xd9723d4428e63f54 .quad 0x94c01df05f65aaae .quad 0x43e4dc3ae14c0809 // 2^60 * 3 * B .quad 0xbc12c7f1a938a517 .quad 0x473028ab3180b2e1 .quad 0x3f78571efbcd254a .quad 0x74e534426ff6f90f .quad 0xea6f7ac3adc2c6a3 .quad 0xd0e928f6e9717c94 .quad 0xe2d379ead645eaf5 .quad 0x46dd8785c51ffbbe .quad 0x709801be375c8898 .quad 0x4b06dab5e3fd8348 .quad 0x75880ced27230714 .quad 0x2b09468fdd2f4c42 // 2^60 * 4 * B .quad 0x97c749eeb701cb96 .quad 0x83f438d4b6a369c3 .quad 0x62962b8b9a402cd9 .quad 0x6976c7509888df7b .quad 0x5b97946582ffa02a .quad 0xda096a51fea8f549 .quad 0xa06351375f77af9b .quad 0x1bcfde61201d1e76 .quad 0x4a4a5490246a59a2 .quad 0xd63ebddee87fdd90 .quad 0xd9437c670d2371fa .quad 0x69e87308d30f8ed6 // 2^60 * 5 * B .quad 0x435a8bb15656beb0 .quad 0xf8fac9ba4f4d5bca .quad 0xb9b278c41548c075 .quad 0x3eb0ef76e892b622 .quad 0x0f80bf028bc80303 .quad 0x6aae16b37a18cefb .quad 0xdd47ea47d72cd6a3 .quad 0x61943588f4ed39aa .quad 0xd26e5c3e91039f85 .quad 0xc0e9e77df6f33aa9 .quad 0xe8968c5570066a93 .quad 0x3c34d1881faaaddd // 2^60 * 6 * B .quad 0x3f9d2b5ea09f9ec0 .quad 0x1dab3b6fb623a890 .quad 0xa09ba3ea72d926c4 .quad 0x374193513fd8b36d .quad 0xbd5b0b8f2fffe0d9 .quad 0x6aa254103ed24fb9 .quad 0x2ac7d7bcb26821c4 .quad 0x605b394b60dca36a .quad 0xb4e856e45a9d1ed2 .quad 0xefe848766c97a9a2 .quad 0xb104cf641e5eee7d .quad 0x2f50b81c88a71c8f // 2^60 * 7 * B .quad 0x31723c61fc6811bb .quad 0x9cb450486211800f .quad 0x768933d347995753 .quad 0x3491a53502752fcd .quad 0x2b552ca0a7da522a .quad 0x3230b336449b0250 .quad 0xf2c4c5bca4b99fb9 .quad 0x7b2c674958074a22 .quad 0xd55165883ed28cdf .quad 0x12d84fd2d362de39 .quad 0x0a874ad3e3378e4f .quad 0x000d2b1f7c763e74 // 2^60 * 8 * B .quad 0x3d420811d06d4a67 .quad 0xbefc048590e0ffe3 .quad 0xf870c6b7bd487bde .quad 0x6e2a7316319afa28 .quad 0x9624778c3e94a8ab .quad 0x0ad6f3cee9a78bec .quad 0x948ac7810d743c4f .quad 0x76627935aaecfccc .quad 0x56a8ac24d6d59a9f .quad 0xc8db753e3096f006 .quad 0x477f41e68f4c5299 .quad 0x588d851cf6c86114 // 2^64 * 1 * B .quad 0x51138ec78df6b0fe .quad 0x5397da89e575f51b .quad 0x09207a1d717af1b9 .quad 0x2102fdba2b20d650 .quad 0xcd2a65e777d1f515 .quad 0x548991878faa60f1 .quad 0xb1b73bbcdabc06e5 .quad 0x654878cba97cc9fb .quad 0x969ee405055ce6a1 .quad 0x36bca7681251ad29 .quad 0x3a1af517aa7da415 .quad 0x0ad725db29ecb2ba // 2^64 * 2 * B .quad 0xdc4267b1834e2457 .quad 0xb67544b570ce1bc5 .quad 0x1af07a0bf7d15ed7 .quad 0x4aefcffb71a03650 .quad 0xfec7bc0c9b056f85 .quad 0x537d5268e7f5ffd7 .quad 0x77afc6624312aefa .quad 0x4f675f5302399fd9 .quad 0xc32d36360415171e .quad 0xcd2bef118998483b .quad 0x870a6eadd0945110 .quad 0x0bccbb72a2a86561 // 2^64 * 3 * B .quad 0x185e962feab1a9c8 .quad 0x86e7e63565147dcd .quad 0xb092e031bb5b6df2 .quad 0x4024f0ab59d6b73e .quad 0x186d5e4c50fe1296 .quad 0xe0397b82fee89f7e .quad 0x3bc7f6c5507031b0 .quad 0x6678fd69108f37c2 .quad 0x1586fa31636863c2 .quad 0x07f68c48572d33f2 .quad 0x4f73cc9f789eaefc .quad 0x2d42e2108ead4701 // 2^64 * 4 * B .quad 0x97f5131594dfd29b .quad 0x6155985d313f4c6a .quad 0xeba13f0708455010 .quad 0x676b2608b8d2d322 .quad 0x21717b0d0f537593 .quad 0x914e690b131e064c .quad 0x1bb687ae752ae09f .quad 0x420bf3a79b423c6e .quad 0x8138ba651c5b2b47 .quad 0x8671b6ec311b1b80 .quad 0x7bff0cb1bc3135b0 .quad 0x745d2ffa9c0cf1e0 // 2^64 * 5 * B .quad 0xbf525a1e2bc9c8bd .quad 0xea5b260826479d81 .quad 0xd511c70edf0155db .quad 0x1ae23ceb960cf5d0 .quad 0x6036df5721d34e6a .quad 0xb1db8827997bb3d0 .quad 0xd3c209c3c8756afa .quad 0x06e15be54c1dc839 .quad 0x5b725d871932994a .quad 0x32351cb5ceb1dab0 .quad 0x7dc41549dab7ca05 .quad 0x58ded861278ec1f7 // 2^64 * 6 * B .quad 0xd8173793f266c55c .quad 0xc8c976c5cc454e49 .quad 0x5ce382f8bc26c3a8 .quad 0x2ff39de85485f6f9 .quad 0x2dfb5ba8b6c2c9a8 .quad 0x48eeef8ef52c598c .quad 0x33809107f12d1573 .quad 0x08ba696b531d5bd8 .quad 0x77ed3eeec3efc57a .quad 0x04e05517d4ff4811 .quad 0xea3d7a3ff1a671cb .quad 0x120633b4947cfe54 // 2^64 * 7 * B .quad 0x0b94987891610042 .quad 0x4ee7b13cecebfae8 .quad 0x70be739594f0a4c0 .quad 0x35d30a99b4d59185 .quad 0x82bd31474912100a .quad 0xde237b6d7e6fbe06 .quad 0xe11e761911ea79c6 .quad 0x07433be3cb393bde .quad 0xff7944c05ce997f4 .quad 0x575d3de4b05c51a3 .quad 0x583381fd5a76847c .quad 0x2d873ede7af6da9f // 2^64 * 8 * B .quad 0x157a316443373409 .quad 0xfab8b7eef4aa81d9 .quad 0xb093fee6f5a64806 .quad 0x2e773654707fa7b6 .quad 0xaa6202e14e5df981 .quad 0xa20d59175015e1f5 .quad 0x18a275d3bae21d6c .quad 0x0543618a01600253 .quad 0x0deabdf4974c23c1 .quad 0xaa6f0a259dce4693 .quad 0x04202cb8a29aba2c .quad 0x4b1443362d07960d // 2^68 * 1 * B .quad 0x47b837f753242cec .quad 0x256dc48cc04212f2 .quad 0xe222fbfbe1d928c5 .quad 0x48ea295bad8a2c07 .quad 0x299b1c3f57c5715e .quad 0x96cb929e6b686d90 .quad 0x3004806447235ab3 .quad 0x2c435c24a44d9fe1 .quad 0x0607c97c80f8833f .quad 0x0e851578ca25ec5b .quad 0x54f7450b161ebb6f .quad 0x7bcb4792a0def80e // 2^68 * 2 * B .quad 0x8487e3d02bc73659 .quad 0x4baf8445059979df .quad 0xd17c975adcad6fbf .quad 0x57369f0bdefc96b6 .quad 0x1cecd0a0045224c2 .quad 0x757f1b1b69e53952 .quad 0x775b7a925289f681 .quad 0x1b6cc62016736148 .quad 0xf1a9990175638698 .quad 0x353dd1beeeaa60d3 .quad 0x849471334c9ba488 .quad 0x63fa6e6843ade311 // 2^68 * 3 * B .quad 0xd15c20536597c168 .quad 0x9f73740098d28789 .quad 0x18aee7f13257ba1f .quad 0x3418bfda07346f14 .quad 0x2195becdd24b5eb7 .quad 0x5e41f18cc0cd44f9 .quad 0xdf28074441ca9ede .quad 0x07073b98f35b7d67 .quad 0xd03c676c4ce530d4 .quad 0x0b64c0473b5df9f4 .quad 0x065cef8b19b3a31e .quad 0x3084d661533102c9 // 2^68 * 4 * B .quad 0xe1f6b79ebf8469ad .quad 0x15801004e2663135 .quad 0x9a498330af74181b .quad 0x3ba2504f049b673c .quad 0x9a6ce876760321fd .quad 0x7fe2b5109eb63ad8 .quad 0x00e7d4ae8ac80592 .quad 0x73d86b7abb6f723a .quad 0x0b52b5606dba5ab6 .quad 0xa9134f0fbbb1edab .quad 0x30a9520d9b04a635 .quad 0x6813b8f37973e5db // 2^68 * 5 * B .quad 0x9854b054334127c1 .quad 0x105d047882fbff25 .quad 0xdb49f7f944186f4f .quad 0x1768e838bed0b900 .quad 0xf194ca56f3157e29 .quad 0x136d35705ef528a5 .quad 0xdd4cef778b0599bc .quad 0x7d5472af24f833ed .quad 0xd0ef874daf33da47 .quad 0x00d3be5db6e339f9 .quad 0x3f2a8a2f9c9ceece .quad 0x5d1aeb792352435a // 2^68 * 6 * B .quad 0xf59e6bb319cd63ca .quad 0x670c159221d06839 .quad 0xb06d565b2150cab6 .quad 0x20fb199d104f12a3 .quad 0x12c7bfaeb61ba775 .quad 0xb84e621fe263bffd .quad 0x0b47a5c35c840dcf .quad 0x7e83be0bccaf8634 .quad 0x61943dee6d99c120 .quad 0x86101f2e460b9fe0 .quad 0x6bb2f1518ee8598d .quad 0x76b76289fcc475cc // 2^68 * 7 * B .quad 0x791b4cc1756286fa .quad 0xdbced317d74a157c .quad 0x7e732421ea72bde6 .quad 0x01fe18491131c8e9 .quad 0x4245f1a1522ec0b3 .quad 0x558785b22a75656d .quad 0x1d485a2548a1b3c0 .quad 0x60959eccd58fe09f .quad 0x3ebfeb7ba8ed7a09 .quad 0x49fdc2bbe502789c .quad 0x44ebce5d3c119428 .quad 0x35e1eb55be947f4a // 2^68 * 8 * B .quad 0xdbdae701c5738dd3 .quad 0xf9c6f635b26f1bee .quad 0x61e96a8042f15ef4 .quad 0x3aa1d11faf60a4d8 .quad 0x14fd6dfa726ccc74 .quad 0x3b084cfe2f53b965 .quad 0xf33ae4f552a2c8b4 .quad 0x59aab07a0d40166a .quad 0x77bcec4c925eac25 .quad 0x1848718460137738 .quad 0x5b374337fea9f451 .quad 0x1865e78ec8e6aa46 // 2^72 * 1 * B .quad 0xccc4b7c7b66e1f7a .quad 0x44157e25f50c2f7e .quad 0x3ef06dfc713eaf1c .quad 0x582f446752da63f7 .quad 0x967c54e91c529ccb .quad 0x30f6269264c635fb .quad 0x2747aff478121965 .quad 0x17038418eaf66f5c .quad 0xc6317bd320324ce4 .quad 0xa81042e8a4488bc4 .quad 0xb21ef18b4e5a1364 .quad 0x0c2a1c4bcda28dc9 // 2^72 * 2 * B .quad 0xd24dc7d06f1f0447 .quad 0xb2269e3edb87c059 .quad 0xd15b0272fbb2d28f .quad 0x7c558bd1c6f64877 .quad 0xedc4814869bd6945 .quad 0x0d6d907dbe1c8d22 .quad 0xc63bd212d55cc5ab .quad 0x5a6a9b30a314dc83 .quad 0xd0ec1524d396463d .quad 0x12bb628ac35a24f0 .quad 0xa50c3a791cbc5fa4 .quad 0x0404a5ca0afbafc3 // 2^72 * 3 * B .quad 0x8c1f40070aa743d6 .quad 0xccbad0cb5b265ee8 .quad 0x574b046b668fd2de .quad 0x46395bfdcadd9633 .quad 0x62bc9e1b2a416fd1 .quad 0xb5c6f728e350598b .quad 0x04343fd83d5d6967 .quad 0x39527516e7f8ee98 .quad 0x117fdb2d1a5d9a9c .quad 0x9c7745bcd1005c2a .quad 0xefd4bef154d56fea .quad 0x76579a29e822d016 // 2^72 * 4 * B .quad 0x45b68e7e49c02a17 .quad 0x23cd51a2bca9a37f .quad 0x3ed65f11ec224c1b .quad 0x43a384dc9e05bdb1 .quad 0x333cb51352b434f2 .quad 0xd832284993de80e1 .quad 0xb5512887750d35ce .quad 0x02c514bb2a2777c1 .quad 0x684bd5da8bf1b645 .quad 0xfb8bd37ef6b54b53 .quad 0x313916d7a9b0d253 .quad 0x1160920961548059 // 2^72 * 5 * B .quad 0xb44d166929dacfaa .quad 0xda529f4c8413598f .quad 0xe9ef63ca453d5559 .quad 0x351e125bc5698e0b .quad 0x7a385616369b4dcd .quad 0x75c02ca7655c3563 .quad 0x7dc21bf9d4f18021 .quad 0x2f637d7491e6e042 .quad 0xd4b49b461af67bbe .quad 0xd603037ac8ab8961 .quad 0x71dee19ff9a699fb .quad 0x7f182d06e7ce2a9a // 2^72 * 6 * B .quad 0x7a7c8e64ab0168ec .quad 0xcb5a4a5515edc543 .quad 0x095519d347cd0eda .quad 0x67d4ac8c343e93b0 .quad 0x09454b728e217522 .quad 0xaa58e8f4d484b8d8 .quad 0xd358254d7f46903c .quad 0x44acc043241c5217 .quad 0x1c7d6bbb4f7a5777 .quad 0x8b35fed4918313e1 .quad 0x4adca1c6c96b4684 .quad 0x556d1c8312ad71bd // 2^72 * 7 * B .quad 0x17ef40e30c8d3982 .quad 0x31f7073e15a3fa34 .quad 0x4f21f3cb0773646e .quad 0x746c6c6d1d824eff .quad 0x81f06756b11be821 .quad 0x0faff82310a3f3dd .quad 0xf8b2d0556a99465d .quad 0x097abe38cc8c7f05 .quad 0x0c49c9877ea52da4 .quad 0x4c4369559bdc1d43 .quad 0x022c3809f7ccebd2 .quad 0x577e14a34bee84bd // 2^72 * 8 * B .quad 0xf0e268ac61a73b0a .quad 0xf2fafa103791a5f5 .quad 0xc1e13e826b6d00e9 .quad 0x60fa7ee96fd78f42 .quad 0x94fecebebd4dd72b .quad 0xf46a4fda060f2211 .quad 0x124a5977c0c8d1ff .quad 0x705304b8fb009295 .quad 0xb63d1d354d296ec6 .quad 0xf3c3053e5fad31d8 .quad 0x670b958cb4bd42ec .quad 0x21398e0ca16353fd // 2^76 * 1 * B .quad 0x216ab2ca8da7d2ef .quad 0x366ad9dd99f42827 .quad 0xae64b9004fdd3c75 .quad 0x403a395b53909e62 .quad 0x86c5fc16861b7e9a .quad 0xf6a330476a27c451 .quad 0x01667267a1e93597 .quad 0x05ffb9cd6082dfeb .quad 0xa617fa9ff53f6139 .quad 0x60f2b5e513e66cb6 .quad 0xd7a8beefb3448aa4 .quad 0x7a2932856f5ea192 // 2^76 * 2 * B .quad 0x0b39d761b02de888 .quad 0x5f550e7ed2414e1f .quad 0xa6bfa45822e1a940 .quad 0x050a2f7dfd447b99 .quad 0xb89c444879639302 .quad 0x4ae4f19350c67f2c .quad 0xf0b35da8c81af9c6 .quad 0x39d0003546871017 .quad 0x437c3b33a650db77 .quad 0x6bafe81dbac52bb2 .quad 0xfe99402d2db7d318 .quad 0x2b5b7eec372ba6ce // 2^76 * 3 * B .quad 0xb3bc4bbd83f50eef .quad 0x508f0c998c927866 .quad 0x43e76587c8b7e66e .quad 0x0f7655a3a47f98d9 .quad 0xa694404d613ac8f4 .quad 0x500c3c2bfa97e72c .quad 0x874104d21fcec210 .quad 0x1b205fb38604a8ee .quad 0x55ecad37d24b133c .quad 0x441e147d6038c90b .quad 0x656683a1d62c6fee .quad 0x0157d5dc87e0ecae // 2^76 * 4 * B .quad 0xf2a7af510354c13d .quad 0xd7a0b145aa372b60 .quad 0x2869b96a05a3d470 .quad 0x6528e42d82460173 .quad 0x95265514d71eb524 .quad 0xe603d8815df14593 .quad 0x147cdf410d4de6b7 .quad 0x5293b1730437c850 .quad 0x23d0e0814bccf226 .quad 0x92c745cd8196fb93 .quad 0x8b61796c59541e5b .quad 0x40a44df0c021f978 // 2^76 * 5 * B .quad 0xdaa869894f20ea6a .quad 0xea14a3d14c620618 .quad 0x6001fccb090bf8be .quad 0x35f4e822947e9cf0 .quad 0x86c96e514bc5d095 .quad 0xf20d4098fca6804a .quad 0x27363d89c826ea5d .quad 0x39ca36565719cacf .quad 0x97506f2f6f87b75c .quad 0xc624aea0034ae070 .quad 0x1ec856e3aad34dd6 .quad 0x055b0be0e440e58f // 2^76 * 6 * B .quad 0x6469a17d89735d12 .quad 0xdb6f27d5e662b9f1 .quad 0x9fcba3286a395681 .quad 0x363b8004d269af25 .quad 0x4d12a04b6ea33da2 .quad 0x57cf4c15e36126dd .quad 0x90ec9675ee44d967 .quad 0x64ca348d2a985aac .quad 0x99588e19e4c4912d .quad 0xefcc3b4e1ca5ce6b .quad 0x4522ea60fa5b98d5 .quad 0x7064bbab1de4a819 // 2^76 * 7 * B .quad 0xb919e1515a770641 .quad 0xa9a2e2c74e7f8039 .quad 0x7527250b3df23109 .quad 0x756a7330ac27b78b .quad 0xa290c06142542129 .quad 0xf2e2c2aebe8d5b90 .quad 0xcf2458db76abfe1b .quad 0x02157ade83d626bf .quad 0x3e46972a1b9a038b .quad 0x2e4ee66a7ee03fb4 .quad 0x81a248776edbb4ca .quad 0x1a944ee88ecd0563 // 2^76 * 8 * B .quad 0xd5a91d1151039372 .quad 0x2ed377b799ca26de .quad 0xa17202acfd366b6b .quad 0x0730291bd6901995 .quad 0xbb40a859182362d6 .quad 0xb99f55778a4d1abb .quad 0x8d18b427758559f6 .quad 0x26c20fe74d26235a .quad 0x648d1d9fe9cc22f5 .quad 0x66bc561928dd577c .quad 0x47d3ed21652439d1 .quad 0x49d271acedaf8b49 // 2^80 * 1 * B .quad 0x89f5058a382b33f3 .quad 0x5ae2ba0bad48c0b4 .quad 0x8f93b503a53db36e .quad 0x5aa3ed9d95a232e6 .quad 0x2798aaf9b4b75601 .quad 0x5eac72135c8dad72 .quad 0xd2ceaa6161b7a023 .quad 0x1bbfb284e98f7d4e .quad 0x656777e9c7d96561 .quad 0xcb2b125472c78036 .quad 0x65053299d9506eee .quad 0x4a07e14e5e8957cc // 2^80 * 2 * B .quad 0x4ee412cb980df999 .quad 0xa315d76f3c6ec771 .quad 0xbba5edde925c77fd .quad 0x3f0bac391d313402 .quad 0x240b58cdc477a49b .quad 0xfd38dade6447f017 .quad 0x19928d32a7c86aad .quad 0x50af7aed84afa081 .quad 0x6e4fde0115f65be5 .quad 0x29982621216109b2 .quad 0x780205810badd6d9 .quad 0x1921a316baebd006 // 2^80 * 3 * B .quad 0x89422f7edfb870fc .quad 0x2c296beb4f76b3bd .quad 0x0738f1d436c24df7 .quad 0x6458df41e273aeb0 .quad 0xd75aad9ad9f3c18b .quad 0x566a0eef60b1c19c .quad 0x3e9a0bac255c0ed9 .quad 0x7b049deca062c7f5 .quad 0xdccbe37a35444483 .quad 0x758879330fedbe93 .quad 0x786004c312c5dd87 .quad 0x6093dccbc2950e64 // 2^80 * 4 * B .quad 0x1ff39a8585e0706d .quad 0x36d0a5d8b3e73933 .quad 0x43b9f2e1718f453b .quad 0x57d1ea084827a97c .quad 0x6bdeeebe6084034b .quad 0x3199c2b6780fb854 .quad 0x973376abb62d0695 .quad 0x6e3180c98b647d90 .quad 0xee7ab6e7a128b071 .quad 0xa4c1596d93a88baa .quad 0xf7b4de82b2216130 .quad 0x363e999ddd97bd18 // 2^80 * 5 * B .quad 0x96a843c135ee1fc4 .quad 0x976eb35508e4c8cf .quad 0xb42f6801b58cd330 .quad 0x48ee9b78693a052b .quad 0x2f1848dce24baec6 .quad 0x769b7255babcaf60 .quad 0x90cb3c6e3cefe931 .quad 0x231f979bc6f9b355 .quad 0x5c31de4bcc2af3c6 .quad 0xb04bb030fe208d1f .quad 0xb78d7009c14fb466 .quad 0x079bfa9b08792413 // 2^80 * 6 * B .quad 0xe3903a51da300df4 .quad 0x843964233da95ab0 .quad 0xed3cf12d0b356480 .quad 0x038c77f684817194 .quad 0xf3c9ed80a2d54245 .quad 0x0aa08b7877f63952 .quad 0xd76dac63d1085475 .quad 0x1ef4fb159470636b .quad 0x854e5ee65b167bec .quad 0x59590a4296d0cdc2 .quad 0x72b2df3498102199 .quad 0x575ee92a4a0bff56 // 2^80 * 7 * B .quad 0xd4c080908a182fcf .quad 0x30e170c299489dbd .quad 0x05babd5752f733de .quad 0x43d4e7112cd3fd00 .quad 0x5d46bc450aa4d801 .quad 0xc3af1227a533b9d8 .quad 0x389e3b262b8906c2 .quad 0x200a1e7e382f581b .quad 0x518db967eaf93ac5 .quad 0x71bc989b056652c0 .quad 0xfe2b85d9567197f5 .quad 0x050eca52651e4e38 // 2^80 * 8 * B .quad 0xc3431ade453f0c9c .quad 0xe9f5045eff703b9b .quad 0xfcd97ac9ed847b3d .quad 0x4b0ee6c21c58f4c6 .quad 0x97ac397660e668ea .quad 0x9b19bbfe153ab497 .quad 0x4cb179b534eca79f .quad 0x6151c09fa131ae57 .quad 0x3af55c0dfdf05d96 .quad 0xdd262ee02ab4ee7a .quad 0x11b2bb8712171709 .quad 0x1fef24fa800f030b // 2^84 * 1 * B .quad 0xb496123a6b6c6609 .quad 0xa750fe8580ab5938 .quad 0xf471bf39b7c27a5f .quad 0x507903ce77ac193c .quad 0xff91a66a90166220 .quad 0xf22552ae5bf1e009 .quad 0x7dff85d87f90df7c .quad 0x4f620ffe0c736fb9 .quad 0x62f90d65dfde3e34 .quad 0xcf28c592b9fa5fad .quad 0x99c86ef9c6164510 .quad 0x25d448044a256c84 // 2^84 * 2 * B .quad 0xbd68230ec7e9b16f .quad 0x0eb1b9c1c1c5795d .quad 0x7943c8c495b6b1ff .quad 0x2f9faf620bbacf5e .quad 0x2c7c4415c9022b55 .quad 0x56a0d241812eb1fe .quad 0xf02ea1c9d7b65e0d .quad 0x4180512fd5323b26 .quad 0xa4ff3e698a48a5db .quad 0xba6a3806bd95403b .quad 0x9f7ce1af47d5b65d .quad 0x15e087e55939d2fb // 2^84 * 3 * B .quad 0x12207543745c1496 .quad 0xdaff3cfdda38610c .quad 0xe4e797272c71c34f .quad 0x39c07b1934bdede9 .quad 0x8894186efb963f38 .quad 0x48a00e80dc639bd5 .quad 0xa4e8092be96c1c99 .quad 0x5a097d54ca573661 .quad 0x2d45892b17c9e755 .quad 0xd033fd7289308df8 .quad 0x6c2fe9d9525b8bd9 .quad 0x2edbecf1c11cc079 // 2^84 * 4 * B .quad 0x1616a4e3c715a0d2 .quad 0x53623cb0f8341d4d .quad 0x96ef5329c7e899cb .quad 0x3d4e8dbba668baa6 .quad 0xee0f0fddd087a25f .quad 0x9c7531555c3e34ee .quad 0x660c572e8fab3ab5 .quad 0x0854fc44544cd3b2 .quad 0x61eba0c555edad19 .quad 0x24b533fef0a83de6 .quad 0x3b77042883baa5f8 .quad 0x678f82b898a47e8d // 2^84 * 5 * B .quad 0xb1491d0bd6900c54 .quad 0x3539722c9d132636 .quad 0x4db928920b362bc9 .quad 0x4d7cd1fea68b69df .quad 0x1e09d94057775696 .quad 0xeed1265c3cd951db .quad 0xfa9dac2b20bce16f .quad 0x0f7f76e0e8d089f4 .quad 0x36d9ebc5d485b00c .quad 0xa2596492e4adb365 .quad 0xc1659480c2119ccd .quad 0x45306349186e0d5f // 2^84 * 6 * B .quad 0x94ddd0c1a6cdff1d .quad 0x55f6f115e84213ae .quad 0x6c935f85992fcf6a .quad 0x067ee0f54a37f16f .quad 0x96a414ec2b072491 .quad 0x1bb2218127a7b65b .quad 0x6d2849596e8a4af0 .quad 0x65f3b08ccd27765f .quad 0xecb29fff199801f7 .quad 0x9d361d1fa2a0f72f .quad 0x25f11d2375fd2f49 .quad 0x124cefe80fe10fe2 // 2^84 * 7 * B .quad 0x4c126cf9d18df255 .quad 0xc1d471e9147a63b6 .quad 0x2c6d3c73f3c93b5f .quad 0x6be3a6a2e3ff86a2 .quad 0x1518e85b31b16489 .quad 0x8faadcb7db710bfb .quad 0x39b0bdf4a14ae239 .quad 0x05f4cbea503d20c1 .quad 0xce040e9ec04145bc .quad 0xc71ff4e208f6834c .quad 0xbd546e8dab8847a3 .quad 0x64666aa0a4d2aba5 // 2^84 * 8 * B .quad 0x6841435a7c06d912 .quad 0xca123c21bb3f830b .quad 0xd4b37b27b1cbe278 .quad 0x1d753b84c76f5046 .quad 0xb0c53bf73337e94c .quad 0x7cb5697e11e14f15 .quad 0x4b84abac1930c750 .quad 0x28dd4abfe0640468 .quad 0x7dc0b64c44cb9f44 .quad 0x18a3e1ace3925dbf .quad 0x7a3034862d0457c4 .quad 0x4c498bf78a0c892e // 2^88 * 1 * B .quad 0x37d653fb1aa73196 .quad 0x0f9495303fd76418 .quad 0xad200b09fb3a17b2 .quad 0x544d49292fc8613e .quad 0x22d2aff530976b86 .quad 0x8d90b806c2d24604 .quad 0xdca1896c4de5bae5 .quad 0x28005fe6c8340c17 .quad 0x6aefba9f34528688 .quad 0x5c1bff9425107da1 .quad 0xf75bbbcd66d94b36 .quad 0x72e472930f316dfa // 2^88 * 2 * B .quad 0x2695208c9781084f .quad 0xb1502a0b23450ee1 .quad 0xfd9daea603efde02 .quad 0x5a9d2e8c2733a34c .quad 0x07f3f635d32a7627 .quad 0x7aaa4d865f6566f0 .quad 0x3c85e79728d04450 .quad 0x1fee7f000fe06438 .quad 0x765305da03dbf7e5 .quad 0xa4daf2491434cdbd .quad 0x7b4ad5cdd24a88ec .quad 0x00f94051ee040543 // 2^88 * 3 * B .quad 0x8d356b23c3d330b2 .quad 0xf21c8b9bb0471b06 .quad 0xb36c316c6e42b83c .quad 0x07d79c7e8beab10d .quad 0xd7ef93bb07af9753 .quad 0x583ed0cf3db766a7 .quad 0xce6998bf6e0b1ec5 .quad 0x47b7ffd25dd40452 .quad 0x87fbfb9cbc08dd12 .quad 0x8a066b3ae1eec29b .quad 0x0d57242bdb1fc1bf .quad 0x1c3520a35ea64bb6 // 2^88 * 4 * B .quad 0x80d253a6bccba34a .quad 0x3e61c3a13838219b .quad 0x90c3b6019882e396 .quad 0x1c3d05775d0ee66f .quad 0xcda86f40216bc059 .quad 0x1fbb231d12bcd87e .quad 0xb4956a9e17c70990 .quad 0x38750c3b66d12e55 .quad 0x692ef1409422e51a .quad 0xcbc0c73c2b5df671 .quad 0x21014fe7744ce029 .quad 0x0621e2c7d330487c // 2^88 * 5 * B .quad 0xaf9860cc8259838d .quad 0x90ea48c1c69f9adc .quad 0x6526483765581e30 .quad 0x0007d6097bd3a5bc .quad 0xb7ae1796b0dbf0f3 .quad 0x54dfafb9e17ce196 .quad 0x25923071e9aaa3b4 .quad 0x5d8e589ca1002e9d .quad 0xc0bf1d950842a94b .quad 0xb2d3c363588f2e3e .quad 0x0a961438bb51e2ef .quad 0x1583d7783c1cbf86 // 2^88 * 6 * B .quad 0xeceea2ef5da27ae1 .quad 0x597c3a1455670174 .quad 0xc9a62a126609167a .quad 0x252a5f2e81ed8f70 .quad 0x90034704cc9d28c7 .quad 0x1d1b679ef72cc58f .quad 0x16e12b5fbe5b8726 .quad 0x4958064e83c5580a .quad 0x0d2894265066e80d .quad 0xfcc3f785307c8c6b .quad 0x1b53da780c1112fd .quad 0x079c170bd843b388 // 2^88 * 7 * B .quad 0x0506ece464fa6fff .quad 0xbee3431e6205e523 .quad 0x3579422451b8ea42 .quad 0x6dec05e34ac9fb00 .quad 0xcdd6cd50c0d5d056 .quad 0x9af7686dbb03573b .quad 0x3ca6723ff3c3ef48 .quad 0x6768c0d7317b8acc .quad 0x94b625e5f155c1b3 .quad 0x417bf3a7997b7b91 .quad 0xc22cbddc6d6b2600 .quad 0x51445e14ddcd52f4 // 2^88 * 8 * B .quad 0x57502b4b3b144951 .quad 0x8e67ff6b444bbcb3 .quad 0xb8bd6927166385db .quad 0x13186f31e39295c8 .quad 0x893147ab2bbea455 .quad 0x8c53a24f92079129 .quad 0x4b49f948be30f7a7 .quad 0x12e990086e4fd43d .quad 0xf10c96b37fdfbb2e .quad 0x9f9a935e121ceaf9 .quad 0xdf1136c43a5b983f .quad 0x77b2e3f05d3e99af // 2^92 * 1 * B .quad 0xfd0d75879cf12657 .quad 0xe82fef94e53a0e29 .quad 0xcc34a7f05bbb4be7 .quad 0x0b251172a50c38a2 .quad 0x9532f48fcc5cd29b .quad 0x2ba851bea3ce3671 .quad 0x32dacaa051122941 .quad 0x478d99d9350004f2 .quad 0x1d5ad94890bb02c0 .quad 0x50e208b10ec25115 .quad 0xa26a22894ef21702 .quad 0x4dc923343b524805 // 2^92 * 2 * B .quad 0xe3828c400f8086b6 .quad 0x3f77e6f7979f0dc8 .quad 0x7ef6de304df42cb4 .quad 0x5265797cb6abd784 .quad 0x3ad3e3ebf36c4975 .quad 0xd75d25a537862125 .quad 0xe873943da025a516 .quad 0x6bbc7cb4c411c847 .quad 0x3c6f9cd1d4a50d56 .quad 0xb6244077c6feab7e .quad 0x6ff9bf483580972e .quad 0x00375883b332acfb // 2^92 * 3 * B .quad 0x0001b2cd28cb0940 .quad 0x63fb51a06f1c24c9 .quad 0xb5ad8691dcd5ca31 .quad 0x67238dbd8c450660 .quad 0xc98bec856c75c99c .quad 0xe44184c000e33cf4 .quad 0x0a676b9bba907634 .quad 0x669e2cb571f379d7 .quad 0xcb116b73a49bd308 .quad 0x025aad6b2392729e .quad 0xb4793efa3f55d9b1 .quad 0x72a1056140678bb9 // 2^92 * 4 * B .quad 0xa2b6812b1cc9249d .quad 0x62866eee21211f58 .quad 0x2cb5c5b85df10ece .quad 0x03a6b259e263ae00 .quad 0x0d8d2909e2e505b6 .quad 0x98ca78abc0291230 .quad 0x77ef5569a9b12327 .quad 0x7c77897b81439b47 .quad 0xf1c1b5e2de331cb5 .quad 0x5a9f5d8e15fca420 .quad 0x9fa438f17bd932b1 .quad 0x2a381bf01c6146e7 // 2^92 * 5 * B .quad 0xac9b9879cfc811c1 .quad 0x8b7d29813756e567 .quad 0x50da4e607c70edfc .quad 0x5dbca62f884400b6 .quad 0xf7c0be32b534166f .quad 0x27e6ca6419cf70d4 .quad 0x934df7d7a957a759 .quad 0x5701461dabdec2aa .quad 0x2c6747402c915c25 .quad 0x1bdcd1a80b0d340a .quad 0x5e5601bd07b43f5f .quad 0x2555b4e05539a242 // 2^92 * 6 * B .quad 0x6fc09f5266ddd216 .quad 0xdce560a7c8e37048 .quad 0xec65939da2df62fd .quad 0x7a869ae7e52ed192 .quad 0x78409b1d87e463d4 .quad 0xad4da95acdfb639d .quad 0xec28773755259b9c .quad 0x69c806e9c31230ab .quad 0x7b48f57414bb3f22 .quad 0x68c7cee4aedccc88 .quad 0xed2f936179ed80be .quad 0x25d70b885f77bc4b // 2^92 * 7 * B .quad 0x4151c3d9762bf4de .quad 0x083f435f2745d82b .quad 0x29775a2e0d23ddd5 .quad 0x138e3a6269a5db24 .quad 0x98459d29bb1ae4d4 .quad 0x56b9c4c739f954ec .quad 0x832743f6c29b4b3e .quad 0x21ea8e2798b6878a .quad 0x87bef4b46a5a7b9c .quad 0xd2299d1b5fc1d062 .quad 0x82409818dd321648 .quad 0x5c5abeb1e5a2e03d // 2^92 * 8 * B .quad 0x14722af4b73c2ddb .quad 0xbc470c5f5a05060d .quad 0x00943eac2581b02e .quad 0x0e434b3b1f499c8f .quad 0x02cde6de1306a233 .quad 0x7b5a52a2116f8ec7 .quad 0xe1c681f4c1163b5b .quad 0x241d350660d32643 .quad 0x6be4404d0ebc52c7 .quad 0xae46233bb1a791f5 .quad 0x2aec170ed25db42b .quad 0x1d8dfd966645d694 // 2^96 * 1 * B .quad 0x296fa9c59c2ec4de .quad 0xbc8b61bf4f84f3cb .quad 0x1c7706d917a8f908 .quad 0x63b795fc7ad3255d .quad 0xd598639c12ddb0a4 .quad 0xa5d19f30c024866b .quad 0xd17c2f0358fce460 .quad 0x07a195152e095e8a .quad 0xa8368f02389e5fc8 .quad 0x90433b02cf8de43b .quad 0xafa1fd5dc5412643 .quad 0x3e8fe83d032f0137 // 2^96 * 2 * B .quad 0x2f8b15b90570a294 .quad 0x94f2427067084549 .quad 0xde1c5ae161bbfd84 .quad 0x75ba3b797fac4007 .quad 0x08704c8de8efd13c .quad 0xdfc51a8e33e03731 .quad 0xa59d5da51260cde3 .quad 0x22d60899a6258c86 .quad 0x6239dbc070cdd196 .quad 0x60fe8a8b6c7d8a9a .quad 0xb38847bceb401260 .quad 0x0904d07b87779e5e // 2^96 * 3 * B .quad 0xb4ce1fd4ddba919c .quad 0xcf31db3ec74c8daa .quad 0x2c63cc63ad86cc51 .quad 0x43e2143fbc1dde07 .quad 0xf4322d6648f940b9 .quad 0x06952f0cbd2d0c39 .quad 0x167697ada081f931 .quad 0x6240aacebaf72a6c .quad 0xf834749c5ba295a0 .quad 0xd6947c5bca37d25a .quad 0x66f13ba7e7c9316a .quad 0x56bdaf238db40cac // 2^96 * 4 * B .quad 0x362ab9e3f53533eb .quad 0x338568d56eb93d40 .quad 0x9e0e14521d5a5572 .quad 0x1d24a86d83741318 .quad 0x1310d36cc19d3bb2 .quad 0x062a6bb7622386b9 .quad 0x7c9b8591d7a14f5c .quad 0x03aa31507e1e5754 .quad 0xf4ec7648ffd4ce1f .quad 0xe045eaf054ac8c1c .quad 0x88d225821d09357c .quad 0x43b261dc9aeb4859 // 2^96 * 5 * B .quad 0xe55b1e1988bb79bb .quad 0xa09ed07dc17a359d .quad 0xb02c2ee2603dea33 .quad 0x326055cf5b276bc2 .quad 0x19513d8b6c951364 .quad 0x94fe7126000bf47b .quad 0x028d10ddd54f9567 .quad 0x02b4d5e242940964 .quad 0xb4a155cb28d18df2 .quad 0xeacc4646186ce508 .quad 0xc49cf4936c824389 .quad 0x27a6c809ae5d3410 // 2^96 * 6 * B .quad 0x8ba6ebcd1f0db188 .quad 0x37d3d73a675a5be8 .quad 0xf22edfa315f5585a .quad 0x2cb67174ff60a17e .quad 0xcd2c270ac43d6954 .quad 0xdd4a3e576a66cab2 .quad 0x79fa592469d7036c .quad 0x221503603d8c2599 .quad 0x59eecdf9390be1d0 .quad 0xa9422044728ce3f1 .quad 0x82891c667a94f0f4 .quad 0x7b1df4b73890f436 // 2^96 * 7 * B .quad 0xe492f2e0b3b2a224 .quad 0x7c6c9e062b551160 .quad 0x15eb8fe20d7f7b0e .quad 0x61fcef2658fc5992 .quad 0x5f2e221807f8f58c .quad 0xe3555c9fd49409d4 .quad 0xb2aaa88d1fb6a630 .quad 0x68698245d352e03d .quad 0xdbb15d852a18187a .quad 0xf3e4aad386ddacd7 .quad 0x44bae2810ff6c482 .quad 0x46cf4c473daf01cf // 2^96 * 8 * B .quad 0x426525ed9ec4e5f9 .quad 0x0e5eda0116903303 .quad 0x72b1a7f2cbe5cadc .quad 0x29387bcd14eb5f40 .quad 0x213c6ea7f1498140 .quad 0x7c1e7ef8392b4854 .quad 0x2488c38c5629ceba .quad 0x1065aae50d8cc5bb .quad 0x1c2c4525df200d57 .quad 0x5c3b2dd6bfca674a .quad 0x0a07e7b1e1834030 .quad 0x69a198e64f1ce716 // 2^100 * 1 * B .quad 0x7afcd613efa9d697 .quad 0x0cc45aa41c067959 .quad 0xa56fe104c1fada96 .quad 0x3a73b70472e40365 .quad 0x7b26e56b9e2d4734 .quad 0xc4c7132b81c61675 .quad 0xef5c9525ec9cde7f .quad 0x39c80b16e71743ad .quad 0x0f196e0d1b826c68 .quad 0xf71ff0e24960e3db .quad 0x6113167023b7436c .quad 0x0cf0ea5877da7282 // 2^100 * 2 * B .quad 0x196c80a4ddd4ccbd .quad 0x22e6f55d95f2dd9d .quad 0xc75e33c740d6c71b .quad 0x7bb51279cb3c042f .quad 0xe332ced43ba6945a .quad 0xde0b1361e881c05d .quad 0x1ad40f095e67ed3b .quad 0x5da8acdab8c63d5d .quad 0xc4b6664a3a70159f .quad 0x76194f0f0a904e14 .quad 0xa5614c39a4096c13 .quad 0x6cd0ff50979feced // 2^100 * 3 * B .quad 0xc0e067e78f4428ac .quad 0x14835ab0a61135e3 .quad 0xf21d14f338062935 .quad 0x6390a4c8df04849c .quad 0x7fecfabdb04ba18e .quad 0xd0fc7bfc3bddbcf7 .quad 0xa41d486e057a131c .quad 0x641a4391f2223a61 .quad 0xc5c6b95aa606a8db .quad 0x914b7f9eb06825f1 .quad 0x2a731f6b44fc9eff .quad 0x30ddf38562705cfc // 2^100 * 4 * B .quad 0x4e3dcbdad1bff7f9 .quad 0xc9118e8220645717 .quad 0xbacccebc0f189d56 .quad 0x1b4822e9d4467668 .quad 0x33bef2bd68bcd52c .quad 0xc649dbb069482ef2 .quad 0xb5b6ee0c41cb1aee .quad 0x5c294d270212a7e5 .quad 0xab360a7f25563781 .quad 0x2512228a480f7958 .quad 0xc75d05276114b4e3 .quad 0x222d9625d976fe2a // 2^100 * 5 * B .quad 0x1c717f85b372ace1 .quad 0x81930e694638bf18 .quad 0x239cad056bc08b58 .quad 0x0b34271c87f8fff4 .quad 0x0f94be7e0a344f85 .quad 0xeb2faa8c87f22c38 .quad 0x9ce1e75e4ee16f0f .quad 0x43e64e5418a08dea .quad 0x8155e2521a35ce63 .quad 0xbe100d4df912028e .quad 0xbff80bf8a57ddcec .quad 0x57342dc96d6bc6e4 // 2^100 * 6 * B .quad 0xefeef065c8ce5998 .quad 0xbf029510b5cbeaa2 .quad 0x8c64a10620b7c458 .quad 0x35134fb231c24855 .quad 0xf3c3bcb71e707bf6 .quad 0x351d9b8c7291a762 .quad 0x00502e6edad69a33 .quad 0x522f521f1ec8807f .quad 0x272c1f46f9a3902b .quad 0xc91ba3b799657bcc .quad 0xae614b304f8a1c0e .quad 0x7afcaad70b99017b // 2^100 * 7 * B .quad 0xc25ded54a4b8be41 .quad 0x902d13e11bb0e2dd .quad 0x41f43233cde82ab2 .quad 0x1085faa5c3aae7cb .quad 0xa88141ecef842b6b .quad 0x55e7b14797abe6c5 .quad 0x8c748f9703784ffe .quad 0x5b50a1f7afcd00b7 .quad 0x9b840f66f1361315 .quad 0x18462242701003e9 .quad 0x65ed45fae4a25080 .quad 0x0a2862393fda7320 // 2^100 * 8 * B .quad 0x46ab13c8347cbc9d .quad 0x3849e8d499c12383 .quad 0x4cea314087d64ac9 .quad 0x1f354134b1a29ee7 .quad 0x960e737b6ecb9d17 .quad 0xfaf24948d67ceae1 .quad 0x37e7a9b4d55e1b89 .quad 0x5cb7173cb46c59eb .quad 0x4a89e68b82b7abf0 .quad 0xf41cd9279ba6b7b9 .quad 0x16e6c210e18d876f .quad 0x7cacdb0f7f1b09c6 // 2^104 * 1 * B .quad 0x9062b2e0d91a78bc .quad 0x47c9889cc8509667 .quad 0x9df54a66405070b8 .quad 0x7369e6a92493a1bf .quad 0xe1014434dcc5caed .quad 0x47ed5d963c84fb33 .quad 0x70019576ed86a0e7 .quad 0x25b2697bd267f9e4 .quad 0x9d673ffb13986864 .quad 0x3ca5fbd9415dc7b8 .quad 0xe04ecc3bdf273b5e .quad 0x1420683db54e4cd2 // 2^104 * 2 * B .quad 0xb478bd1e249dd197 .quad 0x620c35005e58c102 .quad 0xfb02d32fccbaac5c .quad 0x60b63bebf508a72d .quad 0x34eebb6fc1cc5ad0 .quad 0x6a1b0ce99646ac8b .quad 0xd3b0da49a66bde53 .quad 0x31e83b4161d081c1 .quad 0x97e8c7129e062b4f .quad 0x49e48f4f29320ad8 .quad 0x5bece14b6f18683f .quad 0x55cf1eb62d550317 // 2^104 * 3 * B .quad 0x5879101065c23d58 .quad 0x8b9d086d5094819c .quad 0xe2402fa912c55fa7 .quad 0x669a6564570891d4 .quad 0x3076b5e37df58c52 .quad 0xd73ab9dde799cc36 .quad 0xbd831ce34913ee20 .quad 0x1a56fbaa62ba0133 .quad 0x943e6b505c9dc9ec .quad 0x302557bba77c371a .quad 0x9873ae5641347651 .quad 0x13c4836799c58a5c // 2^104 * 4 * B .quad 0x423a5d465ab3e1b9 .quad 0xfc13c187c7f13f61 .quad 0x19f83664ecb5b9b6 .quad 0x66f80c93a637b607 .quad 0xc4dcfb6a5d8bd080 .quad 0xdeebc4ec571a4842 .quad 0xd4b2e883b8e55365 .quad 0x50bdc87dc8e5b827 .quad 0x606d37836edfe111 .quad 0x32353e15f011abd9 .quad 0x64b03ac325b73b96 .quad 0x1dd56444725fd5ae // 2^104 * 5 * B .quad 0x8fa47ff83362127d .quad 0xbc9f6ac471cd7c15 .quad 0x6e71454349220c8b .quad 0x0e645912219f732e .quad 0xc297e60008bac89a .quad 0x7d4cea11eae1c3e0 .quad 0xf3e38be19fe7977c .quad 0x3a3a450f63a305cd .quad 0x078f2f31d8394627 .quad 0x389d3183de94a510 .quad 0xd1e36c6d17996f80 .quad 0x318c8d9393a9a87b // 2^104 * 6 * B .quad 0xf2745d032afffe19 .quad 0x0c9f3c497f24db66 .quad 0xbc98d3e3ba8598ef .quad 0x224c7c679a1d5314 .quad 0x5d669e29ab1dd398 .quad 0xfc921658342d9e3b .quad 0x55851dfdf35973cd .quad 0x509a41c325950af6 .quad 0xbdc06edca6f925e9 .quad 0x793ef3f4641b1f33 .quad 0x82ec12809d833e89 .quad 0x05bff02328a11389 // 2^104 * 7 * B .quad 0x3632137023cae00b .quad 0x544acf0ad1accf59 .quad 0x96741049d21a1c88 .quad 0x780b8cc3fa2a44a7 .quad 0x6881a0dd0dc512e4 .quad 0x4fe70dc844a5fafe .quad 0x1f748e6b8f4a5240 .quad 0x576277cdee01a3ea .quad 0x1ef38abc234f305f .quad 0x9a577fbd1405de08 .quad 0x5e82a51434e62a0d .quad 0x5ff418726271b7a1 // 2^104 * 8 * B .quad 0x398e080c1789db9d .quad 0xa7602025f3e778f5 .quad 0xfa98894c06bd035d .quad 0x106a03dc25a966be .quad 0xe5db47e813b69540 .quad 0xf35d2a3b432610e1 .quad 0xac1f26e938781276 .quad 0x29d4db8ca0a0cb69 .quad 0xd9ad0aaf333353d0 .quad 0x38669da5acd309e5 .quad 0x3c57658ac888f7f0 .quad 0x4ab38a51052cbefa // 2^108 * 1 * B .quad 0xdfdacbee4324c0e9 .quad 0x054442883f955bb7 .quad 0xdef7aaa8ea31609f .quad 0x68aee70642287cff .quad 0xf68fe2e8809de054 .quad 0xe3bc096a9c82bad1 .quad 0x076353d40aadbf45 .quad 0x7b9b1fb5dea1959e .quad 0xf01cc8f17471cc0c .quad 0x95242e37579082bb .quad 0x27776093d3e46b5f .quad 0x2d13d55a28bd85fb // 2^108 * 2 * B .quad 0xfac5d2065b35b8da .quad 0xa8da8a9a85624bb7 .quad 0xccd2ca913d21cd0f .quad 0x6b8341ee8bf90d58 .quad 0xbf019cce7aee7a52 .quad 0xa8ded2b6e454ead3 .quad 0x3c619f0b87a8bb19 .quad 0x3619b5d7560916d8 .quad 0x3579f26b0282c4b2 .quad 0x64d592f24fafefae .quad 0xb7cded7b28c8c7c0 .quad 0x6a927b6b7173a8d7 // 2^108 * 3 * B .quad 0x1f6db24f986e4656 .quad 0x1021c02ed1e9105b .quad 0xf8ff3fff2cc0a375 .quad 0x1d2a6bf8c6c82592 .quad 0x8d7040863ece88eb .quad 0xf0e307a980eec08c .quad 0xac2250610d788fda .quad 0x056d92a43a0d478d .quad 0x1b05a196fc3da5a1 .quad 0x77d7a8c243b59ed0 .quad 0x06da3d6297d17918 .quad 0x66fbb494f12353f7 // 2^108 * 4 * B .quad 0x751a50b9d85c0fb8 .quad 0xd1afdc258bcf097b .quad 0x2f16a6a38309a969 .quad 0x14ddff9ee5b00659 .quad 0xd6d70996f12309d6 .quad 0xdbfb2385e9c3d539 .quad 0x46d602b0f7552411 .quad 0x270a0b0557843e0c .quad 0x61ff0640a7862bcc .quad 0x81cac09a5f11abfe .quad 0x9047830455d12abb .quad 0x19a4bde1945ae873 // 2^108 * 5 * B .quad 0x9b9f26f520a6200a .quad 0x64804443cf13eaf8 .quad 0x8a63673f8631edd3 .quad 0x72bbbce11ed39dc1 .quad 0x40c709dec076c49f .quad 0x657bfaf27f3e53f6 .quad 0x40662331eca042c4 .quad 0x14b375487eb4df04 .quad 0xae853c94ab66dc47 .quad 0xeb62343edf762d6e .quad 0xf08e0e186fb2f7d1 .quad 0x4f0b1c02700ab37a // 2^108 * 6 * B .quad 0xe1706787d81951fa .quad 0xa10a2c8eb290c77b .quad 0xe7382fa03ed66773 .quad 0x0a4d84710bcc4b54 .quad 0x79fd21ccc1b2e23f .quad 0x4ae7c281453df52a .quad 0xc8172ec9d151486b .quad 0x68abe9443e0a7534 .quad 0xda12c6c407831dcb .quad 0x0da230d74d5c510d .quad 0x4ab1531e6bd404e1 .quad 0x4106b166bcf440ef // 2^108 * 7 * B .quad 0x02e57a421cd23668 .quad 0x4ad9fb5d0eaef6fd .quad 0x954e6727b1244480 .quad 0x7f792f9d2699f331 .quad 0xa485ccd539e4ecf2 .quad 0x5aa3f3ad0555bab5 .quad 0x145e3439937df82d .quad 0x1238b51e1214283f .quad 0x0b886b925fd4d924 .quad 0x60906f7a3626a80d .quad 0xecd367b4b98abd12 .quad 0x2876beb1def344cf // 2^108 * 8 * B .quad 0xdc84e93563144691 .quad 0x632fe8a0d61f23f4 .quad 0x4caa800612a9a8d5 .quad 0x48f9dbfa0e9918d3 .quad 0xd594b3333a8a85f8 .quad 0x4ea37689e78d7d58 .quad 0x73bf9f455e8e351f .quad 0x5507d7d2bc41ebb4 .quad 0x1ceb2903299572fc .quad 0x7c8ccaa29502d0ee .quad 0x91bfa43411cce67b .quad 0x5784481964a831e7 // 2^112 * 1 * B .quad 0xda7c2b256768d593 .quad 0x98c1c0574422ca13 .quad 0xf1a80bd5ca0ace1d .quad 0x29cdd1adc088a690 .quad 0xd6cfd1ef5fddc09c .quad 0xe82b3efdf7575dce .quad 0x25d56b5d201634c2 .quad 0x3041c6bb04ed2b9b .quad 0x0ff2f2f9d956e148 .quad 0xade797759f356b2e .quad 0x1a4698bb5f6c025c .quad 0x104bbd6814049a7b // 2^112 * 2 * B .quad 0x51f0fd3168f1ed67 .quad 0x2c811dcdd86f3bc2 .quad 0x44dc5c4304d2f2de .quad 0x5be8cc57092a7149 .quad 0xa95d9a5fd67ff163 .quad 0xe92be69d4cc75681 .quad 0xb7f8024cde20f257 .quad 0x204f2a20fb072df5 .quad 0xc8143b3d30ebb079 .quad 0x7589155abd652e30 .quad 0x653c3c318f6d5c31 .quad 0x2570fb17c279161f // 2^112 * 3 * B .quad 0x3efa367f2cb61575 .quad 0xf5f96f761cd6026c .quad 0xe8c7142a65b52562 .quad 0x3dcb65ea53030acd .quad 0x192ea9550bb8245a .quad 0xc8e6fba88f9050d1 .quad 0x7986ea2d88a4c935 .quad 0x241c5f91de018668 .quad 0x28d8172940de6caa .quad 0x8fbf2cf022d9733a .quad 0x16d7fcdd235b01d1 .quad 0x08420edd5fcdf0e5 // 2^112 * 4 * B .quad 0xcdff20ab8362fa4a .quad 0x57e118d4e21a3e6e .quad 0xe3179617fc39e62b .quad 0x0d9a53efbc1769fd .quad 0x0358c34e04f410ce .quad 0xb6135b5a276e0685 .quad 0x5d9670c7ebb91521 .quad 0x04d654f321db889c .quad 0x5e7dc116ddbdb5d5 .quad 0x2954deb68da5dd2d .quad 0x1cb608173334a292 .quad 0x4a7a4f2618991ad7 // 2^112 * 5 * B .quad 0xf4a718025fb15f95 .quad 0x3df65f346b5c1b8f .quad 0xcdfcf08500e01112 .quad 0x11b50c4cddd31848 .quad 0x24c3b291af372a4b .quad 0x93da8270718147f2 .quad 0xdd84856486899ef2 .quad 0x4a96314223e0ee33 .quad 0xa6e8274408a4ffd6 .quad 0x738e177e9c1576d9 .quad 0x773348b63d02b3f2 .quad 0x4f4bce4dce6bcc51 // 2^112 * 6 * B .quad 0xa71fce5ae2242584 .quad 0x26ea725692f58a9e .quad 0xd21a09d71cea3cf4 .quad 0x73fcdd14b71c01e6 .quad 0x30e2616ec49d0b6f .quad 0xe456718fcaec2317 .quad 0x48eb409bf26b4fa6 .quad 0x3042cee561595f37 .quad 0x427e7079449bac41 .quad 0x855ae36dbce2310a .quad 0x4cae76215f841a7c .quad 0x389e740c9a9ce1d6 // 2^112 * 7 * B .quad 0x64fcb3ae34dcb9ce .quad 0x97500323e348d0ad .quad 0x45b3f07d62c6381b .quad 0x61545379465a6788 .quad 0xc9bd78f6570eac28 .quad 0xe55b0b3227919ce1 .quad 0x65fc3eaba19b91ed .quad 0x25c425e5d6263690 .quad 0x3f3e06a6f1d7de6e .quad 0x3ef976278e062308 .quad 0x8c14f6264e8a6c77 .quad 0x6539a08915484759 // 2^112 * 8 * B .quad 0xe9d21f74c3d2f773 .quad 0xc150544125c46845 .quad 0x624e5ce8f9b99e33 .quad 0x11c5e4aac5cd186c .quad 0xddc4dbd414bb4a19 .quad 0x19b2bc3c98424f8e .quad 0x48a89fd736ca7169 .quad 0x0f65320ef019bd90 .quad 0xd486d1b1cafde0c6 .quad 0x4f3fe6e3163b5181 .quad 0x59a8af0dfaf2939a .quad 0x4cabc7bdec33072a // 2^116 * 1 * B .quad 0x16faa8fb532f7428 .quad 0xdbd42ea046a4e272 .quad 0x5337653b8b9ea480 .quad 0x4065947223973f03 .quad 0xf7c0a19c1a54a044 .quad 0x4a1c5e2477bd9fbb .quad 0xa6e3ca115af22972 .quad 0x1819bb953f2e9e0d .quad 0x498fbb795e042e84 .quad 0x7d0dd89a7698b714 .quad 0x8bfb0ba427fe6295 .quad 0x36ba82e721200524 // 2^116 * 2 * B .quad 0xd60ecbb74245ec41 .quad 0xfd9be89e34348716 .quad 0xc9240afee42284de .quad 0x4472f648d0531db4 .quad 0xc8d69d0a57274ed5 .quad 0x45ba803260804b17 .quad 0xdf3cda102255dfac .quad 0x77d221232709b339 .quad 0x498a6d7064ad94d8 .quad 0xa5b5c8fd9af62263 .quad 0x8ca8ed0545c141f4 .quad 0x2c63bec3662d358c // 2^116 * 3 * B .quad 0x7fe60d8bea787955 .quad 0xb9dc117eb5f401b7 .quad 0x91c7c09a19355cce .quad 0x22692ef59442bedf .quad 0x9a518b3a8586f8bf .quad 0x9ee71af6cbb196f0 .quad 0xaa0625e6a2385cf2 .quad 0x1deb2176ddd7c8d1 .quad 0x8563d19a2066cf6c .quad 0x401bfd8c4dcc7cd7 .quad 0xd976a6becd0d8f62 .quad 0x67cfd773a278b05e // 2^116 * 4 * B .quad 0x8dec31faef3ee475 .quad 0x99dbff8a9e22fd92 .quad 0x512d11594e26cab1 .quad 0x0cde561eec4310b9 .quad 0x2d5fa9855a4e586a .quad 0x65f8f7a449beab7e .quad 0xaa074dddf21d33d3 .quad 0x185cba721bcb9dee .quad 0x93869da3f4e3cb41 .quad 0xbf0392f540f7977e .quad 0x026204fcd0463b83 .quad 0x3ec91a769eec6eed // 2^116 * 5 * B .quad 0x1e9df75bf78166ad .quad 0x4dfda838eb0cd7af .quad 0xba002ed8c1eaf988 .quad 0x13fedb3e11f33cfc .quad 0x0fad2fb7b0a3402f .quad 0x46615ecbfb69f4a8 .quad 0xf745bcc8c5f8eaa6 .quad 0x7a5fa8794a94e896 .quad 0x52958faa13cd67a1 .quad 0x965ee0818bdbb517 .quad 0x16e58daa2e8845b3 .quad 0x357d397d5499da8f // 2^116 * 6 * B .quad 0x1ebfa05fb0bace6c .quad 0xc934620c1caf9a1e .quad 0xcc771cc41d82b61a .quad 0x2d94a16aa5f74fec .quad 0x481dacb4194bfbf8 .quad 0x4d77e3f1bae58299 .quad 0x1ef4612e7d1372a0 .quad 0x3a8d867e70ff69e1 .quad 0x6f58cd5d55aff958 .quad 0xba3eaa5c75567721 .quad 0x75c123999165227d .quad 0x69be1343c2f2b35e // 2^116 * 7 * B .quad 0x0e091d5ee197c92a .quad 0x4f51019f2945119f .quad 0x143679b9f034e99c .quad 0x7d88112e4d24c696 .quad 0x82bbbdac684b8de3 .quad 0xa2f4c7d03fca0718 .quad 0x337f92fbe096aaa8 .quad 0x200d4d8c63587376 .quad 0x208aed4b4893b32b .quad 0x3efbf23ebe59b964 .quad 0xd762deb0dba5e507 .quad 0x69607bd681bd9d94 // 2^116 * 8 * B .quad 0xf6be021068de1ce1 .quad 0xe8d518e70edcbc1f .quad 0xe3effdd01b5505a5 .quad 0x35f63353d3ec3fd0 .quad 0x3b7f3bd49323a902 .quad 0x7c21b5566b2c6e53 .quad 0xe5ba8ff53a7852a7 .quad 0x28bc77a5838ece00 .quad 0x63ba78a8e25d8036 .quad 0x63651e0094333490 .quad 0x48d82f20288ce532 .quad 0x3a31abfa36b57524 // 2^120 * 1 * B .quad 0x239e9624089c0a2e .quad 0xc748c4c03afe4738 .quad 0x17dbed2a764fa12a .quad 0x639b93f0321c8582 .quad 0xc08f788f3f78d289 .quad 0xfe30a72ca1404d9f .quad 0xf2778bfccf65cc9d .quad 0x7ee498165acb2021 .quad 0x7bd508e39111a1c3 .quad 0x2b2b90d480907489 .quad 0xe7d2aec2ae72fd19 .quad 0x0edf493c85b602a6 // 2^120 * 2 * B .quad 0xaecc8158599b5a68 .quad 0xea574f0febade20e .quad 0x4fe41d7422b67f07 .quad 0x403b92e3019d4fb4 .quad 0x6767c4d284764113 .quad 0xa090403ff7f5f835 .quad 0x1c8fcffacae6bede .quad 0x04c00c54d1dfa369 .quad 0x4dc22f818b465cf8 .quad 0x71a0f35a1480eff8 .quad 0xaee8bfad04c7d657 .quad 0x355bb12ab26176f4 // 2^120 * 3 * B .quad 0xa71e64cc7493bbf4 .quad 0xe5bd84d9eca3b0c3 .quad 0x0a6bc50cfa05e785 .quad 0x0f9b8132182ec312 .quad 0xa301dac75a8c7318 .quad 0xed90039db3ceaa11 .quad 0x6f077cbf3bae3f2d .quad 0x7518eaf8e052ad8e .quad 0xa48859c41b7f6c32 .quad 0x0f2d60bcf4383298 .quad 0x1815a929c9b1d1d9 .quad 0x47c3871bbb1755c4 // 2^120 * 4 * B .quad 0x5144539771ec4f48 .quad 0xf805b17dc98c5d6e .quad 0xf762c11a47c3c66b .quad 0x00b89b85764699dc .quad 0xfbe65d50c85066b0 .quad 0x62ecc4b0b3a299b0 .quad 0xe53754ea441ae8e0 .quad 0x08fea02ce8d48d5f .quad 0x824ddd7668deead0 .quad 0xc86445204b685d23 .quad 0xb514cfcd5d89d665 .quad 0x473829a74f75d537 // 2^120 * 5 * B .quad 0x82d2da754679c418 .quad 0xe63bd7d8b2618df0 .quad 0x355eef24ac47eb0a .quad 0x2078684c4833c6b4 .quad 0x23d9533aad3902c9 .quad 0x64c2ddceef03588f .quad 0x15257390cfe12fb4 .quad 0x6c668b4d44e4d390 .quad 0x3b48cf217a78820c .quad 0xf76a0ab281273e97 .quad 0xa96c65a78c8eed7b .quad 0x7411a6054f8a433f // 2^120 * 6 * B .quad 0x4d659d32b99dc86d .quad 0x044cdc75603af115 .quad 0xb34c712cdcc2e488 .quad 0x7c136574fb8134ff .quad 0x579ae53d18b175b4 .quad 0x68713159f392a102 .quad 0x8455ecba1eef35f5 .quad 0x1ec9a872458c398f .quad 0xb8e6a4d400a2509b .quad 0x9b81d7020bc882b4 .quad 0x57e7cc9bf1957561 .quad 0x3add88a5c7cd6460 // 2^120 * 7 * B .quad 0xab895770b635dcf2 .quad 0x02dfef6cf66c1fbc .quad 0x85530268beb6d187 .quad 0x249929fccc879e74 .quad 0x85c298d459393046 .quad 0x8f7e35985ff659ec .quad 0x1d2ca22af2f66e3a .quad 0x61ba1131a406a720 .quad 0xa3d0a0f116959029 .quad 0x023b6b6cba7ebd89 .quad 0x7bf15a3e26783307 .quad 0x5620310cbbd8ece7 // 2^120 * 8 * B .quad 0x528993434934d643 .quad 0xb9dbf806a51222f5 .quad 0x8f6d878fc3f41c22 .quad 0x37676a2a4d9d9730 .quad 0x6646b5f477e285d6 .quad 0x40e8ff676c8f6193 .quad 0xa6ec7311abb594dd .quad 0x7ec846f3658cec4d .quad 0x9b5e8f3f1da22ec7 .quad 0x130f1d776c01cd13 .quad 0x214c8fcfa2989fb8 .quad 0x6daaf723399b9dd5 // 2^124 * 1 * B .quad 0x591e4a5610628564 .quad 0x2a4bb87ca8b4df34 .quad 0xde2a2572e7a38e43 .quad 0x3cbdabd9fee5046e .quad 0x81aebbdd2cd13070 .quad 0x962e4325f85a0e9e .quad 0xde9391aacadffecb .quad 0x53177fda52c230e6 .quad 0xa7bc970650b9de79 .quad 0x3d12a7fbc301b59b .quad 0x02652e68d36ae38c .quad 0x79d739835a6199dc // 2^124 * 2 * B .quad 0xd9354df64131c1bd .quad 0x758094a186ec5822 .quad 0x4464ee12e459f3c2 .quad 0x6c11fce4cb133282 .quad 0x21c9d9920d591737 .quad 0x9bea41d2e9b46cd6 .quad 0xe20e84200d89bfca .quad 0x79d99f946eae5ff8 .quad 0xf17b483568673205 .quad 0x387deae83caad96c .quad 0x61b471fd56ffe386 .quad 0x31741195b745a599 // 2^124 * 3 * B .quad 0xe8d10190b77a360b .quad 0x99b983209995e702 .quad 0xbd4fdff8fa0247aa .quad 0x2772e344e0d36a87 .quad 0x17f8ba683b02a047 .quad 0x50212096feefb6c8 .quad 0x70139be21556cbe2 .quad 0x203e44a11d98915b .quad 0xd6863eba37b9e39f .quad 0x105bc169723b5a23 .quad 0x104f6459a65c0762 .quad 0x567951295b4d38d4 // 2^124 * 4 * B .quad 0x535fd60613037524 .quad 0xe210adf6b0fbc26a .quad 0xac8d0a9b23e990ae .quad 0x47204d08d72fdbf9 .quad 0x07242eb30d4b497f .quad 0x1ef96306b9bccc87 .quad 0x37950934d8116f45 .quad 0x05468d6201405b04 .quad 0x00f565a9f93267de .quad 0xcecfd78dc0d58e8a .quad 0xa215e2dcf318e28e .quad 0x4599ee919b633352 // 2^124 * 5 * B .quad 0xd3c220ca70e0e76b .quad 0xb12bea58ea9f3094 .quad 0x294ddec8c3271282 .quad 0x0c3539e1a1d1d028 .quad 0xac746d6b861ae579 .quad 0x31ab0650f6aea9dc .quad 0x241d661140256d4c .quad 0x2f485e853d21a5de .quad 0x329744839c0833f3 .quad 0x6fe6257fd2abc484 .quad 0x5327d1814b358817 .quad 0x65712585893fe9bc // 2^124 * 6 * B .quad 0x9c102fb732a61161 .quad 0xe48e10dd34d520a8 .quad 0x365c63546f9a9176 .quad 0x32f6fe4c046f6006 .quad 0x81c29f1bd708ee3f .quad 0xddcb5a05ae6407d0 .quad 0x97aec1d7d2a3eba7 .quad 0x1590521a91d50831 .quad 0x40a3a11ec7910acc .quad 0x9013dff8f16d27ae .quad 0x1a9720d8abb195d4 .quad 0x1bb9fe452ea98463 // 2^124 * 7 * B .quad 0xe9d1d950b3d54f9e .quad 0x2d5f9cbee00d33c1 .quad 0x51c2c656a04fc6ac .quad 0x65c091ee3c1cbcc9 .quad 0xcf5e6c95cc36747c .quad 0x294201536b0bc30d .quad 0x453ac67cee797af0 .quad 0x5eae6ab32a8bb3c9 .quad 0x7083661114f118ea .quad 0x2b37b87b94349cad .quad 0x7273f51cb4e99f40 .quad 0x78a2a95823d75698 // 2^124 * 8 * B .quad 0xa2b072e95c8c2ace .quad 0x69cffc96651e9c4b .quad 0x44328ef842e7b42b .quad 0x5dd996c122aadeb3 .quad 0xb4f23c425ef83207 .quad 0xabf894d3c9a934b5 .quad 0xd0708c1339fd87f7 .quad 0x1876789117166130 .quad 0x925b5ef0670c507c .quad 0x819bc842b93c33bf .quad 0x10792e9a70dd003f .quad 0x59ad4b7a6e28dc74 // 2^128 * 1 * B .quad 0x5f3a7562eb3dbe47 .quad 0xf7ea38548ebda0b8 .quad 0x00c3e53145747299 .quad 0x1304e9e71627d551 .quad 0x583b04bfacad8ea2 .quad 0x29b743e8148be884 .quad 0x2b1e583b0810c5db .quad 0x2b5449e58eb3bbaa .quad 0x789814d26adc9cfe .quad 0x3c1bab3f8b48dd0b .quad 0xda0fe1fff979c60a .quad 0x4468de2d7c2dd693 // 2^128 * 2 * B .quad 0x51bb355e9419469e .quad 0x33e6dc4c23ddc754 .quad 0x93a5b6d6447f9962 .quad 0x6cce7c6ffb44bd63 .quad 0x4b9ad8c6f86307ce .quad 0x21113531435d0c28 .quad 0xd4a866c5657a772c .quad 0x5da6427e63247352 .quad 0x1a94c688deac22ca .quad 0xb9066ef7bbae1ff8 .quad 0x88ad8c388d59580f .quad 0x58f29abfe79f2ca8 // 2^128 * 3 * B .quad 0xe90ecfab8de73e68 .quad 0x54036f9f377e76a5 .quad 0xf0495b0bbe015982 .quad 0x577629c4a7f41e36 .quad 0x4b5a64bf710ecdf6 .quad 0xb14ce538462c293c .quad 0x3643d056d50b3ab9 .quad 0x6af93724185b4870 .quad 0x3220024509c6a888 .quad 0xd2e036134b558973 .quad 0x83e236233c33289f .quad 0x701f25bb0caec18f // 2^128 * 4 * B .quad 0xc3a8b0f8e4616ced .quad 0xf700660e9e25a87d .quad 0x61e3061ff4bca59c .quad 0x2e0c92bfbdc40be9 .quad 0x9d18f6d97cbec113 .quad 0x844a06e674bfdbe4 .quad 0x20f5b522ac4e60d6 .quad 0x720a5bc050955e51 .quad 0x0c3f09439b805a35 .quad 0xe84e8b376242abfc .quad 0x691417f35c229346 .quad 0x0e9b9cbb144ef0ec // 2^128 * 5 * B .quad 0xfbbad48ffb5720ad .quad 0xee81916bdbf90d0e .quad 0xd4813152635543bf .quad 0x221104eb3f337bd8 .quad 0x8dee9bd55db1beee .quad 0xc9c3ab370a723fb9 .quad 0x44a8f1bf1c68d791 .quad 0x366d44191cfd3cde .quad 0x9e3c1743f2bc8c14 .quad 0x2eda26fcb5856c3b .quad 0xccb82f0e68a7fb97 .quad 0x4167a4e6bc593244 // 2^128 * 6 * B .quad 0x643b9d2876f62700 .quad 0x5d1d9d400e7668eb .quad 0x1b4b430321fc0684 .quad 0x7938bb7e2255246a .quad 0xc2be2665f8ce8fee .quad 0xe967ff14e880d62c .quad 0xf12e6e7e2f364eee .quad 0x34b33370cb7ed2f6 .quad 0xcdc591ee8681d6cc .quad 0xce02109ced85a753 .quad 0xed7485c158808883 .quad 0x1176fc6e2dfe65e4 // 2^128 * 7 * B .quad 0xb4af6cd05b9c619b .quad 0x2ddfc9f4b2a58480 .quad 0x3d4fa502ebe94dc4 .quad 0x08fc3a4c677d5f34 .quad 0xdb90e28949770eb8 .quad 0x98fbcc2aacf440a3 .quad 0x21354ffeded7879b .quad 0x1f6a3e54f26906b6 .quad 0x60a4c199d30734ea .quad 0x40c085b631165cd6 .quad 0xe2333e23f7598295 .quad 0x4f2fad0116b900d1 // 2^128 * 8 * B .quad 0x44beb24194ae4e54 .quad 0x5f541c511857ef6c .quad 0xa61e6b2d368d0498 .quad 0x445484a4972ef7ab .quad 0x962cd91db73bb638 .quad 0xe60577aafc129c08 .quad 0x6f619b39f3b61689 .quad 0x3451995f2944ee81 .quad 0x9152fcd09fea7d7c .quad 0x4a816c94b0935cf6 .quad 0x258e9aaa47285c40 .quad 0x10b89ca6042893b7 // 2^132 * 1 * B .quad 0x9b2a426e3b646025 .quad 0x32127190385ce4cf .quad 0xa25cffc2dd6dea45 .quad 0x06409010bea8de75 .quad 0xd67cded679d34aa0 .quad 0xcc0b9ec0cc4db39f .quad 0xa535a456e35d190f .quad 0x2e05d9eaf61f6fef .quad 0xc447901ad61beb59 .quad 0x661f19bce5dc880a .quad 0x24685482b7ca6827 .quad 0x293c778cefe07f26 // 2^132 * 2 * B .quad 0x86809e7007069096 .quad 0xaad75b15e4e50189 .quad 0x07f35715a21a0147 .quad 0x0487f3f112815d5e .quad 0x16c795d6a11ff200 .quad 0xcb70d0e2b15815c9 .quad 0x89f293209b5395b5 .quad 0x50b8c2d031e47b4f .quad 0x48350c08068a4962 .quad 0x6ffdd05351092c9a .quad 0x17af4f4aaf6fc8dd .quad 0x4b0553b53cdba58b // 2^132 * 3 * B .quad 0x9c65fcbe1b32ff79 .quad 0xeb75ea9f03b50f9b .quad 0xfced2a6c6c07e606 .quad 0x35106cd551717908 .quad 0xbf05211b27c152d4 .quad 0x5ec26849bd1af639 .quad 0x5e0b2caa8e6fab98 .quad 0x054c8bdd50bd0840 .quad 0x38a0b12f1dcf073d .quad 0x4b60a8a3b7f6a276 .quad 0xfed5ac25d3404f9a .quad 0x72e82d5e5505c229 // 2^132 * 4 * B .quad 0x6b0b697ff0d844c8 .quad 0xbb12f85cd979cb49 .quad 0xd2a541c6c1da0f1f .quad 0x7b7c242958ce7211 .quad 0x00d9cdfd69771d02 .quad 0x410276cd6cfbf17e .quad 0x4c45306c1cb12ec7 .quad 0x2857bf1627500861 .quad 0x9f21903f0101689e .quad 0xd779dfd3bf861005 .quad 0xa122ee5f3deb0f1b .quad 0x510df84b485a00d4 // 2^132 * 5 * B .quad 0xa54133bb9277a1fa .quad 0x74ec3b6263991237 .quad 0x1a3c54dc35d2f15a .quad 0x2d347144e482ba3a .quad 0x24b3c887c70ac15e .quad 0xb0f3a557fb81b732 .quad 0x9b2cde2fe578cc1b .quad 0x4cf7ed0703b54f8e .quad 0x6bd47c6598fbee0f .quad 0x9e4733e2ab55be2d .quad 0x1093f624127610c5 .quad 0x4e05e26ad0a1eaa4 // 2^132 * 6 * B .quad 0xda9b6b624b531f20 .quad 0x429a760e77509abb .quad 0xdbe9f522e823cb80 .quad 0x618f1856880c8f82 .quad 0x1833c773e18fe6c0 .quad 0xe3c4711ad3c87265 .quad 0x3bfd3c4f0116b283 .quad 0x1955875eb4cd4db8 .quad 0x6da6de8f0e399799 .quad 0x7ad61aa440fda178 .quad 0xb32cd8105e3563dd .quad 0x15f6beae2ae340ae // 2^132 * 7 * B .quad 0x862bcb0c31ec3a62 .quad 0x810e2b451138f3c2 .quad 0x788ec4b839dac2a4 .quad 0x28f76867ae2a9281 .quad 0xba9a0f7b9245e215 .quad 0xf368612dd98c0dbb .quad 0x2e84e4cbf220b020 .quad 0x6ba92fe962d90eda .quad 0x3e4df9655884e2aa .quad 0xbd62fbdbdbd465a5 .quad 0xd7596caa0de9e524 .quad 0x6e8042ccb2b1b3d7 // 2^132 * 8 * B .quad 0xf10d3c29ce28ca6e .quad 0xbad34540fcb6093d .quad 0xe7426ed7a2ea2d3f .quad 0x08af9d4e4ff298b9 .quad 0x1530653616521f7e .quad 0x660d06b896203dba .quad 0x2d3989bc545f0879 .quad 0x4b5303af78ebd7b0 .quad 0x72f8a6c3bebcbde8 .quad 0x4f0fca4adc3a8e89 .quad 0x6fa9d4e8c7bfdf7a .quad 0x0dcf2d679b624eb7 // 2^136 * 1 * B .quad 0x3d5947499718289c .quad 0x12ebf8c524533f26 .quad 0x0262bfcb14c3ef15 .quad 0x20b878d577b7518e .quad 0x753941be5a45f06e .quad 0xd07caeed6d9c5f65 .quad 0x11776b9c72ff51b6 .quad 0x17d2d1d9ef0d4da9 .quad 0x27f2af18073f3e6a .quad 0xfd3fe519d7521069 .quad 0x22e3b72c3ca60022 .quad 0x72214f63cc65c6a7 // 2^136 * 2 * B .quad 0xb4e37f405307a693 .quad 0xaba714d72f336795 .quad 0xd6fbd0a773761099 .quad 0x5fdf48c58171cbc9 .quad 0x1d9db7b9f43b29c9 .quad 0xd605824a4f518f75 .quad 0xf2c072bd312f9dc4 .quad 0x1f24ac855a1545b0 .quad 0x24d608328e9505aa .quad 0x4748c1d10c1420ee .quad 0xc7ffe45c06fb25a2 .quad 0x00ba739e2ae395e6 // 2^136 * 3 * B .quad 0x592e98de5c8790d6 .quad 0xe5bfb7d345c2a2df .quad 0x115a3b60f9b49922 .quad 0x03283a3e67ad78f3 .quad 0xae4426f5ea88bb26 .quad 0x360679d984973bfb .quad 0x5c9f030c26694e50 .quad 0x72297de7d518d226 .quad 0x48241dc7be0cb939 .quad 0x32f19b4d8b633080 .quad 0xd3dfc90d02289308 .quad 0x05e1296846271945 // 2^136 * 4 * B .quad 0xba82eeb32d9c495a .quad 0xceefc8fcf12bb97c .quad 0xb02dabae93b5d1e0 .quad 0x39c00c9c13698d9b .quad 0xadbfbbc8242c4550 .quad 0xbcc80cecd03081d9 .quad 0x843566a6f5c8df92 .quad 0x78cf25d38258ce4c .quad 0x15ae6b8e31489d68 .quad 0xaa851cab9c2bf087 .quad 0xc9a75a97f04efa05 .quad 0x006b52076b3ff832 // 2^136 * 5 * B .quad 0x29e0cfe19d95781c .quad 0xb681df18966310e2 .quad 0x57df39d370516b39 .quad 0x4d57e3443bc76122 .quad 0xf5cb7e16b9ce082d .quad 0x3407f14c417abc29 .quad 0xd4b36bce2bf4a7ab .quad 0x7de2e9561a9f75ce .quad 0xde70d4f4b6a55ecb .quad 0x4801527f5d85db99 .quad 0xdbc9c440d3ee9a81 .quad 0x6b2a90af1a6029ed // 2^136 * 6 * B .quad 0x6923f4fc9ae61e97 .quad 0x5735281de03f5fd1 .quad 0xa764ae43e6edd12d .quad 0x5fd8f4e9d12d3e4a .quad 0x77ebf3245bb2d80a .quad 0xd8301b472fb9079b .quad 0xc647e6f24cee7333 .quad 0x465812c8276c2109 .quad 0x4d43beb22a1062d9 .quad 0x7065fb753831dc16 .quad 0x180d4a7bde2968d7 .quad 0x05b32c2b1cb16790 // 2^136 * 7 * B .quad 0xc8c05eccd24da8fd .quad 0xa1cf1aac05dfef83 .quad 0xdbbeeff27df9cd61 .quad 0x3b5556a37b471e99 .quad 0xf7fca42c7ad58195 .quad 0x3214286e4333f3cc .quad 0xb6c29d0d340b979d .quad 0x31771a48567307e1 .quad 0x32b0c524e14dd482 .quad 0xedb351541a2ba4b6 .quad 0xa3d16048282b5af3 .quad 0x4fc079d27a7336eb // 2^136 * 8 * B .quad 0x51c938b089bf2f7f .quad 0x2497bd6502dfe9a7 .quad 0xffffc09c7880e453 .quad 0x124567cecaf98e92 .quad 0xdc348b440c86c50d .quad 0x1337cbc9cc94e651 .quad 0x6422f74d643e3cb9 .quad 0x241170c2bae3cd08 .quad 0x3ff9ab860ac473b4 .quad 0xf0911dee0113e435 .quad 0x4ae75060ebc6c4af .quad 0x3f8612966c87000d // 2^140 * 1 * B .quad 0x0c9c5303f7957be4 .quad 0xa3c31a20e085c145 .quad 0xb0721d71d0850050 .quad 0x0aba390eab0bf2da .quad 0x529fdffe638c7bf3 .quad 0xdf2b9e60388b4995 .quad 0xe027b34f1bad0249 .quad 0x7bc92fc9b9fa74ed .quad 0x9f97ef2e801ad9f9 .quad 0x83697d5479afda3a .quad 0xe906b3ffbd596b50 .quad 0x02672b37dd3fb8e0 // 2^140 * 2 * B .quad 0x48b2ca8b260885e4 .quad 0xa4286bec82b34c1c .quad 0x937e1a2617f58f74 .quad 0x741d1fcbab2ca2a5 .quad 0xee9ba729398ca7f5 .quad 0xeb9ca6257a4849db .quad 0x29eb29ce7ec544e1 .quad 0x232ca21ef736e2c8 .quad 0xbf61423d253fcb17 .quad 0x08803ceafa39eb14 .quad 0xf18602df9851c7af .quad 0x0400f3a049e3414b // 2^140 * 3 * B .quad 0xabce0476ba61c55b .quad 0x36a3d6d7c4d39716 .quad 0x6eb259d5e8d82d09 .quad 0x0c9176e984d756fb .quad 0x2efba412a06e7b06 .quad 0x146785452c8d2560 .quad 0xdf9713ebd67a91c7 .quad 0x32830ac7157eadf3 .quad 0x0e782a7ab73769e8 .quad 0x04a05d7875b18e2c .quad 0x29525226ebcceae1 .quad 0x0d794f8383eba820 // 2^140 * 4 * B .quad 0xff35f5cb9e1516f4 .quad 0xee805bcf648aae45 .quad 0xf0d73c2bb93a9ef3 .quad 0x097b0bf22092a6c2 .quad 0x7be44ce7a7a2e1ac .quad 0x411fd93efad1b8b7 .quad 0x1734a1d70d5f7c9b .quad 0x0d6592233127db16 .quad 0xc48bab1521a9d733 .quad 0xa6c2eaead61abb25 .quad 0x625c6c1cc6cb4305 .quad 0x7fc90fea93eb3a67 // 2^140 * 5 * B .quad 0x0408f1fe1f5c5926 .quad 0x1a8f2f5e3b258bf4 .quad 0x40a951a2fdc71669 .quad 0x6598ee93c98b577e .quad 0xc527deb59c7cb23d .quad 0x955391695328404e .quad 0xd64392817ccf2c7a .quad 0x6ce97dabf7d8fa11 .quad 0x25b5a8e50ef7c48f .quad 0xeb6034116f2ce532 .quad 0xc5e75173e53de537 .quad 0x73119fa08c12bb03 // 2^140 * 6 * B .quad 0xed30129453f1a4cb .quad 0xbce621c9c8f53787 .quad 0xfacb2b1338bee7b9 .quad 0x3025798a9ea8428c .quad 0x7845b94d21f4774d .quad 0xbf62f16c7897b727 .quad 0x671857c03c56522b .quad 0x3cd6a85295621212 .quad 0x3fecde923aeca999 .quad 0xbdaa5b0062e8c12f .quad 0x67b99dfc96988ade .quad 0x3f52c02852661036 // 2^140 * 7 * B .quad 0xffeaa48e2a1351c6 .quad 0x28624754fa7f53d7 .quad 0x0b5ba9e57582ddf1 .quad 0x60c0104ba696ac59 .quad 0x9258bf99eec416c6 .quad 0xac8a5017a9d2f671 .quad 0x629549ab16dea4ab .quad 0x05d0e85c99091569 .quad 0x051de020de9cbe97 .quad 0xfa07fc56b50bcf74 .quad 0x378cec9f0f11df65 .quad 0x36853c69ab96de4d // 2^140 * 8 * B .quad 0x36d9b8de78f39b2d .quad 0x7f42ed71a847b9ec .quad 0x241cd1d679bd3fde .quad 0x6a704fec92fbce6b .quad 0x4433c0b0fac5e7be .quad 0x724bae854c08dcbe .quad 0xf1f24cc446978f9b .quad 0x4a0aff6d62825fc8 .quad 0xe917fb9e61095301 .quad 0xc102df9402a092f8 .quad 0xbf09e2f5fa66190b .quad 0x681109bee0dcfe37 // 2^144 * 1 * B .quad 0x559a0cc9782a0dde .quad 0x551dcdb2ea718385 .quad 0x7f62865b31ef238c .quad 0x504aa7767973613d .quad 0x9c18fcfa36048d13 .quad 0x29159db373899ddd .quad 0xdc9f350b9f92d0aa .quad 0x26f57eee878a19d4 .quad 0x0cab2cd55687efb1 .quad 0x5180d162247af17b .quad 0x85c15a344f5a2467 .quad 0x4041943d9dba3069 // 2^144 * 2 * B .quad 0xc3c0eeba43ebcc96 .quad 0x8d749c9c26ea9caf .quad 0xd9fa95ee1c77ccc6 .quad 0x1420a1d97684340f .quad 0x4b217743a26caadd .quad 0x47a6b424648ab7ce .quad 0xcb1d4f7a03fbc9e3 .quad 0x12d931429800d019 .quad 0x00c67799d337594f .quad 0x5e3c5140b23aa47b .quad 0x44182854e35ff395 .quad 0x1b4f92314359a012 // 2^144 * 3 * B .quad 0x3e5c109d89150951 .quad 0x39cefa912de9696a .quad 0x20eae43f975f3020 .quad 0x239b572a7f132dae .quad 0x33cf3030a49866b1 .quad 0x251f73d2215f4859 .quad 0xab82aa4051def4f6 .quad 0x5ff191d56f9a23f6 .quad 0x819ed433ac2d9068 .quad 0x2883ab795fc98523 .quad 0xef4572805593eb3d .quad 0x020c526a758f36cb // 2^144 * 4 * B .quad 0x779834f89ed8dbbc .quad 0xc8f2aaf9dc7ca46c .quad 0xa9524cdca3e1b074 .quad 0x02aacc4615313877 .quad 0xe931ef59f042cc89 .quad 0x2c589c9d8e124bb6 .quad 0xadc8e18aaec75997 .quad 0x452cfe0a5602c50c .quad 0x86a0f7a0647877df .quad 0xbbc464270e607c9f .quad 0xab17ea25f1fb11c9 .quad 0x4cfb7d7b304b877b // 2^144 * 5 * B .quad 0x72b43d6cb89b75fe .quad 0x54c694d99c6adc80 .quad 0xb8c3aa373ee34c9f .quad 0x14b4622b39075364 .quad 0xe28699c29789ef12 .quad 0x2b6ecd71df57190d .quad 0xc343c857ecc970d0 .quad 0x5b1d4cbc434d3ac5 .quad 0xb6fb2615cc0a9f26 .quad 0x3a4f0e2bb88dcce5 .quad 0x1301498b3369a705 .quad 0x2f98f71258592dd1 // 2^144 * 6 * B .quad 0x0c94a74cb50f9e56 .quad 0x5b1ff4a98e8e1320 .quad 0x9a2acc2182300f67 .quad 0x3a6ae249d806aaf9 .quad 0x2e12ae444f54a701 .quad 0xfcfe3ef0a9cbd7de .quad 0xcebf890d75835de0 .quad 0x1d8062e9e7614554 .quad 0x657ada85a9907c5a .quad 0x1a0ea8b591b90f62 .quad 0x8d0e1dfbdf34b4e9 .quad 0x298b8ce8aef25ff3 // 2^144 * 7 * B .quad 0x2a927953eff70cb2 .quad 0x4b89c92a79157076 .quad 0x9418457a30a7cf6a .quad 0x34b8a8404d5ce485 .quad 0x837a72ea0a2165de .quad 0x3fab07b40bcf79f6 .quad 0x521636c77738ae70 .quad 0x6ba6271803a7d7dc .quad 0xc26eecb583693335 .quad 0xd5a813df63b5fefd .quad 0xa293aa9aa4b22573 .quad 0x71d62bdd465e1c6a // 2^144 * 8 * B .quad 0x6533cc28d378df80 .quad 0xf6db43790a0fa4b4 .quad 0xe3645ff9f701da5a .quad 0x74d5f317f3172ba4 .quad 0xcd2db5dab1f75ef5 .quad 0xd77f95cf16b065f5 .quad 0x14571fea3f49f085 .quad 0x1c333621262b2b3d .quad 0xa86fe55467d9ca81 .quad 0x398b7c752b298c37 .quad 0xda6d0892e3ac623b .quad 0x4aebcc4547e9d98c // 2^148 * 1 * B .quad 0x53175a7205d21a77 .quad 0xb0c04422d3b934d4 .quad 0xadd9f24bdd5deadc .quad 0x074f46e69f10ff8c .quad 0x0de9b204a059a445 .quad 0xe15cb4aa4b17ad0f .quad 0xe1bbec521f79c557 .quad 0x2633f1b9d071081b .quad 0xc1fb4177018b9910 .quad 0xa6ea20dc6c0fe140 .quad 0xd661f3e74354c6ff .quad 0x5ecb72e6f1a3407a // 2^148 * 2 * B .quad 0xa515a31b2259fb4e .quad 0x0960f3972bcac52f .quad 0xedb52fec8d3454cb .quad 0x382e2720c476c019 .quad 0xfeeae106e8e86997 .quad 0x9863337f98d09383 .quad 0x9470480eaa06ebef .quad 0x038b6898d4c5c2d0 .quad 0xf391c51d8ace50a6 .quad 0x3142d0b9ae2d2948 .quad 0xdb4d5a1a7f24ca80 .quad 0x21aeba8b59250ea8 // 2^148 * 3 * B .quad 0x24f13b34cf405530 .quad 0x3c44ea4a43088af7 .quad 0x5dd5c5170006a482 .quad 0x118eb8f8890b086d .quad 0x53853600f0087f23 .quad 0x4c461879da7d5784 .quad 0x6af303deb41f6860 .quad 0x0a3c16c5c27c18ed .quad 0x17e49c17cc947f3d .quad 0xccc6eda6aac1d27b .quad 0xdf6092ceb0f08e56 .quad 0x4909b3e22c67c36b // 2^148 * 4 * B .quad 0x9c9c85ea63fe2e89 .quad 0xbe1baf910e9412ec .quad 0x8f7baa8a86fbfe7b .quad 0x0fb17f9fef968b6c .quad 0x59a16676706ff64e .quad 0x10b953dd0d86a53d .quad 0x5848e1e6ce5c0b96 .quad 0x2d8b78e712780c68 .quad 0x79d5c62eafc3902b .quad 0x773a215289e80728 .quad 0xc38ae640e10120b9 .quad 0x09ae23717b2b1a6d // 2^148 * 5 * B .quad 0xbb6a192a4e4d083c .quad 0x34ace0630029e192 .quad 0x98245a59aafabaeb .quad 0x6d9c8a9ada97faac .quad 0x10ab8fa1ad32b1d0 .quad 0xe9aced1be2778b24 .quad 0xa8856bc0373de90f .quad 0x66f35ddddda53996 .quad 0xd27d9afb24997323 .quad 0x1bb7e07ef6f01d2e .quad 0x2ba7472df52ecc7f .quad 0x03019b4f646f9dc8 // 2^148 * 6 * B .quad 0x04a186b5565345cd .quad 0xeee76610bcc4116a .quad 0x689c73b478fb2a45 .quad 0x387dcbff65697512 .quad 0xaf09b214e6b3dc6b .quad 0x3f7573b5ad7d2f65 .quad 0xd019d988100a23b0 .quad 0x392b63a58b5c35f7 .quad 0x4093addc9c07c205 .quad 0xc565be15f532c37e .quad 0x63dbecfd1583402a .quad 0x61722b4aef2e032e // 2^148 * 7 * B .quad 0x0012aafeecbd47af .quad 0x55a266fb1cd46309 .quad 0xf203eb680967c72c .quad 0x39633944ca3c1429 .quad 0xd6b07a5581cb0e3c .quad 0x290ff006d9444969 .quad 0x08680b6a16dcda1f .quad 0x5568d2b75a06de59 .quad 0x8d0cb88c1b37cfe1 .quad 0x05b6a5a3053818f3 .quad 0xf2e9bc04b787d959 .quad 0x6beba1249add7f64 // 2^148 * 8 * B .quad 0x1d06005ca5b1b143 .quad 0x6d4c6bb87fd1cda2 .quad 0x6ef5967653fcffe7 .quad 0x097c29e8c1ce1ea5 .quad 0x5c3cecb943f5a53b .quad 0x9cc9a61d06c08df2 .quad 0xcfba639a85895447 .quad 0x5a845ae80df09fd5 .quad 0x4ce97dbe5deb94ca .quad 0x38d0a4388c709c48 .quad 0xc43eced4a169d097 .quad 0x0a1249fff7e587c3 // 2^152 * 1 * B .quad 0x12f0071b276d01c9 .quad 0xe7b8bac586c48c70 .quad 0x5308129b71d6fba9 .quad 0x5d88fbf95a3db792 .quad 0x0b408d9e7354b610 .quad 0x806b32535ba85b6e .quad 0xdbe63a034a58a207 .quad 0x173bd9ddc9a1df2c .quad 0x2b500f1efe5872df .quad 0x58d6582ed43918c1 .quad 0xe6ed278ec9673ae0 .quad 0x06e1cd13b19ea319 // 2^152 * 2 * B .quad 0x40d0ad516f166f23 .quad 0x118e32931fab6abe .quad 0x3fe35e14a04d088e .quad 0x3080603526e16266 .quad 0x472baf629e5b0353 .quad 0x3baa0b90278d0447 .quad 0x0c785f469643bf27 .quad 0x7f3a6a1a8d837b13 .quad 0xf7e644395d3d800b .quad 0x95a8d555c901edf6 .quad 0x68cd7830592c6339 .quad 0x30d0fded2e51307e // 2^152 * 3 * B .quad 0xe0594d1af21233b3 .quad 0x1bdbe78ef0cc4d9c .quad 0x6965187f8f499a77 .quad 0x0a9214202c099868 .quad 0x9cb4971e68b84750 .quad 0xa09572296664bbcf .quad 0x5c8de72672fa412b .quad 0x4615084351c589d9 .quad 0xbc9019c0aeb9a02e .quad 0x55c7110d16034cae .quad 0x0e6df501659932ec .quad 0x3bca0d2895ca5dfe // 2^152 * 4 * B .quad 0x40f031bc3c5d62a4 .quad 0x19fc8b3ecff07a60 .quad 0x98183da2130fb545 .quad 0x5631deddae8f13cd .quad 0x9c688eb69ecc01bf .quad 0xf0bc83ada644896f .quad 0xca2d955f5f7a9fe2 .quad 0x4ea8b4038df28241 .quad 0x2aed460af1cad202 .quad 0x46305305a48cee83 .quad 0x9121774549f11a5f .quad 0x24ce0930542ca463 // 2^152 * 5 * B .quad 0x1fe890f5fd06c106 .quad 0xb5c468355d8810f2 .quad 0x827808fe6e8caf3e .quad 0x41d4e3c28a06d74b .quad 0x3fcfa155fdf30b85 .quad 0xd2f7168e36372ea4 .quad 0xb2e064de6492f844 .quad 0x549928a7324f4280 .quad 0xf26e32a763ee1a2e .quad 0xae91e4b7d25ffdea .quad 0xbc3bd33bd17f4d69 .quad 0x491b66dec0dcff6a // 2^152 * 6 * B .quad 0x98f5b13dc7ea32a7 .quad 0xe3d5f8cc7e16db98 .quad 0xac0abf52cbf8d947 .quad 0x08f338d0c85ee4ac .quad 0x75f04a8ed0da64a1 .quad 0xed222caf67e2284b .quad 0x8234a3791f7b7ba4 .quad 0x4cf6b8b0b7018b67 .quad 0xc383a821991a73bd .quad 0xab27bc01df320c7a .quad 0xc13d331b84777063 .quad 0x530d4a82eb078a99 // 2^152 * 7 * B .quad 0x004c3630e1f94825 .quad 0x7e2d78268cab535a .quad 0xc7482323cc84ff8b .quad 0x65ea753f101770b9 .quad 0x6d6973456c9abf9e .quad 0x257fb2fc4900a880 .quad 0x2bacf412c8cfb850 .quad 0x0db3e7e00cbfbd5b .quad 0x3d66fc3ee2096363 .quad 0x81d62c7f61b5cb6b .quad 0x0fbe044213443b1a .quad 0x02a4ec1921e1a1db // 2^152 * 8 * B .quad 0x5ce6259a3b24b8a2 .quad 0xb8577acc45afa0b8 .quad 0xcccbe6e88ba07037 .quad 0x3d143c51127809bf .quad 0xf5c86162f1cf795f .quad 0x118c861926ee57f2 .quad 0x172124851c063578 .quad 0x36d12b5dec067fcf .quad 0x126d279179154557 .quad 0xd5e48f5cfc783a0a .quad 0x36bdb6e8df179bac .quad 0x2ef517885ba82859 // 2^156 * 1 * B .quad 0x88bd438cd11e0d4a .quad 0x30cb610d43ccf308 .quad 0xe09a0e3791937bcc .quad 0x4559135b25b1720c .quad 0x1ea436837c6da1e9 .quad 0xf9c189af1fb9bdbe .quad 0x303001fcce5dd155 .quad 0x28a7c99ebc57be52 .quad 0xb8fd9399e8d19e9d .quad 0x908191cb962423ff .quad 0xb2b948d747c742a3 .quad 0x37f33226d7fb44c4 // 2^156 * 2 * B .quad 0x0dae8767b55f6e08 .quad 0x4a43b3b35b203a02 .quad 0xe3725a6e80af8c79 .quad 0x0f7a7fd1705fa7a3 .quad 0x33912553c821b11d .quad 0x66ed42c241e301df .quad 0x066fcc11104222fd .quad 0x307a3b41c192168f .quad 0x8eeb5d076eb55ce0 .quad 0x2fc536bfaa0d925a .quad 0xbe81830fdcb6c6e8 .quad 0x556c7045827baf52 // 2^156 * 3 * B .quad 0x8e2b517302e9d8b7 .quad 0xe3e52269248714e8 .quad 0xbd4fbd774ca960b5 .quad 0x6f4b4199c5ecada9 .quad 0xb94b90022bf44406 .quad 0xabd4237eff90b534 .quad 0x7600a960faf86d3a .quad 0x2f45abdac2322ee3 .quad 0x61af4912c8ef8a6a .quad 0xe58fa4fe43fb6e5e .quad 0xb5afcc5d6fd427cf .quad 0x6a5393281e1e11eb // 2^156 * 4 * B .quad 0xf3da5139a5d1ee89 .quad 0x8145457cff936988 .quad 0x3f622fed00e188c4 .quad 0x0f513815db8b5a3d .quad 0x0fff04fe149443cf .quad 0x53cac6d9865cddd7 .quad 0x31385b03531ed1b7 .quad 0x5846a27cacd1039d .quad 0x4ff5cdac1eb08717 .quad 0x67e8b29590f2e9bc .quad 0x44093b5e237afa99 .quad 0x0d414bed8708b8b2 // 2^156 * 5 * B .quad 0xcfb68265fd0e75f6 .quad 0xe45b3e28bb90e707 .quad 0x7242a8de9ff92c7a .quad 0x685b3201933202dd .quad 0x81886a92294ac9e8 .quad 0x23162b45d55547be .quad 0x94cfbc4403715983 .quad 0x50eb8fdb134bc401 .quad 0xc0b73ec6d6b330cd .quad 0x84e44807132faff1 .quad 0x732b7352c4a5dee1 .quad 0x5d7c7cf1aa7cd2d2 // 2^156 * 6 * B .quad 0xaf3b46bf7a4aafa2 .quad 0xb78705ec4d40d411 .quad 0x114f0c6aca7c15e3 .quad 0x3f364faaa9489d4d .quad 0x33d1013e9b73a562 .quad 0x925cef5748ec26e1 .quad 0xa7fce614dd468058 .quad 0x78b0fad41e9aa438 .quad 0xbf56a431ed05b488 .quad 0xa533e66c9c495c7e .quad 0xe8652baf87f3651a .quad 0x0241800059d66c33 // 2^156 * 7 * B .quad 0xceb077fea37a5be4 .quad 0xdb642f02e5a5eeb7 .quad 0xc2e6d0c5471270b8 .quad 0x4771b65538e4529c .quad 0x28350c7dcf38ea01 .quad 0x7c6cdbc0b2917ab6 .quad 0xace7cfbe857082f7 .quad 0x4d2845aba2d9a1e0 .quad 0xbb537fe0447070de .quad 0xcba744436dd557df .quad 0xd3b5a3473600dbcb .quad 0x4aeabbe6f9ffd7f8 // 2^156 * 8 * B .quad 0x4630119e40d8f78c .quad 0xa01a9bc53c710e11 .quad 0x486d2b258910dd79 .quad 0x1e6c47b3db0324e5 .quad 0x6a2134bcc4a9c8f2 .quad 0xfbf8fd1c8ace2e37 .quad 0x000ae3049911a0ba .quad 0x046e3a616bc89b9e .quad 0x14e65442f03906be .quad 0x4a019d54e362be2a .quad 0x68ccdfec8dc230c7 .quad 0x7cfb7e3faf6b861c // 2^160 * 1 * B .quad 0x4637974e8c58aedc .quad 0xb9ef22fbabf041a4 .quad 0xe185d956e980718a .quad 0x2f1b78fab143a8a6 .quad 0x96eebffb305b2f51 .quad 0xd3f938ad889596b8 .quad 0xf0f52dc746d5dd25 .quad 0x57968290bb3a0095 .quad 0xf71ab8430a20e101 .quad 0xf393658d24f0ec47 .quad 0xcf7509a86ee2eed1 .quad 0x7dc43e35dc2aa3e1 // 2^160 * 2 * B .quad 0x85966665887dd9c3 .quad 0xc90f9b314bb05355 .quad 0xc6e08df8ef2079b1 .quad 0x7ef72016758cc12f .quad 0x5a782a5c273e9718 .quad 0x3576c6995e4efd94 .quad 0x0f2ed8051f237d3e .quad 0x044fb81d82d50a99 .quad 0xc1df18c5a907e3d9 .quad 0x57b3371dce4c6359 .quad 0xca704534b201bb49 .quad 0x7f79823f9c30dd2e // 2^160 * 3 * B .quad 0x8334d239a3b513e8 .quad 0xc13670d4b91fa8d8 .quad 0x12b54136f590bd33 .quad 0x0a4e0373d784d9b4 .quad 0x6a9c1ff068f587ba .quad 0x0827894e0050c8de .quad 0x3cbf99557ded5be7 .quad 0x64a9b0431c06d6f0 .quad 0x2eb3d6a15b7d2919 .quad 0xb0b4f6a0d53a8235 .quad 0x7156ce4389a45d47 .quad 0x071a7d0ace18346c // 2^160 * 4 * B .quad 0xd3072daac887ba0b .quad 0x01262905bfa562ee .quad 0xcf543002c0ef768b .quad 0x2c3bcc7146ea7e9c .quad 0xcc0c355220e14431 .quad 0x0d65950709b15141 .quad 0x9af5621b209d5f36 .quad 0x7c69bcf7617755d3 .quad 0x07f0d7eb04e8295f .quad 0x10db18252f50f37d .quad 0xe951a9a3171798d7 .quad 0x6f5a9a7322aca51d // 2^160 * 5 * B .quad 0x8ba1000c2f41c6c5 .quad 0xc49f79c10cfefb9b .quad 0x4efa47703cc51c9f .quad 0x494e21a2e147afca .quad 0xe729d4eba3d944be .quad 0x8d9e09408078af9e .quad 0x4525567a47869c03 .quad 0x02ab9680ee8d3b24 .quad 0xefa48a85dde50d9a .quad 0x219a224e0fb9a249 .quad 0xfa091f1dd91ef6d9 .quad 0x6b5d76cbea46bb34 // 2^160 * 6 * B .quad 0x8857556cec0cd994 .quad 0x6472dc6f5cd01dba .quad 0xaf0169148f42b477 .quad 0x0ae333f685277354 .quad 0xe0f941171e782522 .quad 0xf1e6ae74036936d3 .quad 0x408b3ea2d0fcc746 .quad 0x16fb869c03dd313e .quad 0x288e199733b60962 .quad 0x24fc72b4d8abe133 .quad 0x4811f7ed0991d03e .quad 0x3f81e38b8f70d075 // 2^160 * 7 * B .quad 0x7f910fcc7ed9affe .quad 0x545cb8a12465874b .quad 0xa8397ed24b0c4704 .quad 0x50510fc104f50993 .quad 0x0adb7f355f17c824 .quad 0x74b923c3d74299a4 .quad 0xd57c3e8bcbf8eaf7 .quad 0x0ad3e2d34cdedc3d .quad 0x6f0c0fc5336e249d .quad 0x745ede19c331cfd9 .quad 0xf2d6fd0009eefe1c .quad 0x127c158bf0fa1ebe // 2^160 * 8 * B .quad 0xf6197c422e9879a2 .quad 0xa44addd452ca3647 .quad 0x9b413fc14b4eaccb .quad 0x354ef87d07ef4f68 .quad 0xdea28fc4ae51b974 .quad 0x1d9973d3744dfe96 .quad 0x6240680b873848a8 .quad 0x4ed82479d167df95 .quad 0xfee3b52260c5d975 .quad 0x50352efceb41b0b8 .quad 0x8808ac30a9f6653c .quad 0x302d92d20539236d // 2^164 * 1 * B .quad 0x4c59023fcb3efb7c .quad 0x6c2fcb99c63c2a94 .quad 0xba4190e2c3c7e084 .quad 0x0e545daea51874d9 .quad 0x957b8b8b0df53c30 .quad 0x2a1c770a8e60f098 .quad 0xbbc7a670345796de .quad 0x22a48f9a90c99bc9 .quad 0x6b7dc0dc8d3fac58 .quad 0x5497cd6ce6e42bfd .quad 0x542f7d1bf400d305 .quad 0x4159f47f048d9136 // 2^164 * 2 * B .quad 0x20ad660839e31e32 .quad 0xf81e1bd58405be50 .quad 0xf8064056f4dabc69 .quad 0x14d23dd4ce71b975 .quad 0x748515a8bbd24839 .quad 0x77128347afb02b55 .quad 0x50ba2ac649a2a17f .quad 0x060525513ad730f1 .quad 0xf2398e098aa27f82 .quad 0x6d7982bb89a1b024 .quad 0xfa694084214dd24c .quad 0x71ab966fa32301c3 // 2^164 * 3 * B .quad 0x2dcbd8e34ded02fc .quad 0x1151f3ec596f22aa .quad 0xbca255434e0328da .quad 0x35768fbe92411b22 .quad 0xb1088a0702809955 .quad 0x43b273ea0b43c391 .quad 0xca9b67aefe0686ed .quad 0x605eecbf8335f4ed .quad 0x83200a656c340431 .quad 0x9fcd71678ee59c2f .quad 0x75d4613f71300f8a .quad 0x7a912faf60f542f9 // 2^164 * 4 * B .quad 0xb204585e5edc1a43 .quad 0x9f0e16ee5897c73c .quad 0x5b82c0ae4e70483c .quad 0x624a170e2bddf9be .quad 0x253f4f8dfa2d5597 .quad 0x25e49c405477130c .quad 0x00c052e5996b1102 .quad 0x33cb966e33bb6c4a .quad 0x597028047f116909 .quad 0x828ac41c1e564467 .quad 0x70417dbde6217387 .quad 0x721627aefbac4384 // 2^164 * 5 * B .quad 0x97d03bc38736add5 .quad 0x2f1422afc532b130 .quad 0x3aa68a057101bbc4 .quad 0x4c946cf7e74f9fa7 .quad 0xfd3097bc410b2f22 .quad 0xf1a05da7b5cfa844 .quad 0x61289a1def57ca74 .quad 0x245ea199bb821902 .quad 0xaedca66978d477f8 .quad 0x1898ba3c29117fe1 .quad 0xcf73f983720cbd58 .quad 0x67da12e6b8b56351 // 2^164 * 6 * B .quad 0x7067e187b4bd6e07 .quad 0x6e8f0203c7d1fe74 .quad 0x93c6aa2f38c85a30 .quad 0x76297d1f3d75a78a .quad 0x2b7ef3d38ec8308c .quad 0x828fd7ec71eb94ab .quad 0x807c3b36c5062abd .quad 0x0cb64cb831a94141 .quad 0x3030fc33534c6378 .quad 0xb9635c5ce541e861 .quad 0x15d9a9bed9b2c728 .quad 0x49233ea3f3775dcb // 2^164 * 7 * B .quad 0x629398fa8dbffc3a .quad 0xe12fe52dd54db455 .quad 0xf3be11dfdaf25295 .quad 0x628b140dce5e7b51 .quad 0x7b3985fe1c9f249b .quad 0x4fd6b2d5a1233293 .quad 0xceb345941adf4d62 .quad 0x6987ff6f542de50c .quad 0x47e241428f83753c .quad 0x6317bebc866af997 .quad 0xdabb5b433d1a9829 .quad 0x074d8d245287fb2d // 2^164 * 8 * B .quad 0x8337d9cd440bfc31 .quad 0x729d2ca1af318fd7 .quad 0xa040a4a4772c2070 .quad 0x46002ef03a7349be .quad 0x481875c6c0e31488 .quad 0x219429b2e22034b4 .quad 0x7223c98a31283b65 .quad 0x3420d60b342277f9 .quad 0xfaa23adeaffe65f7 .quad 0x78261ed45be0764c .quad 0x441c0a1e2f164403 .quad 0x5aea8e567a87d395 // 2^168 * 1 * B .quad 0x7813c1a2bca4283d .quad 0xed62f091a1863dd9 .quad 0xaec7bcb8c268fa86 .quad 0x10e5d3b76f1cae4c .quad 0x2dbc6fb6e4e0f177 .quad 0x04e1bf29a4bd6a93 .quad 0x5e1966d4787af6e8 .quad 0x0edc5f5eb426d060 .quad 0x5453bfd653da8e67 .quad 0xe9dc1eec24a9f641 .quad 0xbf87263b03578a23 .quad 0x45b46c51361cba72 // 2^168 * 2 * B .quad 0xa9402abf314f7fa1 .quad 0xe257f1dc8e8cf450 .quad 0x1dbbd54b23a8be84 .quad 0x2177bfa36dcb713b .quad 0xce9d4ddd8a7fe3e4 .quad 0xab13645676620e30 .quad 0x4b594f7bb30e9958 .quad 0x5c1c0aef321229df .quad 0x37081bbcfa79db8f .quad 0x6048811ec25f59b3 .quad 0x087a76659c832487 .quad 0x4ae619387d8ab5bb // 2^168 * 3 * B .quad 0x8ddbf6aa5344a32e .quad 0x7d88eab4b41b4078 .quad 0x5eb0eb974a130d60 .quad 0x1a00d91b17bf3e03 .quad 0x61117e44985bfb83 .quad 0xfce0462a71963136 .quad 0x83ac3448d425904b .quad 0x75685abe5ba43d64 .quad 0x6e960933eb61f2b2 .quad 0x543d0fa8c9ff4952 .quad 0xdf7275107af66569 .quad 0x135529b623b0e6aa // 2^168 * 4 * B .quad 0x18f0dbd7add1d518 .quad 0x979f7888cfc11f11 .quad 0x8732e1f07114759b .quad 0x79b5b81a65ca3a01 .quad 0xf5c716bce22e83fe .quad 0xb42beb19e80985c1 .quad 0xec9da63714254aae .quad 0x5972ea051590a613 .quad 0x0fd4ac20dc8f7811 .quad 0x9a9ad294ac4d4fa8 .quad 0xc01b2d64b3360434 .quad 0x4f7e9c95905f3bdb // 2^168 * 5 * B .quad 0x62674bbc5781302e .quad 0xd8520f3989addc0f .quad 0x8c2999ae53fbd9c6 .quad 0x31993ad92e638e4c .quad 0x71c8443d355299fe .quad 0x8bcd3b1cdbebead7 .quad 0x8092499ef1a49466 .quad 0x1942eec4a144adc8 .quad 0x7dac5319ae234992 .quad 0x2c1b3d910cea3e92 .quad 0x553ce494253c1122 .quad 0x2a0a65314ef9ca75 // 2^168 * 6 * B .quad 0x2db7937ff7f927c2 .quad 0xdb741f0617d0a635 .quad 0x5982f3a21155af76 .quad 0x4cf6e218647c2ded .quad 0xcf361acd3c1c793a .quad 0x2f9ebcac5a35bc3b .quad 0x60e860e9a8cda6ab .quad 0x055dc39b6dea1a13 .quad 0xb119227cc28d5bb6 .quad 0x07e24ebc774dffab .quad 0xa83c78cee4a32c89 .quad 0x121a307710aa24b6 // 2^168 * 7 * B .quad 0xe4db5d5e9f034a97 .quad 0xe153fc093034bc2d .quad 0x460546919551d3b1 .quad 0x333fc76c7a40e52d .quad 0xd659713ec77483c9 .quad 0x88bfe077b82b96af .quad 0x289e28231097bcd3 .quad 0x527bb94a6ced3a9b .quad 0x563d992a995b482e .quad 0x3405d07c6e383801 .quad 0x485035de2f64d8e5 .quad 0x6b89069b20a7a9f7 // 2^168 * 8 * B .quad 0x812aa0416270220d .quad 0x995a89faf9245b4e .quad 0xffadc4ce5072ef05 .quad 0x23bc2103aa73eb73 .quad 0x4082fa8cb5c7db77 .quad 0x068686f8c734c155 .quad 0x29e6c8d9f6e7a57e .quad 0x0473d308a7639bcf .quad 0xcaee792603589e05 .quad 0x2b4b421246dcc492 .quad 0x02a1ef74e601a94f .quad 0x102f73bfde04341a // 2^172 * 1 * B .quad 0xb5a2d50c7ec20d3e .quad 0xc64bdd6ea0c97263 .quad 0x56e89052c1ff734d .quad 0x4929c6f72b2ffaba .quad 0x358ecba293a36247 .quad 0xaf8f9862b268fd65 .quad 0x412f7e9968a01c89 .quad 0x5786f312cd754524 .quad 0x337788ffca14032c .quad 0xf3921028447f1ee3 .quad 0x8b14071f231bccad .quad 0x4c817b4bf2344783 // 2^172 * 2 * B .quad 0x0ff853852871b96e .quad 0xe13e9fab60c3f1bb .quad 0xeefd595325344402 .quad 0x0a37c37075b7744b .quad 0x413ba057a40b4484 .quad 0xba4c2e1a4f5f6a43 .quad 0x614ba0a5aee1d61c .quad 0x78a1531a8b05dc53 .quad 0x6cbdf1703ad0562b .quad 0x8ecf4830c92521a3 .quad 0xdaebd303fd8424e7 .quad 0x72ad82a42e5ec56f // 2^172 * 3 * B .quad 0x3f9e8e35bafb65f6 .quad 0x39d69ec8f27293a1 .quad 0x6cb8cd958cf6a3d0 .quad 0x1734778173adae6d .quad 0xc368939167024bc3 .quad 0x8e69d16d49502fda .quad 0xfcf2ec3ce45f4b29 .quad 0x065f669ea3b4cbc4 .quad 0x8a00aec75532db4d .quad 0xb869a4e443e31bb1 .quad 0x4a0f8552d3a7f515 .quad 0x19adeb7c303d7c08 // 2^172 * 4 * B .quad 0xc720cb6153ead9a3 .quad 0x55b2c97f512b636e .quad 0xb1e35b5fd40290b1 .quad 0x2fd9ccf13b530ee2 .quad 0x9d05ba7d43c31794 .quad 0x2470c8ff93322526 .quad 0x8323dec816197438 .quad 0x2852709881569b53 .quad 0x07bd475b47f796b8 .quad 0xd2c7b013542c8f54 .quad 0x2dbd23f43b24f87e .quad 0x6551afd77b0901d6 // 2^172 * 5 * B .quad 0x4546baaf54aac27f .quad 0xf6f66fecb2a45a28 .quad 0x582d1b5b562bcfe8 .quad 0x44b123f3920f785f .quad 0x68a24ce3a1d5c9ac .quad 0xbb77a33d10ff6461 .quad 0x0f86ce4425d3166e .quad 0x56507c0950b9623b .quad 0x1206f0b7d1713e63 .quad 0x353fe3d915bafc74 .quad 0x194ceb970ad9d94d .quad 0x62fadd7cf9d03ad3 // 2^172 * 6 * B .quad 0xc6b5967b5598a074 .quad 0x5efe91ce8e493e25 .quad 0xd4b72c4549280888 .quad 0x20ef1149a26740c2 .quad 0x3cd7bc61e7ce4594 .quad 0xcd6b35a9b7dd267e .quad 0xa080abc84366ef27 .quad 0x6ec7c46f59c79711 .quad 0x2f07ad636f09a8a2 .quad 0x8697e6ce24205e7d .quad 0xc0aefc05ee35a139 .quad 0x15e80958b5f9d897 // 2^172 * 7 * B .quad 0x25a5ef7d0c3e235b .quad 0x6c39c17fbe134ee7 .quad 0xc774e1342dc5c327 .quad 0x021354b892021f39 .quad 0x4dd1ed355bb061c4 .quad 0x42dc0cef941c0700 .quad 0x61305dc1fd86340e .quad 0x56b2cc930e55a443 .quad 0x1df79da6a6bfc5a2 .quad 0x02f3a2749fde4369 .quad 0xb323d9f2cda390a7 .quad 0x7be0847b8774d363 // 2^172 * 8 * B .quad 0x8c99cc5a8b3f55c3 .quad 0x0611d7253fded2a0 .quad 0xed2995ff36b70a36 .quad 0x1f699a54d78a2619 .quad 0x1466f5af5307fa11 .quad 0x817fcc7ded6c0af2 .quad 0x0a6de44ec3a4a3fb .quad 0x74071475bc927d0b .quad 0xe77292f373e7ea8a .quad 0x296537d2cb045a31 .quad 0x1bd0653ed3274fde .quad 0x2f9a2c4476bd2966 // 2^176 * 1 * B .quad 0xeb18b9ab7f5745c6 .quad 0x023a8aee5787c690 .quad 0xb72712da2df7afa9 .quad 0x36597d25ea5c013d .quad 0xa2b4dae0b5511c9a .quad 0x7ac860292bffff06 .quad 0x981f375df5504234 .quad 0x3f6bd725da4ea12d .quad 0x734d8d7b106058ac .quad 0xd940579e6fc6905f .quad 0x6466f8f99202932d .quad 0x7b7ecc19da60d6d0 // 2^176 * 2 * B .quad 0x78c2373c695c690d .quad 0xdd252e660642906e .quad 0x951d44444ae12bd2 .quad 0x4235ad7601743956 .quad 0x6dae4a51a77cfa9b .quad 0x82263654e7a38650 .quad 0x09bbffcd8f2d82db .quad 0x03bedc661bf5caba .quad 0x6258cb0d078975f5 .quad 0x492942549189f298 .quad 0xa0cab423e2e36ee4 .quad 0x0e7ce2b0cdf066a1 // 2^176 * 3 * B .quad 0xc494643ac48c85a3 .quad 0xfd361df43c6139ad .quad 0x09db17dd3ae94d48 .quad 0x666e0a5d8fb4674a .quad 0xfea6fedfd94b70f9 .quad 0xf130c051c1fcba2d .quad 0x4882d47e7f2fab89 .quad 0x615256138aeceeb5 .quad 0x2abbf64e4870cb0d .quad 0xcd65bcf0aa458b6b .quad 0x9abe4eba75e8985d .quad 0x7f0bc810d514dee4 // 2^176 * 4 * B .quad 0xb9006ba426f4136f .quad 0x8d67369e57e03035 .quad 0xcbc8dfd94f463c28 .quad 0x0d1f8dbcf8eedbf5 .quad 0x83ac9dad737213a0 .quad 0x9ff6f8ba2ef72e98 .quad 0x311e2edd43ec6957 .quad 0x1d3a907ddec5ab75 .quad 0xba1693313ed081dc .quad 0x29329fad851b3480 .quad 0x0128013c030321cb .quad 0x00011b44a31bfde3 // 2^176 * 5 * B .quad 0x3fdfa06c3fc66c0c .quad 0x5d40e38e4dd60dd2 .quad 0x7ae38b38268e4d71 .quad 0x3ac48d916e8357e1 .quad 0x16561f696a0aa75c .quad 0xc1bf725c5852bd6a .quad 0x11a8dd7f9a7966ad .quad 0x63d988a2d2851026 .quad 0x00120753afbd232e .quad 0xe92bceb8fdd8f683 .quad 0xf81669b384e72b91 .quad 0x33fad52b2368a066 // 2^176 * 6 * B .quad 0x540649c6c5e41e16 .quad 0x0af86430333f7735 .quad 0xb2acfcd2f305e746 .quad 0x16c0f429a256dca7 .quad 0x8d2cc8d0c422cfe8 .quad 0x072b4f7b05a13acb .quad 0xa3feb6e6ecf6a56f .quad 0x3cc355ccb90a71e2 .quad 0xe9b69443903e9131 .quad 0xb8a494cb7a5637ce .quad 0xc87cd1a4baba9244 .quad 0x631eaf426bae7568 // 2^176 * 7 * B .quad 0xb3e90410da66fe9f .quad 0x85dd4b526c16e5a6 .quad 0xbc3d97611ef9bf83 .quad 0x5599648b1ea919b5 .quad 0x47d975b9a3700de8 .quad 0x7280c5fbe2f80552 .quad 0x53658f2732e45de1 .quad 0x431f2c7f665f80b5 .quad 0xd6026344858f7b19 .quad 0x14ab352fa1ea514a .quad 0x8900441a2090a9d7 .quad 0x7b04715f91253b26 // 2^176 * 8 * B .quad 0x83edbd28acf6ae43 .quad 0x86357c8b7d5c7ab4 .quad 0xc0404769b7eb2c44 .quad 0x59b37bf5c2f6583f .quad 0xb376c280c4e6bac6 .quad 0x970ed3dd6d1d9b0b .quad 0xb09a9558450bf944 .quad 0x48d0acfa57cde223 .quad 0xb60f26e47dabe671 .quad 0xf1d1a197622f3a37 .quad 0x4208ce7ee9960394 .quad 0x16234191336d3bdb // 2^180 * 1 * B .quad 0xf19aeac733a63aef .quad 0x2c7fba5d4442454e .quad 0x5da87aa04795e441 .quad 0x413051e1a4e0b0f5 .quad 0x852dd1fd3d578bbe .quad 0x2b65ce72c3286108 .quad 0x658c07f4eace2273 .quad 0x0933f804ec38ab40 .quad 0xa7ab69798d496476 .quad 0x8121aadefcb5abc8 .quad 0xa5dc12ef7b539472 .quad 0x07fd47065e45351a // 2^180 * 2 * B .quad 0xc8583c3d258d2bcd .quad 0x17029a4daf60b73f .quad 0xfa0fc9d6416a3781 .quad 0x1c1e5fba38b3fb23 .quad 0x304211559ae8e7c3 .quad 0xf281b229944882a5 .quad 0x8a13ac2e378250e4 .quad 0x014afa0954ba48f4 .quad 0xcb3197001bb3666c .quad 0x330060524bffecb9 .quad 0x293711991a88233c .quad 0x291884363d4ed364 // 2^180 * 3 * B .quad 0x033c6805dc4babfa .quad 0x2c15bf5e5596ecc1 .quad 0x1bc70624b59b1d3b .quad 0x3ede9850a19f0ec5 .quad 0xfb9d37c3bc1ab6eb .quad 0x02be14534d57a240 .quad 0xf4d73415f8a5e1f6 .quad 0x5964f4300ccc8188 .quad 0xe44a23152d096800 .quad 0x5c08c55970866996 .quad 0xdf2db60a46affb6e .quad 0x579155c1f856fd89 // 2^180 * 4 * B .quad 0x96324edd12e0c9ef .quad 0x468b878df2420297 .quad 0x199a3776a4f573be .quad 0x1e7fbcf18e91e92a .quad 0xb5f16b630817e7a6 .quad 0x808c69233c351026 .quad 0x324a983b54cef201 .quad 0x53c092084a485345 .quad 0xd2d41481f1cbafbf .quad 0x231d2db6716174e5 .quad 0x0b7d7656e2a55c98 .quad 0x3e955cd82aa495f6 // 2^180 * 5 * B .quad 0xe48f535e3ed15433 .quad 0xd075692a0d7270a3 .quad 0x40fbd21daade6387 .quad 0x14264887cf4495f5 .quad 0xab39f3ef61bb3a3f .quad 0x8eb400652eb9193e .quad 0xb5de6ecc38c11f74 .quad 0x654d7e9626f3c49f .quad 0xe564cfdd5c7d2ceb .quad 0x82eeafded737ccb9 .quad 0x6107db62d1f9b0ab .quad 0x0b6baac3b4358dbb // 2^180 * 6 * B .quad 0x7ae62bcb8622fe98 .quad 0x47762256ceb891af .quad 0x1a5a92bcf2e406b4 .quad 0x7d29401784e41501 .quad 0x204abad63700a93b .quad 0xbe0023d3da779373 .quad 0xd85f0346633ab709 .quad 0x00496dc490820412 .quad 0x1c74b88dc27e6360 .quad 0x074854268d14850c .quad 0xa145fb7b3e0dcb30 .quad 0x10843f1b43803b23 // 2^180 * 7 * B .quad 0xc5f90455376276dd .quad 0xce59158dd7645cd9 .quad 0x92f65d511d366b39 .quad 0x11574b6e526996c4 .quad 0xd56f672de324689b .quad 0xd1da8aedb394a981 .quad 0xdd7b58fe9168cfed .quad 0x7ce246cd4d56c1e8 .quad 0xb8f4308e7f80be53 .quad 0x5f3cb8cb34a9d397 .quad 0x18a961bd33cc2b2c .quad 0x710045fb3a9af671 // 2^180 * 8 * B .quad 0x73f93d36101b95eb .quad 0xfaef33794f6f4486 .quad 0x5651735f8f15e562 .quad 0x7fa3f19058b40da1 .quad 0xa03fc862059d699e .quad 0x2370cfa19a619e69 .quad 0xc4fe3b122f823deb .quad 0x1d1b056fa7f0844e .quad 0x1bc64631e56bf61f .quad 0xd379ab106e5382a3 .quad 0x4d58c57e0540168d .quad 0x566256628442d8e4 // 2^184 * 1 * B .quad 0xb9e499def6267ff6 .quad 0x7772ca7b742c0843 .quad 0x23a0153fe9a4f2b1 .quad 0x2cdfdfecd5d05006 .quad 0xdd499cd61ff38640 .quad 0x29cd9bc3063625a0 .quad 0x51e2d8023dd73dc3 .quad 0x4a25707a203b9231 .quad 0x2ab7668a53f6ed6a .quad 0x304242581dd170a1 .quad 0x4000144c3ae20161 .quad 0x5721896d248e49fc // 2^184 * 2 * B .quad 0x0b6e5517fd181bae .quad 0x9022629f2bb963b4 .quad 0x5509bce932064625 .quad 0x578edd74f63c13da .quad 0x285d5091a1d0da4e .quad 0x4baa6fa7b5fe3e08 .quad 0x63e5177ce19393b3 .quad 0x03c935afc4b030fd .quad 0x997276c6492b0c3d .quad 0x47ccc2c4dfe205fc .quad 0xdcd29b84dd623a3c .quad 0x3ec2ab590288c7a2 // 2^184 * 3 * B .quad 0xa1a0d27be4d87bb9 .quad 0xa98b4deb61391aed .quad 0x99a0ddd073cb9b83 .quad 0x2dd5c25a200fcace .quad 0xa7213a09ae32d1cb .quad 0x0f2b87df40f5c2d5 .quad 0x0baea4c6e81eab29 .quad 0x0e1bf66c6adbac5e .quad 0xe2abd5e9792c887e .quad 0x1a020018cb926d5d .quad 0xbfba69cdbaae5f1e .quad 0x730548b35ae88f5f // 2^184 * 4 * B .quad 0xc43551a3cba8b8ee .quad 0x65a26f1db2115f16 .quad 0x760f4f52ab8c3850 .quad 0x3043443b411db8ca .quad 0x805b094ba1d6e334 .quad 0xbf3ef17709353f19 .quad 0x423f06cb0622702b .quad 0x585a2277d87845dd .quad 0xa18a5f8233d48962 .quad 0x6698c4b5ec78257f .quad 0xa78e6fa5373e41ff .quad 0x7656278950ef981f // 2^184 * 5 * B .quad 0x38c3cf59d51fc8c0 .quad 0x9bedd2fd0506b6f2 .quad 0x26bf109fab570e8f .quad 0x3f4160a8c1b846a6 .quad 0xe17073a3ea86cf9d .quad 0x3a8cfbb707155fdc .quad 0x4853e7fc31838a8e .quad 0x28bbf484b613f616 .quad 0xf2612f5c6f136c7c .quad 0xafead107f6dd11be .quad 0x527e9ad213de6f33 .quad 0x1e79cb358188f75d // 2^184 * 6 * B .quad 0x013436c3eef7e3f1 .quad 0x828b6a7ffe9e10f8 .quad 0x7ff908e5bcf9defc .quad 0x65d7951b3a3b3831 .quad 0x77e953d8f5e08181 .quad 0x84a50c44299dded9 .quad 0xdc6c2d0c864525e5 .quad 0x478ab52d39d1f2f4 .quad 0x66a6a4d39252d159 .quad 0xe5dde1bc871ac807 .quad 0xb82c6b40a6c1c96f .quad 0x16d87a411a212214 // 2^184 * 7 * B .quad 0xb3bd7e5a42066215 .quad 0x879be3cd0c5a24c1 .quad 0x57c05db1d6f994b7 .quad 0x28f87c8165f38ca6 .quad 0xfba4d5e2d54e0583 .quad 0xe21fafd72ebd99fa .quad 0x497ac2736ee9778f .quad 0x1f990b577a5a6dde .quad 0xa3344ead1be8f7d6 .quad 0x7d1e50ebacea798f .quad 0x77c6569e520de052 .quad 0x45882fe1534d6d3e // 2^184 * 8 * B .quad 0x6669345d757983d6 .quad 0x62b6ed1117aa11a6 .quad 0x7ddd1857985e128f .quad 0x688fe5b8f626f6dd .quad 0xd8ac9929943c6fe4 .quad 0xb5f9f161a38392a2 .quad 0x2699db13bec89af3 .quad 0x7dcf843ce405f074 .quad 0x6c90d6484a4732c0 .quad 0xd52143fdca563299 .quad 0xb3be28c3915dc6e1 .quad 0x6739687e7327191b // 2^188 * 1 * B .quad 0x9f65c5ea200814cf .quad 0x840536e169a31740 .quad 0x8b0ed13925c8b4ad .quad 0x0080dbafe936361d .quad 0x8ce5aad0c9cb971f .quad 0x1156aaa99fd54a29 .quad 0x41f7247015af9b78 .quad 0x1fe8cca8420f49aa .quad 0x72a1848f3c0cc82a .quad 0x38c560c2877c9e54 .quad 0x5004e228ce554140 .quad 0x042418a103429d71 // 2^188 * 2 * B .quad 0x899dea51abf3ff5f .quad 0x9b93a8672fc2d8ba .quad 0x2c38cb97be6ebd5c .quad 0x114d578497263b5d .quad 0x58e84c6f20816247 .quad 0x8db2b2b6e36fd793 .quad 0x977182561d484d85 .quad 0x0822024f8632abd7 .quad 0xb301bb7c6b1beca3 .quad 0x55393f6dc6eb1375 .quad 0x910d281097b6e4eb .quad 0x1ad4548d9d479ea3 // 2^188 * 3 * B .quad 0xcd5a7da0389a48fd .quad 0xb38fa4aa9a78371e .quad 0xc6d9761b2cdb8e6c .quad 0x35cf51dbc97e1443 .quad 0xa06fe66d0fe9fed3 .quad 0xa8733a401c587909 .quad 0x30d14d800df98953 .quad 0x41ce5876c7b30258 .quad 0x59ac3bc5d670c022 .quad 0xeae67c109b119406 .quad 0x9798bdf0b3782fda .quad 0x651e3201fd074092 // 2^188 * 4 * B .quad 0xd63d8483ef30c5cf .quad 0x4cd4b4962361cc0c .quad 0xee90e500a48426ac .quad 0x0af51d7d18c14eeb .quad 0xa57ba4a01efcae9e .quad 0x769f4beedc308a94 .quad 0xd1f10eeb3603cb2e .quad 0x4099ce5e7e441278 .quad 0x1ac98e4f8a5121e9 .quad 0x7dae9544dbfa2fe0 .quad 0x8320aa0dd6430df9 .quad 0x667282652c4a2fb5 // 2^188 * 5 * B .quad 0x874621f4d86bc9ab .quad 0xb54c7bbe56fe6fea .quad 0x077a24257fadc22c .quad 0x1ab53be419b90d39 .quad 0xada8b6e02946db23 .quad 0x1c0ce51a7b253ab7 .quad 0x8448c85a66dd485b .quad 0x7f1fc025d0675adf .quad 0xd8ee1b18319ea6aa .quad 0x004d88083a21f0da .quad 0x3bd6aa1d883a4f4b .quad 0x4db9a3a6dfd9fd14 // 2^188 * 6 * B .quad 0x8ce7b23bb99c0755 .quad 0x35c5d6edc4f50f7a .quad 0x7e1e2ed2ed9b50c3 .quad 0x36305f16e8934da1 .quad 0xd95b00bbcbb77c68 .quad 0xddbc846a91f17849 .quad 0x7cf700aebe28d9b3 .quad 0x5ce1285c85d31f3e .quad 0x31b6972d98b0bde8 .quad 0x7d920706aca6de5b .quad 0xe67310f8908a659f .quad 0x50fac2a6efdf0235 // 2^188 * 7 * B .quad 0xf3d3a9f35b880f5a .quad 0xedec050cdb03e7c2 .quad 0xa896981ff9f0b1a2 .quad 0x49a4ae2bac5e34a4 .quad 0x295b1c86f6f449bc .quad 0x51b2e84a1f0ab4dd .quad 0xc001cb30aa8e551d .quad 0x6a28d35944f43662 .quad 0x28bb12ee04a740e0 .quad 0x14313bbd9bce8174 .quad 0x72f5b5e4e8c10c40 .quad 0x7cbfb19936adcd5b // 2^188 * 8 * B .quad 0xa311ddc26b89792d .quad 0x1b30b4c6da512664 .quad 0x0ca77b4ccf150859 .quad 0x1de443df1b009408 .quad 0x8e793a7acc36e6e0 .quad 0xf9fab7a37d586eed .quad 0x3a4f9692bae1f4e4 .quad 0x1c14b03eff5f447e .quad 0x19647bd114a85291 .quad 0x57b76cb21034d3af .quad 0x6329db440f9d6dfa .quad 0x5ef43e586a571493 // 2^192 * 1 * B .quad 0xef782014385675a6 .quad 0xa2649f30aafda9e8 .quad 0x4cd1eb505cdfa8cb .quad 0x46115aba1d4dc0b3 .quad 0xa66dcc9dc80c1ac0 .quad 0x97a05cf41b38a436 .quad 0xa7ebf3be95dbd7c6 .quad 0x7da0b8f68d7e7dab .quad 0xd40f1953c3b5da76 .quad 0x1dac6f7321119e9b .quad 0x03cc6021feb25960 .quad 0x5a5f887e83674b4b // 2^192 * 2 * B .quad 0x8f6301cf70a13d11 .quad 0xcfceb815350dd0c4 .quad 0xf70297d4a4bca47e .quad 0x3669b656e44d1434 .quad 0x9e9628d3a0a643b9 .quad 0xb5c3cb00e6c32064 .quad 0x9b5302897c2dec32 .quad 0x43e37ae2d5d1c70c .quad 0x387e3f06eda6e133 .quad 0x67301d5199a13ac0 .quad 0xbd5ad8f836263811 .quad 0x6a21e6cd4fd5e9be // 2^192 * 3 * B .quad 0xf1c6170a3046e65f .quad 0x58712a2a00d23524 .quad 0x69dbbd3c8c82b755 .quad 0x586bf9f1a195ff57 .quad 0xef4129126699b2e3 .quad 0x71d30847708d1301 .quad 0x325432d01182b0bd .quad 0x45371b07001e8b36 .quad 0xa6db088d5ef8790b .quad 0x5278f0dc610937e5 .quad 0xac0349d261a16eb8 .quad 0x0eafb03790e52179 // 2^192 * 4 * B .quad 0x960555c13748042f .quad 0x219a41e6820baa11 .quad 0x1c81f73873486d0c .quad 0x309acc675a02c661 .quad 0x5140805e0f75ae1d .quad 0xec02fbe32662cc30 .quad 0x2cebdf1eea92396d .quad 0x44ae3344c5435bb3 .quad 0x9cf289b9bba543ee .quad 0xf3760e9d5ac97142 .quad 0x1d82e5c64f9360aa .quad 0x62d5221b7f94678f // 2^192 * 5 * B .quad 0x524c299c18d0936d .quad 0xc86bb56c8a0c1a0c .quad 0xa375052edb4a8631 .quad 0x5c0efde4bc754562 .quad 0x7585d4263af77a3c .quad 0xdfae7b11fee9144d .quad 0xa506708059f7193d .quad 0x14f29a5383922037 .quad 0xdf717edc25b2d7f5 .quad 0x21f970db99b53040 .quad 0xda9234b7c3ed4c62 .quad 0x5e72365c7bee093e // 2^192 * 6 * B .quad 0x575bfc074571217f .quad 0x3779675d0694d95b .quad 0x9a0a37bbf4191e33 .quad 0x77f1104c47b4eabc .quad 0x7d9339062f08b33e .quad 0x5b9659e5df9f32be .quad 0xacff3dad1f9ebdfd .quad 0x70b20555cb7349b7 .quad 0xbe5113c555112c4c .quad 0x6688423a9a881fcd .quad 0x446677855e503b47 .quad 0x0e34398f4a06404a // 2^192 * 7 * B .quad 0xb67d22d93ecebde8 .quad 0x09b3e84127822f07 .quad 0x743fa61fb05b6d8d .quad 0x5e5405368a362372 .quad 0x18930b093e4b1928 .quad 0x7de3e10e73f3f640 .quad 0xf43217da73395d6f .quad 0x6f8aded6ca379c3e .quad 0xe340123dfdb7b29a .quad 0x487b97e1a21ab291 .quad 0xf9967d02fde6949e .quad 0x780de72ec8d3de97 // 2^192 * 8 * B .quad 0x0ae28545089ae7bc .quad 0x388ddecf1c7f4d06 .quad 0x38ac15510a4811b8 .quad 0x0eb28bf671928ce4 .quad 0x671feaf300f42772 .quad 0x8f72eb2a2a8c41aa .quad 0x29a17fd797373292 .quad 0x1defc6ad32b587a6 .quad 0xaf5bbe1aef5195a7 .quad 0x148c1277917b15ed .quad 0x2991f7fb7ae5da2e .quad 0x467d201bf8dd2867 // 2^196 * 1 * B .quad 0x7906ee72f7bd2e6b .quad 0x05d270d6109abf4e .quad 0x8d5cfe45b941a8a4 .quad 0x44c218671c974287 .quad 0x745f9d56296bc318 .quad 0x993580d4d8152e65 .quad 0xb0e5b13f5839e9ce .quad 0x51fc2b28d43921c0 .quad 0x1b8fd11795e2a98c .quad 0x1c4e5ee12b6b6291 .quad 0x5b30e7107424b572 .quad 0x6e6b9de84c4f4ac6 // 2^196 * 2 * B .quad 0xdff25fce4b1de151 .quad 0xd841c0c7e11c4025 .quad 0x2554b3c854749c87 .quad 0x2d292459908e0df9 .quad 0x6b7c5f10f80cb088 .quad 0x736b54dc56e42151 .quad 0xc2b620a5c6ef99c4 .quad 0x5f4c802cc3a06f42 .quad 0x9b65c8f17d0752da .quad 0x881ce338c77ee800 .quad 0xc3b514f05b62f9e3 .quad 0x66ed5dd5bec10d48 // 2^196 * 3 * B .quad 0x7d38a1c20bb2089d .quad 0x808334e196ccd412 .quad 0xc4a70b8c6c97d313 .quad 0x2eacf8bc03007f20 .quad 0xf0adf3c9cbca047d .quad 0x81c3b2cbf4552f6b .quad 0xcfda112d44735f93 .quad 0x1f23a0c77e20048c .quad 0xf235467be5bc1570 .quad 0x03d2d9020dbab38c .quad 0x27529aa2fcf9e09e .quad 0x0840bef29d34bc50 // 2^196 * 4 * B .quad 0x796dfb35dc10b287 .quad 0x27176bcd5c7ff29d .quad 0x7f3d43e8c7b24905 .quad 0x0304f5a191c54276 .quad 0xcd54e06b7f37e4eb .quad 0x8cc15f87f5e96cca .quad 0xb8248bb0d3597dce .quad 0x246affa06074400c .quad 0x37d88e68fbe45321 .quad 0x86097548c0d75032 .quad 0x4e9b13ef894a0d35 .quad 0x25a83cac5753d325 // 2^196 * 5 * B .quad 0x10222f48eed8165e .quad 0x623fc1234b8bcf3a .quad 0x1e145c09c221e8f0 .quad 0x7ccfa59fca782630 .quad 0x9f0f66293952b6e2 .quad 0x33db5e0e0934267b .quad 0xff45252bd609fedc .quad 0x06be10f5c506e0c9 .quad 0x1a9615a9b62a345f .quad 0x22050c564a52fecc .quad 0xa7a2788528bc0dfe .quad 0x5e82770a1a1ee71d // 2^196 * 6 * B .quad 0x35425183ad896a5c .quad 0xe8673afbe78d52f6 .quad 0x2c66f25f92a35f64 .quad 0x09d04f3b3b86b102 .quad 0xe802e80a42339c74 .quad 0x34175166a7fffae5 .quad 0x34865d1f1c408cae .quad 0x2cca982c605bc5ee .quad 0xfd2d5d35197dbe6e .quad 0x207c2eea8be4ffa3 .quad 0x2613d8db325ae918 .quad 0x7a325d1727741d3e // 2^196 * 7 * B .quad 0xd036b9bbd16dfde2 .quad 0xa2055757c497a829 .quad 0x8e6cc966a7f12667 .quad 0x4d3b1a791239c180 .quad 0xecd27d017e2a076a .quad 0xd788689f1636495e .quad 0x52a61af0919233e5 .quad 0x2a479df17bb1ae64 .quad 0x9e5eee8e33db2710 .quad 0x189854ded6c43ca5 .quad 0xa41c22c592718138 .quad 0x27ad5538a43a5e9b // 2^196 * 8 * B .quad 0x2746dd4b15350d61 .quad 0xd03fcbc8ee9521b7 .quad 0xe86e365a138672ca .quad 0x510e987f7e7d89e2 .quad 0xcb5a7d638e47077c .quad 0x8db7536120a1c059 .quad 0x549e1e4d8bedfdcc .quad 0x080153b7503b179d .quad 0xdda69d930a3ed3e3 .quad 0x3d386ef1cd60a722 .quad 0xc817ad58bdaa4ee6 .quad 0x23be8d554fe7372a // 2^200 * 1 * B .quad 0x95fe919a74ef4fad .quad 0x3a827becf6a308a2 .quad 0x964e01d309a47b01 .quad 0x71c43c4f5ba3c797 .quad 0xbc1ef4bd567ae7a9 .quad 0x3f624cb2d64498bd .quad 0xe41064d22c1f4ec8 .quad 0x2ef9c5a5ba384001 .quad 0xb6fd6df6fa9e74cd .quad 0xf18278bce4af267a .quad 0x8255b3d0f1ef990e .quad 0x5a758ca390c5f293 // 2^200 * 2 * B .quad 0xa2b72710d9462495 .quad 0x3aa8c6d2d57d5003 .quad 0xe3d400bfa0b487ca .quad 0x2dbae244b3eb72ec .quad 0x8ce0918b1d61dc94 .quad 0x8ded36469a813066 .quad 0xd4e6a829afe8aad3 .quad 0x0a738027f639d43f .quad 0x980f4a2f57ffe1cc .quad 0x00670d0de1839843 .quad 0x105c3f4a49fb15fd .quad 0x2698ca635126a69c // 2^200 * 3 * B .quad 0xe765318832b0ba78 .quad 0x381831f7925cff8b .quad 0x08a81b91a0291fcc .quad 0x1fb43dcc49caeb07 .quad 0x2e3d702f5e3dd90e .quad 0x9e3f0918e4d25386 .quad 0x5e773ef6024da96a .quad 0x3c004b0c4afa3332 .quad 0x9aa946ac06f4b82b .quad 0x1ca284a5a806c4f3 .quad 0x3ed3265fc6cd4787 .quad 0x6b43fd01cd1fd217 // 2^200 * 4 * B .quad 0xc7a75d4b4697c544 .quad 0x15fdf848df0fffbf .quad 0x2868b9ebaa46785a .quad 0x5a68d7105b52f714 .quad 0xb5c742583e760ef3 .quad 0x75dc52b9ee0ab990 .quad 0xbf1427c2072b923f .quad 0x73420b2d6ff0d9f0 .quad 0xaf2cf6cb9e851e06 .quad 0x8f593913c62238c4 .quad 0xda8ab89699fbf373 .quad 0x3db5632fea34bc9e // 2^200 * 5 * B .quad 0xf46eee2bf75dd9d8 .quad 0x0d17b1f6396759a5 .quad 0x1bf2d131499e7273 .quad 0x04321adf49d75f13 .quad 0x2e4990b1829825d5 .quad 0xedeaeb873e9a8991 .quad 0xeef03d394c704af8 .quad 0x59197ea495df2b0e .quad 0x04e16019e4e55aae .quad 0xe77b437a7e2f92e9 .quad 0xc7ce2dc16f159aa4 .quad 0x45eafdc1f4d70cc0 // 2^200 * 6 * B .quad 0x698401858045d72b .quad 0x4c22faa2cf2f0651 .quad 0x941a36656b222dc6 .quad 0x5a5eebc80362dade .quad 0xb60e4624cfccb1ed .quad 0x59dbc292bd5c0395 .quad 0x31a09d1ddc0481c9 .quad 0x3f73ceea5d56d940 .quad 0xb7a7bfd10a4e8dc6 .quad 0xbe57007e44c9b339 .quad 0x60c1207f1557aefa .quad 0x26058891266218db // 2^200 * 7 * B .quad 0x59f704a68360ff04 .quad 0xc3d93fde7661e6f4 .quad 0x831b2a7312873551 .quad 0x54ad0c2e4e615d57 .quad 0x4c818e3cc676e542 .quad 0x5e422c9303ceccad .quad 0xec07cccab4129f08 .quad 0x0dedfa10b24443b8 .quad 0xee3b67d5b82b522a .quad 0x36f163469fa5c1eb .quad 0xa5b4d2f26ec19fd3 .quad 0x62ecb2baa77a9408 // 2^200 * 8 * B .quad 0xe5ed795261152b3d .quad 0x4962357d0eddd7d1 .quad 0x7482c8d0b96b4c71 .quad 0x2e59f919a966d8be .quad 0x92072836afb62874 .quad 0x5fcd5e8579e104a5 .quad 0x5aad01adc630a14a .quad 0x61913d5075663f98 .quad 0x0dc62d361a3231da .quad 0xfa47583294200270 .quad 0x02d801513f9594ce .quad 0x3ddbc2a131c05d5c // 2^204 * 1 * B .quad 0x3f50a50a4ffb81ef .quad 0xb1e035093bf420bf .quad 0x9baa8e1cc6aa2cd0 .quad 0x32239861fa237a40 .quad 0xfb735ac2004a35d1 .quad 0x31de0f433a6607c3 .quad 0x7b8591bfc528d599 .quad 0x55be9a25f5bb050c .quad 0x0d005acd33db3dbf .quad 0x0111b37c80ac35e2 .quad 0x4892d66c6f88ebeb .quad 0x770eadb16508fbcd // 2^204 * 2 * B .quad 0x8451f9e05e4e89dd .quad 0xc06302ffbc793937 .quad 0x5d22749556a6495c .quad 0x09a6755ca05603fb .quad 0xf1d3b681a05071b9 .quad 0x2207659a3592ff3a .quad 0x5f0169297881e40e .quad 0x16bedd0e86ba374e .quad 0x5ecccc4f2c2737b5 .quad 0x43b79e0c2dccb703 .quad 0x33e008bc4ec43df3 .quad 0x06c1b840f07566c0 // 2^204 * 3 * B .quad 0x7688a5c6a388f877 .quad 0x02a96c14deb2b6ac .quad 0x64c9f3431b8c2af8 .quad 0x3628435554a1eed6 .quad 0x69ee9e7f9b02805c .quad 0xcbff828a547d1640 .quad 0x3d93a869b2430968 .quad 0x46b7b8cd3fe26972 .quad 0xe9812086fe7eebe0 .quad 0x4cba6be72f515437 .quad 0x1d04168b516efae9 .quad 0x5ea1391043982cb9 // 2^204 * 4 * B .quad 0x49125c9cf4702ee1 .quad 0x4520b71f8b25b32d .quad 0x33193026501fef7e .quad 0x656d8997c8d2eb2b .quad 0x6f2b3be4d5d3b002 .quad 0xafec33d96a09c880 .quad 0x035f73a4a8bcc4cc .quad 0x22c5b9284662198b .quad 0xcb58c8fe433d8939 .quad 0x89a0cb2e6a8d7e50 .quad 0x79ca955309fbbe5a .quad 0x0c626616cd7fc106 // 2^204 * 5 * B .quad 0x1ffeb80a4879b61f .quad 0x6396726e4ada21ed .quad 0x33c7b093368025ba .quad 0x471aa0c6f3c31788 .quad 0x8fdfc379fbf454b1 .quad 0x45a5a970f1a4b771 .quad 0xac921ef7bad35915 .quad 0x42d088dca81c2192 .quad 0x8fda0f37a0165199 .quad 0x0adadb77c8a0e343 .quad 0x20fbfdfcc875e820 .quad 0x1cf2bea80c2206e7 // 2^204 * 6 * B .quad 0xc2ddf1deb36202ac .quad 0x92a5fe09d2e27aa5 .quad 0x7d1648f6fc09f1d3 .quad 0x74c2cc0513bc4959 .quad 0x982d6e1a02c0412f .quad 0x90fa4c83db58e8fe .quad 0x01c2f5bcdcb18bc0 .quad 0x686e0c90216abc66 .quad 0x1fadbadba54395a7 .quad 0xb41a02a0ae0da66a .quad 0xbf19f598bba37c07 .quad 0x6a12b8acde48430d // 2^204 * 7 * B .quad 0xf8daea1f39d495d9 .quad 0x592c190e525f1dfc .quad 0xdb8cbd04c9991d1b .quad 0x11f7fda3d88f0cb7 .quad 0x793bdd801aaeeb5f .quad 0x00a2a0aac1518871 .quad 0xe8a373a31f2136b4 .quad 0x48aab888fc91ef19 .quad 0x041f7e925830f40e .quad 0x002d6ca979661c06 .quad 0x86dc9ff92b046a2e .quad 0x760360928b0493d1 // 2^204 * 8 * B .quad 0x21bb41c6120cf9c6 .quad 0xeab2aa12decda59b .quad 0xc1a72d020aa48b34 .quad 0x215d4d27e87d3b68 .quad 0xb43108e5695a0b05 .quad 0x6cb00ee8ad37a38b .quad 0x5edad6eea3537381 .quad 0x3f2602d4b6dc3224 .quad 0xc8b247b65bcaf19c .quad 0x49779dc3b1b2c652 .quad 0x89a180bbd5ece2e2 .quad 0x13f098a3cec8e039 // 2^208 * 1 * B .quad 0x9adc0ff9ce5ec54b .quad 0x039c2a6b8c2f130d .quad 0x028007c7f0f89515 .quad 0x78968314ac04b36b .quad 0xf3aa57a22796bb14 .quad 0x883abab79b07da21 .quad 0xe54be21831a0391c .quad 0x5ee7fb38d83205f9 .quad 0x538dfdcb41446a8e .quad 0xa5acfda9434937f9 .quad 0x46af908d263c8c78 .quad 0x61d0633c9bca0d09 // 2^208 * 2 * B .quad 0x63744935ffdb2566 .quad 0xc5bd6b89780b68bb .quad 0x6f1b3280553eec03 .quad 0x6e965fd847aed7f5 .quad 0xada328bcf8fc73df .quad 0xee84695da6f037fc .quad 0x637fb4db38c2a909 .quad 0x5b23ac2df8067bdc .quad 0x9ad2b953ee80527b .quad 0xe88f19aafade6d8d .quad 0x0e711704150e82cf .quad 0x79b9bbb9dd95dedc // 2^208 * 3 * B .quad 0xebb355406a3126c2 .quad 0xd26383a868c8c393 .quad 0x6c0c6429e5b97a82 .quad 0x5065f158c9fd2147 .quad 0xd1997dae8e9f7374 .quad 0xa032a2f8cfbb0816 .quad 0xcd6cba126d445f0a .quad 0x1ba811460accb834 .quad 0x708169fb0c429954 .quad 0xe14600acd76ecf67 .quad 0x2eaab98a70e645ba .quad 0x3981f39e58a4faf2 // 2^208 * 4 * B .quad 0x18fb8a7559230a93 .quad 0x1d168f6960e6f45d .quad 0x3a85a94514a93cb5 .quad 0x38dc083705acd0fd .quad 0xc845dfa56de66fde .quad 0xe152a5002c40483a .quad 0xe9d2e163c7b4f632 .quad 0x30f4452edcbc1b65 .quad 0x856d2782c5759740 .quad 0xfa134569f99cbecc .quad 0x8844fc73c0ea4e71 .quad 0x632d9a1a593f2469 // 2^208 * 5 * B .quad 0xf6bb6b15b807cba6 .quad 0x1823c7dfbc54f0d7 .quad 0xbb1d97036e29670b .quad 0x0b24f48847ed4a57 .quad 0xbf09fd11ed0c84a7 .quad 0x63f071810d9f693a .quad 0x21908c2d57cf8779 .quad 0x3a5a7df28af64ba2 .quad 0xdcdad4be511beac7 .quad 0xa4538075ed26ccf2 .quad 0xe19cff9f005f9a65 .quad 0x34fcf74475481f63 // 2^208 * 6 * B .quad 0xc197e04c789767ca .quad 0xb8714dcb38d9467d .quad 0x55de888283f95fa8 .quad 0x3d3bdc164dfa63f7 .quad 0xa5bb1dab78cfaa98 .quad 0x5ceda267190b72f2 .quad 0x9309c9110a92608e .quad 0x0119a3042fb374b0 .quad 0x67a2d89ce8c2177d .quad 0x669da5f66895d0c1 .quad 0xf56598e5b282a2b0 .quad 0x56c088f1ede20a73 // 2^208 * 7 * B .quad 0x336d3d1110a86e17 .quad 0xd7f388320b75b2fa .quad 0xf915337625072988 .quad 0x09674c6b99108b87 .quad 0x581b5fac24f38f02 .quad 0xa90be9febae30cbd .quad 0x9a2169028acf92f0 .quad 0x038b7ea48359038f .quad 0x9f4ef82199316ff8 .quad 0x2f49d282eaa78d4f .quad 0x0971a5ab5aef3174 .quad 0x6e5e31025969eb65 // 2^208 * 8 * B .quad 0xb16c62f587e593fb .quad 0x4999eddeca5d3e71 .quad 0xb491c1e014cc3e6d .quad 0x08f5114789a8dba8 .quad 0x3304fb0e63066222 .quad 0xfb35068987acba3f .quad 0xbd1924778c1061a3 .quad 0x3058ad43d1838620 .quad 0x323c0ffde57663d0 .quad 0x05c3df38a22ea610 .quad 0xbdc78abdac994f9a .quad 0x26549fa4efe3dc99 // 2^212 * 1 * B .quad 0x738b38d787ce8f89 .quad 0xb62658e24179a88d .quad 0x30738c9cf151316d .quad 0x49128c7f727275c9 .quad 0x04dbbc17f75396b9 .quad 0x69e6a2d7d2f86746 .quad 0xc6409d99f53eabc6 .quad 0x606175f6332e25d2 .quad 0x4021370ef540e7dd .quad 0x0910d6f5a1f1d0a5 .quad 0x4634aacd5b06b807 .quad 0x6a39e6356944f235 // 2^212 * 2 * B .quad 0x96cd5640df90f3e7 .quad 0x6c3a760edbfa25ea .quad 0x24f3ef0959e33cc4 .quad 0x42889e7e530d2e58 .quad 0x1da1965774049e9d .quad 0xfbcd6ea198fe352b .quad 0xb1cbcd50cc5236a6 .quad 0x1f5ec83d3f9846e2 .quad 0x8efb23c3328ccb75 .quad 0xaf42a207dd876ee9 .quad 0x20fbdadc5dfae796 .quad 0x241e246b06bf9f51 // 2^212 * 3 * B .quad 0x29e68e57ad6e98f6 .quad 0x4c9260c80b462065 .quad 0x3f00862ea51ebb4b .quad 0x5bc2c77fb38d9097 .quad 0x7eaafc9a6280bbb8 .quad 0x22a70f12f403d809 .quad 0x31ce40bb1bfc8d20 .quad 0x2bc65635e8bd53ee .quad 0xe8d5dc9fa96bad93 .quad 0xe58fb17dde1947dc .quad 0x681532ea65185fa3 .quad 0x1fdd6c3b034a7830 // 2^212 * 4 * B .quad 0x0a64e28c55dc18fe .quad 0xe3df9e993399ebdd .quad 0x79ac432370e2e652 .quad 0x35ff7fc33ae4cc0e .quad 0x9c13a6a52dd8f7a9 .quad 0x2dbb1f8c3efdcabf .quad 0x961e32405e08f7b5 .quad 0x48c8a121bbe6c9e5 .quad 0xfc415a7c59646445 .quad 0xd224b2d7c128b615 .quad 0x6035c9c905fbb912 .quad 0x42d7a91274429fab // 2^212 * 5 * B .quad 0x4e6213e3eaf72ed3 .quad 0x6794981a43acd4e7 .quad 0xff547cde6eb508cb .quad 0x6fed19dd10fcb532 .quad 0xa9a48947933da5bc .quad 0x4a58920ec2e979ec .quad 0x96d8800013e5ac4c .quad 0x453692d74b48b147 .quad 0xdd775d99a8559c6f .quad 0xf42a2140df003e24 .quad 0x5223e229da928a66 .quad 0x063f46ba6d38f22c // 2^212 * 6 * B .quad 0xd2d242895f536694 .quad 0xca33a2c542939b2c .quad 0x986fada6c7ddb95c .quad 0x5a152c042f712d5d .quad 0x39843cb737346921 .quad 0xa747fb0738c89447 .quad 0xcb8d8031a245307e .quad 0x67810f8e6d82f068 .quad 0x3eeb8fbcd2287db4 .quad 0x72c7d3a301a03e93 .quad 0x5473e88cbd98265a .quad 0x7324aa515921b403 // 2^212 * 7 * B .quad 0x857942f46c3cbe8e .quad 0xa1d364b14730c046 .quad 0x1c8ed914d23c41bf .quad 0x0838e161eef6d5d2 .quad 0xad23f6dae82354cb .quad 0x6962502ab6571a6d .quad 0x9b651636e38e37d1 .quad 0x5cac5005d1a3312f .quad 0x8cc154cce9e39904 .quad 0x5b3a040b84de6846 .quad 0xc4d8a61cb1be5d6e .quad 0x40fb897bd8861f02 // 2^212 * 8 * B .quad 0x84c5aa9062de37a1 .quad 0x421da5000d1d96e1 .quad 0x788286306a9242d9 .quad 0x3c5e464a690d10da .quad 0xe57ed8475ab10761 .quad 0x71435e206fd13746 .quad 0x342f824ecd025632 .quad 0x4b16281ea8791e7b .quad 0xd1c101d50b813381 .quad 0xdee60f1176ee6828 .quad 0x0cb68893383f6409 .quad 0x6183c565f6ff484a // 2^216 * 1 * B .quad 0x741d5a461e6bf9d6 .quad 0x2305b3fc7777a581 .quad 0xd45574a26474d3d9 .quad 0x1926e1dc6401e0ff .quad 0xdb468549af3f666e .quad 0xd77fcf04f14a0ea5 .quad 0x3df23ff7a4ba0c47 .quad 0x3a10dfe132ce3c85 .quad 0xe07f4e8aea17cea0 .quad 0x2fd515463a1fc1fd .quad 0x175322fd31f2c0f1 .quad 0x1fa1d01d861e5d15 // 2^216 * 2 * B .quad 0xcc8055947d599832 .quad 0x1e4656da37f15520 .quad 0x99f6f7744e059320 .quad 0x773563bc6a75cf33 .quad 0x38dcac00d1df94ab .quad 0x2e712bddd1080de9 .quad 0x7f13e93efdd5e262 .quad 0x73fced18ee9a01e5 .quad 0x06b1e90863139cb3 .quad 0xa493da67c5a03ecd .quad 0x8d77cec8ad638932 .quad 0x1f426b701b864f44 // 2^216 * 3 * B .quad 0xefc9264c41911c01 .quad 0xf1a3b7b817a22c25 .quad 0x5875da6bf30f1447 .quad 0x4e1af5271d31b090 .quad 0xf17e35c891a12552 .quad 0xb76b8153575e9c76 .quad 0xfa83406f0d9b723e .quad 0x0b76bb1b3fa7e438 .quad 0x08b8c1f97f92939b .quad 0xbe6771cbd444ab6e .quad 0x22e5646399bb8017 .quad 0x7b6dd61eb772a955 // 2^216 * 4 * B .quad 0xb7adc1e850f33d92 .quad 0x7998fa4f608cd5cf .quad 0xad962dbd8dfc5bdb .quad 0x703e9bceaf1d2f4f .quad 0x5730abf9ab01d2c7 .quad 0x16fb76dc40143b18 .quad 0x866cbe65a0cbb281 .quad 0x53fa9b659bff6afe .quad 0x6c14c8e994885455 .quad 0x843a5d6665aed4e5 .quad 0x181bb73ebcd65af1 .quad 0x398d93e5c4c61f50 // 2^216 * 5 * B .quad 0x1c4bd16733e248f3 .quad 0xbd9e128715bf0a5f .quad 0xd43f8cf0a10b0376 .quad 0x53b09b5ddf191b13 .quad 0xc3877c60d2e7e3f2 .quad 0x3b34aaa030828bb1 .quad 0x283e26e7739ef138 .quad 0x699c9c9002c30577 .quad 0xf306a7235946f1cc .quad 0x921718b5cce5d97d .quad 0x28cdd24781b4e975 .quad 0x51caf30c6fcdd907 // 2^216 * 6 * B .quad 0xa60ba7427674e00a .quad 0x630e8570a17a7bf3 .quad 0x3758563dcf3324cc .quad 0x5504aa292383fdaa .quad 0x737af99a18ac54c7 .quad 0x903378dcc51cb30f .quad 0x2b89bc334ce10cc7 .quad 0x12ae29c189f8e99a .quad 0xa99ec0cb1f0d01cf .quad 0x0dd1efcc3a34f7ae .quad 0x55ca7521d09c4e22 .quad 0x5fd14fe958eba5ea // 2^216 * 7 * B .quad 0xb5dc2ddf2845ab2c .quad 0x069491b10a7fe993 .quad 0x4daaf3d64002e346 .quad 0x093ff26e586474d1 .quad 0x3c42fe5ebf93cb8e .quad 0xbedfa85136d4565f .quad 0xe0f0859e884220e8 .quad 0x7dd73f960725d128 .quad 0xb10d24fe68059829 .quad 0x75730672dbaf23e5 .quad 0x1367253ab457ac29 .quad 0x2f59bcbc86b470a4 // 2^216 * 8 * B .quad 0x83847d429917135f .quad 0xad1b911f567d03d7 .quad 0x7e7748d9be77aad1 .quad 0x5458b42e2e51af4a .quad 0x7041d560b691c301 .quad 0x85201b3fadd7e71e .quad 0x16c2e16311335585 .quad 0x2aa55e3d010828b1 .quad 0xed5192e60c07444f .quad 0x42c54e2d74421d10 .quad 0x352b4c82fdb5c864 .quad 0x13e9004a8a768664 // 2^220 * 1 * B .quad 0xcbb5b5556c032bff .quad 0xdf7191b729297a3a .quad 0xc1ff7326aded81bb .quad 0x71ade8bb68be03f5 .quad 0x1e6284c5806b467c .quad 0xc5f6997be75d607b .quad 0x8b67d958b378d262 .quad 0x3d88d66a81cd8b70 .quad 0x8b767a93204ed789 .quad 0x762fcacb9fa0ae2a .quad 0x771febcc6dce4887 .quad 0x343062158ff05fb3 // 2^220 * 2 * B .quad 0xe05da1a7e1f5bf49 .quad 0x26457d6dd4736092 .quad 0x77dcb07773cc32f6 .quad 0x0a5d94969cdd5fcd .quad 0xfce219072a7b31b4 .quad 0x4d7adc75aa578016 .quad 0x0ec276a687479324 .quad 0x6d6d9d5d1fda4beb .quad 0x22b1a58ae9b08183 .quad 0xfd95d071c15c388b .quad 0xa9812376850a0517 .quad 0x33384cbabb7f335e // 2^220 * 3 * B .quad 0x3c6fa2680ca2c7b5 .quad 0x1b5082046fb64fda .quad 0xeb53349c5431d6de .quad 0x5278b38f6b879c89 .quad 0x33bc627a26218b8d .quad 0xea80b21fc7a80c61 .quad 0x9458b12b173e9ee6 .quad 0x076247be0e2f3059 .quad 0x52e105f61416375a .quad 0xec97af3685abeba4 .quad 0x26e6b50623a67c36 .quad 0x5cf0e856f3d4fb01 // 2^220 * 4 * B .quad 0xf6c968731ae8cab4 .quad 0x5e20741ecb4f92c5 .quad 0x2da53be58ccdbc3e .quad 0x2dddfea269970df7 .quad 0xbeaece313db342a8 .quad 0xcba3635b842db7ee .quad 0xe88c6620817f13ef .quad 0x1b9438aa4e76d5c6 .quad 0x8a50777e166f031a .quad 0x067b39f10fb7a328 .quad 0x1925c9a6010fbd76 .quad 0x6df9b575cc740905 // 2^220 * 5 * B .quad 0x42c1192927f6bdcf .quad 0x8f91917a403d61ca .quad 0xdc1c5a668b9e1f61 .quad 0x1596047804ec0f8d .quad 0xecdfc35b48cade41 .quad 0x6a88471fb2328270 .quad 0x740a4a2440a01b6a .quad 0x471e5796003b5f29 .quad 0xda96bbb3aced37ac .quad 0x7a2423b5e9208cea .quad 0x24cc5c3038aebae2 .quad 0x50c356afdc5dae2f // 2^220 * 6 * B .quad 0x09dcbf4341c30318 .quad 0xeeba061183181dce .quad 0xc179c0cedc1e29a1 .quad 0x1dbf7b89073f35b0 .quad 0xcfed9cdf1b31b964 .quad 0xf486a9858ca51af3 .quad 0x14897265ea8c1f84 .quad 0x784a53dd932acc00 .quad 0x2d99f9df14fc4920 .quad 0x76ccb60cc4499fe5 .quad 0xa4132cbbe5cf0003 .quad 0x3f93d82354f000ea // 2^220 * 7 * B .quad 0x8183e7689e04ce85 .quad 0x678fb71e04465341 .quad 0xad92058f6688edac .quad 0x5da350d3532b099a .quad 0xeaac12d179e14978 .quad 0xff923ff3bbebff5e .quad 0x4af663e40663ce27 .quad 0x0fd381a811a5f5ff .quad 0xf256aceca436df54 .quad 0x108b6168ae69d6e8 .quad 0x20d986cb6b5d036c .quad 0x655957b9fee2af50 // 2^220 * 8 * B .quad 0xaea8b07fa902030f .quad 0xf88c766af463d143 .quad 0x15b083663c787a60 .quad 0x08eab1148267a4a8 .quad 0xbdc1409bd002d0ac .quad 0x66660245b5ccd9a6 .quad 0x82317dc4fade85ec .quad 0x02fe934b6ad7df0d .quad 0xef5cf100cfb7ea74 .quad 0x22897633a1cb42ac .quad 0xd4ce0c54cef285e2 .quad 0x30408c048a146a55 // 2^224 * 1 * B .quad 0x739d8845832fcedb .quad 0xfa38d6c9ae6bf863 .quad 0x32bc0dcab74ffef7 .quad 0x73937e8814bce45e .quad 0xbb2e00c9193b877f .quad 0xece3a890e0dc506b .quad 0xecf3b7c036de649f .quad 0x5f46040898de9e1a .quad 0xb9037116297bf48d .quad 0xa9d13b22d4f06834 .quad 0xe19715574696bdc6 .quad 0x2cf8a4e891d5e835 // 2^224 * 2 * B .quad 0x6d93fd8707110f67 .quad 0xdd4c09d37c38b549 .quad 0x7cb16a4cc2736a86 .quad 0x2049bd6e58252a09 .quad 0x2cb5487e17d06ba2 .quad 0x24d2381c3950196b .quad 0xd7659c8185978a30 .quad 0x7a6f7f2891d6a4f6 .quad 0x7d09fd8d6a9aef49 .quad 0xf0ee60be5b3db90b .quad 0x4c21b52c519ebfd4 .quad 0x6011aadfc545941d // 2^224 * 3 * B .quad 0x5f67926dcf95f83c .quad 0x7c7e856171289071 .quad 0xd6a1e7f3998f7a5b .quad 0x6fc5cc1b0b62f9e0 .quad 0x63ded0c802cbf890 .quad 0xfbd098ca0dff6aaa .quad 0x624d0afdb9b6ed99 .quad 0x69ce18b779340b1e .quad 0xd1ef5528b29879cb .quad 0xdd1aae3cd47e9092 .quad 0x127e0442189f2352 .quad 0x15596b3ae57101f1 // 2^224 * 4 * B .quad 0x462739d23f9179a2 .quad 0xff83123197d6ddcf .quad 0x1307deb553f2148a .quad 0x0d2237687b5f4dda .quad 0x09ff31167e5124ca .quad 0x0be4158bd9c745df .quad 0x292b7d227ef556e5 .quad 0x3aa4e241afb6d138 .quad 0x2cc138bf2a3305f5 .quad 0x48583f8fa2e926c3 .quad 0x083ab1a25549d2eb .quad 0x32fcaa6e4687a36c // 2^224 * 5 * B .quad 0x7bc56e8dc57d9af5 .quad 0x3e0bd2ed9df0bdf2 .quad 0xaac014de22efe4a3 .quad 0x4627e9cefebd6a5c .quad 0x3207a4732787ccdf .quad 0x17e31908f213e3f8 .quad 0xd5b2ecd7f60d964e .quad 0x746f6336c2600be9 .quad 0x3f4af345ab6c971c .quad 0xe288eb729943731f .quad 0x33596a8a0344186d .quad 0x7b4917007ed66293 // 2^224 * 6 * B .quad 0x2d85fb5cab84b064 .quad 0x497810d289f3bc14 .quad 0x476adc447b15ce0c .quad 0x122ba376f844fd7b .quad 0x54341b28dd53a2dd .quad 0xaa17905bdf42fc3f .quad 0x0ff592d94dd2f8f4 .quad 0x1d03620fe08cd37d .quad 0xc20232cda2b4e554 .quad 0x9ed0fd42115d187f .quad 0x2eabb4be7dd479d9 .quad 0x02c70bf52b68ec4c // 2^224 * 7 * B .quad 0xa287ec4b5d0b2fbb .quad 0x415c5790074882ca .quad 0xe044a61ec1d0815c .quad 0x26334f0a409ef5e0 .quad 0xace532bf458d72e1 .quad 0x5be768e07cb73cb5 .quad 0x56cf7d94ee8bbde7 .quad 0x6b0697e3feb43a03 .quad 0xb6c8f04adf62a3c0 .quad 0x3ef000ef076da45d .quad 0x9c9cb95849f0d2a9 .quad 0x1cc37f43441b2fae // 2^224 * 8 * B .quad 0x508f565a5cc7324f .quad 0xd061c4c0e506a922 .quad 0xfb18abdb5c45ac19 .quad 0x6c6809c10380314a .quad 0xd76656f1c9ceaeb9 .quad 0x1c5b15f818e5656a .quad 0x26e72832844c2334 .quad 0x3a346f772f196838 .quad 0xd2d55112e2da6ac8 .quad 0xe9bd0331b1e851ed .quad 0x960746dd8ec67262 .quad 0x05911b9f6ef7c5d0 // 2^228 * 1 * B .quad 0xe9dcd756b637ff2d .quad 0xec4c348fc987f0c4 .quad 0xced59285f3fbc7b7 .quad 0x3305354793e1ea87 .quad 0x01c18980c5fe9f94 .quad 0xcd656769716fd5c8 .quad 0x816045c3d195a086 .quad 0x6e2b7f3266cc7982 .quad 0xcc802468f7c3568f .quad 0x9de9ba8219974cb3 .quad 0xabb7229cb5b81360 .quad 0x44e2017a6fbeba62 // 2^228 * 2 * B .quad 0xc4c2a74354dab774 .quad 0x8e5d4c3c4eaf031a .quad 0xb76c23d242838f17 .quad 0x749a098f68dce4ea .quad 0x87f82cf3b6ca6ecd .quad 0x580f893e18f4a0c2 .quad 0x058930072604e557 .quad 0x6cab6ac256d19c1d .quad 0xdcdfe0a02cc1de60 .quad 0x032665ff51c5575b .quad 0x2c0c32f1073abeeb .quad 0x6a882014cd7b8606 // 2^228 * 3 * B .quad 0xa52a92fea4747fb5 .quad 0xdc12a4491fa5ab89 .quad 0xd82da94bb847a4ce .quad 0x4d77edce9512cc4e .quad 0xd111d17caf4feb6e .quad 0x050bba42b33aa4a3 .quad 0x17514c3ceeb46c30 .quad 0x54bedb8b1bc27d75 .quad 0x77c8e14577e2189c .quad 0xa3e46f6aff99c445 .quad 0x3144dfc86d335343 .quad 0x3a96559e7c4216a9 // 2^228 * 4 * B .quad 0x12550d37f42ad2ee .quad 0x8b78e00498a1fbf5 .quad 0x5d53078233894cb2 .quad 0x02c84e4e3e498d0c .quad 0x4493896880baaa52 .quad 0x4c98afc4f285940e .quad 0xef4aa79ba45448b6 .quad 0x5278c510a57aae7f .quad 0xa54dd074294c0b94 .quad 0xf55d46b8df18ffb6 .quad 0xf06fecc58dae8366 .quad 0x588657668190d165 // 2^228 * 5 * B .quad 0xd47712311aef7117 .quad 0x50343101229e92c7 .quad 0x7a95e1849d159b97 .quad 0x2449959b8b5d29c9 .quad 0xbf5834f03de25cc3 .quad 0xb887c8aed6815496 .quad 0x5105221a9481e892 .quad 0x6760ed19f7723f93 .quad 0x669ba3b7ac35e160 .quad 0x2eccf73fba842056 .quad 0x1aec1f17c0804f07 .quad 0x0d96bc031856f4e7 // 2^228 * 6 * B .quad 0x3318be7775c52d82 .quad 0x4cb764b554d0aab9 .quad 0xabcf3d27cc773d91 .quad 0x3bf4d1848123288a .quad 0xb1d534b0cc7505e1 .quad 0x32cd003416c35288 .quad 0xcb36a5800762c29d .quad 0x5bfe69b9237a0bf8 .quad 0x183eab7e78a151ab .quad 0xbbe990c999093763 .quad 0xff717d6e4ac7e335 .quad 0x4c5cddb325f39f88 // 2^228 * 7 * B .quad 0xc0f6b74d6190a6eb .quad 0x20ea81a42db8f4e4 .quad 0xa8bd6f7d97315760 .quad 0x33b1d60262ac7c21 .quad 0x57750967e7a9f902 .quad 0x2c37fdfc4f5b467e .quad 0xb261663a3177ba46 .quad 0x3a375e78dc2d532b .quad 0x8141e72f2d4dddea .quad 0xe6eafe9862c607c8 .quad 0x23c28458573cafd0 .quad 0x46b9476f4ff97346 // 2^228 * 8 * B .quad 0x0c1ffea44f901e5c .quad 0x2b0b6fb72184b782 .quad 0xe587ff910114db88 .quad 0x37130f364785a142 .quad 0x1215505c0d58359f .quad 0x2a2013c7fc28c46b .quad 0x24a0a1af89ea664e .quad 0x4400b638a1130e1f .quad 0x3a01b76496ed19c3 .quad 0x31e00ab0ed327230 .quad 0x520a885783ca15b1 .quad 0x06aab9875accbec7 // 2^232 * 1 * B .quad 0xc1339983f5df0ebb .quad 0xc0f3758f512c4cac .quad 0x2cf1130a0bb398e1 .quad 0x6b3cecf9aa270c62 .quad 0x5349acf3512eeaef .quad 0x20c141d31cc1cb49 .quad 0x24180c07a99a688d .quad 0x555ef9d1c64b2d17 .quad 0x36a770ba3b73bd08 .quad 0x624aef08a3afbf0c .quad 0x5737ff98b40946f2 .quad 0x675f4de13381749d // 2^232 * 2 * B .quad 0x0e2c52036b1782fc .quad 0x64816c816cad83b4 .quad 0xd0dcbdd96964073e .quad 0x13d99df70164c520 .quad 0xa12ff6d93bdab31d .quad 0x0725d80f9d652dfe .quad 0x019c4ff39abe9487 .quad 0x60f450b882cd3c43 .quad 0x014b5ec321e5c0ca .quad 0x4fcb69c9d719bfa2 .quad 0x4e5f1c18750023a0 .quad 0x1c06de9e55edac80 // 2^232 * 3 * B .quad 0x990f7ad6a33ec4e2 .quad 0x6608f938be2ee08e .quad 0x9ca143c563284515 .quad 0x4cf38a1fec2db60d .quad 0xffd52b40ff6d69aa .quad 0x34530b18dc4049bb .quad 0x5e4a5c2fa34d9897 .quad 0x78096f8e7d32ba2d .quad 0xa0aaaa650dfa5ce7 .quad 0xf9c49e2a48b5478c .quad 0x4f09cc7d7003725b .quad 0x373cad3a26091abe // 2^232 * 4 * B .quad 0xb294634d82c9f57c .quad 0x1fcbfde124934536 .quad 0x9e9c4db3418cdb5a .quad 0x0040f3d9454419fc .quad 0xf1bea8fb89ddbbad .quad 0x3bcb2cbc61aeaecb .quad 0x8f58a7bb1f9b8d9d .quad 0x21547eda5112a686 .quad 0xdefde939fd5986d3 .quad 0xf4272c89510a380c .quad 0xb72ba407bb3119b9 .quad 0x63550a334a254df4 // 2^232 * 5 * B .quad 0x6507d6edb569cf37 .quad 0x178429b00ca52ee1 .quad 0xea7c0090eb6bd65d .quad 0x3eea62c7daf78f51 .quad 0x9bba584572547b49 .quad 0xf305c6fae2c408e0 .quad 0x60e8fa69c734f18d .quad 0x39a92bafaa7d767a .quad 0x9d24c713e693274e .quad 0x5f63857768dbd375 .quad 0x70525560eb8ab39a .quad 0x68436a0665c9c4cd // 2^232 * 6 * B .quad 0xbc0235e8202f3f27 .quad 0xc75c00e264f975b0 .quad 0x91a4e9d5a38c2416 .quad 0x17b6e7f68ab789f9 .quad 0x1e56d317e820107c .quad 0xc5266844840ae965 .quad 0xc1e0a1c6320ffc7a .quad 0x5373669c91611472 .quad 0x5d2814ab9a0e5257 .quad 0x908f2084c9cab3fc .quad 0xafcaf5885b2d1eca .quad 0x1cb4b5a678f87d11 // 2^232 * 7 * B .quad 0xb664c06b394afc6c .quad 0x0c88de2498da5fb1 .quad 0x4f8d03164bcad834 .quad 0x330bca78de7434a2 .quad 0x6b74aa62a2a007e7 .quad 0xf311e0b0f071c7b1 .quad 0x5707e438000be223 .quad 0x2dc0fd2d82ef6eac .quad 0x982eff841119744e .quad 0xf9695e962b074724 .quad 0xc58ac14fbfc953fb .quad 0x3c31be1b369f1cf5 // 2^232 * 8 * B .quad 0xb0f4864d08948aee .quad 0x07dc19ee91ba1c6f .quad 0x7975cdaea6aca158 .quad 0x330b61134262d4bb .quad 0xc168bc93f9cb4272 .quad 0xaeb8711fc7cedb98 .quad 0x7f0e52aa34ac8d7a .quad 0x41cec1097e7d55bb .quad 0xf79619d7a26d808a .quad 0xbb1fd49e1d9e156d .quad 0x73d7c36cdba1df27 .quad 0x26b44cd91f28777d // 2^236 * 1 * B .quad 0x300a9035393aa6d8 .quad 0x2b501131a12bb1cd .quad 0x7b1ff677f093c222 .quad 0x4309c1f8cab82bad .quad 0xaf44842db0285f37 .quad 0x8753189047efc8df .quad 0x9574e091f820979a .quad 0x0e378d6069615579 .quad 0xd9fa917183075a55 .quad 0x4bdb5ad26b009fdc .quad 0x7829ad2cd63def0e .quad 0x078fc54975fd3877 // 2^236 * 2 * B .quad 0x87dfbd1428878f2d .quad 0x134636dd1e9421a1 .quad 0x4f17c951257341a3 .quad 0x5df98d4bad296cb8 .quad 0xe2004b5bb833a98a .quad 0x44775dec2d4c3330 .quad 0x3aa244067eace913 .quad 0x272630e3d58e00a9 .quad 0xf3678fd0ecc90b54 .quad 0xf001459b12043599 .quad 0x26725fbc3758b89b .quad 0x4325e4aa73a719ae // 2^236 * 3 * B .quad 0x657dc6ef433c3493 .quad 0x65375e9f80dbf8c3 .quad 0x47fd2d465b372dae .quad 0x4966ab79796e7947 .quad 0xed24629acf69f59d .quad 0x2a4a1ccedd5abbf4 .quad 0x3535ca1f56b2d67b .quad 0x5d8c68d043b1b42d .quad 0xee332d4de3b42b0a .quad 0xd84e5a2b16a4601c .quad 0x78243877078ba3e4 .quad 0x77ed1eb4184ee437 // 2^236 * 4 * B .quad 0xbfd4e13f201839a0 .quad 0xaeefffe23e3df161 .quad 0xb65b04f06b5d1fe3 .quad 0x52e085fb2b62fbc0 .quad 0x185d43f89e92ed1a .quad 0xb04a1eeafe4719c6 .quad 0x499fbe88a6f03f4f .quad 0x5d8b0d2f3c859bdd .quad 0x124079eaa54cf2ba .quad 0xd72465eb001b26e7 .quad 0x6843bcfdc97af7fd .quad 0x0524b42b55eacd02 // 2^236 * 5 * B .quad 0xfd0d5dbee45447b0 .quad 0x6cec351a092005ee .quad 0x99a47844567579cb .quad 0x59d242a216e7fa45 .quad 0xbc18dcad9b829eac .quad 0x23ae7d28b5f579d0 .quad 0xc346122a69384233 .quad 0x1a6110b2e7d4ac89 .quad 0x4f833f6ae66997ac .quad 0x6849762a361839a4 .quad 0x6985dec1970ab525 .quad 0x53045e89dcb1f546 // 2^236 * 6 * B .quad 0xcb8bb346d75353db .quad 0xfcfcb24bae511e22 .quad 0xcba48d40d50ae6ef .quad 0x26e3bae5f4f7cb5d .quad 0x84da3cde8d45fe12 .quad 0xbd42c218e444e2d2 .quad 0xa85196781f7e3598 .quad 0x7642c93f5616e2b2 .quad 0x2323daa74595f8e4 .quad 0xde688c8b857abeb4 .quad 0x3fc48e961c59326e .quad 0x0b2e73ca15c9b8ba // 2^236 * 7 * B .quad 0xd6bb4428c17f5026 .quad 0x9eb27223fb5a9ca7 .quad 0xe37ba5031919c644 .quad 0x21ce380db59a6602 .quad 0x0e3fbfaf79c03a55 .quad 0x3077af054cbb5acf .quad 0xd5c55245db3de39f .quad 0x015e68c1476a4af7 .quad 0xc1d5285220066a38 .quad 0x95603e523570aef3 .quad 0x832659a7226b8a4d .quad 0x5dd689091f8eedc9 // 2^236 * 8 * B .quad 0xcbac84debfd3c856 .quad 0x1624c348b35ff244 .quad 0xb7f88dca5d9cad07 .quad 0x3b0e574da2c2ebe8 .quad 0x1d022591a5313084 .quad 0xca2d4aaed6270872 .quad 0x86a12b852f0bfd20 .quad 0x56e6c439ad7da748 .quad 0xc704ff4942bdbae6 .quad 0x5e21ade2b2de1f79 .quad 0xe95db3f35652fad8 .quad 0x0822b5378f08ebc1 // 2^240 * 1 * B .quad 0x51f048478f387475 .quad 0xb25dbcf49cbecb3c .quad 0x9aab1244d99f2055 .quad 0x2c709e6c1c10a5d6 .quad 0xe1b7f29362730383 .quad 0x4b5279ffebca8a2c .quad 0xdafc778abfd41314 .quad 0x7deb10149c72610f .quad 0xcb62af6a8766ee7a .quad 0x66cbec045553cd0e .quad 0x588001380f0be4b5 .quad 0x08e68e9ff62ce2ea // 2^240 * 2 * B .quad 0x34ad500a4bc130ad .quad 0x8d38db493d0bd49c .quad 0xa25c3d98500a89be .quad 0x2f1f3f87eeba3b09 .quad 0x2f2d09d50ab8f2f9 .quad 0xacb9218dc55923df .quad 0x4a8f342673766cb9 .quad 0x4cb13bd738f719f5 .quad 0xf7848c75e515b64a .quad 0xa59501badb4a9038 .quad 0xc20d313f3f751b50 .quad 0x19a1e353c0ae2ee8 // 2^240 * 3 * B .quad 0x7d1c7560bafa05c3 .quad 0xb3e1a0a0c6e55e61 .quad 0xe3529718c0d66473 .quad 0x41546b11c20c3486 .quad 0xb42172cdd596bdbd .quad 0x93e0454398eefc40 .quad 0x9fb15347b44109b5 .quad 0x736bd3990266ae34 .quad 0x85532d509334b3b4 .quad 0x46fd114b60816573 .quad 0xcc5f5f30425c8375 .quad 0x412295a2b87fab5c // 2^240 * 4 * B .quad 0x19c99b88f57ed6e9 .quad 0x5393cb266df8c825 .quad 0x5cee3213b30ad273 .quad 0x14e153ebb52d2e34 .quad 0x2e655261e293eac6 .quad 0x845a92032133acdb .quad 0x460975cb7900996b .quad 0x0760bb8d195add80 .quad 0x413e1a17cde6818a .quad 0x57156da9ed69a084 .quad 0x2cbf268f46caccb1 .quad 0x6b34be9bc33ac5f2 // 2^240 * 5 * B .quad 0xf3df2f643a78c0b2 .quad 0x4c3e971ef22e027c .quad 0xec7d1c5e49c1b5a3 .quad 0x2012c18f0922dd2d .quad 0x11fc69656571f2d3 .quad 0xc6c9e845530e737a .quad 0xe33ae7a2d4fe5035 .quad 0x01b9c7b62e6dd30b .quad 0x880b55e55ac89d29 .quad 0x1483241f45a0a763 .quad 0x3d36efdfc2e76c1f .quad 0x08af5b784e4bade8 // 2^240 * 6 * B .quad 0x283499dc881f2533 .quad 0x9d0525da779323b6 .quad 0x897addfb673441f4 .quad 0x32b79d71163a168d .quad 0xe27314d289cc2c4b .quad 0x4be4bd11a287178d .quad 0x18d528d6fa3364ce .quad 0x6423c1d5afd9826e .quad 0xcc85f8d9edfcb36a .quad 0x22bcc28f3746e5f9 .quad 0xe49de338f9e5d3cd .quad 0x480a5efbc13e2dcc // 2^240 * 7 * B .quad 0x0b51e70b01622071 .quad 0x06b505cf8b1dafc5 .quad 0x2c6bb061ef5aabcd .quad 0x47aa27600cb7bf31 .quad 0xb6614ce442ce221f .quad 0x6e199dcc4c053928 .quad 0x663fb4a4dc1cbe03 .quad 0x24b31d47691c8e06 .quad 0x2a541eedc015f8c3 .quad 0x11a4fe7e7c693f7c .quad 0xf0af66134ea278d6 .quad 0x545b585d14dda094 // 2^240 * 8 * B .quad 0x67bf275ea0d43a0f .quad 0xade68e34089beebe .quad 0x4289134cd479e72e .quad 0x0f62f9c332ba5454 .quad 0x6204e4d0e3b321e1 .quad 0x3baa637a28ff1e95 .quad 0x0b0ccffd5b99bd9e .quad 0x4d22dc3e64c8d071 .quad 0xfcb46589d63b5f39 .quad 0x5cae6a3f57cbcf61 .quad 0xfebac2d2953afa05 .quad 0x1c0fa01a36371436 // 2^244 * 1 * B .quad 0xe7547449bc7cd692 .quad 0x0f9abeaae6f73ddf .quad 0x4af01ca700837e29 .quad 0x63ab1b5d3f1bc183 .quad 0xc11ee5e854c53fae .quad 0x6a0b06c12b4f3ff4 .quad 0x33540f80e0b67a72 .quad 0x15f18fc3cd07e3ef .quad 0x32750763b028f48c .quad 0x06020740556a065f .quad 0xd53bd812c3495b58 .quad 0x08706c9b865f508d // 2^244 * 2 * B .quad 0xf37ca2ab3d343dff .quad 0x1a8c6a2d80abc617 .quad 0x8e49e035d4ccffca .quad 0x48b46beebaa1d1b9 .quad 0xcc991b4138b41246 .quad 0x243b9c526f9ac26b .quad 0xb9ef494db7cbabbd .quad 0x5fba433dd082ed00 .quad 0x9c49e355c9941ad0 .quad 0xb9734ade74498f84 .quad 0x41c3fed066663e5c .quad 0x0ecfedf8e8e710b3 // 2^244 * 3 * B .quad 0x76430f9f9cd470d9 .quad 0xb62acc9ba42f6008 .quad 0x1898297c59adad5e .quad 0x7789dd2db78c5080 .quad 0x744f7463e9403762 .quad 0xf79a8dee8dfcc9c9 .quad 0x163a649655e4cde3 .quad 0x3b61788db284f435 .quad 0xb22228190d6ef6b2 .quad 0xa94a66b246ce4bfa .quad 0x46c1a77a4f0b6cc7 .quad 0x4236ccffeb7338cf // 2^244 * 4 * B .quad 0x8497404d0d55e274 .quad 0x6c6663d9c4ad2b53 .quad 0xec2fb0d9ada95734 .quad 0x2617e120cdb8f73c .quad 0x3bd82dbfda777df6 .quad 0x71b177cc0b98369e .quad 0x1d0e8463850c3699 .quad 0x5a71945b48e2d1f1 .quad 0x6f203dd5405b4b42 .quad 0x327ec60410b24509 .quad 0x9c347230ac2a8846 .quad 0x77de29fc11ffeb6a // 2^244 * 5 * B .quad 0xb0ac57c983b778a8 .quad 0x53cdcca9d7fe912c .quad 0x61c2b854ff1f59dc .quad 0x3a1a2cf0f0de7dac .quad 0x835e138fecced2ca .quad 0x8c9eaf13ea963b9a .quad 0xc95fbfc0b2160ea6 .quad 0x575e66f3ad877892 .quad 0x99803a27c88fcb3a .quad 0x345a6789275ec0b0 .quad 0x459789d0ff6c2be5 .quad 0x62f882651e70a8b2 // 2^244 * 6 * B .quad 0x085ae2c759ff1be4 .quad 0x149145c93b0e40b7 .quad 0xc467e7fa7ff27379 .quad 0x4eeecf0ad5c73a95 .quad 0x6d822986698a19e0 .quad 0xdc9821e174d78a71 .quad 0x41a85f31f6cb1f47 .quad 0x352721c2bcda9c51 .quad 0x48329952213fc985 .quad 0x1087cf0d368a1746 .quad 0x8e5261b166c15aa5 .quad 0x2d5b2d842ed24c21 // 2^244 * 7 * B .quad 0x02cfebd9ebd3ded1 .quad 0xd45b217739021974 .quad 0x7576f813fe30a1b7 .quad 0x5691b6f9a34ef6c2 .quad 0x5eb7d13d196ac533 .quad 0x377234ecdb80be2b .quad 0xe144cffc7cf5ae24 .quad 0x5226bcf9c441acec .quad 0x79ee6c7223e5b547 .quad 0x6f5f50768330d679 .quad 0xed73e1e96d8adce9 .quad 0x27c3da1e1d8ccc03 // 2^244 * 8 * B .quad 0x7eb9efb23fe24c74 .quad 0x3e50f49f1651be01 .quad 0x3ea732dc21858dea .quad 0x17377bd75bb810f9 .quad 0x28302e71630ef9f6 .quad 0xc2d4a2032b64cee0 .quad 0x090820304b6292be .quad 0x5fca747aa82adf18 .quad 0x232a03c35c258ea5 .quad 0x86f23a2c6bcb0cf1 .quad 0x3dad8d0d2e442166 .quad 0x04a8933cab76862b // 2^248 * 1 * B .quad 0xd2c604b622943dff .quad 0xbc8cbece44cfb3a0 .quad 0x5d254ff397808678 .quad 0x0fa3614f3b1ca6bf .quad 0x69082b0e8c936a50 .quad 0xf9c9a035c1dac5b6 .quad 0x6fb73e54c4dfb634 .quad 0x4005419b1d2bc140 .quad 0xa003febdb9be82f0 .quad 0x2089c1af3a44ac90 .quad 0xf8499f911954fa8e .quad 0x1fba218aef40ab42 // 2^248 * 2 * B .quad 0xab549448fac8f53e .quad 0x81f6e89a7ba63741 .quad 0x74fd6c7d6c2b5e01 .quad 0x392e3acaa8c86e42 .quad 0x4f3e57043e7b0194 .quad 0xa81d3eee08daaf7f .quad 0xc839c6ab99dcdef1 .quad 0x6c535d13ff7761d5 .quad 0x4cbd34e93e8a35af .quad 0x2e0781445887e816 .quad 0x19319c76f29ab0ab .quad 0x25e17fe4d50ac13b // 2^248 * 3 * B .quad 0x0a289bd71e04f676 .quad 0x208e1c52d6420f95 .quad 0x5186d8b034691fab .quad 0x255751442a9fb351 .quad 0x915f7ff576f121a7 .quad 0xc34a32272fcd87e3 .quad 0xccba2fde4d1be526 .quad 0x6bba828f8969899b .quad 0xe2d1bc6690fe3901 .quad 0x4cb54a18a0997ad5 .quad 0x971d6914af8460d4 .quad 0x559d504f7f6b7be4 // 2^248 * 4 * B .quad 0xa7738378b3eb54d5 .quad 0x1d69d366a5553c7c .quad 0x0a26cf62f92800ba .quad 0x01ab12d5807e3217 .quad 0x9c4891e7f6d266fd .quad 0x0744a19b0307781b .quad 0x88388f1d6061e23b .quad 0x123ea6a3354bd50e .quad 0x118d189041e32d96 .quad 0xb9ede3c2d8315848 .quad 0x1eab4271d83245d9 .quad 0x4a3961e2c918a154 // 2^248 * 5 * B .quad 0x71dc3be0f8e6bba0 .quad 0xd6cef8347effe30a .quad 0xa992425fe13a476a .quad 0x2cd6bce3fb1db763 .quad 0x0327d644f3233f1e .quad 0x499a260e34fcf016 .quad 0x83b5a716f2dab979 .quad 0x68aceead9bd4111f .quad 0x38b4c90ef3d7c210 .quad 0x308e6e24b7ad040c .quad 0x3860d9f1b7e73e23 .quad 0x595760d5b508f597 // 2^248 * 6 * B .quad 0x6129bfe104aa6397 .quad 0x8f960008a4a7fccb .quad 0x3f8bc0897d909458 .quad 0x709fa43edcb291a9 .quad 0x882acbebfd022790 .quad 0x89af3305c4115760 .quad 0x65f492e37d3473f4 .quad 0x2cb2c5df54515a2b .quad 0xeb0a5d8c63fd2aca .quad 0xd22bc1662e694eff .quad 0x2723f36ef8cbb03a .quad 0x70f029ecf0c8131f // 2^248 * 7 * B .quad 0x461307b32eed3e33 .quad 0xae042f33a45581e7 .quad 0xc94449d3195f0366 .quad 0x0b7d5d8a6c314858 .quad 0x2a6aafaa5e10b0b9 .quad 0x78f0a370ef041aa9 .quad 0x773efb77aa3ad61f .quad 0x44eca5a2a74bd9e1 .quad 0x25d448327b95d543 .quad 0x70d38300a3340f1d .quad 0xde1c531c60e1c52b .quad 0x272224512c7de9e4 // 2^248 * 8 * B .quad 0x1abc92af49c5342e .quad 0xffeed811b2e6fad0 .quad 0xefa28c8dfcc84e29 .quad 0x11b5df18a44cc543 .quad 0xbf7bbb8a42a975fc .quad 0x8c5c397796ada358 .quad 0xe27fc76fcdedaa48 .quad 0x19735fd7f6bc20a6 .quad 0xe3ab90d042c84266 .quad 0xeb848e0f7f19547e .quad 0x2503a1d065a497b9 .quad 0x0fef911191df895f
wlsfx/bnbb
22,899
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_pdouble.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Projective doubling for edwards25519 // Input p1[12]; output p3[12] // // extern void edwards25519_pdouble // (uint64_t p3[static 12],const uint64_t p1[static 12]); // // If p1 is a point on edwards25519, returns its double p3 = 2 * p1. // Input and output are in pure projective coordinates, representing // an affine (x,y) by a triple (X,Y,Z) where x = X / Z, y = Y / Z. // // Standard ARM ABI: X0 = p3, X1 = p1 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(edwards25519_pdouble) S2N_BN_FUNCTION_TYPE_DIRECTIVE(edwards25519_pdouble) S2N_BN_SYM_PRIVACY_DIRECTIVE(edwards25519_pdouble) .text .balign 4 // Size of individual field elements #define NUMSIZE 32 // Stable homes for input arguments during main code sequence #define p3 x17 #define p1 x19 // Pointers to input and output coordinates #define x_1 p1, #0 #define y_1 p1, #NUMSIZE #define z_1 p1, #(2*NUMSIZE) #define x_3 p3, #0 #define y_3 p3, #NUMSIZE #define z_3 p3, #(2*NUMSIZE) // Pointer-offset pairs for temporaries on stack #define t0 sp, #(0*NUMSIZE) #define t1 sp, #(1*NUMSIZE) #define t2 sp, #(2*NUMSIZE) #define t3 sp, #(3*NUMSIZE) #define t4 sp, #(4*NUMSIZE) // Total size to reserve on the stack #define NSPACE 5*NUMSIZE // Macro wrapping up the basic field operation bignum_mul_p25519, only // trivially different from a pure function call to that subroutine. #define mul_p25519(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x5, x6, [P2] __LF \ umull x7, w3, w5 __LF \ lsr x0, x3, #32 __LF \ umull x15, w0, w5 __LF \ lsr x16, x5, #32 __LF \ umull x8, w16, w0 __LF \ umull x16, w3, w16 __LF \ adds x7, x7, x15, lsl #32 __LF \ lsr x15, x15, #32 __LF \ adc x8, x8, x15 __LF \ adds x7, x7, x16, lsl #32 __LF \ lsr x16, x16, #32 __LF \ adc x8, x8, x16 __LF \ mul x9, x4, x6 __LF \ umulh x10, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x16, cc __LF \ adds x9, x9, x8 __LF \ adc x10, x10, xzr __LF \ subs x3, x5, x6 __LF \ cneg x3, x3, cc __LF \ cinv x16, x16, cc __LF \ mul x15, x4, x3 __LF \ umulh x3, x4, x3 __LF \ adds x8, x7, x9 __LF \ adcs x9, x9, x10 __LF \ adc x10, x10, xzr __LF \ cmn x16, #0x1 __LF \ eor x15, x15, x16 __LF \ adcs x8, x15, x8 __LF \ eor x3, x3, x16 __LF \ adcs x9, x3, x9 __LF \ adc x10, x10, x16 __LF \ ldp x3, x4, [P1+16] __LF \ ldp x5, x6, [P2+16] __LF \ umull x11, w3, w5 __LF \ lsr x0, x3, #32 __LF \ umull x15, w0, w5 __LF \ lsr x16, x5, #32 __LF \ umull x12, w16, w0 __LF \ umull x16, w3, w16 __LF \ adds x11, x11, x15, lsl #32 __LF \ lsr x15, x15, #32 __LF \ adc x12, x12, x15 __LF \ adds x11, x11, x16, lsl #32 __LF \ lsr x16, x16, #32 __LF \ adc x12, x12, x16 __LF \ mul x13, x4, x6 __LF \ umulh x14, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x16, cc __LF \ adds x13, x13, x12 __LF \ adc x14, x14, xzr __LF \ subs x3, x5, x6 __LF \ cneg x3, x3, cc __LF \ cinv x16, x16, cc __LF \ mul x15, x4, x3 __LF \ umulh x3, x4, x3 __LF \ adds x12, x11, x13 __LF \ adcs x13, x13, x14 __LF \ adc x14, x14, xzr __LF \ cmn x16, #0x1 __LF \ eor x15, x15, x16 __LF \ adcs x12, x15, x12 __LF \ eor x3, x3, x16 __LF \ adcs x13, x3, x13 __LF \ adc x14, x14, x16 __LF \ ldp x3, x4, [P1+16] __LF \ ldp x15, x16, [P1] __LF \ subs x3, x3, x15 __LF \ sbcs x4, x4, x16 __LF \ csetm x16, cc __LF \ ldp x15, x0, [P2] __LF \ subs x5, x15, x5 __LF \ sbcs x6, x0, x6 __LF \ csetm x0, cc __LF \ eor x3, x3, x16 __LF \ subs x3, x3, x16 __LF \ eor x4, x4, x16 __LF \ sbc x4, x4, x16 __LF \ eor x5, x5, x0 __LF \ subs x5, x5, x0 __LF \ eor x6, x6, x0 __LF \ sbc x6, x6, x0 __LF \ eor x16, x0, x16 __LF \ adds x11, x11, x9 __LF \ adcs x12, x12, x10 __LF \ adcs x13, x13, xzr __LF \ adc x14, x14, xzr __LF \ mul x2, x3, x5 __LF \ umulh x0, x3, x5 __LF \ mul x15, x4, x6 __LF \ umulh x1, x4, x6 __LF \ subs x4, x4, x3 __LF \ cneg x4, x4, cc __LF \ csetm x9, cc __LF \ adds x15, x15, x0 __LF \ adc x1, x1, xzr __LF \ subs x6, x5, x6 __LF \ cneg x6, x6, cc __LF \ cinv x9, x9, cc __LF \ mul x5, x4, x6 __LF \ umulh x6, x4, x6 __LF \ adds x0, x2, x15 __LF \ adcs x15, x15, x1 __LF \ adc x1, x1, xzr __LF \ cmn x9, #0x1 __LF \ eor x5, x5, x9 __LF \ adcs x0, x5, x0 __LF \ eor x6, x6, x9 __LF \ adcs x15, x6, x15 __LF \ adc x1, x1, x9 __LF \ adds x9, x11, x7 __LF \ adcs x10, x12, x8 __LF \ adcs x11, x13, x11 __LF \ adcs x12, x14, x12 __LF \ adcs x13, x13, xzr __LF \ adc x14, x14, xzr __LF \ cmn x16, #0x1 __LF \ eor x2, x2, x16 __LF \ adcs x9, x2, x9 __LF \ eor x0, x0, x16 __LF \ adcs x10, x0, x10 __LF \ eor x15, x15, x16 __LF \ adcs x11, x15, x11 __LF \ eor x1, x1, x16 __LF \ adcs x12, x1, x12 __LF \ adcs x13, x13, x16 __LF \ adc x14, x14, x16 __LF \ mov x3, #0x26 __LF \ umull x4, w11, w3 __LF \ add x4, x4, w7, uxtw __LF \ lsr x7, x7, #32 __LF \ lsr x11, x11, #32 __LF \ umaddl x11, w11, w3, x7 __LF \ mov x7, x4 __LF \ umull x4, w12, w3 __LF \ add x4, x4, w8, uxtw __LF \ lsr x8, x8, #32 __LF \ lsr x12, x12, #32 __LF \ umaddl x12, w12, w3, x8 __LF \ mov x8, x4 __LF \ umull x4, w13, w3 __LF \ add x4, x4, w9, uxtw __LF \ lsr x9, x9, #32 __LF \ lsr x13, x13, #32 __LF \ umaddl x13, w13, w3, x9 __LF \ mov x9, x4 __LF \ umull x4, w14, w3 __LF \ add x4, x4, w10, uxtw __LF \ lsr x10, x10, #32 __LF \ lsr x14, x14, #32 __LF \ umaddl x14, w14, w3, x10 __LF \ mov x10, x4 __LF \ lsr x0, x14, #31 __LF \ mov x5, #0x13 __LF \ umaddl x5, w5, w0, x5 __LF \ add x7, x7, x5 __LF \ adds x7, x7, x11, lsl #32 __LF \ extr x3, x12, x11, #32 __LF \ adcs x8, x8, x3 __LF \ extr x3, x13, x12, #32 __LF \ adcs x9, x9, x3 __LF \ extr x3, x14, x13, #32 __LF \ lsl x5, x0, #63 __LF \ eor x10, x10, x5 __LF \ adc x10, x10, x3 __LF \ mov x3, #0x13 __LF \ tst x10, #0x8000000000000000 __LF \ csel x3, x3, xzr, pl __LF \ subs x7, x7, x3 __LF \ sbcs x8, x8, xzr __LF \ sbcs x9, x9, xzr __LF \ sbc x10, x10, xzr __LF \ and x10, x10, #0x7fffffffffffffff __LF \ stp x7, x8, [P0] __LF \ stp x9, x10, [P0+16] // Squaring just giving a result < 2 * p_25519, which is done by // basically skipping the +1 in the quotient estimate and the final // optional correction. #define sqr_4(P0,P1) \ ldp x10, x11, [P1] __LF \ ldp x12, x13, [P1+16] __LF \ umull x2, w10, w10 __LF \ lsr x14, x10, #32 __LF \ umull x3, w14, w14 __LF \ umull x14, w10, w14 __LF \ adds x2, x2, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x3, x3, x14 __LF \ umull x4, w11, w11 __LF \ lsr x14, x11, #32 __LF \ umull x5, w14, w14 __LF \ umull x14, w11, w14 __LF \ mul x15, x10, x11 __LF \ umulh x16, x10, x11 __LF \ adds x4, x4, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x5, x5, x14 __LF \ adds x15, x15, x15 __LF \ adcs x16, x16, x16 __LF \ adc x5, x5, xzr __LF \ adds x3, x3, x15 __LF \ adcs x4, x4, x16 __LF \ adc x5, x5, xzr __LF \ umull x6, w12, w12 __LF \ lsr x14, x12, #32 __LF \ umull x7, w14, w14 __LF \ umull x14, w12, w14 __LF \ adds x6, x6, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x7, x7, x14 __LF \ umull x8, w13, w13 __LF \ lsr x14, x13, #32 __LF \ umull x9, w14, w14 __LF \ umull x14, w13, w14 __LF \ mul x15, x12, x13 __LF \ umulh x16, x12, x13 __LF \ adds x8, x8, x14, lsl #33 __LF \ lsr x14, x14, #31 __LF \ adc x9, x9, x14 __LF \ adds x15, x15, x15 __LF \ adcs x16, x16, x16 __LF \ adc x9, x9, xzr __LF \ adds x7, x7, x15 __LF \ adcs x8, x8, x16 __LF \ adc x9, x9, xzr __LF \ subs x10, x10, x12 __LF \ sbcs x11, x11, x13 __LF \ csetm x16, cc __LF \ eor x10, x10, x16 __LF \ subs x10, x10, x16 __LF \ eor x11, x11, x16 __LF \ sbc x11, x11, x16 __LF \ adds x6, x6, x4 __LF \ adcs x7, x7, x5 __LF \ adcs x8, x8, xzr __LF \ adc x9, x9, xzr __LF \ umull x12, w10, w10 __LF \ lsr x5, x10, #32 __LF \ umull x13, w5, w5 __LF \ umull x5, w10, w5 __LF \ adds x12, x12, x5, lsl #33 __LF \ lsr x5, x5, #31 __LF \ adc x13, x13, x5 __LF \ umull x15, w11, w11 __LF \ lsr x5, x11, #32 __LF \ umull x14, w5, w5 __LF \ umull x5, w11, w5 __LF \ mul x4, x10, x11 __LF \ umulh x16, x10, x11 __LF \ adds x15, x15, x5, lsl #33 __LF \ lsr x5, x5, #31 __LF \ adc x14, x14, x5 __LF \ adds x4, x4, x4 __LF \ adcs x16, x16, x16 __LF \ adc x14, x14, xzr __LF \ adds x13, x13, x4 __LF \ adcs x15, x15, x16 __LF \ adc x14, x14, xzr __LF \ adds x4, x2, x6 __LF \ adcs x5, x3, x7 __LF \ adcs x6, x6, x8 __LF \ adcs x7, x7, x9 __LF \ csetm x16, cc __LF \ subs x4, x4, x12 __LF \ sbcs x5, x5, x13 __LF \ sbcs x6, x6, x15 __LF \ sbcs x7, x7, x14 __LF \ adcs x8, x8, x16 __LF \ adc x9, x9, x16 __LF \ mov x10, #0x26 __LF \ umull x12, w6, w10 __LF \ add x12, x12, w2, uxtw __LF \ lsr x2, x2, #32 __LF \ lsr x6, x6, #32 __LF \ umaddl x6, w6, w10, x2 __LF \ mov x2, x12 __LF \ umull x12, w7, w10 __LF \ add x12, x12, w3, uxtw __LF \ lsr x3, x3, #32 __LF \ lsr x7, x7, #32 __LF \ umaddl x7, w7, w10, x3 __LF \ mov x3, x12 __LF \ umull x12, w8, w10 __LF \ add x12, x12, w4, uxtw __LF \ lsr x4, x4, #32 __LF \ lsr x8, x8, #32 __LF \ umaddl x8, w8, w10, x4 __LF \ mov x4, x12 __LF \ umull x12, w9, w10 __LF \ add x12, x12, w5, uxtw __LF \ lsr x5, x5, #32 __LF \ lsr x9, x9, #32 __LF \ umaddl x9, w9, w10, x5 __LF \ mov x5, x12 __LF \ lsr x13, x9, #31 __LF \ mov x11, #0x13 __LF \ umull x11, w11, w13 __LF \ add x2, x2, x11 __LF \ adds x2, x2, x6, lsl #32 __LF \ extr x10, x7, x6, #32 __LF \ adcs x3, x3, x10 __LF \ extr x10, x8, x7, #32 __LF \ adcs x4, x4, x10 __LF \ extr x10, x9, x8, #32 __LF \ lsl x11, x13, #63 __LF \ eor x5, x5, x11 __LF \ adc x5, x5, x10 __LF \ stp x2, x3, [P0] __LF \ stp x4, x5, [P0+16] // Plain 4-digit adding without any normalization. // With inputs < p_25519 (indeed < 2^255) it still gives a 4-digit result, // indeed one < 2 * p_25519 for normalized inputs. #define add_4(P0,P1,P2) \ ldp x0, x1, [P1] __LF \ ldp x4, x5, [P2] __LF \ adds x0, x0, x4 __LF \ adcs x1, x1, x5 __LF \ ldp x2, x3, [P1+16] __LF \ ldp x6, x7, [P2+16] __LF \ adcs x2, x2, x6 __LF \ adc x3, x3, x7 __LF \ stp x0, x1, [P0] __LF \ stp x2, x3, [P0+16] // Modular subtraction with double modulus 2 * p_25519 = 2^256 - 38 #define sub_twice4(P0,P1,P2) \ ldp x5, x6, [P1] __LF \ ldp x4, x3, [P2] __LF \ subs x5, x5, x4 __LF \ sbcs x6, x6, x3 __LF \ ldp x7, x8, [P1+16] __LF \ ldp x4, x3, [P2+16] __LF \ sbcs x7, x7, x4 __LF \ sbcs x8, x8, x3 __LF \ mov x4, #38 __LF \ csel x3, x4, xzr, lo __LF \ subs x5, x5, x3 __LF \ sbcs x6, x6, xzr __LF \ sbcs x7, x7, xzr __LF \ sbc x8, x8, xzr __LF \ stp x5, x6, [P0] __LF \ stp x7, x8, [P0+16] // Modular addition and doubling with double modulus 2 * p_25519 = 2^256 - 38. // This only ensures that the result fits in 4 digits, not that it is reduced // even w.r.t. double modulus. The result is always correct modulo provided // the sum of the inputs is < 2^256 + 2^256 - 38, so in particular provided // at least one of them is reduced double modulo. #define add_twice4(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x7, x8, [P2] __LF \ adds x3, x3, x7 __LF \ adcs x4, x4, x8 __LF \ ldp x5, x6, [P1+16] __LF \ ldp x7, x8, [P2+16] __LF \ adcs x5, x5, x7 __LF \ adcs x6, x6, x8 __LF \ mov x9, #38 __LF \ csel x9, x9, xzr, cs __LF \ adds x3, x3, x9 __LF \ adcs x4, x4, xzr __LF \ adcs x5, x5, xzr __LF \ adc x6, x6, xzr __LF \ stp x3, x4, [P0] __LF \ stp x5, x6, [P0+16] #define double_twice4(P0,P1) \ ldp x3, x4, [P1] __LF \ adds x3, x3, x3 __LF \ adcs x4, x4, x4 __LF \ ldp x5, x6, [P1+16] __LF \ adcs x5, x5, x5 __LF \ adcs x6, x6, x6 __LF \ mov x9, #38 __LF \ csel x9, x9, xzr, cs __LF \ adds x3, x3, x9 __LF \ adcs x4, x4, xzr __LF \ adcs x5, x5, xzr __LF \ adc x6, x6, xzr __LF \ stp x3, x4, [P0] __LF \ stp x5, x6, [P0+16] S2N_BN_SYMBOL(edwards25519_pdouble): CFI_START // Save regs and make room for temporaries CFI_PUSH2(x19,x20) CFI_DEC_SP(NSPACE) // Move the input arguments to stable places mov p3, x0 mov p1, x1 // Main sequence add_4(t0,x_1,y_1) sqr_4(t1,z_1) sqr_4(t2,x_1) sqr_4(t3,y_1) double_twice4(t1,t1) sqr_4(t0,t0) add_twice4(t4,t2,t3) sub_twice4(t2,t2,t3) add_twice4(t3,t1,t2) sub_twice4(t1,t4,t0) mul_p25519(y_3,t2,t4) mul_p25519(z_3,t3,t2) mul_p25519(x_3,t1,t3) // Restore stack and registers CFI_INC_SP(NSPACE) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(edwards25519_pdouble) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack, "", %progbits #endif
wlsfx/bnbb
2,247
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/bignum_add_p25519.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Add modulo p_25519, z := (x + y) mod p_25519, assuming x and y reduced // Inputs x[4], y[4]; output z[4] // // extern void bignum_add_p25519(uint64_t z[static 4], const uint64_t x[static 4], // const uint64_t y[static 4]); // // Standard ARM ABI: X0 = z, X1 = x, X2 = y // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_add_p25519) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_add_p25519) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_add_p25519) .text .balign 4 #define z x0 #define x x1 #define y x2 #define d0 x3 #define d1 x4 #define d2 x5 #define d3 x6 #define c0 x7 #define c1 x8 #define c2 x9 #define c3 x10 S2N_BN_SYMBOL(bignum_add_p25519): CFI_START // Add as [d3; d2; d1; d0] = x + y; since we assume x, y < 2^255 - 19 // this sum fits in 256 bits ldp d0, d1, [x] ldp c0, c1, [y] adds d0, d0, c0 adcs d1, d1, c1 ldp d2, d3, [x, #16] ldp c0, c1, [y, #16] adcs d2, d2, c0 adc d3, d3, c1 // Now x + y >= 2^255 - 19 <=> x + y + (2^255 + 19) >= 2^256 // Form [c3; c2; c1; c0] = (x + y) + (2^255 + 19), with CF for the comparison mov c3, #0x8000000000000000 adds c0, d0, #19 adcs c1, d1, xzr adcs c2, d2, xzr adcs c3, d3, c3 // If the comparison holds, select [c3; c2; c1; c0]. There's no need to mask // it since in this case it is ((x + y) + (2^255 + 19)) - 2^256 because the // top carry is lost, which is the desired (x + y) - (2^255 - 19). csel d0, d0, c0, cc csel d1, d1, c1, cc csel d2, d2, c2, cc csel d3, d3, c3, cc // Store the result stp d0, d1, [z] stp d2, d3, [z, #16] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_add_p25519) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
31,264
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/curve25519_pxscalarmul_alt.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Projective scalar multiplication, x coordinate only, for curve25519 // Inputs scalar[4], point[4]; output res[8] // // extern void curve25519_pxscalarmul_alt // (uint64_t res[static 8],const uint64_t scalar[static 4], // const uint64_t point[static 4]); // // Given the X coordinate of an input point = (X,Y) on curve25519, which // could also be part of a projective representation (X,Y,1) of the same // point, returns a projective representation (X,Z) = scalar * point, where // scalar is a 256-bit number. The corresponding affine form is (X/Z,Y'), // X/Z meaning division modulo 2^255-19, and Y' not being computed by // this function (nor is any Y coordinate of the input point used). // // Standard ARM ABI: X0 = res, X1 = scalar, X2 = point // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(curve25519_pxscalarmul_alt) S2N_BN_FUNCTION_TYPE_DIRECTIVE(curve25519_pxscalarmul_alt) S2N_BN_SYM_PRIVACY_DIRECTIVE(curve25519_pxscalarmul_alt) .text .balign 4 // Size of individual field elements #define NUMSIZE 32 // Stable homes for input arguments during main code sequence // and additional registers for loop counter and swap flag #define res x17 #define point x19 #define scalar x20 #define i x21 #define swap x22 // Pointers to input x coord (we don't use y or z) and output coords. #define x point, #0 #define resx res, #0 #define resz res, #NUMSIZE // Pointer-offset pairs for temporaries on stack with some aliasing. #define zm sp, #(0*NUMSIZE) #define sm sp, #(0*NUMSIZE) #define dpro sp, #(0*NUMSIZE) #define sn sp, #(1*NUMSIZE) #define dm sp, #(2*NUMSIZE) #define zn sp, #(3*NUMSIZE) #define dn sp, #(3*NUMSIZE) #define e sp, #(3*NUMSIZE) #define dmsn sp, #(4*NUMSIZE) #define p sp, #(4*NUMSIZE) #define xm sp, #(5*NUMSIZE) #define dnsm sp, #(5*NUMSIZE) #define spro sp, #(5*NUMSIZE) #define xn sp, #(6*NUMSIZE) #define s sp, #(6*NUMSIZE) #define d sp, #(7*NUMSIZE) // Total size to reserve on the stack #define NSPACE 8*NUMSIZE // Macros wrapping up the basic field operations bignum_mul_p25519_alt // and bignum_sqr_p25519_alt, only trivially different from pure function // call to those subroutines. #define mul_p25519(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x7, x8, [P2] __LF \ mul x12, x3, x7 __LF \ umulh x13, x3, x7 __LF \ mul x11, x3, x8 __LF \ umulh x14, x3, x8 __LF \ adds x13, x13, x11 __LF \ ldp x9, x10, [P2+16] __LF \ mul x11, x3, x9 __LF \ umulh x15, x3, x9 __LF \ adcs x14, x14, x11 __LF \ mul x11, x3, x10 __LF \ umulh x16, x3, x10 __LF \ adcs x15, x15, x11 __LF \ adc x16, x16, xzr __LF \ ldp x5, x6, [P1+16] __LF \ mul x11, x4, x7 __LF \ adds x13, x13, x11 __LF \ mul x11, x4, x8 __LF \ adcs x14, x14, x11 __LF \ mul x11, x4, x9 __LF \ adcs x15, x15, x11 __LF \ mul x11, x4, x10 __LF \ adcs x16, x16, x11 __LF \ umulh x3, x4, x10 __LF \ adc x3, x3, xzr __LF \ umulh x11, x4, x7 __LF \ adds x14, x14, x11 __LF \ umulh x11, x4, x8 __LF \ adcs x15, x15, x11 __LF \ umulh x11, x4, x9 __LF \ adcs x16, x16, x11 __LF \ adc x3, x3, xzr __LF \ mul x11, x5, x7 __LF \ adds x14, x14, x11 __LF \ mul x11, x5, x8 __LF \ adcs x15, x15, x11 __LF \ mul x11, x5, x9 __LF \ adcs x16, x16, x11 __LF \ mul x11, x5, x10 __LF \ adcs x3, x3, x11 __LF \ umulh x4, x5, x10 __LF \ adc x4, x4, xzr __LF \ umulh x11, x5, x7 __LF \ adds x15, x15, x11 __LF \ umulh x11, x5, x8 __LF \ adcs x16, x16, x11 __LF \ umulh x11, x5, x9 __LF \ adcs x3, x3, x11 __LF \ adc x4, x4, xzr __LF \ mul x11, x6, x7 __LF \ adds x15, x15, x11 __LF \ mul x11, x6, x8 __LF \ adcs x16, x16, x11 __LF \ mul x11, x6, x9 __LF \ adcs x3, x3, x11 __LF \ mul x11, x6, x10 __LF \ adcs x4, x4, x11 __LF \ umulh x5, x6, x10 __LF \ adc x5, x5, xzr __LF \ umulh x11, x6, x7 __LF \ adds x16, x16, x11 __LF \ umulh x11, x6, x8 __LF \ adcs x3, x3, x11 __LF \ umulh x11, x6, x9 __LF \ adcs x4, x4, x11 __LF \ adc x5, x5, xzr __LF \ mov x7, #0x26 __LF \ mul x11, x7, x16 __LF \ umulh x9, x7, x16 __LF \ adds x12, x12, x11 __LF \ mul x11, x7, x3 __LF \ umulh x3, x7, x3 __LF \ adcs x13, x13, x11 __LF \ mul x11, x7, x4 __LF \ umulh x4, x7, x4 __LF \ adcs x14, x14, x11 __LF \ mul x11, x7, x5 __LF \ umulh x5, x7, x5 __LF \ adcs x15, x15, x11 __LF \ cset x16, cs __LF \ adds x15, x15, x4 __LF \ adc x16, x16, x5 __LF \ cmn x15, x15 __LF \ orr x15, x15, #0x8000000000000000 __LF \ adc x8, x16, x16 __LF \ mov x7, #0x13 __LF \ madd x11, x7, x8, x7 __LF \ adds x12, x12, x11 __LF \ adcs x13, x13, x9 __LF \ adcs x14, x14, x3 __LF \ adcs x15, x15, xzr __LF \ csel x7, x7, xzr, cc __LF \ subs x12, x12, x7 __LF \ sbcs x13, x13, xzr __LF \ sbcs x14, x14, xzr __LF \ sbc x15, x15, xzr __LF \ and x15, x15, #0x7fffffffffffffff __LF \ stp x12, x13, [P0] __LF \ stp x14, x15, [P0+16] #define sqr_p25519(P0,P1) \ ldp x2, x3, [P1] __LF \ mul x9, x2, x3 __LF \ umulh x10, x2, x3 __LF \ ldp x4, x5, [P1+16] __LF \ mul x11, x2, x5 __LF \ umulh x12, x2, x5 __LF \ mul x7, x2, x4 __LF \ umulh x6, x2, x4 __LF \ adds x10, x10, x7 __LF \ adcs x11, x11, x6 __LF \ mul x7, x3, x4 __LF \ umulh x6, x3, x4 __LF \ adc x6, x6, xzr __LF \ adds x11, x11, x7 __LF \ mul x13, x4, x5 __LF \ umulh x14, x4, x5 __LF \ adcs x12, x12, x6 __LF \ mul x7, x3, x5 __LF \ umulh x6, x3, x5 __LF \ adc x6, x6, xzr __LF \ adds x12, x12, x7 __LF \ adcs x13, x13, x6 __LF \ adc x14, x14, xzr __LF \ adds x9, x9, x9 __LF \ adcs x10, x10, x10 __LF \ adcs x11, x11, x11 __LF \ adcs x12, x12, x12 __LF \ adcs x13, x13, x13 __LF \ adcs x14, x14, x14 __LF \ cset x6, cs __LF \ umulh x7, x2, x2 __LF \ mul x8, x2, x2 __LF \ adds x9, x9, x7 __LF \ mul x7, x3, x3 __LF \ adcs x10, x10, x7 __LF \ umulh x7, x3, x3 __LF \ adcs x11, x11, x7 __LF \ mul x7, x4, x4 __LF \ adcs x12, x12, x7 __LF \ umulh x7, x4, x4 __LF \ adcs x13, x13, x7 __LF \ mul x7, x5, x5 __LF \ adcs x14, x14, x7 __LF \ umulh x7, x5, x5 __LF \ adc x6, x6, x7 __LF \ mov x3, #0x26 __LF \ mul x7, x3, x12 __LF \ umulh x4, x3, x12 __LF \ adds x8, x8, x7 __LF \ mul x7, x3, x13 __LF \ umulh x13, x3, x13 __LF \ adcs x9, x9, x7 __LF \ mul x7, x3, x14 __LF \ umulh x14, x3, x14 __LF \ adcs x10, x10, x7 __LF \ mul x7, x3, x6 __LF \ umulh x6, x3, x6 __LF \ adcs x11, x11, x7 __LF \ cset x12, cs __LF \ adds x11, x11, x14 __LF \ adc x12, x12, x6 __LF \ cmn x11, x11 __LF \ orr x11, x11, #0x8000000000000000 __LF \ adc x2, x12, x12 __LF \ mov x3, #0x13 __LF \ madd x7, x3, x2, x3 __LF \ adds x8, x8, x7 __LF \ adcs x9, x9, x4 __LF \ adcs x10, x10, x13 __LF \ adcs x11, x11, xzr __LF \ csel x3, x3, xzr, cc __LF \ subs x8, x8, x3 __LF \ sbcs x9, x9, xzr __LF \ sbcs x10, x10, xzr __LF \ sbc x11, x11, xzr __LF \ and x11, x11, #0x7fffffffffffffff __LF \ stp x8, x9, [P0] __LF \ stp x10, x11, [P0+16] __LF \ // A version of multiplication that only guarantees output < 2 * p_25519. // This basically skips the +1 and final correction in quotient estimation. #define mul_4(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x7, x8, [P2] __LF \ mul x12, x3, x7 __LF \ umulh x13, x3, x7 __LF \ mul x11, x3, x8 __LF \ umulh x14, x3, x8 __LF \ adds x13, x13, x11 __LF \ ldp x9, x10, [P2+16] __LF \ mul x11, x3, x9 __LF \ umulh x15, x3, x9 __LF \ adcs x14, x14, x11 __LF \ mul x11, x3, x10 __LF \ umulh x16, x3, x10 __LF \ adcs x15, x15, x11 __LF \ adc x16, x16, xzr __LF \ ldp x5, x6, [P1+16] __LF \ mul x11, x4, x7 __LF \ adds x13, x13, x11 __LF \ mul x11, x4, x8 __LF \ adcs x14, x14, x11 __LF \ mul x11, x4, x9 __LF \ adcs x15, x15, x11 __LF \ mul x11, x4, x10 __LF \ adcs x16, x16, x11 __LF \ umulh x3, x4, x10 __LF \ adc x3, x3, xzr __LF \ umulh x11, x4, x7 __LF \ adds x14, x14, x11 __LF \ umulh x11, x4, x8 __LF \ adcs x15, x15, x11 __LF \ umulh x11, x4, x9 __LF \ adcs x16, x16, x11 __LF \ adc x3, x3, xzr __LF \ mul x11, x5, x7 __LF \ adds x14, x14, x11 __LF \ mul x11, x5, x8 __LF \ adcs x15, x15, x11 __LF \ mul x11, x5, x9 __LF \ adcs x16, x16, x11 __LF \ mul x11, x5, x10 __LF \ adcs x3, x3, x11 __LF \ umulh x4, x5, x10 __LF \ adc x4, x4, xzr __LF \ umulh x11, x5, x7 __LF \ adds x15, x15, x11 __LF \ umulh x11, x5, x8 __LF \ adcs x16, x16, x11 __LF \ umulh x11, x5, x9 __LF \ adcs x3, x3, x11 __LF \ adc x4, x4, xzr __LF \ mul x11, x6, x7 __LF \ adds x15, x15, x11 __LF \ mul x11, x6, x8 __LF \ adcs x16, x16, x11 __LF \ mul x11, x6, x9 __LF \ adcs x3, x3, x11 __LF \ mul x11, x6, x10 __LF \ adcs x4, x4, x11 __LF \ umulh x5, x6, x10 __LF \ adc x5, x5, xzr __LF \ umulh x11, x6, x7 __LF \ adds x16, x16, x11 __LF \ umulh x11, x6, x8 __LF \ adcs x3, x3, x11 __LF \ umulh x11, x6, x9 __LF \ adcs x4, x4, x11 __LF \ adc x5, x5, xzr __LF \ mov x7, #0x26 __LF \ mul x11, x7, x16 __LF \ umulh x9, x7, x16 __LF \ adds x12, x12, x11 __LF \ mul x11, x7, x3 __LF \ umulh x3, x7, x3 __LF \ adcs x13, x13, x11 __LF \ mul x11, x7, x4 __LF \ umulh x4, x7, x4 __LF \ adcs x14, x14, x11 __LF \ mul x11, x7, x5 __LF \ umulh x5, x7, x5 __LF \ adcs x15, x15, x11 __LF \ cset x16, cs __LF \ adds x15, x15, x4 __LF \ adc x16, x16, x5 __LF \ cmn x15, x15 __LF \ bic x15, x15, #0x8000000000000000 __LF \ adc x8, x16, x16 __LF \ mov x7, #0x13 __LF \ mul x11, x7, x8 __LF \ adds x12, x12, x11 __LF \ adcs x13, x13, x9 __LF \ adcs x14, x14, x3 __LF \ adc x15, x15, xzr __LF \ stp x12, x13, [P0] __LF \ stp x14, x15, [P0+16] // Squaring just giving a result < 2 * p_25519, which is done by // basically skipping the +1 in the quotient estimate and the final // optional correction. #define sqr_4(P0,P1) \ ldp x2, x3, [P1] __LF \ mul x9, x2, x3 __LF \ umulh x10, x2, x3 __LF \ ldp x4, x5, [P1+16] __LF \ mul x11, x2, x5 __LF \ umulh x12, x2, x5 __LF \ mul x7, x2, x4 __LF \ umulh x6, x2, x4 __LF \ adds x10, x10, x7 __LF \ adcs x11, x11, x6 __LF \ mul x7, x3, x4 __LF \ umulh x6, x3, x4 __LF \ adc x6, x6, xzr __LF \ adds x11, x11, x7 __LF \ mul x13, x4, x5 __LF \ umulh x14, x4, x5 __LF \ adcs x12, x12, x6 __LF \ mul x7, x3, x5 __LF \ umulh x6, x3, x5 __LF \ adc x6, x6, xzr __LF \ adds x12, x12, x7 __LF \ adcs x13, x13, x6 __LF \ adc x14, x14, xzr __LF \ adds x9, x9, x9 __LF \ adcs x10, x10, x10 __LF \ adcs x11, x11, x11 __LF \ adcs x12, x12, x12 __LF \ adcs x13, x13, x13 __LF \ adcs x14, x14, x14 __LF \ cset x6, cs __LF \ umulh x7, x2, x2 __LF \ mul x8, x2, x2 __LF \ adds x9, x9, x7 __LF \ mul x7, x3, x3 __LF \ adcs x10, x10, x7 __LF \ umulh x7, x3, x3 __LF \ adcs x11, x11, x7 __LF \ mul x7, x4, x4 __LF \ adcs x12, x12, x7 __LF \ umulh x7, x4, x4 __LF \ adcs x13, x13, x7 __LF \ mul x7, x5, x5 __LF \ adcs x14, x14, x7 __LF \ umulh x7, x5, x5 __LF \ adc x6, x6, x7 __LF \ mov x3, #0x26 __LF \ mul x7, x3, x12 __LF \ umulh x4, x3, x12 __LF \ adds x8, x8, x7 __LF \ mul x7, x3, x13 __LF \ umulh x13, x3, x13 __LF \ adcs x9, x9, x7 __LF \ mul x7, x3, x14 __LF \ umulh x14, x3, x14 __LF \ adcs x10, x10, x7 __LF \ mul x7, x3, x6 __LF \ umulh x6, x3, x6 __LF \ adcs x11, x11, x7 __LF \ cset x12, cs __LF \ adds x11, x11, x14 __LF \ adc x12, x12, x6 __LF \ cmn x11, x11 __LF \ bic x11, x11, #0x8000000000000000 __LF \ adc x2, x12, x12 __LF \ mov x3, #0x13 __LF \ mul x7, x3, x2 __LF \ adds x8, x8, x7 __LF \ adcs x9, x9, x4 __LF \ adcs x10, x10, x13 __LF \ adc x11, x11, xzr __LF \ stp x8, x9, [P0] __LF \ stp x10, x11, [P0+16] // Plain 4-digit add without any normalization // With inputs < p_25519 (indeed < 2^255) it still gives a 4-digit result #define add_4(p0,p1,p2) \ ldp x0, x1, [p1] __LF \ ldp x4, x5, [p2] __LF \ adds x0, x0, x4 __LF \ adcs x1, x1, x5 __LF \ ldp x2, x3, [p1+16] __LF \ ldp x6, x7, [p2+16] __LF \ adcs x2, x2, x6 __LF \ adc x3, x3, x7 __LF \ stp x0, x1, [p0] __LF \ stp x2, x3, [p0+16] // Subtraction of a pair of numbers < p_25519 just sufficient // to give a 4-digit result. It actually always does (x - z) + (2^255-19) // which in turn is done by (x - z) - (2^255+19) discarding the 2^256 // implicitly #define sub_4(p0,p1,p2) \ ldp x5, x6, [p1] __LF \ ldp x4, x3, [p2] __LF \ subs x5, x5, x4 __LF \ sbcs x6, x6, x3 __LF \ ldp x7, x8, [p1+16] __LF \ ldp x4, x3, [p2+16] __LF \ sbcs x7, x7, x4 __LF \ sbcs x8, x8, x3 __LF \ mov x3, #19 __LF \ subs x5, x5, x3 __LF \ sbcs x6, x6, xzr __LF \ sbcs x7, x7, xzr __LF \ mov x4, #0x8000000000000000 __LF \ sbc x8, x8, x4 __LF \ stp x5, x6, [p0] __LF \ stp x7, x8, [p0+16] // Modular addition with double modulus 2 * p_25519 = 2^256 - 38. // This only ensures that the result fits in 4 digits, not that it is reduced // even w.r.t. double modulus. The result is always correct modulo provided // the sum of the inputs is < 2^256 + 2^256 - 38, so in particular provided // at least one of them is reduced double modulo. #define add_twice4(P0,P1,P2) \ ldp x3, x4, [P1] __LF \ ldp x7, x8, [P2] __LF \ adds x3, x3, x7 __LF \ adcs x4, x4, x8 __LF \ ldp x5, x6, [P1+16] __LF \ ldp x7, x8, [P2+16] __LF \ adcs x5, x5, x7 __LF \ adcs x6, x6, x8 __LF \ mov x9, #38 __LF \ csel x9, x9, xzr, cs __LF \ adds x3, x3, x9 __LF \ adcs x4, x4, xzr __LF \ adcs x5, x5, xzr __LF \ adc x6, x6, xzr __LF \ stp x3, x4, [P0] __LF \ stp x5, x6, [P0+16] // Modular subtraction with double modulus 2 * p_25519 = 2^256 - 38 #define sub_twice4(p0,p1,p2) \ ldp x5, x6, [p1] __LF \ ldp x4, x3, [p2] __LF \ subs x5, x5, x4 __LF \ sbcs x6, x6, x3 __LF \ ldp x7, x8, [p1+16] __LF \ ldp x4, x3, [p2+16] __LF \ sbcs x7, x7, x4 __LF \ sbcs x8, x8, x3 __LF \ mov x4, #38 __LF \ csel x3, x4, xzr, lo __LF \ subs x5, x5, x3 __LF \ sbcs x6, x6, xzr __LF \ sbcs x7, x7, xzr __LF \ sbc x8, x8, xzr __LF \ stp x5, x6, [p0] __LF \ stp x7, x8, [p0+16] // Combined z = c * x + y with reduction only < 2 * p_25519 // where c is initially in the X1 register. It is assumed // that 19 * (c * x + y) < 2^60 * 2^256 so we don't need a // high mul in the final part. #define cmadd_4(p0,p2,p3) \ ldp x7, x8, [p2] __LF \ ldp x9, x10, [p2+16] __LF \ mul x3, x1, x7 __LF \ mul x4, x1, x8 __LF \ mul x5, x1, x9 __LF \ mul x6, x1, x10 __LF \ umulh x7, x1, x7 __LF \ umulh x8, x1, x8 __LF \ umulh x9, x1, x9 __LF \ umulh x10, x1, x10 __LF \ adds x4, x4, x7 __LF \ adcs x5, x5, x8 __LF \ adcs x6, x6, x9 __LF \ adc x10, x10, xzr __LF \ ldp x7, x8, [p3] __LF \ adds x3, x3, x7 __LF \ adcs x4, x4, x8 __LF \ ldp x7, x8, [p3+16] __LF \ adcs x5, x5, x7 __LF \ adcs x6, x6, x8 __LF \ adc x10, x10, xzr __LF \ cmn x6, x6 __LF \ bic x6, x6, #0x8000000000000000 __LF \ adc x8, x10, x10 __LF \ mov x9, #19 __LF \ mul x7, x8, x9 __LF \ adds x3, x3, x7 __LF \ adcs x4, x4, xzr __LF \ adcs x5, x5, xzr __LF \ adc x6, x6, xzr __LF \ stp x3, x4, [p0] __LF \ stp x5, x6, [p0+16] // Multiplex: z := if NZ then x else y #define mux_4(p0,p1,p2) \ ldp x0, x1, [p1] __LF \ ldp x2, x3, [p2] __LF \ csel x0, x0, x2, ne __LF \ csel x1, x1, x3, ne __LF \ stp x0, x1, [p0] __LF \ ldp x0, x1, [p1+16] __LF \ ldp x2, x3, [p2+16] __LF \ csel x0, x0, x2, ne __LF \ csel x1, x1, x3, ne __LF \ stp x0, x1, [p0+16] S2N_BN_SYMBOL(curve25519_pxscalarmul_alt): CFI_START // Save regs and make room for temporaries CFI_PUSH2(x19,x22) CFI_PUSH2(x20,x21) CFI_DEC_SP(NSPACE) // Move the input arguments to stable places mov res, x0 mov scalar, x1 mov point, x2 // Initialize (xn,zn) = (1,0) and (xm,zm) = (x,1) with swap = 0 mov x2, #1 stp x2, xzr, [xn] stp xzr, xzr, [xn+16] stp xzr, xzr, [zn] stp xzr, xzr, [zn+16] ldp x0, x1, [x] stp x0, x1, [xm] ldp x0, x1, [x+16] stp x0, x1, [xm+16] ldp x0, x1, [x+32] stp x2, xzr, [zm] stp xzr, xzr, [zm+16] mov swap, xzr // The outer loop from i = 255, ..., i = 0 (inclusive) mov i, #255 Lcurve25519_pxscalarmul_alt_loop: // sm = xm + zm; sn = xn + zn; dm = xm - zm; dn = xn - zn // The adds don't need any normalization as they're fed to muls // Just make sure the subs fit in 4 digits sub_4(dm, xm, zm) add_4(sn, xn, zn) sub_4(dn, xn, zn) add_4(sm, xm, zm) // ADDING: dmsn = dm * sn; dnsm = sm * dn // DOUBLING: mux d = xt - zt and s = xt + zt for appropriate choice of (xt,zt) mul_4(dmsn,sn,dm) lsr x0, i, #6 ldr x2, [scalar, x0, lsl #3] lsr x2, x2, i and x2, x2, #1 cmp swap, x2 mov swap, x2 mux_4(d,dm,dn) mux_4(s,sm,sn) mul_4(dnsm,sm,dn) // DOUBLING: d = (xt - zt)^2 normalized only to 4 digits sqr_4(d,d) // ADDING: dpro = (dmsn - dnsm)^2, spro = (dmsn + dnsm)^2 // DOUBLING: s = (xt + zt)^2, normalized only to 4 digits sub_twice4(dpro,dmsn,dnsm) sqr_4(s,s) add_twice4(spro,dmsn,dnsm) sqr_4(dpro,dpro) // DOUBLING: p = 4 * xt * zt = s - d sub_twice4(p,s,d) // ADDING: xm' = (dmsn + dnsm)^2 sqr_p25519(xm,spro) // DOUBLING: e = 121666 * p + d mov x1, 0xdb42 orr x1, x1, 0x10000 cmadd_4(e,p,d) // DOUBLING: xn' = (xt + zt)^2 * (xt - zt)^2 = s * d mul_p25519(xn,s,d) // ADDING: zm' = x * (dmsn - dnsm)^2 mul_p25519(zm,dpro,x) // DOUBLING: zn' = (4 * xt * zt) * ((xt - zt)^2 + 121666 * (4 * xt * zt)) // = p * (d + 121666 * p) mul_p25519(zn,p,e) // Loop down as far as 0 (inclusive) subs i, i, #1 bcs Lcurve25519_pxscalarmul_alt_loop // The main loop does not handle the special input of the 2-torsion // point = (0,0). In that case we may get a spurious (0,0) as output // when we want (0,1) [for odd scalar] or (1,0) [for even scalar]. // Test if x = 0 (this is equivalent for curve25519 to y = 0) and if // so, patch zm = 1 [for odd multiple], xn = 1 [for even multiple]. ldp x0, x1, [point] orr x0, x0, x1 ldp x2, x3, [point, #16] orr x2, x2, x3 orr x0, x0, x2 cmp x0, xzr cset x0, eq ldr x1, [zm] orr x1, x1, x0 str x1, [zm] ldr x2, [xn] orr x2, x2, x0 str x2, [xn] // Multiplex into the final outputs cmp swap, xzr mux_4(resx,xm,xn) mux_4(resz,zm,zn) // Restore stack and registers CFI_INC_SP(NSPACE) CFI_POP2(x20,x21) CFI_POP2(x19,x22) CFI_RET S2N_BN_SIZE_DIRECTIVE(curve25519_pxscalarmul_alt) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack, "", %progbits #endif
wlsfx/bnbb
14,538
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_modifier.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Compute "modification" constant z := 2^{64k} mod m // Input m[k]; output z[k]; temporary buffer t[>=k] // // extern void bignum_modifier(uint64_t k, uint64_t *z, const uint64_t *m, // uint64_t *t); // // The last argument points to a temporary buffer t that should have size >= k. // This is called "mod-ifier" because given any other k-digit number x we can // get x MOD m simply and reasonably efficiently just by Montgomery // multiplication of x and z. But one can also consider it the identity for // Montgomery multiplication, assuming you have a reduced multiplier already. // // Standard ARM ABI: X0 = k, X1 = z, X2 = m, X3 = t // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_modifier) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_modifier) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_modifier) .text .balign 4 #define k x0 #define z x1 #define m x2 #define t x3 // Some variables // Modular inverse w is aliased to i, but we never use them together #define i x4 #define w x4 #define j x5 #define h x6 #define a x7 #define l x8 #define c x9 #define b x10 #define d x11 // Some aliases for the values b and d #define r x10 #define q x11 S2N_BN_SYMBOL(bignum_modifier): CFI_START // If k = 0 the whole operation is trivial cbz k, Lbignum_modifier_end // Copy the input m into the temporary buffer t. The temporary register // c matters since we want it to hold the highest digit, ready for the // normalization phase. mov i, xzr Lbignum_modifier_copyinloop: ldr c, [m, i, lsl #3] str c, [t, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_modifier_copyinloop // Do a rather stupid but constant-time digit normalization, conditionally // shifting left (k-1) times based on whether the top word is zero. // With careful binary striding this could be O(k*log(k)) instead of O(k^2) // while still retaining the constant-time style. // The "cmp c, xzr" sets the zeroness predicate (ZF) for the entire inner loop subs i, k, #1 beq Lbignum_modifier_normalized Lbignum_modifier_normloop: mov j, xzr cmp c, xzr mov a, xzr Lbignum_modifier_shufloop: mov c, a ldr a, [t, j, lsl #3] csel c, c, a, eq str c, [t, j, lsl #3] add j, j, #1 sub d, j, k cbnz d, Lbignum_modifier_shufloop subs i, i, #1 bne Lbignum_modifier_normloop // We now have the top digit nonzero, assuming the input was nonzero, // and as per the invariant of the loop above, c holds that digit. So // now just count c's leading zeros and shift t bitwise that many bits. Lbignum_modifier_normalized: clz c, c mov b, xzr mov i, xzr ands xzr, c, #63 csetm l, ne neg d, c Lbignum_modifier_bitloop: ldr j, [t, i, lsl #3] lsl a, j, c orr a, a, b lsr b, j, d and b, b, l str a, [t, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_modifier_bitloop // Let h be the high word of n, which in all the in-scope cases is >= 2^63. // Now successively form q = 2^i div h and r = 2^i mod h as i goes from // 64 to 126. We avoid just using division out of constant-time concerns // (at the least we would need to fix up h = 0 for out-of-scope inputs) and // don't bother with Newton-Raphson, since this stupid simple loop doesn't // contribute much of the overall runtime at typical sizes. sub h, k, #1 ldr h, [t, h, lsl #3] mov q, #1 neg r, h mov i, #62 Lbignum_modifier_estloop: add q, q, q mov a, h sub a, a, r cmp r, a // CF <=> r >= h - r <=> 2 * r >= h csetm a, cs sub q, q, a add r, r, r and a, a, h sub r, r, a subs i, i, #1 bne Lbignum_modifier_estloop // Strictly speaking the above loop doesn't quite give the true remainder // and quotient in the special case r = h = 2^63, so fix it up. We get // q = 2^63 - 1 and r = 2^63 and really want q = 2^63 and r = 0. This is // supererogatory, because the main property of q used below still holds // in this case unless the initial m = 1, and then anyway the overall // specification (congruence modulo m) holds degenerately. But it seems // nicer to get a "true" quotient and remainder. cmp r, h csinc q, q, q, ne // So now we have q and r with 2^126 = q * h + r (imagining r = 0 in the // fixed-up case above: note that we never actually use the computed // value of r below and so didn't adjust it). And we can assume the ranges // q <= 2^63 and r < h < 2^64. // // The idea is to use q as a first quotient estimate for a remainder // of 2^{p+62} mod n, where p = 64 * k. We have, splitting n into the // high and low parts h and l: // // 2^{p+62} - q * n = 2^{p+62} - q * (2^{p-64} * h + l) // = 2^{p+62} - (2^{p-64} * (q * h) + q * l) // = 2^{p+62} - 2^{p-64} * (2^126 - r) - q * l // = 2^{p-64} * r - q * l // // Note that 2^{p-64} * r < 2^{p-64} * h <= n // and also q * l < 2^63 * 2^{p-64} = 2^{p-1} <= n // so |diff| = |2^{p-64} * r - q * l| < n. // // If in fact diff >= 0 then it is already 2^{p+62} mod n. // otherwise diff + n is the right answer. // // To (maybe?) make the computation slightly easier we actually flip // the sign and compute d = q * n - 2^{p+62}. Then the answer is either // -d (when negative) or n - d; in either case we effectively negate d. // This negating tweak in fact spoils the result for cases where // 2^{p+62} mod n = 0, when we get n instead. However the only case // where this can happen is m = 1, when the whole spec holds trivially, // and actually the remainder of the logic below works anyway since // the latter part of the code only needs a congruence for the k-digit // result, not strict modular reduction (the doublings will maintain // the non-strict inequality). mov c, xzr adds i, xzr, xzr Lbignum_modifier_mulloop: ldr a, [t, i, lsl #3] mul l, q, a adcs l, l, c umulh c, q, a str l, [z, i, lsl #3] add i, i, #1 sub a, i, k cbnz a, Lbignum_modifier_mulloop adc c, c, xzr mov a, #0x4000000000000000 subs c, c, a csetm q, cs // Now do [c] * n - d for our final answer subs i, xzr, xzr Lbignum_modifier_remloop: ldr a, [t, i, lsl #3] ldr b, [z, i, lsl #3] and a, a, q sbcs a, a, b str a, [z, i, lsl #3] add i, i, #1 sub a, i, k cbnz a, Lbignum_modifier_remloop // Now still need to do a couple of modular doublings to get us all the // way up to 2^{p+64} == r from the initial 2^{p+62} == r (mod n). mov c, xzr subs j, xzr, xzr Lbignum_modifier_dubloop1: ldr a, [z, j, lsl #3] extr c, a, c, #63 ldr b, [t, j, lsl #3] sbcs c, c, b str c, [z, j, lsl #3] mov c, a add j, j, #1 sub a, j, k cbnz a, Lbignum_modifier_dubloop1 lsr c, c, #63 sbc c, c, xzr adds j, xzr, xzr Lbignum_modifier_corrloop1: ldr a, [z, j, lsl #3] ldr b, [t, j, lsl #3] and b, b, c adcs a, a, b str a, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_modifier_corrloop1 // This is not exactly the same: we also copy output to t giving the // initialization t_1 = r == 2^{p+64} mod n for the main loop next. mov c, xzr subs j, xzr, xzr Lbignum_modifier_dubloop2: ldr a, [z, j, lsl #3] extr c, a, c, #63 ldr b, [t, j, lsl #3] sbcs c, c, b str c, [z, j, lsl #3] mov c, a add j, j, #1 sub a, j, k cbnz a, Lbignum_modifier_dubloop2 lsr c, c, #63 sbc c, c, xzr adds j, xzr, xzr Lbignum_modifier_corrloop2: ldr a, [z, j, lsl #3] ldr b, [t, j, lsl #3] and b, b, c adcs a, a, b str a, [z, j, lsl #3] str a, [t, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_modifier_corrloop2 // We then successively generate (k+1)-digit values satisfying // t_i == 2^{p+64*i} mod n, each of which is stored in h::t. Finish // initialization by zeroing h initially mov h, xzr // Then if t_i = 2^{p} * h + l // we have t_{i+1} == 2^64 * t_i // = (2^{p+64} * h) + (2^64 * l) // == r * h + l<<64 // Do this k more times so we end up == 2^{128*k+64}, one more than we want // // Writing B = 2^{64k}, the possible correction of adding r, which for // a (k+1)-digit result is equivalent to subtracting q = 2^{64*(k+1)} - r // would give the overall worst-case value minus q of // [ B * (B^k - 1) + (B - 1) * r ] - [B^{k+1} - r] // = B * (r - 1) < B^{k+1} so we keep inside k+1 digits as required. // // This implementation makes the shift implicit by starting b with the // "previous" digit (initially 0) to offset things by 1. mov i, k Lbignum_modifier_modloop: mov j, xzr mov b, xzr adds c, xzr, xzr Lbignum_modifier_cmaloop: ldr a, [z, j, lsl #3] mul l, h, a adcs b, b, c umulh c, h, a adc c, c, xzr adds l, b, l ldr b, [t, j, lsl #3] str l, [t, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_modifier_cmaloop adcs h, b, c csetm l, cs adds j, xzr, xzr Lbignum_modifier_oaloop: ldr a, [t, j, lsl #3] ldr b, [z, j, lsl #3] and b, b, l adcs a, a, b str a, [t, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_modifier_oaloop adc h, h, xzr subs i, i, #1 bne Lbignum_modifier_modloop // Compute the negated modular inverse w (same register as i, not used again). ldr a, [m] lsl w, a, #2 sub w, a, w eor w, w, #2 mov l, #1 madd c, a, w, l mul b, c, c madd w, c, w, w mul c, b, b madd w, b, w, w mul b, c, c madd w, c, w, w madd w, b, w, w // Now do one almost-Montgomery reduction w.r.t. the original m // which lops off one 2^64 from the congruence and, with the usual // almost-Montgomery correction, gets us back inside k digits for // the end result. ldr b, [t] mul d, b, w mul l, d, a umulh c, d, a mov j, #1 sub a, k, #1 adds xzr, b, l cbz a, Lbignum_modifier_amontend Lbignum_modifier_amontloop: ldr a, [m, j, lsl #3] ldr b, [t, j, lsl #3] mul l, d, a adcs b, b, c umulh c, d, a adc c, c, xzr adds b, b, l sub a, j, #1 str b, [t, a, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_modifier_amontloop Lbignum_modifier_amontend: adcs h, h, c csetm l, cs sub a, k, #1 str h, [t, a, lsl #3] subs j, xzr, xzr Lbignum_modifier_osloop: ldr a, [t, j, lsl #3] ldr b, [m, j, lsl #3] and b, b, l sbcs a, a, b str a, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_modifier_osloop // So far, the code (basically the same as bignum_amontifier) has produced // a k-digit value z == 2^{128k} (mod m), not necessarily fully reduced mod m. // We now do a short Montgomery reduction (similar to bignum_demont) so that // we achieve full reduction mod m while lopping 2^{64k} off the congruence. // We recycle h as the somewhat strangely-named outer loop counter. mov h, k Lbignum_modifier_montouterloop: ldr b, [z] mul d, b, w ldr a, [m] mul l, d, a umulh c, d, a mov j, #1 sub a, k, #1 adds xzr, b, l cbz a, Lbignum_modifier_montend Lbignum_modifier_montloop: ldr a, [m, j, lsl #3] ldr b, [z, j, lsl #3] mul l, d, a adcs b, b, c umulh c, d, a adc c, c, xzr adds b, b, l sub a, j, #1 str b, [z, a, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_modifier_montloop Lbignum_modifier_montend: adc c, c, xzr sub a, k, #1 str c, [z, a, lsl #3] subs h, h, #1 bne Lbignum_modifier_montouterloop // Now do a comparison of z with m to set a final correction mask // indicating that z >= m and so we need to subtract m. subs j, xzr, xzr Lbignum_modifier_cmploop: ldr a, [z, j, lsl #3] ldr b, [m, j, lsl #3] sbcs xzr, a, b add j, j, #1 sub a, j, k cbnz a, Lbignum_modifier_cmploop csetm h, cs // Now do a masked subtraction of m for the final reduced result. subs j, xzr, xzr Lbignum_modifier_corrloop: ldr a, [z, j, lsl #3] ldr b, [m, j, lsl #3] and b, b, h sbcs a, a, b str a, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_modifier_corrloop Lbignum_modifier_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_modifier) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
5,464
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_montmul.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Montgomery multiply, z := (x * y / 2^{64k}) mod m // Inputs x[k], y[k], m[k]; output z[k] // // extern void bignum_montmul(uint64_t k, uint64_t *z, const uint64_t *x, // const uint64_t *y, const uint64_t *m); // // Does z := (x * y / 2^{64k}) mod m, assuming x * y <= 2^{64k} * m, which is // guaranteed in particular if x < m, y < m initially (the "intended" case). // // Standard ARM ABI: X0 = k, X1 = z, X2 = x, X3 = y, X4 = m // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_montmul) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_montmul) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_montmul) .text .balign 4 #define k x0 #define z x1 #define x x2 #define y x3 #define m x4 // Negated modular inverse #define w x5 // Top carry for k'th position #define c0 x6 // Additional top carry for (k+1)'th position #define c1 x7 // Outer loop counter #define i x8 // Home for i'th digit or Montgomery multiplier #define d x9 // Inner loop counter #define j x10 #define h x11 #define e x12 #define l x13 #define a x14 // This is just a short-term temporary used in zero-test subtraction. // It's aliased to the same register as "a" which is always safe here. #define t x14 // Some more intuitive names for temp regs in initial word-level negmodinv. // These just use c0 and c1 again, which aren't initialized early on. #define one x6 #define e1 x6 #define e2 x7 #define e4 x6 #define e8 x7 S2N_BN_SYMBOL(bignum_montmul): CFI_START // If k = 0 the whole operation is trivial cbz k, Lbignum_montmul_end // Compute word-level negated modular inverse w for m == m[0]. // This is essentially the same as word_negmodinv. ldr a, [m] lsl w, a, #2 sub w, a, w eor w, w, #2 mov one, #1 madd e1, a, w, one mul e2, e1, e1 madd w, e1, w, w mul e4, e2, e2 madd w, e2, w, w mul e8, e4, e4 madd w, e4, w, w madd w, e8, w, w // Initialize the output c0::z to zero so we can then consistently add rows. // It would be a bit more efficient to special-case the zeroth row, but // this keeps the code slightly simpler. mov i, xzr Lbignum_montmul_zoop: str xzr, [z, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_montmul_zoop mov c0, xzr // Outer loop pulling down digits d=x[i], multiplying by y and reducing mov i, xzr Lbignum_montmul_outerloop: // Multiply-add loop where we always have CF + previous high part h to add in // Note that in general we do need yet one more carry in this phase and hence // initialize c1 with the top carry. ldr d, [x, i, lsl #3] mov j, xzr adds h, xzr, xzr Lbignum_montmul_maddloop: ldr a, [y, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l str e, [z, j, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_montmul_maddloop adcs c0, c0, h adc c1, xzr, xzr // Montgomery reduction loop, similar but offsetting writebacks ldr e, [z] mul d, e, w ldr a, [m] mul l, d, a umulh h, d, a adds e, e, l // Will be zero but want the carry mov j, #1 sub t, k, #1 cbz t, Lbignum_montmul_montend Lbignum_montmul_montloop: ldr a, [m, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l sub l, j, #1 str e, [z, l, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_montmul_montloop Lbignum_montmul_montend: adcs h, c0, h adc c0, c1, xzr sub l, j, #1 str h, [z, l, lsl #3] // End of outer loop add i, i, #1 cmp i, k bcc Lbignum_montmul_outerloop // Now do a comparison of (c0::z) with (0::m) to set a final correction mask // indicating that (c0::z) >= m and so we need to subtract m. subs j, xzr, xzr Lbignum_montmul_cmploop: ldr a, [z, j, lsl #3] ldr e, [m, j, lsl #3] sbcs xzr, a, e add j, j, #1 sub t, j, k cbnz t, Lbignum_montmul_cmploop sbcs xzr, c0, xzr csetm c0, cs // Now do a masked subtraction of m for the final reduced result. subs j, xzr, xzr Lbignum_montmul_corrloop: ldr a, [z, j, lsl #3] ldr e, [m, j, lsl #3] and e, e, c0 sbcs a, a, e str a, [z, j, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_montmul_corrloop Lbignum_montmul_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_montmul) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,500
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_lt.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Compare bignums, x < y // Inputs x[m], y[n]; output function return // // extern uint64_t bignum_lt(uint64_t m, const uint64_t *x, uint64_t n, // const uint64_t *y); // // Standard ARM ABI: X0 = m, X1 = x, X2 = n, X3 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_lt) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_lt) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_lt) .text .balign 4 #define m x0 #define x x1 #define n x2 #define y x3 #define i x4 #define a x5 #define d x6 S2N_BN_SYMBOL(bignum_lt): CFI_START // Zero the main index counter for both branches mov i, xzr // Speculatively form m := m - n and do case split subs m, m, n bcc Lbignum_lt_ylonger // The case where x is longer or of the same size (m >= n) // Note that CF=1 initially by the fact that we reach this point cbz n, Lbignum_lt_xtest Lbignum_lt_xmainloop: ldr a, [x, i, lsl #3] ldr d, [y, i, lsl #3] sbcs xzr, a, d add i, i, #1 sub n, n, #1 cbnz n, Lbignum_lt_xmainloop Lbignum_lt_xtest: cbz m, Lbignum_lt_xskip Lbignum_lt_xtoploop: ldr a, [x, i, lsl #3] sbcs xzr, a, xzr add i, i, #1 sub m, m, #1 cbnz m, Lbignum_lt_xtoploop Lbignum_lt_xskip: cset x0, cc ret // The case where y is longer (n > m) // The first "adds" also makes sure CF=1 initially in this branch Lbignum_lt_ylonger: adds m, m, n cbz m, Lbignum_lt_ytoploop sub n, n, m Lbignum_lt_ymainloop: ldr a, [x, i, lsl #3] ldr d, [y, i, lsl #3] sbcs xzr, a, d add i, i, #1 sub m, m, #1 cbnz m, Lbignum_lt_ymainloop Lbignum_lt_ytoploop: ldr a, [y, i, lsl #3] sbcs xzr, xzr, a add i, i, #1 sub n, n, #1 cbnz n, Lbignum_lt_ytoploop cset x0, cc CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_lt) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,118
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_bitsize.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Return size of bignum in bits // Input x[k]; output function return // // extern uint64_t bignum_bitsize(uint64_t k, const uint64_t *x); // // In the case of a zero bignum as input the result is 0 // // In principle this has a precondition k < 2^58, but obviously that // is always true in practice because of address space limitations. // // Standard ARM ABI: X0 = k, X1 = x, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_bitsize) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_bitsize) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_bitsize) .text .balign 4 #define k x0 #define x x1 #define i x2 #define w x3 #define a x4 #define j x5 S2N_BN_SYMBOL(bignum_bitsize): CFI_START // If the bignum is zero-length, x0 is already the right answer of 0 cbz k, Lbignum_bitsize_end // Use w = a[i-1] to store nonzero words in a bottom-up sweep // Set the initial default to be as if we had a 11...11 word directly below mov i, xzr mov w, #-1 mov j, xzr Lbignum_bitsize_loop: ldr a, [x, j, lsl #3] add j, j, #1 cmp a, #0 csel i, j, i, ne csel w, a, w, ne cmp j, k bne Lbignum_bitsize_loop // Now w = a[i-1] is the highest nonzero word, or in the zero case the // default of the "extra" 11...11 = a[0-1]. We now want 64* i - clz(w). // Note that this code does not rely on the behavior of the clz instruction // for zero inputs, though the ARM manual does in fact guarantee clz(0) = 64. lsl i, i, #6 clz a, w sub x0, i, a Lbignum_bitsize_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_bitsize) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,501
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_ge.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Compare bignums, x >= y // Inputs x[m], y[n]; output function return // // extern uint64_t bignum_ge(uint64_t m, const uint64_t *x, uint64_t n, // const uint64_t *y); // // Standard ARM ABI: X0 = m, X1 = x, X2 = n, X3 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_ge) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_ge) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_ge) .text .balign 4 #define m x0 #define x x1 #define n x2 #define y x3 #define i x4 #define a x5 #define d x6 S2N_BN_SYMBOL(bignum_ge): CFI_START // Zero the main index counter for both branches mov i, xzr // Speculatively form m := m - n and do case split subs m, m, n bcc Lbignum_ge_ylonger // The case where x is longer or of the same size (m >= n) // Note that CF=1 initially by the fact that we reach this point cbz n, Lbignum_ge_xtest Lbignum_ge_xmainloop: ldr a, [x, i, lsl #3] ldr d, [y, i, lsl #3] sbcs xzr, a, d add i, i, #1 sub n, n, #1 cbnz n, Lbignum_ge_xmainloop Lbignum_ge_xtest: cbz m, Lbignum_ge_xskip Lbignum_ge_xtoploop: ldr a, [x, i, lsl #3] sbcs xzr, a, xzr add i, i, #1 sub m, m, #1 cbnz m, Lbignum_ge_xtoploop Lbignum_ge_xskip: cset x0, cs ret // The case where y is longer (n > m) // The first "adds" also makes sure CF=1 initially in this branch Lbignum_ge_ylonger: adds m, m, n cbz m, Lbignum_ge_ytoploop sub n, n, m Lbignum_ge_ymainloop: ldr a, [x, i, lsl #3] ldr d, [y, i, lsl #3] sbcs xzr, a, d add i, i, #1 sub m, m, #1 cbnz m, Lbignum_ge_ymainloop Lbignum_ge_ytoploop: ldr a, [y, i, lsl #3] sbcs xzr, xzr, a add i, i, #1 sub n, n, #1 cbnz n, Lbignum_ge_ytoploop cset x0, cs CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_ge) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,028
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_odd.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Test bignum for odd-ness // Input x[k]; output function return // // extern uint64_t bignum_odd(uint64_t k, const uint64_t *x); // // Standard ARM ABI: X0 = k, X1 = x, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_odd) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_odd) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_odd) .text .balign 4 S2N_BN_SYMBOL(bignum_odd): CFI_START cbz x0, Lbignum_odd_end // if k = 0, that's the return! ldr x0, [x1] and x0, x0, #1 Lbignum_odd_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_odd) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,126
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_moddouble.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Double modulo m, z := (2 * x) mod m, assuming x reduced // Inputs x[k], m[k]; output z[k] // // extern void bignum_moddouble(uint64_t k, uint64_t *z, const uint64_t *x, // const uint64_t *m); // // Standard ARM ABI: X0 = k, X1 = z, X2 = x, X3 = m // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_moddouble) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_moddouble) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_moddouble) .text .balign 4 #define k x0 #define z x1 #define x x2 #define m x3 #define i x4 #define j x5 #define a x6 #define b x7 #define c x8 S2N_BN_SYMBOL(bignum_moddouble): CFI_START adds j, k, xzr // j = k and ZF = (k = 0) beq Lbignum_moddouble_end // if k = 0 do nothing // Do (_::z) = 2 * x - m and generate a mask in c for 2 * x < m mov c, xzr subs i, xzr, xzr // i = 0 and CF = 1 Lbignum_moddouble_dubloop: ldr a, [x, i] extr c, a, c, #63 ldr b, [m, i] sbcs c, c, b str c, [z, i] mov c, a add i, i, #8 sub j, j, #1 cbnz j, Lbignum_moddouble_dubloop lsr c, c, #63 sbc c, c, xzr // Now do a corrective masked addition z := z + [c] * m mov j, k adds i, xzr, xzr Lbignum_moddouble_corrloop: ldr a, [z, i] ldr b, [m, i] and b, b, c adcs a, a, b str a, [z, i] add i, i, #8 sub j, j, #1 cbnz j, Lbignum_moddouble_corrloop Lbignum_moddouble_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_moddouble) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
17,915
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_modinv.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Invert modulo m, z = (1/a) mod b, assuming b is an odd number > 1, coprime a // Inputs a[k], b[k]; output z[k]; temporary buffer t[>=3*k] // // extern void bignum_modinv(uint64_t k, uint64_t *z, const uint64_t *a, // const uint64_t *b, uint64_t *t); // // k-digit (digit=64 bits) "z := a^-1 mod b" (modular inverse of a modulo b) // using t as a temporary buffer (t at least 3*k words = 24*k bytes), and // assuming that a and b are coprime *and* that b is an odd number > 1. // // Standard ARM ABI: X0 = k, X1 = z, X2 = a, X3 = b, X4 = t // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_modinv) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_modinv) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_modinv) .text .balign 4 // We get CHUNKSIZE bits per outer iteration, 64 minus a few for proxy errors #define CHUNKSIZE 58 // Pervasive variables #define k x0 #define z x1 #define b x3 #define w x4 // This one is recycled after initial copying in of a as outer loop counter #define a x2 #define t x2 // Additional variables; later ones are currently rather high regs #define l x5 #define m x21 #define n x22 // The matrix of update factors to apply to m and n // Also used a couple of additional temporary variables for the swapping loop // Also used as an extra down-counter in corrective negation loops #define m_m x6 #define m_n x7 #define n_m x8 #define n_n x9 #define j x6 // General temporary variables and loop counters #define i x10 #define t1 x11 #define t2 x12 // High and low proxies for the inner loop // Then re-used for high and carry words during actual cross-multiplications #define m_hi x13 #define n_hi x14 #define m_lo x15 #define n_lo x16 #define h1 x13 #define h2 x14 #define l1 x15 #define l2 x16 #define c1 x17 #define c2 x19 // Negated modular inverse for Montgomery #define v x20 // Some more intuitive names for temp regs in initial word-level negmodinv. // These just use t1 and t2 again, though carefully since t1 = initial b[0] #define one t2 #define e1 t2 #define e2 t1 #define e4 t2 #define e8 t1 S2N_BN_SYMBOL(bignum_modinv): CFI_START // We make use of registers beyond the modifiable CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) // If k = 0 then do nothing (this is out of scope anyway) cbz k, Lbignum_modinv_end // Set up the additional two buffers m and n beyond w in temp space lsl i, k, #3 add m, w, i add n, m, i // Initialize the main buffers with their starting values: // m = a, n = b, w = b (to be tweaked to b - 1) and z = 0 mov i, xzr Lbignum_modinv_copyloop: ldr t1, [a, i, lsl #3] ldr t2, [b, i, lsl #3] str t1, [m, i, lsl #3] str t2, [n, i, lsl #3] str t2, [w, i, lsl #3] str xzr, [z, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_modinv_copyloop // Tweak down w to b - 1 (this crude approach is safe as b needs to be odd // for it to be in scope). We have then established the congruence invariant: // // a * w == -m (mod b) // a * z == n (mod b) // // This, with the bound w <= b and z <= b, is maintained round the outer loop ldr t1, [w] sub t2, t1, #1 str t2, [w] // Compute v = negated modular inverse of b mod 2^64, reusing t1 from above // This is used for Montgomery reduction operations each time round the loop lsl v, t1, #2 sub v, t1, v eor v, v, #2 mov one, #1 madd e1, t1, v, one mul e2, e1, e1 madd v, e1, v, v mul e4, e2, e2 madd v, e2, v, v mul e8, e4, e4 madd v, e4, v, v madd v, e8, v, v // Set up the outer loop count of 128 * k // The invariant is that m * n < 2^t at all times. lsl t, k, #7 // Start of the main outer loop iterated t / CHUNKSIZE times Lbignum_modinv_outerloop: // We need only bother with sharper l = min k (ceil(t/64)) digits // for the computations on m and n (but we still need k for w and z). // Either both m and n fit in l digits, or m has become zero and so // nothing happens in the loop anyway and this makes no difference. add i, t, #63 lsr l, i, #6 cmp l, k csel l, k, l, cs // Select upper and lower proxies for both m and n to drive the inner // loop. The lower proxies are simply the lowest digits themselves, // m_lo = m[0] and n_lo = n[0], while the upper proxies are bitfields // of the two inputs selected so their top bit (63) aligns with the // most significant bit of *either* of the two inputs. mov h1, xzr // Previous high and low for m mov l1, xzr mov h2, xzr // Previous high and low for n mov l2, xzr mov c2, xzr // Mask flag: previous word of one was nonzero // and in this case h1 and h2 are those words mov i, xzr Lbignum_modinv_toploop: ldr t1, [m, i, lsl #3] ldr t2, [n, i, lsl #3] orr c1, t1, t2 cmp c1, xzr and c1, c2, h1 csel l1, c1, l1, ne and c1, c2, h2 csel l2, c1, l2, ne csel h1, t1, h1, ne csel h2, t2, h2, ne csetm c2, ne add i, i, #1 cmp i, l bcc Lbignum_modinv_toploop orr t1, h1, h2 clz t2, t1 negs c1, t2 lsl h1, h1, t2 csel l1, l1, xzr, ne lsl h2, h2, t2 csel l2, l2, xzr, ne lsr l1, l1, c1 lsr l2, l2, c1 orr m_hi, h1, l1 orr n_hi, h2, l2 ldr m_lo, [m] ldr n_lo, [n] // Now the inner loop, with i as loop counter from CHUNKSIZE down. // This records a matrix of updates to apply to the initial // values of m and n with, at stage j: // // sgn * m' = (m_m * m - m_n * n) / 2^j // -sgn * n' = (n_m * m - n_n * n) / 2^j // // where "sgn" is either +1 or -1, and we lose track of which except // that both instance above are the same. This throwing away the sign // costs nothing (since we have to correct in general anyway because // of the proxied comparison) and makes things a bit simpler. But it // is simply the parity of the number of times the first condition, // used as the swapping criterion, fires in this loop. mov m_m, #1 mov m_n, xzr mov n_m, xzr mov n_n, #1 mov i, #CHUNKSIZE // Conceptually in the inner loop we follow these steps: // // * If m_lo is odd and m_hi < n_hi, then swap the four pairs // (m_hi,n_hi); (m_lo,n_lo); (m_m,n_m); (m_n,n_n) // // * Now, if m_lo is odd (old or new, doesn't matter as initial n_lo is odd) // m_hi := m_hi - n_hi, m_lo := m_lo - n_lo // m_m := m_m + n_m, m_n := m_n + n_n // // * Halve and double them // m_hi := m_hi / 2, m_lo := m_lo / 2 // n_m := n_m * 2, n_n := n_n * 2 // // The actual computation computes updates before actually swapping and // then corrects as needed. It also maintains the invariant ~ZF <=> odd(m_lo), // since it seems to reduce the dependent latency. Set that up first. ands xzr, m_lo, #1 Lbignum_modinv_innerloop: // At the start of the loop ~ZF <=> m_lo is odd; mask values accordingly // Set the flags for m_hi - [~ZF] * n_hi so we know to flip things. csel t1, n_hi, xzr, ne csel t2, n_lo, xzr, ne csel c1, n_m, xzr, ne csel c2, n_n, xzr, ne ccmp m_hi, n_hi, #0x2, ne // Compute subtractive updates, trivial in the case ZF <=> even(m_lo). sub t1, m_hi, t1 sub t2, m_lo, t2 // If the subtraction borrows, swap things appropriately, negating where // we've already subtracted so things are as if we actually swapped first. csel n_hi, n_hi, m_hi, cs cneg t1, t1, cc csel n_lo, n_lo, m_lo, cs cneg m_lo, t2, cc csel n_m, n_m, m_m, cs csel n_n, n_n, m_n, cs // Update and shift while setting oddness flag for next iteration // We look at bit 1 of t2 (m_lo before possible negation), which is // safe because it is even. ands xzr, t2, #2 add m_m, m_m, c1 add m_n, m_n, c2 lsr m_hi, t1, #1 lsr m_lo, m_lo, #1 add n_m, n_m, n_m add n_n, n_n, n_n // Next iteration; don't disturb the flags since they are used at entry sub i, i, #1 cbnz i, Lbignum_modinv_innerloop // Apply the update to w and z, using addition in this case, and also take // the chance to shift an additional 6 = 64-CHUNKSIZE bits to be ready for a // Montgomery multiplication. Because we know that m_m + m_n <= 2^58 and // w, z <= b < 2^{64k}, we know that both of these fit in k+1 words. // We do this before the m-n update to allow us to play with c1 and c2 here. // // h1::w = 2^6 * (m_m * w + m_n * z) // h2::z = 2^6 * (n_m * w + n_n * z) // // with c1 and c2 recording previous words for the shifting part mov h1, xzr mov h2, xzr mov c1, xzr mov c2, xzr mov i, xzr Lbignum_modinv_congloop: ldr t1, [w, i, lsl #3] ldr t2, [z, i, lsl #3] mul l1, m_m, t1 mul l2, m_n, t2 adds l1, l1, h1 umulh h1, m_m, t1 adc h1, h1, xzr adds l1, l1, l2 extr c1, l1, c1, #CHUNKSIZE str c1, [w, i, lsl #3] mov c1, l1 umulh l1, m_n, t2 adc h1, h1, l1 mul l1, n_m, t1 mul l2, n_n, t2 adds l1, l1, h2 umulh h2, n_m, t1 adc h2, h2, xzr adds l1, l1, l2 extr c2, l1, c2, #CHUNKSIZE str c2, [z, i, lsl #3] mov c2, l1 umulh l1, n_n, t2 adc h2, h2, l1 add i, i, #1 cmp i, k bcc Lbignum_modinv_congloop extr h1, h1, c1, #CHUNKSIZE extr h2, h2, c2, #CHUNKSIZE // Do a Montgomery reduction of h1::w ldr t1, [w] mul c1, t1, v ldr t2, [b] mul l1, c1, t2 umulh l2, c1, t2 adds t1, t1, l1 // Will be zero but want the carry mov i, #1 sub t1, k, #1 cbz t1, Lbignum_modinv_wmontend Lbignum_modinv_wmontloop: ldr t1, [b, i, lsl #3] ldr t2, [w, i, lsl #3] mul l1, c1, t1 adcs t2, t2, l2 umulh l2, c1, t1 adc l2, l2, xzr adds t2, t2, l1 sub l1, i, #1 str t2, [w, l1, lsl #3] add i, i, #1 sub t1, i, k cbnz t1, Lbignum_modinv_wmontloop Lbignum_modinv_wmontend: adcs l2, l2, h1 adc h1, xzr, xzr sub l1, i, #1 str l2, [w, l1, lsl #3] subs i, xzr, xzr Lbignum_modinv_wcmploop: ldr t1, [w, i, lsl #3] ldr t2, [b, i, lsl #3] sbcs xzr, t1, t2 add i, i, #1 sub t1, i, k cbnz t1, Lbignum_modinv_wcmploop sbcs xzr, h1, xzr csetm h1, cs subs i, xzr, xzr Lbignum_modinv_wcorrloop: ldr t1, [w, i, lsl #3] ldr t2, [b, i, lsl #3] and t2, t2, h1 sbcs t1, t1, t2 str t1, [w, i, lsl #3] add i, i, #1 sub t1, i, k cbnz t1, Lbignum_modinv_wcorrloop // Do a Montgomery reduction of h2::z ldr t1, [z] mul c1, t1, v ldr t2, [b] mul l1, c1, t2 umulh l2, c1, t2 adds t1, t1, l1 // Will be zero but want the carry mov i, #1 sub t1, k, #1 cbz t1, Lbignum_modinv_zmontend Lbignum_modinv_zmontloop: ldr t1, [b, i, lsl #3] ldr t2, [z, i, lsl #3] mul l1, c1, t1 adcs t2, t2, l2 umulh l2, c1, t1 adc l2, l2, xzr adds t2, t2, l1 sub l1, i, #1 str t2, [z, l1, lsl #3] add i, i, #1 sub t1, i, k cbnz t1, Lbignum_modinv_zmontloop Lbignum_modinv_zmontend: adcs l2, l2, h2 adc h2, xzr, xzr sub l1, i, #1 str l2, [z, l1, lsl #3] subs i, xzr, xzr Lbignum_modinv_zcmploop: ldr t1, [z, i, lsl #3] ldr t2, [b, i, lsl #3] sbcs xzr, t1, t2 add i, i, #1 sub t1, i, k cbnz t1, Lbignum_modinv_zcmploop sbcs xzr, h2, xzr csetm h2, cs subs i, xzr, xzr Lbignum_modinv_zcorrloop: ldr t1, [z, i, lsl #3] ldr t2, [b, i, lsl #3] and t2, t2, h2 sbcs t1, t1, t2 str t1, [z, i, lsl #3] add i, i, #1 sub t1, i, k cbnz t1, Lbignum_modinv_zcorrloop // Now actually compute the updates to m and n corresponding to the matrix, // and correct the signs if they have gone negative. First we compute the // (k+1)-sized updates with the following invariant (here c1 and c2 are in // fact carry bitmasks, either 0 or -1): // // c1::h1::m = m_m * m - m_n * n // c2::h2::n = n_m * m - n_n * n mov h1, xzr mov h2, xzr mov c1, xzr mov c2, xzr mov i, xzr Lbignum_modinv_crossloop: ldr t1, [m, i, lsl #3] ldr t2, [n, i, lsl #3] mul l1, m_m, t1 mul l2, m_n, t2 adds l1, l1, h1 umulh h1, m_m, t1 adc h1, h1, xzr subs l1, l1, l2 str l1, [m, i, lsl #3] umulh l1, m_n, t2 sub c1, l1, c1 sbcs h1, h1, c1 csetm c1, cc mul l1, n_m, t1 mul l2, n_n, t2 adds l1, l1, h2 umulh h2, n_m, t1 adc h2, h2, xzr subs l1, l1, l2 str l1, [n, i, lsl #3] umulh l1, n_n, t2 sub c2, l1, c2 sbcs h2, h2, c2 csetm c2, cc add i, i, #1 cmp i, l bcc Lbignum_modinv_crossloop // Write back m optionally negated and shifted right CHUNKSIZE bits adds xzr, c1, c1 ldr l1, [m] mov i, xzr sub j, l, #1 cbz j, Lbignum_modinv_negskip1 Lbignum_modinv_negloop1: add t1, i, #8 ldr t2, [m, t1] extr l1, t2, l1, #CHUNKSIZE eor l1, l1, c1 adcs l1, l1, xzr str l1, [m, i] mov l1, t2 add i, i, #8 sub j, j, #1 cbnz j, Lbignum_modinv_negloop1 Lbignum_modinv_negskip1: extr l1, h1, l1, #CHUNKSIZE eor l1, l1, c1 adcs l1, l1, xzr str l1, [m, i] // Write back n optionally negated and shifted right CHUNKSIZE bits adds xzr, c2, c2 ldr l1, [n] mov i, xzr sub j, l, #1 cbz j, Lbignum_modinv_negskip2 Lbignum_modinv_negloop2: add t1, i, #8 ldr t2, [n, t1] extr l1, t2, l1, #CHUNKSIZE eor l1, l1, c2 adcs l1, l1, xzr str l1, [n, i] mov l1, t2 add i, i, #8 sub j, j, #1 cbnz j, Lbignum_modinv_negloop2 Lbignum_modinv_negskip2: extr l1, h2, l1, #CHUNKSIZE eor l1, l1, c2 adcs l1, l1, xzr str l1, [n, i] // Finally, use the signs c1 and c2 to do optional modular negations of // w and z respectively, flipping c2 to make signs work. We don't make // any checks for zero values, but we certainly retain w <= b and z <= b. // This is enough for the Montgomery step in the next iteration to give // strict reduction w < b amd z < b, and anyway when we terminate we // could not have z = b since it violates the coprimality assumption for // in-scope cases. mov i, xzr adds xzr, c1, c1 Lbignum_modinv_wfliploop: ldr t1, [b, i, lsl #3] ldr t2, [w, i, lsl #3] and t1, t1, c1 eor t2, t2, c1 adcs t1, t1, t2 str t1, [w, i, lsl #3] add i, i, #1 sub t1, i, k cbnz t1, Lbignum_modinv_wfliploop mvn c2, c2 mov i, xzr adds xzr, c2, c2 Lbignum_modinv_zfliploop: ldr t1, [b, i, lsl #3] ldr t2, [z, i, lsl #3] and t1, t1, c2 eor t2, t2, c2 adcs t1, t1, t2 str t1, [z, i, lsl #3] add i, i, #1 sub t1, i, k cbnz t1, Lbignum_modinv_zfliploop // End of main loop. We can stop if t' <= 0 since then m * n < 2^0, which // since n is odd and m and n are coprime (in the in-scope cases) means // m = 0, n = 1 and hence from the congruence invariant a * z == 1 (mod b). // Moreover we do in fact need to maintain strictly t > 0 in the main loop, // or the computation of the optimized digit bound l could collapse to 0. subs t, t, #CHUNKSIZE bhi Lbignum_modinv_outerloop Lbignum_modinv_end: CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_modinv) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,363
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_modadd.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Add modulo m, z := (x + y) mod m, assuming x and y reduced // Inputs x[k], y[k], m[k]; output z[k] // // extern void bignum_modadd(uint64_t k, uint64_t *z, const uint64_t *x, // const uint64_t *y, const uint64_t *m); // // Standard ARM ABI: X0 = k, X1 = z, X2 = x, X3 = y, X4 = m // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_modadd) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_modadd) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_modadd) .text .balign 4 #define k x0 #define z x1 #define x x2 #define y x3 #define m x4 #define i x5 #define j x6 #define a x7 #define b x8 #define c x9 S2N_BN_SYMBOL(bignum_modadd): CFI_START adds j, k, xzr // j = k and ZF = (k = 0) beq Lbignum_modadd_end // if k = 0 do nothing adds i, xzr, xzr // i = 0 and CF = 0 // First just add (c::z) := x + y Lbignum_modadd_addloop: ldr a, [x, i] ldr b, [y, i] adcs a, a, b str a, [z, i] add i, i, #8 sub j, j, #1 cbnz j, Lbignum_modadd_addloop cset c, cs // Now do a comparison subtraction (c::z) - m, recording mask for (c::z) >= m mov j, k subs i, xzr, xzr Lbignum_modadd_cmploop: ldr a, [z, i] ldr b, [m, i] sbcs xzr, a, b add i, i, #8 sub j, j, #1 cbnz j, Lbignum_modadd_cmploop sbcs c, c, xzr mvn c, c // Now do a masked subtraction z := z - [c] * m mov j, k subs i, xzr, xzr Lbignum_modadd_subloop: ldr a, [z, i] ldr b, [m, i] and b, b, c sbcs a, a, b str a, [z, i] add i, i, #8 sub j, j, #1 cbnz j, Lbignum_modadd_subloop Lbignum_modadd_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_modadd) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,946
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_optadd.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Optionally add, z := x + y (if p nonzero) or z := x (if p zero) // Inputs x[k], p, y[k]; outputs function return (carry-out) and z[k] // // extern uint64_t bignum_optadd(uint64_t k, uint64_t *z, const uint64_t *x, // uint64_t p, const uint64_t *y); // // It is assumed that all numbers x, y and z have the same size k digits. // Returns carry-out as per usual addition, always 0 if p was zero. // // Standard ARM ABI: X0 = k, X1 = z, X2 = x, X3 = p, X4 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_optadd) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_optadd) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_optadd) .text .balign 4 #define k x0 #define z x1 #define x x2 #define p x3 #define y x4 #define m x3 #define a x5 #define b x6 #define i x7 S2N_BN_SYMBOL(bignum_optadd): CFI_START // if k = 0 do nothing. This is also the right top carry in X0 cbz k, Lbignum_optadd_end // Convert p into a strict bitmask (same register in fact) cmp p, xzr csetm m, ne // Set i = 0 *and* make sure initial CF = 0 adds i, xzr, xzr // Main loop Lbignum_optadd_loop: ldr a, [x, i] ldr b, [y, i] and b, b, m adcs a, a, b str a, [z, i] add i, i, #8 sub k, k, #1 cbnz k, Lbignum_optadd_loop // Return carry flag adc x0, xzr, xzr Lbignum_optadd_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_optadd) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,489
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_madd.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply-add, z := z + x * y // Inputs x[m], y[n]; outputs function return (carry-out) and z[k] // // extern uint64_t bignum_madd(uint64_t k, uint64_t *z, uint64_t m, // const uint64_t *x, uint64_t n, const uint64_t *y); // // Does the "z := x * y + z" operation, while also returning a "next" or // "carry" word. In the case where m + n <= p (i.e. the pure product would // fit in the destination) this is the remainder for the exact result. // // Standard ARM ABI: X0 = k, X1 = z, X2 = m, X3 = x, X4 = n, X5 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_madd) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_madd) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_madd) .text .balign 4 #define p x0 #define z x1 #define m x2 #define x x3 #define n x4 #define y x5 #define l x6 #define h x7 #define c x8 #define k x9 #define i x10 #define a x11 #define b x12 #define d x13 #define xx x14 #define yy x15 S2N_BN_SYMBOL(bignum_madd): CFI_START // If p = 0 the result is trivial and nothing needs doing // Note that fortuitously our "carry/remainder" term is still right! // As it's a multiply-add, could also do this if either argument is trivial cbz p, Lbignum_madd_end // initialize (h,l) = 0, saving c = 0 for inside the loop mov l, xzr mov h, xzr // Iterate outer loop from k = 0 ... k = p - 1 producing result digits mov k, xzr Lbignum_madd_outerloop: // Add the existing z[k] and (h,l) to get initial (c,h,l) combination ldr c, [z, k, lsl #3] adds l, l, c adcs h, h, xzr adc c, xzr, xzr // First let a = MAX 0 (k + 1 - n) and b = MIN (k + 1) m // We want to accumulate all x[i] * y[k - i] for a <= i < b add a, k, #1 cmp a, m csel b, a, m, cc subs a, a, n csel a, a, xzr, cs // Set loop count i = b - a, and skip everything if it's <= 0 subs i, b, a bls Lbignum_madd_innerend // Use temporary pointers xx = x + 8 * a and yy = y + 8 * (k - b) // Increment xx per iteration but just use loop counter with yy // So we start with [xx] = x[a] and [yy] = y[(k - b) + (b - a)] = y[k - a] lsl xx, a, #3 add xx, xx, x sub yy, k, b lsl yy, yy, #3 add yy, yy, y // And index using the loop counter i = b - a, ..., i = 1 Lbignum_madd_innerloop: ldr a, [xx], #8 ldr b, [yy, i, lsl #3] mul d, a, b umulh a, a, b adds l, l, d adcs h, h, a adc c, c, xzr subs i, i, #1 bne Lbignum_madd_innerloop Lbignum_madd_innerend: str l, [z, k, lsl #3] mov l, h mov h, c add k, k, #1 cmp k, p bcc Lbignum_madd_outerloop // Inverted carry flag! // Return the "carry/remainder" term mov x0, l Lbignum_madd_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_madd) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,190
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_ctz.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Count trailing zero bits // Input x[k]; output function return // // extern uint64_t bignum_ctz(uint64_t k, const uint64_t *x); // // // In the case of a zero bignum as input the result is 64 * k // // In principle this has a precondition k < 2^58, but obviously that // is always true in practice because of address space limitations // // Standard ARM ABI: X0 = k, X1 = x, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_ctz) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_ctz) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_ctz) .text .balign 4 #define k x0 #define x x1 #define i x2 #define w x3 #define a x4 S2N_BN_SYMBOL(bignum_ctz): CFI_START // If the bignum is zero-length, x0 is already the right answer of 0 cbz k, Lbignum_ctz_end // Use w = a[i] to store nonzero words in a top-down sweep // Set the initial default to be as if we had a 1 word directly above mov i, k mov w, #1 Lbignum_ctz_loop: sub k, k, #1 ldr a, [x, k, lsl #3] cmp a, #0 csel i, k, i, ne csel w, a, w, ne cbnz k, Lbignum_ctz_loop // Now w = a[i] is the lowest nonzero word, or in the zero case the // default of the "extra" 1 = a[k]. We now want 64*i + ctz(w). // // ARM doesn't have a direct word ctz instruction, so we emulate it via // ctz(w) = 64 - clz(~w & (w-1)). This is depending, for cases of the form // ctz(....1), on the behavior clz(0) = 64, which is guaranteed according // to the ARM manual. mvn a, w sub w, w, #1 add i, i, #1 and w, w, a lsl i, i, #6 clz a, w sub x0, i, a Lbignum_ctz_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_ctz) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,347
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_nonzero.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Test bignum for nonzero-ness x =/= 0 // Input x[k]; output function return // // extern uint64_t bignum_nonzero(uint64_t k, const uint64_t *x); // // Standard ARM ABI: X0 = k, X1 = x, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_nonzero) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_nonzero) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_nonzero) .text .balign 4 #define k x0 #define x x1 #define a x2 #define c x3 S2N_BN_SYMBOL(bignum_nonzero): CFI_START mov c, xzr // c will be or of the digits cbz k, Lbignum_nonzero_end // if k = 0 skip the Lbignum_nonzero_loop Lbignum_nonzero_loop: sub k, k, #1 ldr a, [x, k, lsl #3] orr c, c, a cbnz k, Lbignum_nonzero_loop cmp c, xzr cset x0, ne Lbignum_nonzero_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_nonzero) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,699
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_bitfield.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Select bitfield starting at bit n with length l <= 64 // Inputs x[k], n, l; output function return // // extern uint64_t bignum_bitfield(uint64_t k, const uint64_t *x, uint64_t n, // uint64_t l); // // One-word bitfield from a k-digit (digit=64 bits) bignum, in constant-time // style. Bitfield starts at bit n and has length l, indexing from 0 (=LSB). // Digits above the top are treated uniformly as zero, as usual. Since the // result is returned in a single word, effectively we use l' = min(64,l) // for the length. // // Standard ARM ABI: X0 = k, X1 = x, X2 = n, X3 = l, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_bitfield) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_bitfield) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_bitfield) .text .balign 4 #define k x0 #define x x1 #define n x2 #define l x3 #define d x4 #define e x5 #define i x6 #define a x7 #define m x8 S2N_BN_SYMBOL(bignum_bitfield): CFI_START // For length zero finish immediately (the return value in x0 is 0) cbz k, Lbignum_bitfield_end // Decompose the index into n = 64 * n + m, then increment n for next part and m, n, #63 lsr n, n, #6 add n, n, #1 // Run over the digits setting d = n'th and e = (n+1)'th mov i, xzr mov e, xzr Lbignum_bitfield_loop: ldr a, [x, i, lsl #3] cmp i, n csel d, a, d, cc csel e, a, e, eq add i, i, #1 cmp i, k bcc Lbignum_bitfield_loop // Override d with 0 if we ran off the end (e will retain original 0). cmp i, n csel d, xzr, d, cc // Override e if we have m = 0 (i.e. original n was divisible by 64) // This is because then we want to shift it right by 64 below. cmp m, xzr csel e, xzr, e, eq // Combine shifted digits to get the bitfield(n,64) lsr d, d, m neg m, m lsl e, e, m orr a, d, e // Now mask it down to get bitfield (n,l) cmp l, #64 cset m, cc lsl m, m, l sub m, m, #1 and x0, a, m Lbignum_bitfield_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_bitfield) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,064
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_even.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Test bignum for even-ness // Input x[k]; output function return // // extern uint64_t bignum_even(uint64_t k, const uint64_t *x); // // Standard ARM ABI: X0 = k, X1 = x, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_even) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_even) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_even) .text .balign 4 S2N_BN_SYMBOL(bignum_even): CFI_START cbz x0, Lbignum_even_end // if k = 0, that's the return! ldr x0, [x1] and x0, x0, #1 Lbignum_even_end: eor x0, x0, #1 CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_even) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,068
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_copy_row_from_table_8n.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Given table: uint64_t[height*width], copy table[idx*width...(idx+1)*width-1] // into z[0..width-1]. width must be a multiple of 8. // This function is constant-time with respect to the value of `idx`. This is // achieved by reading the whole table and using the bit-masking to get the // `idx`-th row. // // extern void bignum_copy_row_from_table_8n // (uint64_t *z, const uint64_t *table, uint64_t height, uint64_t width, uint64_t idx); // // Standard ARM ABI: X0 = z, X1 = table, X2 = height, X3 = width, X4 = idx // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_copy_row_from_table_8n) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_copy_row_from_table_8n) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_copy_row_from_table_8n) .text .balign 4 #define z x0 #define table x1 #define height x2 #define width x3 #define idx x4 #define i x5 #define mask x6 #define j x7 #define vmask v16 S2N_BN_SYMBOL(bignum_copy_row_from_table_8n): CFI_START cbz height, Lbignum_copy_row_from_table_8n_end cbz width, Lbignum_copy_row_from_table_8n_end mov i, width mov x6, z dup v16.2d, xzr Lbignum_copy_row_from_table_8n_initzero: str q16, [x6] str q16, [x6, #16] str q16, [x6, #32] str q16, [x6, #48] add x6, x6, #64 subs i, i, #8 bne Lbignum_copy_row_from_table_8n_initzero mov i, xzr mov x8, table Lbignum_copy_row_from_table_8n_outerloop: cmp i, idx csetm mask, eq dup vmask.2d, mask mov j, width mov x9, z Lbignum_copy_row_from_table_8n_innerloop: ldr q17, [x8] ldr q18, [x9] bit v18.16b, v17.16b, vmask.16b str q18, [x9] ldr q17, [x8, #16] ldr q18, [x9, #16] bit v18.16b, v17.16b, vmask.16b str q18, [x9, #16] ldr q17, [x8, #32] ldr q18, [x9, #32] bit v18.16b, v17.16b, vmask.16b str q18, [x9, #32] ldr q17, [x8, #48] ldr q18, [x9, #48] bit v18.16b, v17.16b, vmask.16b str q18, [x9, #48] add x8, x8, #64 add x9, x9, #64 subs j, j, #8 bne Lbignum_copy_row_from_table_8n_innerloop Lbignum_copy_row_from_table_8n_innerloop_done: add i, i, #1 cmp i, height bne Lbignum_copy_row_from_table_8n_outerloop Lbignum_copy_row_from_table_8n_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_copy_row_from_table_8n) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,413
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_copy_row_from_table_16.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Given table: uint64_t[height*16], copy table[idx*16...(idx+1)*16-1] // into z[0..row-1]. // This function is constant-time with respect to the value of `idx`. This is // achieved by reading the whole table and using the bit-masking to get the // `idx`-th row. // // extern void bignum_copy_row_from_table_16 // (uint64_t *z, const uint64_t *table, uint64_t height, uint64_t idx); // // Initial version written by Hanno Becker // Standard ARM ABI: X0 = z, X1 = table, X2 = height, X3 = idx // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_copy_row_from_table_16) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_copy_row_from_table_16) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_copy_row_from_table_16) .text .balign 4 // ***************************************************** // Main code // ***************************************************** #define z x0 #define tbl x1 #define height x2 #define idx x3 #define mask x5 #define cnt x6 #define ventry0 v20 #define qentry0 q20 #define ventry1 v21 #define qentry1 q21 #define ventry2 v22 #define qentry2 q22 #define ventry3 v23 #define qentry3 q23 #define ventry4 v24 #define qentry4 q24 #define ventry5 v25 #define qentry5 q25 #define ventry6 v26 #define qentry6 q26 #define ventry7 v27 #define qentry7 q27 #define ventry8 v28 #define vtmp v16 #define qtmp q16 #define vmask v17 S2N_BN_SYMBOL(bignum_copy_row_from_table_16): CFI_START // Clear accumulator // Zeroing can be done via xor, but xor isn't formalized yet. dup ventry0.2d, xzr mov ventry1.16b, ventry0.16b mov ventry2.16b, ventry0.16b mov ventry3.16b, ventry0.16b mov ventry4.16b, ventry0.16b mov ventry5.16b, ventry0.16b mov ventry6.16b, ventry0.16b mov ventry7.16b, ventry0.16b mov cnt, #0 Lbignum_copy_row_from_table_16_loop: // Compute mask: Check if current index matches target index subs xzr, cnt, idx cinv mask, xzr, eq dup vmask.2d, mask ldr qtmp, [tbl, #16*0] bit ventry0.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*1] bit ventry1.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*2] bit ventry2.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*3] bit ventry3.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*4] bit ventry4.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*5] bit ventry5.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*6] bit ventry6.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*7] bit ventry7.16b, vtmp.16b, vmask.16b add tbl, tbl, #16*8 add cnt, cnt, #1 subs xzr, height, cnt b.ne Lbignum_copy_row_from_table_16_loop Lbignum_copy_row_from_table_16_end: str qentry0, [z, #16*0] str qentry1, [z, #16*1] str qentry2, [z, #16*2] str qentry3, [z, #16*3] str qentry4, [z, #16*4] str qentry5, [z, #16*5] str qentry6, [z, #16*6] str qentry7, [z, #16*7] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_copy_row_from_table_16) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,467
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_ctd.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Count trailing zero digits (64-bit words) // Input x[k]; output function return // // extern uint64_t bignum_ctd(uint64_t k, const uint64_t *x); // // In the case of a zero bignum as input the result is k // // Standard ARM ABI: X0 = k, X1 = x, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_ctd) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_ctd) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_ctd) .text .balign 4 #define k x0 #define x x1 #define i x2 #define a x3 S2N_BN_SYMBOL(bignum_ctd): CFI_START // If the bignum is zero-length, x0 is already the right answer of 0 cbz k, Lbignum_ctd_end // Record in i that the lowest nonzero word is i, where i = k means // that the bignum was entirely zero mov i, k Lbignum_ctd_loop: sub k, k, #1 ldr a, [x, k, lsl #3] cmp a, #0 csel i, k, i, ne cbnz k, Lbignum_ctd_loop // Now return i mov x0, i Lbignum_ctd_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_ctd) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,730
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_muladd10.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply bignum by 10 and add word: z := 10 * z + d // Inputs z[k], d; outputs function return (carry) and z[k] // // extern uint64_t bignum_muladd10(uint64_t k, uint64_t *z, uint64_t d); // // Although typically the input d < 10, this is not actually required. // // Standard ARM ABI: X0 = k, X1 = z, X2 = d, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_muladd10) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_muladd10) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_muladd10) .text .balign 4 #define k x0 #define z x1 #define d x2 #define i x3 #define h x4 #define a x5 #define l x5 S2N_BN_SYMBOL(bignum_muladd10): CFI_START // If k = 0 just return the input d as the carry (out of zero digits) cbz k, Lbignum_muladd10_end // Simple loop mov i, xzr Lbignum_muladd10_loop: ldr a, [z, i, lsl #3] lsr h, a, #61 add l, a, a add h, h, h, lsr #2 adds l, l, l, lsl #2 adc h, h, xzr adds a, l, d str a, [z, i, lsl #3] adc d, h, xzr add i, i, 1 cmp i, k bcc Lbignum_muladd10_loop // Return the final carry Lbignum_muladd10_end: mov x0, d CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_muladd10) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
16,025
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_modexp.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Modular exponentiation for arbitrary odd modulus // Inputs a[k], p[k], m[k]; output z[k], temporary buffer t[>=3*k] // // extern void bignum_modexp // (uint64_t k,uint64_t *z, const uint64_t *a,const uint64_t *p, // const uint64_t *m,uint64_t *t); // // Does z := (a^p) mod m where all numbers are k-digit and m is odd // // Standard ARM ABI: X0 = k, X1 = z, X2 = a, X3 = p, X4 = m, X5 = t // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_modexp) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_modexp) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_modexp) .text .balign 4 // Local variables, all held in extra registers #define k x19 #define res x20 #define a x21 #define p x22 #define m x23 #define x x24 #define i x25 #define y x, k, lsl #3 #define z x, k, lsl #4 S2N_BN_SYMBOL(bignum_modexp): CFI_START // Save some registers including link register CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x24) CFI_PUSH2(x25,x30) // If size is zero (which falsifies the oddness condition) do nothing cbz x0, Lbignum_modexp_end // Move parameters into permanent homes mov k, x0 mov res, x1 mov a, x2 mov p, x3 mov m, x4 mov x, x5 // Let x == 2^64k * a (mod m) and initialize z == 2^64k * 1 (mod m) mov x0, k add x1, z mov x2, m add x3, y CFI_BL(Lbignum_modexp_local_amontifier) mov x0, k mov x1, x add x2, z mov x3, a mov x4, m CFI_BL(Lbignum_modexp_local_amontmul) mov x0, k add x1, z add x2, z mov x3, m CFI_BL(Lbignum_modexp_local_demont) // Main loop with z == 2^64k * a^(p >> 2^i) (mod m) lsl i, k, #6 Lbignum_modexp_loop: sub i, i, #1 mov x0, k add x1, y add x2, z add x3, z mov x4, m CFI_BL(Lbignum_modexp_local_amontmul) mov x0, k add x1, z mov x2, x add x3, y mov x4, m CFI_BL(Lbignum_modexp_local_amontmul) lsr x0, i, #6 ldr x0, [p, x0, lsl #3] lsr x0, x0, i and x0, x0, #1 mov x1, k add x2, z add x3, z add x4, y CFI_BL(Lbignum_modexp_local_mux) cbnz i, Lbignum_modexp_loop // Convert back from Montgomery representation and copy the result // (via a degenerate case of multiplexing) into the output buffer mov x0, k add x1, z add x2, z mov x3, m CFI_BL(Lbignum_modexp_local_demont) mov x0, xzr mov x1, k mov x2, res add x3, z add x4, z CFI_BL(Lbignum_modexp_local_mux) // Restore registers and return Lbignum_modexp_end: CFI_POP2(x25,x30) CFI_POP2(x23,x24) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_modexp) // Local copy of bignum_amontifier S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_modexp_local_amontifier) Lbignum_modexp_local_amontifier: CFI_START cbz x0, Lbignum_modexp_amontifend mov x4, xzr Lbignum_modexp_copyinloop: ldr x9, [x2, x4, lsl #3] str x9, [x3, x4, lsl #3] add x4, x4, #0x1 cmp x4, x0 b.cc Lbignum_modexp_copyinloop subs x4, x0, #0x1 b.eq Lbignum_modexp_normalized Lbignum_modexp_normloop: mov x5, xzr cmp x9, xzr mov x7, xzr Lbignum_modexp_shufloop: mov x9, x7 ldr x7, [x3, x5, lsl #3] csel x9, x9, x7, eq str x9, [x3, x5, lsl #3] add x5, x5, #0x1 sub x11, x5, x0 cbnz x11, Lbignum_modexp_shufloop subs x4, x4, #0x1 b.ne Lbignum_modexp_normloop Lbignum_modexp_normalized: clz x9, x9 mov x10, xzr mov x4, xzr tst x9, #0x3f csetm x8, ne neg x11, x9 Lbignum_modexp_bitloop: ldr x5, [x3, x4, lsl #3] lsl x7, x5, x9 orr x7, x7, x10 lsr x10, x5, x11 and x10, x10, x8 str x7, [x3, x4, lsl #3] add x4, x4, #0x1 cmp x4, x0 b.cc Lbignum_modexp_bitloop sub x6, x0, #0x1 ldr x6, [x3, x6, lsl #3] mov x11, #0x1 neg x10, x6 mov x4, #0x3e Lbignum_modexp_estloop: add x11, x11, x11 mov x7, x6 sub x7, x7, x10 cmp x10, x7 csetm x7, cs sub x11, x11, x7 add x10, x10, x10 and x7, x7, x6 sub x10, x10, x7 subs x4, x4, #0x1 b.ne Lbignum_modexp_estloop cmp x10, x6 cinc x11, x11, eq mov x9, xzr adds x4, xzr, xzr Lbignum_modexp_mulloop: ldr x7, [x3, x4, lsl #3] mul x8, x11, x7 adcs x8, x8, x9 umulh x9, x11, x7 str x8, [x1, x4, lsl #3] add x4, x4, #0x1 sub x7, x4, x0 cbnz x7, Lbignum_modexp_mulloop adc x9, x9, xzr mov x7, #0x4000000000000000 subs x9, x9, x7 csetm x11, cs negs x4, xzr Lbignum_modexp_remloop: ldr x7, [x3, x4, lsl #3] ldr x10, [x1, x4, lsl #3] and x7, x7, x11 sbcs x7, x7, x10 str x7, [x1, x4, lsl #3] add x4, x4, #0x1 sub x7, x4, x0 cbnz x7, Lbignum_modexp_remloop mov x9, xzr negs x5, xzr Lbignum_modexp_dubloop1: ldr x7, [x1, x5, lsl #3] extr x9, x7, x9, #63 ldr x10, [x3, x5, lsl #3] sbcs x9, x9, x10 str x9, [x1, x5, lsl #3] mov x9, x7 add x5, x5, #0x1 sub x7, x5, x0 cbnz x7, Lbignum_modexp_dubloop1 lsr x9, x9, #63 sbc x9, x9, xzr adds x5, xzr, xzr Lbignum_modexp_corrloop1: ldr x7, [x1, x5, lsl #3] ldr x10, [x3, x5, lsl #3] and x10, x10, x9 adcs x7, x7, x10 str x7, [x1, x5, lsl #3] add x5, x5, #0x1 sub x7, x5, x0 cbnz x7, Lbignum_modexp_corrloop1 mov x9, xzr negs x5, xzr Lbignum_modexp_dubloop2: ldr x7, [x1, x5, lsl #3] extr x9, x7, x9, #63 ldr x10, [x3, x5, lsl #3] sbcs x9, x9, x10 str x9, [x1, x5, lsl #3] mov x9, x7 add x5, x5, #0x1 sub x7, x5, x0 cbnz x7, Lbignum_modexp_dubloop2 lsr x9, x9, #63 sbc x9, x9, xzr adds x5, xzr, xzr Lbignum_modexp_corrloop2: ldr x7, [x1, x5, lsl #3] ldr x10, [x3, x5, lsl #3] and x10, x10, x9 adcs x7, x7, x10 str x7, [x1, x5, lsl #3] str x7, [x3, x5, lsl #3] add x5, x5, #0x1 sub x7, x5, x0 cbnz x7, Lbignum_modexp_corrloop2 mov x6, xzr mov x4, x0 Lbignum_modexp_modloop: mov x5, xzr mov x10, xzr adds x9, xzr, xzr Lbignum_modexp_cmaloop: ldr x7, [x1, x5, lsl #3] mul x8, x6, x7 adcs x10, x10, x9 umulh x9, x6, x7 adc x9, x9, xzr adds x8, x10, x8 ldr x10, [x3, x5, lsl #3] str x8, [x3, x5, lsl #3] add x5, x5, #0x1 sub x7, x5, x0 cbnz x7, Lbignum_modexp_cmaloop adcs x6, x10, x9 csetm x8, cs adds x5, xzr, xzr Lbignum_modexp_oaloop: ldr x7, [x3, x5, lsl #3] ldr x10, [x1, x5, lsl #3] and x10, x10, x8 adcs x7, x7, x10 str x7, [x3, x5, lsl #3] add x5, x5, #0x1 sub x7, x5, x0 cbnz x7, Lbignum_modexp_oaloop adc x6, x6, xzr subs x4, x4, #0x1 b.ne Lbignum_modexp_modloop ldr x7, [x2] lsl x11, x7, #2 sub x11, x7, x11 eor x11, x11, #0x2 mov x8, #0x1 madd x9, x7, x11, x8 mul x10, x9, x9 madd x11, x9, x11, x11 mul x9, x10, x10 madd x11, x10, x11, x11 mul x10, x9, x9 madd x11, x9, x11, x11 madd x11, x10, x11, x11 ldr x10, [x3] mul x11, x10, x11 mul x8, x11, x7 umulh x9, x11, x7 mov x5, #0x1 sub x7, x0, #0x1 cmn x10, x8 cbz x7, Lbignum_modexp_montifend Lbignum_modexp_montifloop: ldr x7, [x2, x5, lsl #3] ldr x10, [x3, x5, lsl #3] mul x8, x11, x7 adcs x10, x10, x9 umulh x9, x11, x7 adc x9, x9, xzr adds x10, x10, x8 sub x7, x5, #0x1 str x10, [x3, x7, lsl #3] add x5, x5, #0x1 sub x7, x5, x0 cbnz x7, Lbignum_modexp_montifloop Lbignum_modexp_montifend: adcs x6, x6, x9 csetm x8, cs sub x7, x0, #0x1 str x6, [x3, x7, lsl #3] negs x5, xzr Lbignum_modexp_osloop: ldr x7, [x3, x5, lsl #3] ldr x10, [x2, x5, lsl #3] and x10, x10, x8 sbcs x7, x7, x10 str x7, [x1, x5, lsl #3] add x5, x5, #0x1 sub x7, x5, x0 cbnz x7, Lbignum_modexp_osloop Lbignum_modexp_amontifend: CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_modexp_local_amontifier) // Local copy of bignum_amontmul S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_modexp_local_amontmul) Lbignum_modexp_local_amontmul: CFI_START cbz x0, Lbignum_modexp_amomend ldr x14, [x4] lsl x5, x14, #2 sub x5, x14, x5 eor x5, x5, #0x2 mov x6, #0x1 madd x6, x14, x5, x6 mul x7, x6, x6 madd x5, x6, x5, x5 mul x6, x7, x7 madd x5, x7, x5, x5 mul x7, x6, x6 madd x5, x6, x5, x5 madd x5, x7, x5, x5 mov x8, xzr Lbignum_modexp_zoop: str xzr, [x1, x8, lsl #3] add x8, x8, #0x1 cmp x8, x0 b.cc Lbignum_modexp_zoop mov x6, xzr mov x8, xzr Lbignum_modexp_outerloop: ldr x9, [x2, x8, lsl #3] mov x10, xzr adds x11, xzr, xzr Lbignum_modexp_maddloop: ldr x14, [x3, x10, lsl #3] ldr x12, [x1, x10, lsl #3] mul x13, x9, x14 adcs x12, x12, x11 umulh x11, x9, x14 adc x11, x11, xzr adds x12, x12, x13 str x12, [x1, x10, lsl #3] add x10, x10, #0x1 sub x14, x10, x0 cbnz x14, Lbignum_modexp_maddloop adcs x6, x6, x11 adc x7, xzr, xzr ldr x12, [x1] mul x9, x12, x5 ldr x14, [x4] mul x13, x9, x14 umulh x11, x9, x14 adds x12, x12, x13 mov x10, #0x1 sub x14, x0, #0x1 cbz x14, Lbignum_modexp_montend Lbignum_modexp_montloop: ldr x14, [x4, x10, lsl #3] ldr x12, [x1, x10, lsl #3] mul x13, x9, x14 adcs x12, x12, x11 umulh x11, x9, x14 adc x11, x11, xzr adds x12, x12, x13 sub x13, x10, #0x1 str x12, [x1, x13, lsl #3] add x10, x10, #0x1 sub x14, x10, x0 cbnz x14, Lbignum_modexp_montloop Lbignum_modexp_montend: adcs x11, x6, x11 adc x6, x7, xzr sub x13, x10, #0x1 str x11, [x1, x13, lsl #3] add x8, x8, #0x1 cmp x8, x0 b.cc Lbignum_modexp_outerloop neg x6, x6 negs x10, xzr Lbignum_modexp_corrloop3: ldr x14, [x1, x10, lsl #3] ldr x12, [x4, x10, lsl #3] and x12, x12, x6 sbcs x14, x14, x12 str x14, [x1, x10, lsl #3] add x10, x10, #0x1 sub x14, x10, x0 cbnz x14, Lbignum_modexp_corrloop3 Lbignum_modexp_amomend: CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_modexp_local_amontmul) // Local copy of bignum_demont S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_modexp_local_demont) Lbignum_modexp_local_demont: CFI_START cbz x0, Lbignum_modexp_demontend ldr x11, [x3] lsl x4, x11, #2 sub x4, x11, x4 eor x4, x4, #0x2 mov x5, #0x1 madd x5, x11, x4, x5 mul x6, x5, x5 madd x4, x5, x4, x4 mul x5, x6, x6 madd x4, x6, x4, x4 mul x6, x5, x5 madd x4, x5, x4, x4 madd x4, x6, x4, x4 mov x5, xzr Lbignum_modexp_iloop: ldr x11, [x2, x5, lsl #3] str x11, [x1, x5, lsl #3] add x5, x5, #0x1 cmp x5, x0 b.cc Lbignum_modexp_iloop mov x5, xzr Lbignum_modexp_douterloop: ldr x9, [x1] mul x7, x9, x4 ldr x11, [x3] mul x10, x7, x11 umulh x8, x7, x11 adds x9, x9, x10 mov x6, #0x1 sub x11, x0, #0x1 cbz x11, Lbignum_modexp_dmontend Lbignum_modexp_dmontloop: ldr x11, [x3, x6, lsl #3] ldr x9, [x1, x6, lsl #3] mul x10, x7, x11 adcs x9, x9, x8 umulh x8, x7, x11 adc x8, x8, xzr adds x9, x9, x10 sub x10, x6, #0x1 str x9, [x1, x10, lsl #3] add x6, x6, #0x1 sub x11, x6, x0 cbnz x11, Lbignum_modexp_dmontloop Lbignum_modexp_dmontend: adc x8, xzr, x8 sub x10, x6, #0x1 str x8, [x1, x10, lsl #3] add x5, x5, #0x1 cmp x5, x0 b.cc Lbignum_modexp_douterloop negs x6, xzr Lbignum_modexp_cmploop: ldr x11, [x1, x6, lsl #3] ldr x9, [x3, x6, lsl #3] sbcs xzr, x11, x9 add x6, x6, #0x1 sub x11, x6, x0 cbnz x11, Lbignum_modexp_cmploop csetm x8, cs negs x6, xzr Lbignum_modexp_corrloop: ldr x11, [x1, x6, lsl #3] ldr x9, [x3, x6, lsl #3] and x9, x9, x8 sbcs x11, x11, x9 str x11, [x1, x6, lsl #3] add x6, x6, #0x1 sub x11, x6, x0 cbnz x11, Lbignum_modexp_corrloop Lbignum_modexp_demontend: CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_modexp_local_demont) // Local copy of bignum_mux S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_modexp_local_mux) Lbignum_modexp_local_mux: CFI_START cbz x1, Lbignum_modexp_muxend cmp x0, #0x0 Lbignum_modexp_muxloop: sub x1, x1, #0x1 ldr x5, [x3, x1, lsl #3] ldr x0, [x4, x1, lsl #3] csel x5, x5, x0, ne str x5, [x2, x1, lsl #3] cbnz x1, Lbignum_modexp_muxloop Lbignum_modexp_muxend: CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_modexp_local_mux) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,616
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_mux.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiplex/select z := x (if p nonzero) or z := y (if p zero) // Inputs p, x[k], y[k]; output z[k] // // extern void bignum_mux(uint64_t p, uint64_t k, uint64_t *z, const uint64_t *x, // const uint64_t *y); // // It is assumed that all numbers x, y and z have the same size k digits. // // Standard ARM ABI: X0 = p, X1 = k, X2 = z, X3 = x, X4 = y // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mux) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mux) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mux) .text .balign 4 #define b x0 #define k x1 #define z x2 #define x x3 #define y x4 #define a x5 S2N_BN_SYMBOL(bignum_mux): CFI_START cbz k, Lbignum_mux_end // if k = 0 skip the Lbignum_mux_loop cmp b, #0 // Set condition codes b = 0 // We've set cc's from b once and for all and can now re-use "b" as a temporary Lbignum_mux_loop: sub k, k, #1 ldr a, [x, k, lsl #3] ldr b, [y, k, lsl #3] csel a, a, b, ne str a, [z, k, lsl #3] cbnz k, Lbignum_mux_loop Lbignum_mux_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mux) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,383
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_emontredc.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Extended Montgomery reduce, returning results in input-output buffer // Inputs z[2*k], m[k], w; outputs function return (extra result bit) and z[2*k] // // extern uint64_t bignum_emontredc(uint64_t k, uint64_t *z, const uint64_t *m, // uint64_t w); // // Assumes that z initially holds a 2k-digit bignum z_0, m is a k-digit odd // bignum and m * w == -1 (mod 2^64). This function also uses z for the output // as well as returning a carry c of 0 or 1. This encodes two numbers: in the // lower half of the z buffer we have q = z[0..k-1], while the upper half // together with the carry gives r = 2^{64k}*c + z[k..2k-1]. These values // satisfy z_0 + q * m = 2^{64k} * r, i.e. r gives a raw (unreduced) Montgomery // reduction while q gives the multiplier that was used. Another way of // thinking of it is that if z' is the output z with the lower half replaced // with zeros, then z_0 + q * m = 2^{128k} * c + z'. // // Standard ARM ABI: X0 = k, X1 = z, X2 = m, X3 = w, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_emontredc) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_emontredc) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_emontredc) .text .balign 4 #define k x0 #define z x1 #define m x2 #define w x3 // Outer loop counter #define i x4 // Inner loop counter #define j x5 // Home for Montgomery multiplier #define d x6 // Top carry for current window #define c x7 #define h x8 #define e x9 #define l x10 #define a x11 S2N_BN_SYMBOL(bignum_emontredc): CFI_START // If k = 0 the whole operation is trivial; note we also get a return of c = 0 cbz k, Lbignum_emontredc_end // Initialize top carry to zero, and launch into the outer loop mov c, xzr mov i, xzr Lbignum_emontredc_outerloop: ldr e, [z] mul d, e, w ldr a, [m] mul l, d, a umulh h, d, a str d, [z] adds xzr, e, l // Will be zero but want the carry mov j, #1 sub a, k, #1 cbz a, Lbignum_emontredc_montend Lbignum_emontredc_montloop: ldr a, [m, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l str e, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_emontredc_montloop Lbignum_emontredc_montend: adcs h, h, c adc c, xzr, xzr ldr a, [z, k, lsl #3] adds h, h, a adc c, c, xzr str h, [z, k, lsl #3] // End of outer loop add z, z, #8 // For simple indexing, z pointer moves add i, i, #1 cmp i, k bcc Lbignum_emontredc_outerloop // Return c in X0 mov x0, c Lbignum_emontredc_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_emontredc) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,486
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_cld.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Count leading zero digits (64-bit words) // Input x[k]; output function return // // extern uint64_t bignum_cld(uint64_t k, const uint64_t *x); // // In the case of a zero bignum as input the result is k // // Standard ARM ABI: X0 = k, X1 = x, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_cld) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_cld) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_cld) .text .balign 4 #define k x0 #define x x1 #define i x2 #define a x3 #define j x4 S2N_BN_SYMBOL(bignum_cld): CFI_START // If the bignum is zero-length, x0 is already the right answer of k = 0 cbz k, Lbignum_cld_end // Run over the words j = 0..i-1, and set i := j + 1 when hitting nonzero a[j] mov i, xzr mov j, xzr Lbignum_cld_loop: ldr a, [x, j, lsl #3] add j, j, #1 cmp a, #0 csel i, j, i, ne cmp j, k bne Lbignum_cld_loop sub x0, x0, i Lbignum_cld_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_cld) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
12,282
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_amontifier.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Compute "amontification" constant z :== 2^{128k} (congruent mod m) // Input m[k]; output z[k]; temporary buffer t[>=k] // // extern void bignum_amontifier(uint64_t k, uint64_t *z, const uint64_t *m, // uint64_t *t); // // This is called "amontifier" because any other value x can now be mapped into // the almost-Montgomery domain with an almost-Montgomery multiplication by z. // // Standard ARM ABI: X0 = k, X1 = z, X2 = m, X3 = t // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_amontifier) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_amontifier) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_amontifier) .text .balign 4 #define k x0 #define z x1 #define m x2 #define t x3 // Some variables #define i x4 #define j x5 #define h x6 #define a x7 #define l x8 #define c x9 #define b x10 #define d x11 // Some aliases for the values b and d #define r x10 #define q x11 S2N_BN_SYMBOL(bignum_amontifier): CFI_START // If k = 0 the whole operation is trivial cbz k, Lbignum_amontifier_end // Copy the input m into the temporary buffer t. The temporary register // c matters since we want it to hold the highest digit, ready for the // normalization phase. mov i, xzr Lbignum_amontifier_copyinloop: ldr c, [m, i, lsl #3] str c, [t, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_amontifier_copyinloop // Do a rather stupid but constant-time digit normalization, conditionally // shifting left (k-1) times based on whether the top word is zero. // With careful binary striding this could be O(k*log(k)) instead of O(k^2) // while still retaining the constant-time style. // The "cmp c, xzr" sets the zeroness predicate (ZF) for the entire inner loop subs i, k, #1 beq Lbignum_amontifier_normalized Lbignum_amontifier_normloop: mov j, xzr cmp c, xzr mov a, xzr Lbignum_amontifier_shufloop: mov c, a ldr a, [t, j, lsl #3] csel c, c, a, eq str c, [t, j, lsl #3] add j, j, #1 sub d, j, k cbnz d, Lbignum_amontifier_shufloop subs i, i, #1 bne Lbignum_amontifier_normloop // We now have the top digit nonzero, assuming the input was nonzero, // and as per the invariant of the loop above, c holds that digit. So // now just count c's leading zeros and shift t bitwise that many bits. Lbignum_amontifier_normalized: clz c, c mov b, xzr mov i, xzr ands xzr, c, #63 csetm l, ne neg d, c Lbignum_amontifier_bitloop: ldr j, [t, i, lsl #3] lsl a, j, c orr a, a, b lsr b, j, d and b, b, l str a, [t, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_amontifier_bitloop // Let h be the high word of n, which in all the in-scope cases is >= 2^63. // Now successively form q = 2^i div h and r = 2^i mod h as i goes from // 64 to 126. We avoid just using division out of constant-time concerns // (at the least we would need to fix up h = 0 for out-of-scope inputs) and // don't bother with Newton-Raphson, since this stupid simple loop doesn't // contribute much of the overall runtime at typical sizes. sub h, k, #1 ldr h, [t, h, lsl #3] mov q, #1 neg r, h mov i, #62 Lbignum_amontifier_estloop: add q, q, q mov a, h sub a, a, r cmp r, a // CF <=> r >= h - r <=> 2 * r >= h csetm a, cs sub q, q, a add r, r, r and a, a, h sub r, r, a subs i, i, #1 bne Lbignum_amontifier_estloop // Strictly speaking the above loop doesn't quite give the true remainder // and quotient in the special case r = h = 2^63, so fix it up. We get // q = 2^63 - 1 and r = 2^63 and really want q = 2^63 and r = 0. This is // supererogatory, because the main property of q used below still holds // in this case unless the initial m = 1, and then anyway the overall // specification (congruence modulo m) holds degenerately. But it seems // nicer to get a "true" quotient and remainder. cmp r, h csinc q, q, q, ne // So now we have q and r with 2^126 = q * h + r (imagining r = 0 in the // fixed-up case above: note that we never actually use the computed // value of r below and so didn't adjust it). And we can assume the ranges // q <= 2^63 and r < h < 2^64. // // The idea is to use q as a first quotient estimate for a remainder // of 2^{p+62} mod n, where p = 64 * k. We have, splitting n into the // high and low parts h and l: // // 2^{p+62} - q * n = 2^{p+62} - q * (2^{p-64} * h + l) // = 2^{p+62} - (2^{p-64} * (q * h) + q * l) // = 2^{p+62} - 2^{p-64} * (2^126 - r) - q * l // = 2^{p-64} * r - q * l // // Note that 2^{p-64} * r < 2^{p-64} * h <= n // and also q * l < 2^63 * 2^{p-64} = 2^{p-1} <= n // so |diff| = |2^{p-64} * r - q * l| < n. // // If in fact diff >= 0 then it is already 2^{p+62} mod n. // otherwise diff + n is the right answer. // // To (maybe?) make the computation slightly easier we actually flip // the sign and compute d = q * n - 2^{p+62}. Then the answer is either // -d (when negative) or n - d; in either case we effectively negate d. // This negating tweak in fact spoils the result for cases where // 2^{p+62} mod n = 0, when we get n instead. However the only case // where this can happen is m = 1, when the whole spec holds trivially, // and actually the remainder of the logic below works anyway since // the latter part of the code only needs a congruence for the k-digit // result, not strict modular reduction (the doublings will maintain // the non-strict inequality). mov c, xzr adds i, xzr, xzr Lbignum_amontifier_mulloop: ldr a, [t, i, lsl #3] mul l, q, a adcs l, l, c umulh c, q, a str l, [z, i, lsl #3] add i, i, #1 sub a, i, k cbnz a, Lbignum_amontifier_mulloop adc c, c, xzr mov a, #0x4000000000000000 subs c, c, a csetm q, cs // Now do [c] * n - d for our final answer subs i, xzr, xzr Lbignum_amontifier_remloop: ldr a, [t, i, lsl #3] ldr b, [z, i, lsl #3] and a, a, q sbcs a, a, b str a, [z, i, lsl #3] add i, i, #1 sub a, i, k cbnz a, Lbignum_amontifier_remloop // Now still need to do a couple of modular doublings to get us all the // way up to 2^{p+64} == r from the initial 2^{p+62} == r (mod n). mov c, xzr subs j, xzr, xzr Lbignum_amontifier_dubloop1: ldr a, [z, j, lsl #3] extr c, a, c, #63 ldr b, [t, j, lsl #3] sbcs c, c, b str c, [z, j, lsl #3] mov c, a add j, j, #1 sub a, j, k cbnz a, Lbignum_amontifier_dubloop1 lsr c, c, #63 sbc c, c, xzr adds j, xzr, xzr Lbignum_amontifier_corrloop1: ldr a, [z, j, lsl #3] ldr b, [t, j, lsl #3] and b, b, c adcs a, a, b str a, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_amontifier_corrloop1 // This is not exactly the same: we also copy output to t giving the // initialization t_1 = r == 2^{p+64} mod n for the main loop next. mov c, xzr subs j, xzr, xzr Lbignum_amontifier_dubloop2: ldr a, [z, j, lsl #3] extr c, a, c, #63 ldr b, [t, j, lsl #3] sbcs c, c, b str c, [z, j, lsl #3] mov c, a add j, j, #1 sub a, j, k cbnz a, Lbignum_amontifier_dubloop2 lsr c, c, #63 sbc c, c, xzr adds j, xzr, xzr Lbignum_amontifier_corrloop2: ldr a, [z, j, lsl #3] ldr b, [t, j, lsl #3] and b, b, c adcs a, a, b str a, [z, j, lsl #3] str a, [t, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_amontifier_corrloop2 // We then successively generate (k+1)-digit values satisfying // t_i == 2^{p+64*i} mod n, each of which is stored in h::t. Finish // initialization by zeroing h initially mov h, xzr // Then if t_i = 2^{p} * h + l // we have t_{i+1} == 2^64 * t_i // = (2^{p+64} * h) + (2^64 * l) // == r * h + l<<64 // Do this k more times so we end up == 2^{128*k+64}, one more than we want // // Writing B = 2^{64k}, the possible correction of adding r, which for // a (k+1)-digit result is equivalent to subtracting q = 2^{64*(k+1)} - r // would give the overall worst-case value minus q of // [ B * (B^k - 1) + (B - 1) * r ] - [B^{k+1} - r] // = B * (r - 1) < B^{k+1} so we keep inside k+1 digits as required. // // This implementation makes the shift implicit by starting b with the // "previous" digit (initially 0) to offset things by 1. mov i, k Lbignum_amontifier_modloop: mov j, xzr mov b, xzr adds c, xzr, xzr Lbignum_amontifier_cmaloop: ldr a, [z, j, lsl #3] mul l, h, a adcs b, b, c umulh c, h, a adc c, c, xzr adds l, b, l ldr b, [t, j, lsl #3] str l, [t, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_amontifier_cmaloop adcs h, b, c csetm l, cs adds j, xzr, xzr Lbignum_amontifier_oaloop: ldr a, [t, j, lsl #3] ldr b, [z, j, lsl #3] and b, b, l adcs a, a, b str a, [t, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_amontifier_oaloop adc h, h, xzr subs i, i, #1 bne Lbignum_amontifier_modloop // Now do one almost-Montgomery reduction w.r.t. the original m // which lops off one 2^64 from the congruence and, with the usual // almost-Montgomery correction, gets us back inside k digits for // the end result. ldr a, [m] lsl d, a, #2 sub d, a, d eor d, d, #2 mov l, #1 madd c, a, d, l mul b, c, c madd d, c, d, d mul c, b, b madd d, b, d, d mul b, c, c madd d, c, d, d madd d, b, d, d ldr b, [t] mul d, b, d mul l, d, a umulh c, d, a mov j, #1 sub a, k, #1 adds xzr, b, l cbz a, Lbignum_amontifier_montend Lbignum_amontifier_montloop: ldr a, [m, j, lsl #3] ldr b, [t, j, lsl #3] mul l, d, a adcs b, b, c umulh c, d, a adc c, c, xzr adds b, b, l sub a, j, #1 str b, [t, a, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_amontifier_montloop Lbignum_amontifier_montend: adcs h, h, c csetm l, cs sub a, k, #1 str h, [t, a, lsl #3] subs j, xzr, xzr Lbignum_amontifier_osloop: ldr a, [t, j, lsl #3] ldr b, [m, j, lsl #3] and b, b, l sbcs a, a, b str a, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_amontifier_osloop Lbignum_amontifier_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_amontifier) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,509
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_sub.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Subtract, z := x - y // Inputs x[m], y[n]; outputs function return (carry-out) and z[p] // // extern uint64_t bignum_sub(uint64_t p, uint64_t *z, uint64_t m, // const uint64_t *x, uint64_t n, const uint64_t *y); // // Does the z := x - y operation, truncating modulo p words in general and // returning a top borrow (0 or 1) in the p'th place, only subtracting input // words below p (as well as m and n respectively) to get the diff and borrow. // // Standard ARM ABI: X0 = p, X1 = z, X2 = m, X3 = x, X4 = n, X5 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sub) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_sub) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sub) .text .balign 4 #define p x0 #define z x1 #define m x2 #define x x3 #define n x4 #define y x5 #define i x6 #define a x7 #define d x8 S2N_BN_SYMBOL(bignum_sub): CFI_START // First clamp the two input sizes m := min(p,m) and n := min(p,n) since // we'll never need words past the p'th. Can now assume m <= p and n <= p. // Then compare the modified m and n and branch accordingly cmp m, p csel m, p, m, cs cmp n, p csel n, p, n, cs cmp m, n bcc Lbignum_sub_ylonger // The case where x is longer or of the same size (p >= m >= n) sub p, p, m sub m, m, n subs i, xzr, xzr cbz n, Lbignum_sub_xmainskip Lbignum_sub_xmainloop: ldr a, [x, i, lsl #3] ldr d, [y, i, lsl #3] sbcs a, a, d str a, [z, i, lsl #3] add i, i, #1 sub n, n, #1 cbnz n, Lbignum_sub_xmainloop Lbignum_sub_xmainskip: cbz m, Lbignum_sub_xtopskip Lbignum_sub_xtoploop: ldr a, [x, i, lsl #3] sbcs a, a, xzr str a, [z, i, lsl #3] add i, i, #1 sub m, m, #1 cbnz m, Lbignum_sub_xtoploop Lbignum_sub_xtopskip: cbnz p, Lbignum_sub_tails cset x0, cc ret // The case where y is longer (p >= n > m) Lbignum_sub_ylonger: sub p, p, n sub n, n, m subs i, xzr, xzr cbz m, Lbignum_sub_ytoploop Lbignum_sub_ymainloop: ldr a, [x, i, lsl #3] ldr d, [y, i, lsl #3] sbcs a, a, d str a, [z, i, lsl #3] add i, i, #1 sub m, m, #1 cbnz m, Lbignum_sub_ymainloop Lbignum_sub_ytoploop: ldr a, [y, i, lsl #3] sbcs a, xzr, a str a, [z, i, lsl #3] add i, i, #1 sub n, n, #1 cbnz n, Lbignum_sub_ytoploop Lbignum_sub_ytopskip: cbnz p, Lbignum_sub_tails cset x0, cc ret // Adding a non-trivial tail, when p > max(m,n) Lbignum_sub_tails: csetm a, cc Lbignum_sub_tailloop: str a, [z, i, lsl #3] add i, i, #1 subs p, p, #1 bne Lbignum_sub_tailloop neg x0, a CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_sub) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,637
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_optsubadd.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Optionally subtract or add, z := x + sgn(p) * y interpreting p as signed // Inputs x[k], p, y[k]; outputs function return (carry-out) and z[k] // // extern uint64_t bignum_optsubadd(uint64_t k, uint64_t *z, const uint64_t *x, // uint64_t p, const uint64_t *y); // // If p has top bit set (i.e. is negative as a signed int) return z := x - y // Else if p is nonzero (i.e. is positive as a signed int) return z := x + y // Otherwise (i.e. p is zero) return z := x // // Return in X0 = the top carry, which will be 0 or 1, and appropriate for // addition or subtraction respectively (and always zero for p = 0) // // 2^{64*k} * -carryout + z = x - y [for subtraction] // 2^{64*k} * carryout + z = x + y [for addition] // // Standard ARM ABI: X0 = k, X1 = z, X2 = x, X3 = p, X4 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_optsubadd) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_optsubadd) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_optsubadd) .text .balign 4 #define k x0 #define z x1 #define x x2 #define p x3 #define y x4 #define m x3 #define q x5 #define a x6 #define b x7 #define i x8 S2N_BN_SYMBOL(bignum_optsubadd): CFI_START // if k = 0 do nothing. This is also the right top carry in X0 cbz k, Lbignum_optsubadd_end // Turn the input p into two bitmasks, m indicating to use the y input at // all (same register as p) and q indicating a sign-flip cmp p, xzr csetm m, ne csetm q, mi // Generate an initial carry-in for the negating case only to add 1; this // is because we are actually going to do complements of the words of y adds xzr, q, q // Main loop mov i, xzr Lbignum_optsubadd_loop: ldr b, [y, i] eor b, b, q ldr a, [x, i] and b, b, m adcs a, a, b str a, [z, i] add i, i, #8 sub k, k, #1 cbnz k, Lbignum_optsubadd_loop // Return carry flag, fixing up inversion for negative case adc x0, xzr, xzr neg q, q eor x0, x0, q Lbignum_optsubadd_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_optsubadd) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
7,484
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_cdiv.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Divide by a single (nonzero) word, z := x / m and return x mod m // Inputs x[n], m; outputs function return (remainder) and z[k] // // extern uint64_t bignum_cdiv(uint64_t k, uint64_t *z, uint64_t n, // const uint64_t *x, uint64_t m); // // Does the "z := x / m" operation where x is n digits, result z is k. // Truncates the quotient in general, but always (for nonzero m) returns // the true remainder x mod m. // // Standard ARM ABI: X0 = k, X1 = z, X2 = n, X3 = x, X4 = m, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_cdiv) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_cdiv) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_cdiv) .text .balign 4 #define k x0 #define z x1 #define n x2 #define x x3 #define m x4 // Main variables #define w x5 #define i x6 #define a x7 #define c x8 #define d x9 #define e x10 #define f x11 #define l x12 // These two are the same #define h x13 #define q x13 // Variables for the negmodinv #define one x6 #define e1 x6 #define e2 x7 #define e4 x6 #define e8 x7 // Variable to hold the remainder #define r x14 S2N_BN_SYMBOL(bignum_cdiv): CFI_START // Effectively the same dataflow as bignum_cmod, with some basic // variable changes (using n for the size not k, returning r, etc.) // and using the i counter instead of modifying the size as a loop // counter. mov r, xzr cbz n, Lbignum_cdiv_nomodulus clz e, m lsl f, m, e lsr a, f, #16 eor w, a, #0x1ffffffffffff add a, a, #0x1 lsr w, w, #32 mneg r, a, w lsr d, r, #49 mul d, d, d lsr r, r, #34 add r, d, r orr d, d, #0x40000000 mul d, r, d lsr d, d, #30 lsl r, w, #30 madd w, w, d, r lsr w, w, #30 mneg r, a, w lsr r, r, #24 mul r, r, w lsl w, w, #16 lsr r, r, #24 add w, w, r mneg r, a, w lsr r, r, #32 mul r, r, w lsl w, w, #31 lsr r, r, #17 add w, w, r mul d, f, w umulh r, f, w extr d, r, d, #60 lsr r, w, #33 mvn d, d mul d, r, d lsl w, w, #1 lsr d, d, #33 add w, w, d adds d, w, #0x1 cinv d, d, eq umulh r, f, d adds xzr, r, f csel w, w, d, cs mneg r, w, f mov h, xzr mov l, xzr mov i, n Lbignum_cdiv_modloop: sub i, i, #1 ldr d, [x, i, lsl #3] mul a, r, h umulh h, r, h adds a, a, d adcs h, h, l csel l, r, xzr, cs adds l, l, a adc h, h, xzr cbnz i, Lbignum_cdiv_modloop umulh c, w, h adds c, c, h csel r, f, xzr, cs mul a, c, f umulh d, c, f add d, d, r subs l, l, a sbcs h, h, d csel a, f, xzr, ne subs l, l, a sbcs h, h, xzr csel a, f, xzr, ne sub l, l, a umulh c, w, l adds c, c, l cset r, cs extr c, r, c, #1 eor e, e, #63 lsr c, c, e mul a, c, m sub l, l, a subs r, l, m csel r, r, l, cs Lbignum_cdiv_nomodulus: // If k = 0 then there's no more to be done cbz k, Lbignum_cdiv_end // Let e be the number of trailing zeros in m. This implementation uses // 63 - clz(-m & m) which is a bit slicker than the main word_ctz function // but fails for m = 0. We don't have to worry about that case here. neg e, m and e, e, m clz e, e eor e, e, #63 // Also generate a corresponding bitmask f for selecting bottom 64 - e bits. mov f, #-1 lsr f, f, e // Now just shift m right by e bits. So hereafter we can assume m is odd // but we first need to shift the input right by e bits then divide by m. lsr m, m, e // Compute the negated modular inverse w with w * m + 1 == 0 (mod 2^64) // This is essentially the same as word_negmodinv. sub w, m, m, lsl #2 eor w, w, #2 mov one, #1 madd e1, m, w, one mul e2, e1, e1 madd w, e1, w, w mul e4, e2, e2 madd w, e2, w, w mul e8, e4, e4 madd w, e4, w, w madd w, e8, w, w // We have the remainder r, so now x = m * y + r for some quotient y // to be computed. Consider x' = x + (m - r) = m * (y + 1) and do a // Montgomery reduction, keeping the cofactor z. This gives us // x' + m * z = 2^{64k} * c where c <= m. Thus since x' = m * (y + 1) // we have // // m * (y + z + 1) = 2^{64k} * c // // This means m * (y + z + 1) == 0 (mod 2^{64k}), even when we truncate // x to k digits (if in fact k < n). Since m is odd, it's coprime to // 2^{64k} so we can cancel and get y + z + 1 == 0 (mod 2^{64k}), and // hence using logical complement y == ~z (mod 2^{64k}). Thus we can // write back the logical complements of the cofactor as the answer. // Start with carry word c = m - r/2^e to make the initial tweak // x' = x + (m - r); since we've shifted everything initially by e // we need to shift the remainder too before subtracting from the // shifted m. lsr c, r, e sub c, m, c mov i, xzr // Unless n = 0, preload the zeroth digit shifted right e places and bump // up the x pointer by 8 and n down by 1, to ease indexing and comparison // using the same variable i in the main loop. When n = 0 we leave it alone, // as the comparison i < n will always fail and the x pointer is unused. mov d, xzr cbz n, Lbignum_cdiv_loop ldr d, [x], #8 lsr d, d, e sub n, n, 1 Lbignum_cdiv_loop: // Load the next digit up to get [l,d] then shift right e places, // eventually setting d back to the other part of the newly loaded digit // ready for the next time round the loop. mov l, xzr cmp i, n bcs Lbignum_cdiv_noload ldr l, [x, i, lsl #3] Lbignum_cdiv_noload: rorv l, l, e bic a, l, f orr a, d, a and d, l, f // Now a is the next digit after shifting right by e places, c the carry-in. // Do the main Montgomery step with the (odd) m, writing back ~q. adds a, a, c mul q, a, w cset c, cs mvn l, q str l, [z, i, lsl #3] mul l, q, m umulh h, q, m adds l, l, a adc c, h, c add i, i, #1 cmp i, k bcc Lbignum_cdiv_loop // And return the remainder Lbignum_cdiv_end: mov x0, r CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_cdiv) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,044
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_cmul.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply by a single word, z := c * y // Inputs c, y[n]; outputs function return (carry-out) and z[k] // // extern uint64_t bignum_cmul(uint64_t k, uint64_t *z, uint64_t c, uint64_t n, // const uint64_t *y); // // Does the "z := c * y" operation where y is n digits, result z is p. // Truncates the result in general unless p >= n + 1. // // The return value is a high/carry word that is meaningful when p >= n as // giving the high part of the result. Since this is always zero if p > n, // it is mainly of interest in the special case p = n, i.e. where the source // and destination have the same nominal size, when it gives the extra word // of the full result. // // Standard ARM ABI: X0 = k, X1 = z, X2 = c, X3 = n, X4 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_cmul) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_cmul) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_cmul) .text .balign 4 #define p x0 #define z x1 #define c x2 #define n x3 #define x x4 #define i x5 #define h x6 #define l x7 #define a x8 S2N_BN_SYMBOL(bignum_cmul): CFI_START // First clamp the input size n := min(p,n) since we can never need to read // past the p'th term of the input to generate p-digit output. // Subtract p := p - min(n,p) so it holds the size of the extra tail needed cmp n, p csel n, p, n, cs sub p, p, n // Initialize current input/output pointer offset i and high part h. // But then if n = 0 skip the multiplication and go to the tail part mov h, xzr mov i, xzr cbz n, Lbignum_cmul_tail // Initialization of the loop: [h,l] = c * x_0 ldr a, [x] mul l, c, a umulh h, c, a str l, [z] add i, i, #8 subs n, n, #1 beq Lbignum_cmul_tail // Main loop (force CF = 0 at the beginning) adds xzr, xzr, xzr Lbignum_cmul_loop: ldr a, [x, i] mul l, c, a adcs l, l, h umulh h, c, a str l, [z, i] add i, i, #8 sub n, n, #1 cbnz n, Lbignum_cmul_loop adc h, h, xzr Lbignum_cmul_tail: cbz p, Lbignum_cmul_end str h, [z, i] mov h, xzr subs p, p, #1 beq Lbignum_cmul_end Lbignum_cmul_tloop: add i, i, #8 str xzr, [z, i] sub p, p, #1 cbnz p, Lbignum_cmul_tloop // Return the high/carry word Lbignum_cmul_end: mov x0, h CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_cmul) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,105
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_clz.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Count leading zero bits // Input x[k]; output function return // // extern uint64_t bignum_clz(uint64_t k, const uint64_t *x); // // In the case of a zero bignum as input the result is 64 * k // // In principle this has a precondition k < 2^58, but obviously that // is always true in practice because of address space limitations // // Standard ARM ABI: X0 = k, X1 = x, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_clz) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_clz) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_clz) .text .balign 4 #define k x0 #define x x1 #define i x2 #define w x3 #define a x4 #define j x5 S2N_BN_SYMBOL(bignum_clz): CFI_START // If the bignum is zero-length, x0 is already the right answer of 0 cbz k, Lbignum_clz_end // Use w = a[i-1] to store nonzero words in a bottom-up sweep // Set the initial default to be as if we had a 11...11 word directly below mov i, xzr mov w, #-1 mov j, xzr Lbignum_clz_loop: ldr a, [x, j, lsl #3] add j, j, #1 cmp a, #0 csel i, j, i, ne csel w, a, w, ne cmp j, k bne Lbignum_clz_loop // Now w = a[i-1] is the highest nonzero word, or in the zero case the // default of the "extra" 11...11 = a[0-1]. We now want 64*(k - i) + clz(w). // Note that this code does not rely on the behavior of the clz instruction // for zero inputs, though the ARM manual does in fact guarantee clz(0) = 64. sub k, k, i lsl k, k, #6 clz a, w add x0, k, a Lbignum_clz_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_clz) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,279
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/word_bytereverse.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Reverse the order of bytes in a 64-bit word // // extern uint64_t word_bytereverse(uint64_t a); // // Standard ARM ABI: X0 = a, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(word_bytereverse) S2N_BN_FUNCTION_TYPE_DIRECTIVE(word_bytereverse) S2N_BN_SYM_PRIVACY_DIRECTIVE(word_bytereverse) .text .balign 4 S2N_BN_SYMBOL(word_bytereverse): CFI_START mov x1, #0xFFFF0000FFFF0000 mov x2, #0x0000FFFF0000FFFF and x1, x1, x0 and x2, x2, x0 ror x1, x1, #32 orr x0, x1, x2 mov x1, #0xFF00FF00FF00FF00 mov x2, #0x00FF00FF00FF00FF and x1, x1, x0 and x2, x2, x0 ror x1, x1, #24 ror x2, x2, #8 orr x0, x1, x2 CFI_RET S2N_BN_SIZE_DIRECTIVE(word_bytereverse) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
5,407
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_cmod.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Find bignum modulo a single word // Input x[k], m; output function return // // extern uint64_t bignum_cmod(uint64_t k, const uint64_t *x, uint64_t m); // // Returns x mod m, assuming m is nonzero. // // Standard ARM ABI: X0 = k, X1 = x, X2 = m, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_cmod) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_cmod) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_cmod) .text .balign 4 #define k x0 #define x x1 #define m x2 #define e x3 #define n x4 #define w x5 #define r x6 #define h x7 #define l x8 #define a x9 #define d x10 // We re-use the k argument for a quotient estimate when it is no longer // needed for traversal (x0 is modified for the return value anyway). #define q x0 S2N_BN_SYMBOL(bignum_cmod): CFI_START // If the bignum is zero-length, x0 is already the right answer of 0 cbz k, Lbignum_cmod_end // Find number of leading zeros of m and let n = 2^e m so that for an // in-scope (nonzero) input m we have n >= 2^63, e <= 63. clz e, m lsl n, m, e // A near-clone of word_recip so 2^64 + w = ceil(2^128 / n) - 1 lsr a, n, #16 eor w, a, #0x1ffffffffffff add a, a, #0x1 lsr w, w, #32 mneg r, a, w lsr d, r, #49 mul d, d, d lsr r, r, #34 add r, d, r orr d, d, #0x40000000 mul d, r, d lsr d, d, #30 lsl r, w, #30 madd w, w, d, r lsr w, w, #30 mneg r, a, w lsr r, r, #24 mul r, r, w lsl w, w, #16 lsr r, r, #24 add w, w, r mneg r, a, w lsr r, r, #32 mul r, r, w lsl w, w, #31 lsr r, r, #17 add w, w, r mul d, n, w umulh r, n, w extr d, r, d, #60 lsr r, w, #33 mvn d, d mul d, r, d lsl w, w, #1 lsr d, d, #33 add w, w, d adds d, w, #0x1 cinv d, d, eq umulh r, n, d adds xzr, r, n csel w, w, d, cs // Take the residue r = 2^128 - (2^64 + w) * n, which by the above bound // we know fits in 64 bits. We know 2^128 == r (mod n) and hence (mod m). mneg r, w, n // Now just go down through the digits accumulating [h;l] == x (mod n) // by 2^64 * [h;l] + d = 2^128 * h + [l;d] == r * h + [l; d]. That addition // may overflow with a carry, say 2^128 + [h';l'] = r * h + [l; d], in // which case we subtract 2^128 - r (which is divisible by m and keeping // things in 128 bits we just add r). Thus the overall bound when we initially // overflow is r * h + [l; d] - (2^128 - r) = r * (h + 1) + [l; d] - 2^128 // < 2^128 so we stay inside 2 words mov h, xzr mov l, xzr Lbignum_cmod_loop: sub k, k, #1 ldr d, [x, k, lsl #3] mul a, r, h umulh h, r, h adds a, a, d adcs h, h, l csel l, r, xzr, cs adds l, l, a adc h, h, xzr cbnz k, Lbignum_cmod_loop // Now do reciprocal multiplication to reduce the 2-word modular equivalent // [h;l] to the single word l. If we assume the truncations are as follows // 2^64 + w = 2^128 / n - epsilon (0 <= epsilon <= 1) // q = (w * h / 2^64) - delta (0 <= delta <= 1) // the net remainder is l + (h/2^64 * epsilon + delta) * n < l + 2 * n. // In general this needs two rounds of comparison to guarantee getting // into a single word (though one more mul could be used instead). // Also, the quotient estimate can overflow so we use r as extra addend // 2^64 * n when the initial addition overflows. The overall multiple // of n can't itself overflow, since we know it's an underestimate of // the initial residue. umulh q, w, h adds q, q, h csel r, n, xzr, cs mul a, q, n umulh d, q, n add d, d, r subs l, l, a sbcs h, h, d csel a, n, xzr, ne subs l, l, a sbcs h, h, xzr csel a, n, xzr, ne sub l, l, a // One more reciprocal multiplication to do a modular reduction, but now in // one word and in terms of the original m. For the quotient estimate we want // q = ((2^64 + w) * l) / 2^{128-e} = ((2^64 + w) * l) / 2^65 / 2^{63-e}. umulh q, w, l adds q, q, l cset r, cs extr q, r, q, #1 eor e, e, #63 lsr q, q, e mul a, q, m sub l, l, a // Note that since there is no neglected "low" part of the single word, // one round of correction suffices; in the analog of the above l = 0 // and hence the residue so far is already < 2 * m. subs x0, l, m csel x0, x0, l, cs Lbignum_cmod_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_cmod) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,365
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/word_popcount.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Count number of set bits in a single 64-bit word (population count) // Input a; output function return // // extern uint64_t word_popcount(uint64_t a); // // Standard ARM ABI: X0 = a, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(word_popcount) S2N_BN_FUNCTION_TYPE_DIRECTIVE(word_popcount) S2N_BN_SYM_PRIVACY_DIRECTIVE(word_popcount) .text .balign 4 // Very similar to the traditional algorithm, e.g. Hacker's Delight 5-2 S2N_BN_SYMBOL(word_popcount): CFI_START and x1, x0, #0xAAAAAAAAAAAAAAAA sub x0, x0, x1, lsr #1 bic x1, x0, #0x3333333333333333 and x0, x0, #0x3333333333333333 add x0, x0, x1, lsr #2 add x0, x0, x0, lsr #4 and x0, x0, #0x0F0F0F0F0F0F0F0F mov x1, #0x101010101010101 mul x0, x0, x1 lsr x0, x0, #56 CFI_RET S2N_BN_SIZE_DIRECTIVE(word_popcount) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
5,309
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_montredc.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Montgomery reduce, z := (x' / 2^{64p}) MOD m // Inputs x[n], m[k], p; output z[k] // // extern void bignum_montredc(uint64_t k, uint64_t *z, uint64_t n, // const uint64_t *x, const uint64_t *m, uint64_t p); // // Does a := (x' / 2^{64p}) mod m where x' = x if n <= p + k and in general // is the lowest (p+k) digits of x, assuming x' <= 2^{64p} * m. That is, // p-fold Montgomery reduction w.r.t. a k-digit modulus m giving a k-digit // answer. // // Standard ARM ABI: X0 = k, X1 = z, X2 = n, X3 = x, X4 = m, X5 = p // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_montredc) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_montredc) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_montredc) .text .balign 4 #define k x0 #define z x1 #define n x2 #define x x3 #define m x4 #define p x5 // Negated modular inverse #define w x6 // Outer loop counter #define i x7 // Inner loop counter #define j x8 // Home for Montgomery multiplier #define d x9 // Top carry for current window #define c x14 #define h x10 #define e x11 #define l x12 #define a x13 // Some more intuitive names for temp regs in initial word-level negmodinv. // These just use i and j again, which aren't used early on. #define one x7 #define e1 x7 #define e2 x8 #define e4 x7 #define e8 x8 S2N_BN_SYMBOL(bignum_montredc): CFI_START // If k = 0 the whole operation is trivial cbz k, Lbignum_montredc_end // Compute word-level negated modular inverse w for m == m[0]. // This is essentially the same as word_negmodinv. ldr a, [m] lsl w, a, #2 sub w, a, w eor w, w, #2 mov one, #1 madd e1, a, w, one mul e2, e1, e1 madd w, e1, w, w mul e4, e2, e2 madd w, e2, w, w mul e8, e4, e4 madd w, e4, w, w madd w, e8, w, w // Initialize z to the lowest k digits of the input, zero-padding if n < k. cmp n, k csel j, k, n, cs mov i, xzr cbz j, Lbignum_montredc_padloop Lbignum_montredc_copyloop: ldr a, [x, i, lsl #3] str a, [z, i, lsl #3] add i, i, #1 cmp i, j bcc Lbignum_montredc_copyloop cmp i, k bcs Lbignum_montredc_initialized Lbignum_montredc_padloop: str xzr, [z, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_montredc_padloop Lbignum_montredc_initialized: mov c, xzr // Now if p = 0 we just need the corrective tail, and even that is // only needed for the case when the input is exactly the modulus, // to maintain the <= 2^64p * n precondition cbz p, Lbignum_montredc_corrective // Outer loop, just doing a standard Montgomery reduction on z mov i, xzr Lbignum_montredc_outerloop: ldr e, [z] mul d, e, w ldr a, [m] mul l, d, a umulh h, d, a adds e, e, l // Will be zero but want the carry mov j, #1 sub a, k, #1 cbz a, Lbignum_montredc_montend Lbignum_montredc_montloop: ldr a, [m, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l sub l, j, #1 str e, [z, l, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_montredc_montloop Lbignum_montredc_montend: adcs h, h, c adc c, xzr, xzr add j, j, i cmp j, n bcs Lbignum_montredc_offtheend ldr a, [x, j, lsl #3] adds h, h, a adc c, c, xzr Lbignum_montredc_offtheend: sub j, k, #1 str h, [z, j, lsl #3] // End of outer loop add i, i, #1 cmp i, p bcc Lbignum_montredc_outerloop // Now do a comparison of (c::z) with (0::m) to set a final correction mask // indicating that (c::z) >= m and so we need to subtract m. Lbignum_montredc_corrective: subs j, xzr, xzr Lbignum_montredc_cmploop: ldr a, [z, j, lsl #3] ldr e, [m, j, lsl #3] sbcs xzr, a, e add j, j, #1 sub a, j, k cbnz a, Lbignum_montredc_cmploop sbcs xzr, c, xzr csetm c, cs // Now do a masked subtraction of m for the final reduced result. subs j, xzr, xzr Lbignum_montredc_corrloop: ldr a, [z, j, lsl #3] ldr e, [m, j, lsl #3] and e, e, c sbcs a, a, e str a, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_montredc_corrloop Lbignum_montredc_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_montredc) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,253
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/word_ctz.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Count trailing zero bits in a single word // Input a; output function return // // extern uint64_t word_ctz(uint64_t a); // // Standard ARM ABI: X0 = a, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(word_ctz) S2N_BN_FUNCTION_TYPE_DIRECTIVE(word_ctz) S2N_BN_SYM_PRIVACY_DIRECTIVE(word_ctz) .text .balign 4 S2N_BN_SYMBOL(word_ctz): CFI_START // ARM doesn't have a direct word ctz instruction, so we emulate it via // ctz(w) = 64 - clz(~w & (w-1)). This is depending, for cases of the form // ctz(....1), on the behavior clz(0) = 64, which is guaranteed according // to the ARM manual. mvn x1, x0 sub x0, x0, #1 and x0, x0, x1 clz x1, x0 mov x0, #64 sub x0, x0, x1 CFI_RET S2N_BN_SIZE_DIRECTIVE(word_ctz) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
4,336
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_demont.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Convert from (almost-)Montgomery form z := (x / 2^{64k}) mod m // Inputs x[k], m[k]; output z[k] // // extern void bignum_demont(uint64_t k, uint64_t *z, const uint64_t *x, // const uint64_t *m); // // Does z := (x / 2^{64k}) mod m, hence mapping out of Montgomery domain. // In other words, this is a k-fold Montgomery reduction with same-size input. // This can handle almost-Montgomery inputs, i.e. any k-digit bignum. // // Standard ARM ABI: X0 = k, X1 = z, X2 = x, X3 = m // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_demont) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_demont) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_demont) .text .balign 4 #define k x0 #define z x1 #define x x2 #define m x3 // Negated modular inverse #define w x4 // Outer loop counter #define i x5 // Inner loop counter #define j x6 // Home for Montgomery multiplier #define d x7 #define h x8 #define e x9 #define l x10 #define a x11 // Some more intuitive names for temp regs in initial word-level negmodinv. // These just use i and j again, which aren't used early on. #define one x5 #define e1 x5 #define e2 x6 #define e4 x5 #define e8 x6 S2N_BN_SYMBOL(bignum_demont): CFI_START // If k = 0 the whole operation is trivial cbz k, Lbignum_demont_end // Compute word-level negated modular inverse w for m == m[0]. // This is essentially the same as word_negmodinv. ldr a, [m] lsl w, a, #2 sub w, a, w eor w, w, #2 mov one, #1 madd e1, a, w, one mul e2, e1, e1 madd w, e1, w, w mul e4, e2, e2 madd w, e2, w, w mul e8, e4, e4 madd w, e4, w, w madd w, e8, w, w // Initially just copy the input to the output. It would be a little more // efficient but somewhat fiddlier to tweak the zeroth iteration below instead. mov i, xzr Lbignum_demont_iloop: ldr a, [x, i, lsl #3] str a, [z, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_demont_iloop // Outer loop, just doing a standard Montgomery reduction on z mov i, xzr Lbignum_demont_outerloop: ldr e, [z] mul d, e, w ldr a, [m] mul l, d, a umulh h, d, a adds e, e, l // Will be zero but want the carry mov j, #1 sub a, k, #1 cbz a, Lbignum_demont_montend Lbignum_demont_montloop: ldr a, [m, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l sub l, j, #1 str e, [z, l, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_demont_montloop Lbignum_demont_montend: adc h, xzr, h sub l, j, #1 str h, [z, l, lsl #3] // End of outer loop add i, i, #1 cmp i, k bcc Lbignum_demont_outerloop // Now do a comparison of z with m to set a final correction mask // indicating that z >= m and so we need to subtract m. subs j, xzr, xzr Lbignum_demont_cmploop: ldr a, [z, j, lsl #3] ldr e, [m, j, lsl #3] sbcs xzr, a, e add j, j, #1 sub a, j, k cbnz a, Lbignum_demont_cmploop csetm h, cs // Now do a masked subtraction of m for the final reduced result. subs j, xzr, xzr Lbignum_demont_corrloop: ldr a, [z, j, lsl #3] ldr e, [m, j, lsl #3] and e, e, h sbcs a, a, e str a, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_demont_corrloop Lbignum_demont_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_demont) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
5,402
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_montsqr.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Montgomery square, z := (x^2 / 2^{64k}) mod m // Inputs x[k], m[k]; output z[k] // // extern void bignum_montsqr(uint64_t k, uint64_t *z, const uint64_t *x, // const uint64_t *m); // // Does z := (x^2 / 2^{64k}) mod m, assuming x^2 <= 2^{64k} * m, which is // guaranteed in particular if x < m initially (the "intended" case). // // Standard ARM ABI: X0 = k, X1 = z, X2 = x, X3 = m // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_montsqr) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_montsqr) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_montsqr) .text .balign 4 #define k x0 #define z x1 #define x x2 #define m x3 // Negated modular inverse #define w x4 // Top carry for k'th position #define c0 x5 // Additional top carry for (k+1)'th position #define c1 x6 // Outer loop counter #define i x7 // Home for i'th digit or Montgomery multiplier #define d x8 // Inner loop counter #define j x9 #define h x10 #define e x11 #define l x12 #define a x13 // This is just a short-term temporary used in zero-test subtraction. // It's aliased to the same register as "a" which is always safe here. #define t x13 // Some more intuitive names for temp regs in initial word-level negmodinv. // These just use c0 and c1 again, which aren't initialized early on. #define one x5 #define e1 x5 #define e2 x6 #define e4 x5 #define e8 x6 S2N_BN_SYMBOL(bignum_montsqr): CFI_START // If k = 0 the whole operation is trivial cbz k, Lbignum_montsqr_end // Compute word-level negated modular inverse w for m == m[0]. // This is essentially the same as word_negmodinv. ldr a, [m] lsl w, a, #2 sub w, a, w eor w, w, #2 mov one, #1 madd e1, a, w, one mul e2, e1, e1 madd w, e1, w, w mul e4, e2, e2 madd w, e2, w, w mul e8, e4, e4 madd w, e4, w, w madd w, e8, w, w // Initialize the output c0::z to zero so we can then consistently add rows. // It would be a bit more efficient to special-case the zeroth row, but // this keeps the code slightly simpler. mov i, xzr Lbignum_montsqr_zoop: str xzr, [z, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_montsqr_zoop mov c0, xzr // Outer loop pulling down digits d=x[i], multiplying by x and reducing mov i, xzr Lbignum_montsqr_outerloop: // Multiply-add loop where we always have CF + previous high part h to add in // Note that in general we do need yet one more carry in this phase and hence // initialize c1 with the top carry. ldr d, [x, i, lsl #3] mov j, xzr adds h, xzr, xzr Lbignum_montsqr_maddloop: ldr a, [x, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l str e, [z, j, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_montsqr_maddloop adcs c0, c0, h adc c1, xzr, xzr // Montgomery reduction loop, similar but offsetting writebacks ldr e, [z] mul d, e, w ldr a, [m] mul l, d, a umulh h, d, a adds e, e, l // Will be zero but want the carry mov j, #1 sub t, k, #1 cbz t, Lbignum_montsqr_montend Lbignum_montsqr_montloop: ldr a, [m, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l sub l, j, #1 str e, [z, l, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_montsqr_montloop Lbignum_montsqr_montend: adcs h, c0, h adc c0, c1, xzr sub l, j, #1 str h, [z, l, lsl #3] // End of outer loop add i, i, #1 cmp i, k bcc Lbignum_montsqr_outerloop // Now do a comparison of (c0::z) with (0::m) to set a final correction mask // indicating that (c0::z) >= m and so we need to subtract m. subs j, xzr, xzr Lbignum_montsqr_cmploop: ldr a, [z, j, lsl #3] ldr e, [m, j, lsl #3] sbcs xzr, a, e add j, j, #1 sub t, j, k cbnz t, Lbignum_montsqr_cmploop sbcs xzr, c0, xzr csetm c0, cs // Now do a masked subtraction of m for the final reduced result. subs j, xzr, xzr Lbignum_montsqr_corrloop: ldr a, [z, j, lsl #3] ldr e, [m, j, lsl #3] and e, e, c0 sbcs a, a, e str a, [z, j, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_montsqr_corrloop Lbignum_montsqr_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_montsqr) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,831
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_shl_small.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Shift bignum left by c < 64 bits z := x * 2^c // Inputs x[n], c; outputs function return (carry-out) and z[k] // // extern uint64_t bignum_shl_small(uint64_t k, uint64_t *z, uint64_t n, // const uint64_t *x, uint64_t c); // // Does the "z := x << c" operation where x is n digits, result z is p. // The shift count c is masked to 6 bits so it actually uses c' = c mod 64. // The return value is the "next word" of a p+1 bit result, if n <= p. // // Standard ARM ABI: X0 = k, X1 = z, X2 = n, X3 = x, X4 = c, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_shl_small) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_shl_small) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_shl_small) .text .balign 4 #define p x0 #define z x1 #define n x2 #define x x3 #define c x4 #define d x5 #define a x6 #define b x7 #define m x8 #define t x9 #define i x10 S2N_BN_SYMBOL(bignum_shl_small): CFI_START // First clamp the input size n := min(p,n) since we can never need to read // past the p'th term of the input to generate p-digit output. cmp n, p csel n, p, n, cs // Initialize counter i and "previous word" carry b to zero // and skip main loop if n = 0 mov b, xzr mov i, xzr cbz n, Lbignum_shl_small_tail // Set up a mask for nonzero shift and a negated version of the shift. // Note that all basic word-level shifts are predictably masked to 6 bits. ands xzr, c, #63 csetm m, ne neg d, c // Now the main loop Lbignum_shl_small_loop: ldr t, [x, i, lsl #3] lsl a, t, c orr a, a, b lsr b, t, d and b, b, m str a, [z, i, lsl #3] add i, i, #1 cmp i, n bcc Lbignum_shl_small_loop // If we are at the end, finish, otherwise write carry word then zeros Lbignum_shl_small_tail: cmp i, p bcs Lbignum_shl_small_end str b, [z, i, lsl #3] mov b, xzr add i, i, #1 cmp i, p bcs Lbignum_shl_small_end Lbignum_shl_small_tloop: str xzr, [z, i, lsl #3] add i, i, #1 cmp i, p bcc Lbignum_shl_small_tloop // Return top word Lbignum_shl_small_end: mov x0, b CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_shl_small) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,717
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_cmnegadd.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Negated multiply-add with single-word multiplier, z := z - c * y // Inputs c, y[n]; outputs function return (carry-out) and z[k] // // extern uint64_t bignum_cmnegadd(uint64_t k, uint64_t *z, uint64_t c, uint64_t n, // const uint64_t *y); // // Does the "z := z - c * y" operation where y is n digits, result z is p. // Truncates the result in general. // // The return value is a high/carry word that is meaningful when n <= p. // It is interpreted negatively as z' - 2^{64k} * return = z - c * y. // // Standard ARM ABI: X0 = k, X1 = z, X2 = c, X3 = n, X4 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_cmnegadd) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_cmnegadd) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_cmnegadd) .text .balign 4 #define p x0 #define z x1 #define c x2 #define n x3 #define x x4 #define i x5 #define h x6 #define l x7 #define a x8 #define b x9 S2N_BN_SYMBOL(bignum_cmnegadd): CFI_START // First clamp the input size n := min(p,n) since we can never need to read // past the p'th term of the input to generate p-digit output. // Subtract p := p - min(n,p) so it holds the size of the extra tail needed cmp n, p csel n, p, n, cs sub p, p, n // Initialize high part h = 0; if n = 0 do nothing but return that zero mov h, xzr cbz n, Lbignum_cmnegadd_end // Initialization of the loop: 2^64 * CF + [h,z_0'] = z_0 + c * ~x_0 + c ldr a, [x] mvn a, a mul l, c, a umulh h, c, a adds l, l, c adc h, h, xzr ldr b, [z] adds b, b, l str b, [z] mov i, #8 sub n, n, #1 cbz n, Lbignum_cmnegadd_tail // Main loop, where we always have CF + previous high part h to add in Lbignum_cmnegadd_loop: ldr a, [x, i] ldr b, [z, i] mvn a, a mul l, c, a adcs b, b, h umulh h, c, a adc h, h, xzr adds b, b, l str b, [z, i] add i, i, #8 sub n, n, #1 cbnz n, Lbignum_cmnegadd_loop // At this point we have 2^{64n} * (h + CF) + z' = z + c * (2^{64n} - x) // so z' - 2^{64n} * (c - (h + CF)) = z - c * x. // Since z - c * x < 2^{64n} we must have c - (h + CF) >= 0. // Accumulate the negative carry in h for consistency with trivial cases. Lbignum_cmnegadd_tail: adc h, h, xzr sub h, c, h // Propagate the carry all the way to the end with h as extra carry word cbz p, Lbignum_cmnegadd_end ldr b, [z, i] subs b, b, h str b, [z, i] mov h, xzr sub p, p, #1 cbz p, Lbignum_cmnegadd_highend Lbignum_cmnegadd_tloop: add i, i, #8 ldr b, [z, i] sbcs b, b, xzr str b, [z, i] sub p, p, #1 cbnz p, Lbignum_cmnegadd_tloop // Adjust the high word with the inverted carry h := h + (1 - CF) Lbignum_cmnegadd_highend: cset x0, cc add h, h, x0 // Now copy h into the function return Lbignum_cmnegadd_end: mov x0, h CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_cmnegadd) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,266
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_normalize.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Normalize bignum in-place by shifting left till top bit is 1 // Input z[k]; outputs function return (bits shifted left) and z[k] // // extern uint64_t bignum_normalize(uint64_t k, uint64_t *z); // // Given a k-digit bignum z, this function shifts it left by its number of // leading zero bits, to give result with top bit 1, unless the input number // was 0. The return is the same as the output of bignum_clz, i.e. the number // of bits shifted (nominally 64 * k in the case of zero input). // // Standard ARM ABI: X0 = k, X1 = z, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_normalize) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_normalize) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_normalize) .text .balign 4 #define k x0 #define z x1 // This is the return value we accumulate #define r x2 // Other variables #define a x3 #define b x4 #define c x5 #define d x6 #define i x7 #define j x8 #define l x9 S2N_BN_SYMBOL(bignum_normalize): CFI_START // If k = 0 the whole operation is trivial. Otherwise initialize // shift count r and top digit c, but then if k = 1 skip the digitwise part subs i, k, #1 bcc Lbignum_normalize_end ldr c, [z, i, lsl #3] mov r, xzr beq Lbignum_normalize_bitpart // Do a rather stupid but constant-time digit normalization, conditionally // shifting left (k-1) times based on whether the top word is zero. // With careful binary striding this could be O(k*log(k)) instead of O(k^2) // while still retaining the constant-time style. Lbignum_normalize_normloop: mov j, xzr cmp c, xzr cinc r, r, eq mov a, xzr Lbignum_normalize_shufloop: mov c, a ldr a, [z, j, lsl #3] csel c, c, a, eq str c, [z, j, lsl #3] add j, j, #1 sub d, j, k cbnz d, Lbignum_normalize_shufloop subs i, i, #1 bne Lbignum_normalize_normloop // We now have the top digit nonzero, assuming the input was nonzero, // and as per the invariant of the loop above, c holds that digit. So // now just count c's leading zeros and shift z bitwise that many bits. Lbignum_normalize_bitpart: lsl r, r, #6 clz c, c add r, r, c mov b, xzr mov i, xzr ands xzr, c, #63 csetm l, ne neg d, c Lbignum_normalize_bitloop: ldr j, [z, i, lsl #3] lsl a, j, c orr a, a, b lsr b, j, d and b, b, l str a, [z, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_normalize_bitloop // Return the final shift count mov x0, r Lbignum_normalize_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_normalize) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,026
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_modsub.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Subtract modulo m, z := (x - y) mod m, assuming x and y reduced // Inputs x[k], y[k], m[k]; output z[k] // // extern void bignum_modsub(uint64_t k, uint64_t *z, const uint64_t *x, // const uint64_t *y, const uint64_t *m); // // Standard ARM ABI: X0 = k, X1 = z, X2 = x, X3 = y, X4 = m // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_modsub) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_modsub) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_modsub) .text .balign 4 #define k x0 #define z x1 #define x x2 #define y x3 #define m x4 #define i x5 #define j x6 #define a x7 #define b x8 #define c x9 S2N_BN_SYMBOL(bignum_modsub): CFI_START adds j, k, xzr // j = k and ZF = (k = 0) beq Lbignum_modsub_end // if k = 0 do nothing subs i, xzr, xzr // i = 0 and CF = 1 // Subtract z := x - y and record a mask for the carry x - y < 0 Lbignum_modsub_subloop: ldr a, [x, i] ldr b, [y, i] sbcs a, a, b str a, [z, i] add i, i, #8 sub j, j, #1 cbnz j, Lbignum_modsub_subloop csetm c, cc // Now do a masked addition z := z + [c] * m mov j, k adds i, xzr, xzr Lbignum_modsub_addloop: ldr a, [z, i] ldr b, [m, i] and b, b, c adcs a, a, b str a, [z, i] add i, i, #8 sub j, j, #1 cbnz j, Lbignum_modsub_addloop Lbignum_modsub_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_modsub) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
13,315
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_coprime.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Test bignums for coprimality, gcd(x,y) = 1 // Inputs x[m], y[n]; output function return; temporary buffer t[>=2*max(m,n)] // // extern uint64_t bignum_coprime(uint64_t m, const uint64_t *x, uint64_t n, // const uint64_t *y, uint64_t *t); // // Test for whether two bignums are coprime (no common factor besides 1). // This is equivalent to testing if their gcd is 1, but a bit faster than // doing those two computations separately. // // Here bignum x is m digits long, y is n digits long and the temporary // buffer t needs to be 2 * max(m,n) digits long. The return value is // 1 if coprime(x,y) and 0 otherwise. // // Standard ARM ABI: X0 = m, X1 = x, X2 = n, X3 = y, X4 = t, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_coprime) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_coprime) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_coprime) .text .balign 4 #define CHUNKSIZE 58 // Pervasive variables #define k x9 #define m x4 #define n x5 // Used via parameters in copy-in loop, then re-used as outer loop // counter t and adaptive precision digit size l, which becomes a // reduced version of k in later iterations but starts at l = k #define x x1 #define y x3 #define t x2 #define l x3 // The matrix of update factors to apply to m and n // Also used a couple of additional temporary variables for the swapping loop // Also used as an extra down-counter in corrective negation loops #define m_m x6 #define m_n x7 #define n_m x8 #define n_n x1 #define t3 x6 #define t4 x7 #define j x6 // General temporary variables and loop counters #define i x10 #define t1 x11 #define t2 x12 // High and low proxies for the inner loop // Then re-used for high and carry words during actual cross-multiplications #define m_hi x13 #define n_hi x14 #define m_lo x15 #define n_lo x16 #define h1 x13 #define h2 x14 #define l1 x15 #define l2 x16 #define c1 x17 #define c2 x19 #define tt x20 S2N_BN_SYMBOL(bignum_coprime): CFI_START // We make use of just a couple of additional registers CFI_PUSH2(x19,x20) // Compute k = max(m,n), and if this is zero skip to the end. Note that // in this case x0 = m = 0 so we return the right answer of "false" cmp x0, x2 csel k, x2, x0, cc cbz k, Lbignum_coprime_end // Set up inside w two size-k buffers m and n lsl i, k, #3 add n, m, i // Copy the input x into the buffer m, padding with zeros as needed mov i, xzr cbz x0, Lbignum_coprime_xpadloop Lbignum_coprime_xloop: ldr t1, [x1, i, lsl #3] str t1, [m, i, lsl #3] add i, i, #1 cmp i, x0 bcc Lbignum_coprime_xloop cmp i, k bcs Lbignum_coprime_xskip Lbignum_coprime_xpadloop: str xzr, [m, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_coprime_xpadloop Lbignum_coprime_xskip: // Copy the input y into the buffer n, padding with zeros as needed mov i, xzr cbz x2, Lbignum_coprime_ypadloop Lbignum_coprime_yloop: ldr t1, [x3, i, lsl #3] str t1, [n, i, lsl #3] add i, i, #1 cmp i, x2 bcc Lbignum_coprime_yloop cmp i, k bcs Lbignum_coprime_yskip Lbignum_coprime_ypadloop: str xzr, [n, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_coprime_ypadloop Lbignum_coprime_yskip: // Set up the outer loop count of 64 * sum of input sizes. // The invariant is that m * n < 2^t at all times. add t, x0, x2 lsl t, t, #6 // Record for the very end the OR of the lowest words. // If the bottom bit is zero we know both are even so the answer is false. // But since this is constant-time code we still execute all the main part. ldr x0, [m] ldr t3, [n] orr x0, x0, t3 // Now if n is even trigger a swap of m and n. This ensures that if // one or other of m and n is odd then we make sure now that n is, // as expected by our invariant later on. and t3, t3, #1 sub t3, t3, #1 mov i, xzr Lbignum_coprime_swaploop: ldr t1, [m, i, lsl #3] ldr t2, [n, i, lsl #3] eor t4, t1, t2 and t4, t4, t3 eor t1, t1, t4 eor t2, t2, t4 str t1, [m, i, lsl #3] str t2, [n, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_coprime_swaploop // Start of the main outer loop iterated t / CHUNKSIZE times Lbignum_coprime_outerloop: // We need only bother with sharper l = min k (ceil(t/64)) digits // Either both m and n fit in l digits, or m has become zero and so // nothing happens in the loop anyway and this makes no difference. add i, t, #63 lsr l, i, #6 cmp l, k csel l, k, l, cs // Select upper and lower proxies for both m and n to drive the inner // loop. The lower proxies are simply the lowest digits themselves, // m_lo = m[0] and n_lo = n[0], while the upper proxies are bitfields // of the two inputs selected so their top bit (63) aligns with the // most significant bit of *either* of the two inputs. mov h1, xzr // Previous high and low for m mov l1, xzr mov h2, xzr // Previous high and low for n mov l2, xzr mov c2, xzr // Mask flag: previous word of one was nonzero // and in this case h1 and h2 are those words mov i, xzr Lbignum_coprime_toploop: ldr t1, [m, i, lsl #3] ldr t2, [n, i, lsl #3] orr c1, t1, t2 cmp c1, xzr and c1, c2, h1 csel l1, c1, l1, ne and c1, c2, h2 csel l2, c1, l2, ne csel h1, t1, h1, ne csel h2, t2, h2, ne csetm c2, ne add i, i, #1 cmp i, l bcc Lbignum_coprime_toploop orr t1, h1, h2 clz t2, t1 negs c1, t2 lsl h1, h1, t2 csel l1, l1, xzr, ne lsl h2, h2, t2 csel l2, l2, xzr, ne lsr l1, l1, c1 lsr l2, l2, c1 orr m_hi, h1, l1 orr n_hi, h2, l2 ldr m_lo, [m] ldr n_lo, [n] // Now the inner loop, with i as loop counter from CHUNKSIZE down. // This records a matrix of updates to apply to the initial // values of m and n with, at stage j: // // sgn * m' = (m_m * m - m_n * n) / 2^j // -sgn * n' = (n_m * m - n_n * n) / 2^j // // where "sgn" is either +1 or -1, and we lose track of which except // that both instance above are the same. This throwing away the sign // costs nothing (since we have to correct in general anyway because // of the proxied comparison) and makes things a bit simpler. But it // is simply the parity of the number of times the first condition, // used as the swapping criterion, fires in this loop. mov m_m, #1 mov m_n, xzr mov n_m, xzr mov n_n, #1 mov i, #CHUNKSIZE // Conceptually in the inner loop we follow these steps: // // * If m_lo is odd and m_hi < n_hi, then swap the four pairs // (m_hi,n_hi); (m_lo,n_lo); (m_m,n_m); (m_n,n_n) // // * Now, if m_lo is odd (old or new, doesn't matter as initial n_lo is odd) // m_hi := m_hi - n_hi, m_lo := m_lo - n_lo // m_m := m_m + n_m, m_n := m_n + n_n // // * Halve and double them // m_hi := m_hi / 2, m_lo := m_lo / 2 // n_m := n_m * 2, n_n := n_n * 2 // // The actual computation computes updates before actually swapping and // then corrects as needed. It also maintains the invariant ~ZF <=> odd(m_lo), // since it seems to reduce the dependent latency. Set that up first. ands xzr, m_lo, #1 Lbignum_coprime_innerloop: // At the start of the loop ~ZF <=> m_lo is odd; mask values accordingly // Set the flags for m_hi - [~ZF] * n_hi so we know to flip things. csel t1, n_hi, xzr, ne csel t2, n_lo, xzr, ne csel c1, n_m, xzr, ne csel c2, n_n, xzr, ne ccmp m_hi, n_hi, #0x2, ne // Compute subtractive updates, trivial in the case ZF <=> even(m_lo). sub t1, m_hi, t1 sub t2, m_lo, t2 // If the subtraction borrows, swap things appropriately, negating where // we've already subtracted so things are as if we actually swapped first. csel n_hi, n_hi, m_hi, cs cneg t1, t1, cc csel n_lo, n_lo, m_lo, cs cneg m_lo, t2, cc csel n_m, n_m, m_m, cs csel n_n, n_n, m_n, cs // Update and shift while setting oddness flag for next iteration // We look at bit 1 of t2 (m_lo before possible negation), which is // safe because it is even. ands xzr, t2, #2 add m_m, m_m, c1 add m_n, m_n, c2 lsr m_hi, t1, #1 lsr m_lo, m_lo, #1 add n_m, n_m, n_m add n_n, n_n, n_n // Next iteration; don't disturb the flags since they are used at entry sub i, i, #1 cbnz i, Lbignum_coprime_innerloop // Now actually compute the updates to m and n corresponding to that matrix, // and correct the signs if they have gone negative. First we compute the // (k+1)-sized updates // // c1::h1::m = m_m * m - m_n * n // c2::h2::n = n_m * m - n_n * n // // then for each one, sign-correct and shift by CHUNKSIZE mov h1, xzr mov h2, xzr mov c1, xzr mov c2, xzr mov i, xzr Lbignum_coprime_crossloop: ldr t1, [m, i, lsl #3] ldr t2, [n, i, lsl #3] mul l1, m_m, t1 mul l2, m_n, t2 adds l1, l1, h1 umulh h1, m_m, t1 adc h1, h1, xzr umulh tt, m_n, t2 sub c1, tt, c1 subs l1, l1, l2 str l1, [m, i, lsl #3] sbcs h1, h1, c1 csetm c1, cc mul l1, n_m, t1 mul l2, n_n, t2 adds l1, l1, h2 umulh h2, n_m, t1 adc h2, h2, xzr umulh tt, n_n, t2 sub c2, tt, c2 subs l1, l1, l2 str l1, [n, i, lsl #3] sbcs h2, h2, c2 csetm c2, cc add i, i, #1 cmp i, l bcc Lbignum_coprime_crossloop // Write back m optionally negated and shifted right CHUNKSIZE bits adds xzr, c1, c1 ldr l1, [m] mov i, xzr sub j, l, #1 cbz j, Lbignum_coprime_negskip1 Lbignum_coprime_negloop1: add t1, i, #8 ldr t2, [m, t1] extr l1, t2, l1, #CHUNKSIZE eor l1, l1, c1 adcs l1, l1, xzr str l1, [m, i] mov l1, t2 add i, i, #8 sub j, j, #1 cbnz j, Lbignum_coprime_negloop1 Lbignum_coprime_negskip1: extr l1, h1, l1, #CHUNKSIZE eor l1, l1, c1 adcs l1, l1, xzr str l1, [m, i] // Write back n optionally negated and shifted right CHUNKSIZE bits adds xzr, c2, c2 ldr l1, [n] mov i, xzr sub j, l, #1 cbz j, Lbignum_coprime_negskip2 Lbignum_coprime_negloop2: add t1, i, #8 ldr t2, [n, t1] extr l1, t2, l1, #CHUNKSIZE eor l1, l1, c2 adcs l1, l1, xzr str l1, [n, i] mov l1, t2 add i, i, #8 sub j, j, #1 cbnz j, Lbignum_coprime_negloop2 Lbignum_coprime_negskip2: extr l1, h2, l1, #CHUNKSIZE eor l1, l1, c2 adcs l1, l1, xzr str l1, [n, i] // End of main loop. We can stop if t' <= 0 since then m * n < 2^0, which // since n is odd (in the main cases where we had one or other input odd) // means that m = 0 and n is the final gcd. Moreover we do in fact need to // maintain strictly t > 0 in the main loop, or the computation of the // optimized digit bound l could collapse to 0. subs t, t, #CHUNKSIZE bhi Lbignum_coprime_outerloop // Now compare n with 1 (OR of the XORs in t1) ldr t1, [n] eor t1, t1, #1 cmp k, #1 beq Lbignum_coprime_finalcomb mov i, #1 Lbignum_coprime_compareloop: ldr t2, [n, i, lsl #3] orr t1, t1, t2 add i, i, #1 cmp i, k bcc Lbignum_coprime_compareloop // Now combine that with original oddness flag, which is still in x0 Lbignum_coprime_finalcomb: cmp t1, xzr cset t1, eq and x0, x0, t1 Lbignum_coprime_end: CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_coprime) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
4,830
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_amontredc.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Almost-Montgomery reduce, z :== (x' / 2^{64p}) (congruent mod m) // Inputs x[n], m[k], p; output z[k] // // extern void bignum_amontredc(uint64_t k, uint64_t *z, uint64_t n, // const uint64_t *x, const uint64_t *m, uint64_t p); // // Does a :== (x' / 2^{64p}) mod m where x' = x if n <= p + k and in general // is the lowest (p+k) digits of x. That is, p-fold almost-Montgomery reduction // w.r.t. a k-digit modulus m giving a k-digit answer. // // Standard ARM ABI: X0 = k, X1 = z, X2 = n, X3 = x, X4 = m, X5 = p // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_amontredc) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_amontredc) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_amontredc) .text .balign 4 #define k x0 #define z x1 #define n x2 #define x x3 #define m x4 #define p x5 // Negated modular inverse #define w x6 // Outer loop counter #define i x7 // Inner loop counter #define j x8 // Home for Montgomery multiplier #define d x9 // Top carry for current window #define c x14 #define h x10 #define e x11 #define l x12 #define a x13 // Some more intuitive names for temp regs in initial word-level negmodinv. // These just use i and j again, which aren't used early on. #define one x7 #define e1 x7 #define e2 x8 #define e4 x7 #define e8 x8 S2N_BN_SYMBOL(bignum_amontredc): CFI_START // If k = 0 the whole operation is trivial cbz k, Lbignum_amontredc_end // Compute word-level negated modular inverse w for m == m[0]. // This is essentially the same as word_negmodinv. ldr a, [m] lsl w, a, #2 sub w, a, w eor w, w, #2 mov one, #1 madd e1, a, w, one mul e2, e1, e1 madd w, e1, w, w mul e4, e2, e2 madd w, e2, w, w mul e8, e4, e4 madd w, e4, w, w madd w, e8, w, w // Initialize z to the lowest k digits of the input, zero-padding if n < k. cmp n, k csel j, k, n, cs mov i, xzr cbz j, Lbignum_amontredc_padloop Lbignum_amontredc_copyloop: ldr a, [x, i, lsl #3] str a, [z, i, lsl #3] add i, i, #1 cmp i, j bcc Lbignum_amontredc_copyloop cmp i, k bcs Lbignum_amontredc_initialized Lbignum_amontredc_padloop: str xzr, [z, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_amontredc_padloop Lbignum_amontredc_initialized: mov c, xzr // Now if p = 0 that's the end of the operation cbz p, Lbignum_amontredc_end // Outer loop, just doing a standard Montgomery reduction on z mov i, xzr Lbignum_amontredc_outerloop: ldr e, [z] mul d, e, w ldr a, [m] mul l, d, a umulh h, d, a adds e, e, l // Will be zero but want the carry mov j, #1 sub a, k, #1 cbz a, Lbignum_amontredc_montend Lbignum_amontredc_montloop: ldr a, [m, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l sub l, j, #1 str e, [z, l, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_amontredc_montloop Lbignum_amontredc_montend: adcs h, h, c adc c, xzr, xzr add j, j, i cmp j, n bcs Lbignum_amontredc_offtheend ldr a, [x, j, lsl #3] adds h, h, a adc c, c, xzr Lbignum_amontredc_offtheend: sub j, k, #1 str h, [z, j, lsl #3] // End of outer loop add i, i, #1 cmp i, p bcc Lbignum_amontredc_outerloop // Now convert carry word, which is always in {0,1}, into a mask // and do a masked subtraction of m for the final almost-Montgomery result. neg c, c subs j, xzr, xzr Lbignum_amontredc_corrloop: ldr a, [z, j, lsl #3] ldr e, [m, j, lsl #3] and e, e, c sbcs a, a, e str a, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_amontredc_corrloop Lbignum_amontredc_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_amontredc) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,592
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_add.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Add, z := x + y // Inputs x[m], y[n]; outputs function return (carry-out) and z[p] // // extern uint64_t bignum_add(uint64_t p, uint64_t *z, uint64_t m, // const uint64_t *x, uint64_t n, const uint64_t *y); // // Does the z := x + y operation, truncating modulo p words in general and // returning a top carry (0 or 1) in the p'th place, only adding the input // words below p (as well as m and n respectively) to get the sum and carry. // // Standard ARM ABI: X0 = p, X1 = z, X2 = m, X3 = x, X4 = n, X5 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_add) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_add) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_add) .text .balign 4 #define p x0 #define z x1 #define m x2 #define x x3 #define n x4 #define y x5 #define i x6 #define a x7 #define d x8 S2N_BN_SYMBOL(bignum_add): CFI_START // First clamp the two input sizes m := min(p,m) and n := min(p,n) since // we'll never need words past the p'th. Can now assume m <= p and n <= p. // Then compare the modified m and n and branch accordingly cmp m, p csel m, p, m, cs cmp n, p csel n, p, n, cs cmp m, n bcc Lbignum_add_ylonger // The case where x is longer or of the same size (p >= m >= n) sub p, p, m sub m, m, n ands i, xzr, xzr cbz n, Lbignum_add_xmainskip Lbignum_add_xmainloop: ldr a, [x, i, lsl #3] ldr d, [y, i, lsl #3] adcs a, a, d str a, [z, i, lsl #3] add i, i, #1 sub n, n, #1 cbnz n, Lbignum_add_xmainloop Lbignum_add_xmainskip: cbz m, Lbignum_add_xtopskip Lbignum_add_xtoploop: ldr a, [x, i, lsl #3] adcs a, a, xzr str a, [z, i, lsl #3] add i, i, #1 sub m, m, #1 cbnz m, Lbignum_add_xtoploop Lbignum_add_xtopskip: cbnz p, Lbignum_add_tails cset x0, cs ret // The case where y is longer (p >= n > m) Lbignum_add_ylonger: sub p, p, n sub n, n, m ands i, xzr, xzr cbz m, Lbignum_add_ytoploop Lbignum_add_ymainloop: ldr a, [x, i, lsl #3] ldr d, [y, i, lsl #3] adcs a, a, d str a, [z, i, lsl #3] add i, i, #1 sub m, m, #1 cbnz m, Lbignum_add_ymainloop Lbignum_add_ytoploop: ldr a, [y, i, lsl #3] adcs a, xzr, a str a, [z, i, lsl #3] add i, i, #1 sub n, n, #1 cbnz n, Lbignum_add_ytoploop Lbignum_add_ytopskip: cbnz p, Lbignum_add_tails cset x0, cs ret // Adding a non-trivial tail, when p > max(m,n) Lbignum_add_tails: cset a, cs str a, [z, i, lsl #3] b Lbignum_add_tail Lbignum_add_tailloop: str xzr, [z, i, lsl #3] Lbignum_add_tail: add i, i, #1 sub p, p, #1 cbnz p, Lbignum_add_tailloop mov x0, xzr CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_add) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,624
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/word_recip.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Single-word reciprocal, underestimate of floor(2^128 / a) - 2^64 // Input a; output function return // // extern uint64_t word_recip(uint64_t a); // // Given an input word "a" with its top bit set (i.e. 2^63 <= a < 2^64), the // result "x" is implicitly augmented with a leading 1 giving x' = 2^64 + x. // The result is x' = ceil(2^128 / a) - 1, which except for the single // special case a = 2^63 is the same thing as x' = floor(2^128 / a). // // Standard ARM ABI: X0 = a, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(word_recip) S2N_BN_FUNCTION_TYPE_DIRECTIVE(word_recip) S2N_BN_SYM_PRIVACY_DIRECTIVE(word_recip) .text .balign 4 #define a x0 #define x x1 // Some of these are aliased for clarity #define b x2 #define t x3 #define l x3 #define d x4 #define h x4 S2N_BN_SYMBOL(word_recip): CFI_START // Scale the input down: b overestimates a/2^16 with b <= 2^48 and // x underestimates 2^64/b with b * x =~= 2^64, accurate to ~2 bits. lsr b, a, #16 eor x, b, #0x1FFFFFFFFFFFF add b, b, #1 lsr x, x, #32 // Suppose x = 2^64/b * (1 - e). and get scaled error d = 2^64 * e msub d, b, x, xzr // Rescale to give c = 2^15 * e (so c <= 2^13) and compute // e + e^2 + e^3 + e^4 = (1 + e^2) (e + e^2) // = (2^30 + c^2) * (2^15 * c + c^2) / 2^60 // and then x * (1 + e + e^2 + e^3 + e^4) // = (2^30 * x + x * (2^30 + c^2) * (2^30 * c + c^2) / 2^30) / 2^30 lsr t, d, #49 mul t, t, t lsr d, d, #34 add d, t, d orr t, t, #0x40000000 mul t, d, t lsr t, t, #30 lsl d, x, #30 madd x, x, t, d lsr x, x, #30 // Now b * x =~= 2^64, accurate to ~10 bits. // Do a 64-bit Newton step, scaling up x by 16 bits in the process. msub d, b, x, xzr lsr d, d, #24 mul d, d, x lsl x, x, #16 lsr d, d, #24 add x, x, d // Now b * x =~= 2^80, accurate to ~20 bits. // Do a 64-bit Newton step, scaling up x by 31 bits in the process msub d, b, x, xzr lsr d, d, #32 mul d, d, x lsl x, x, #31 lsr d, d, #17 add x, x, d // Now a * x =~= 2^127, accurate to ~40 bits. Do a Newton step at full size. // Instead of literally negating the product (h,l) we complement bits in // the extracted bitfield, which is close enough and a bit faster. // At the end we also shift x one more bit left, losing the known-1 top bit // so that a * (2^64 + x) =~= 2^128. mul l, a, x umulh h, a, x extr l, h, l, #60 lsr h, x, #33 mvn l, l mul l, h, l lsl x, x, #1 lsr l, l, #33 add x, x, l // Test if (x' + 1) * a < 2^128 where x' = 2^64 + x, catching the special // case where x + 1 would wrap, corresponding to input a = 2^63. adds t, x, #1 cinv t, t, eq umulh h, a, t adds h, h, a // Select either x or x + 1 accordingly as the final answer csel x0, x, t, cs CFI_RET S2N_BN_SIZE_DIRECTIVE(word_recip) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
5,170
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_amontsqr.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Almost-Montgomery square, z :== (x^2 / 2^{64k}) (congruent mod m) // Inputs x[k], m[k]; output z[k] // // extern void bignum_amontsqr(uint64_t k, uint64_t *z, const uint64_t *x, // const uint64_t *m); // // Does z :== (x^2 / 2^{64k}) mod m, meaning that the result, in the native // size k, is congruent modulo m, but might not be fully reduced mod m. This // is why it is called *almost* Montgomery squaring. // // Standard ARM ABI: X0 = k, X1 = z, X2 = x, X3 = m // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_amontsqr) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_amontsqr) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_amontsqr) .text .balign 4 #define k x0 #define z x1 #define x x2 #define m x3 // Negated modular inverse #define w x4 // Top carry for k'th position #define c0 x5 // Additional top carry for (k+1)'th position #define c1 x6 // Outer loop counter #define i x7 // Home for i'th digit or Montgomery multiplier #define d x8 // Inner loop counter #define j x9 #define h x10 #define e x11 #define l x12 #define a x13 // This is just a short-term temporary used in zero-test subtraction. // It's aliased to the same register as "a" which is always safe here. #define t x13 // Some more intuitive names for temp regs in initial word-level negmodinv. // These just use c0 and c1 again, which aren't initialized early on. #define one x5 #define e1 x5 #define e2 x6 #define e4 x5 #define e8 x6 S2N_BN_SYMBOL(bignum_amontsqr): CFI_START // If k = 0 the whole operation is trivial cbz k, Lbignum_amontsqr_end // Compute word-level negated modular inverse w for m == m[0]. // This is essentially the same as word_negmodinv. ldr a, [m] lsl w, a, #2 sub w, a, w eor w, w, #2 mov one, #1 madd e1, a, w, one mul e2, e1, e1 madd w, e1, w, w mul e4, e2, e2 madd w, e2, w, w mul e8, e4, e4 madd w, e4, w, w madd w, e8, w, w // Initialize the output c0::z to zero so we can then consistently add rows. // It would be a bit more efficient to special-case the zeroth row, but // this keeps the code slightly simpler. mov i, xzr Lbignum_amontsqr_zoop: str xzr, [z, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_amontsqr_zoop mov c0, xzr // Outer loop pulling down digits d=x[i], multiplying by x and reducing mov i, xzr Lbignum_amontsqr_outerloop: // Multiply-add loop where we always have CF + previous high part h to add in // Note that in general we do need yet one more carry in this phase and hence // initialize c1 with the top carry. ldr d, [x, i, lsl #3] mov j, xzr adds h, xzr, xzr Lbignum_amontsqr_maddloop: ldr a, [x, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l str e, [z, j, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_amontsqr_maddloop adcs c0, c0, h adc c1, xzr, xzr // Montgomery reduction loop, similar but offsetting writebacks ldr e, [z] mul d, e, w ldr a, [m] mul l, d, a umulh h, d, a adds e, e, l // Will be zero but want the carry mov j, #1 sub t, k, #1 cbz t, Lbignum_amontsqr_montend Lbignum_amontsqr_montloop: ldr a, [m, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l sub l, j, #1 str e, [z, l, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_amontsqr_montloop Lbignum_amontsqr_montend: adcs h, c0, h adc c0, c1, xzr sub l, j, #1 str h, [z, l, lsl #3] // End of outer loop add i, i, #1 cmp i, k bcc Lbignum_amontsqr_outerloop // Now convert carry word, which is always in {0,1}, into a mask // and do a masked subtraction of m for the final almost-Montgomery result. neg c0, c0 subs j, xzr, xzr Lbignum_amontsqr_corrloop: ldr a, [z, j, lsl #3] ldr e, [m, j, lsl #3] and e, e, c0 sbcs a, a, e str a, [z, j, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_amontsqr_corrloop Lbignum_amontsqr_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_amontsqr) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,634
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_shr_small.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Shift bignum right by c < 64 bits z := floor(x / 2^c) // Inputs x[n], c; outputs function return (bits shifted out) and z[k] // // extern uint64_t bignum_shr_small(uint64_t k, uint64_t *z, uint64_t n, // const uint64_t *x, uint64_t c); // // Does the "z := x >> c" operation where x is n digits, result z is p. // The shift count c is masked to 6 bits so it actually uses c' = c mod 64. // The return value is the inout mod 2^c'. // // Standard ARM ABI: X0 = k, X1 = z, X2 = n, X3 = x, X4 = c, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_shr_small) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_shr_small) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_shr_small) .text .balign 4 #define p x0 #define z x1 #define n x2 #define x x3 #define c x4 #define d x5 #define a x6 #define b x7 #define m x8 #define t x9 S2N_BN_SYMBOL(bignum_shr_small): CFI_START // Set default carry-in word to 0 mov b, xzr // First, if p > n then pad output on the left with p-n zeros cmp n, p bcs Lbignum_shr_small_nopad Lbignum_shr_small_padloop: sub p, p, #1 str xzr, [z, p, lsl #3] cmp n, p bcc Lbignum_shr_small_padloop // We now know that p <= n. If in fact p < n let carry word = x[p] instead of 0 Lbignum_shr_small_nopad: beq Lbignum_shr_small_shiftstart ldr b, [x, p, lsl #3] Lbignum_shr_small_shiftstart: // Set up negated version of the shift and shift b in preparation. // Use a mask for nonzero shift to fake 64-bit left shift in zero case neg d, c lsl b, b, d ands xzr, c, #63 csetm m, ne and b, b, m // Now the main loop cbz p, Lbignum_shr_small_end Lbignum_shr_small_loop: sub p, p, #1 ldr t, [x, p, lsl #3] lsr a, t, c orr a, a, b lsl b, t, d and b, b, m str a, [z, p, lsl #3] cbnz p, Lbignum_shr_small_loop // Return top word, shifted back to be a modulus Lbignum_shr_small_end: lsr x0, b, d CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_shr_small) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,415
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_copy_row_from_table.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Given table: uint64_t[height*width], copy table[idx*width...(idx+1)*width-1] // into z[0..width-1]. // This function is constant-time with respect to the value of `idx`. This is // achieved by reading the whole table and using the bit-masking to get the // `idx`-th row. // // extern void bignum_copy_row_from_table // (uint64_t *z, const uint64_t *table, uint64_t height, uint64_t width, // uint64_t idx); // // Standard ARM ABI: X0 = z, X1 = table, X2 = height, X3 = width, X4 = idx // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_copy_row_from_table) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_copy_row_from_table) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_copy_row_from_table) .text .balign 4 #define z x0 #define table x1 #define height x2 #define width x3 #define idx x4 #define i x5 #define mask x6 #define j x7 S2N_BN_SYMBOL(bignum_copy_row_from_table): CFI_START cbz height, Lbignum_copy_row_from_table_end cbz width, Lbignum_copy_row_from_table_end mov i, width mov x6, z Lbignum_copy_row_from_table_initzero: str xzr, [x6] add x6, x6, #8 subs i, i, #1 bne Lbignum_copy_row_from_table_initzero mov i, xzr mov x8, table Lbignum_copy_row_from_table_outerloop: cmp i, idx csetm mask, eq mov j, width mov x9, z Lbignum_copy_row_from_table_innerloop: ldr x10, [x8] ldr x11, [x9] and x10, x10, mask orr x11, x11, x10 str x11, [x9] add x8, x8, #8 add x9, x9, #8 subs j, j, #1 bne Lbignum_copy_row_from_table_innerloop Lbignum_copy_row_from_table_innerloop_done: add i, i, #1 cmp i, height bne Lbignum_copy_row_from_table_outerloop Lbignum_copy_row_from_table_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_copy_row_from_table) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
5,228
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_amontmul.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Almost-Montgomery multiply, z :== (x * y / 2^{64k}) (congruent mod m) // Inputs x[k], y[k], m[k]; output z[k] // // extern void bignum_amontmul(uint64_t k, uint64_t *z, const uint64_t *x, // const uint64_t *y, const uint64_t *m); // // Does z :== (x * y / 2^{64k}) mod m, meaning that the result, in the native // size k, is congruent modulo m, but might not be fully reduced mod m. This // is why it is called *almost* Montgomery multiplication. // // Standard ARM ABI: X0 = k, X1 = z, X2 = x, X3 = y, X4 = m // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_amontmul) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_amontmul) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_amontmul) .text .balign 4 #define k x0 #define z x1 #define x x2 #define y x3 #define m x4 // Negated modular inverse #define w x5 // Top carry for k'th position #define c0 x6 // Additional top carry for (k+1)'th position #define c1 x7 // Outer loop counter #define i x8 // Home for i'th digit or Montgomery multiplier #define d x9 // Inner loop counter #define j x10 #define h x11 #define e x12 #define l x13 #define a x14 // This is just a short-term temporary used in zero-test subtraction. // It's aliased to the same register as "a" which is always safe here. #define t x14 // Some more intuitive names for temp regs in initial word-level negmodinv. // These just use c0 and c1 again, which aren't initialized early on. #define one x6 #define e1 x6 #define e2 x7 #define e4 x6 #define e8 x7 S2N_BN_SYMBOL(bignum_amontmul): CFI_START // If k = 0 the whole operation is trivial cbz k, Lbignum_amontmul_end // Compute word-level negated modular inverse w for m == m[0]. // This is essentially the same as word_negmodinv. ldr a, [m] lsl w, a, #2 sub w, a, w eor w, w, #2 mov one, #1 madd e1, a, w, one mul e2, e1, e1 madd w, e1, w, w mul e4, e2, e2 madd w, e2, w, w mul e8, e4, e4 madd w, e4, w, w madd w, e8, w, w // Initialize the output c0::z to zero so we can then consistently add rows. // It would be a bit more efficient to special-case the zeroth row, but // this keeps the code slightly simpler. mov i, xzr Lbignum_amontmul_zoop: str xzr, [z, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_amontmul_zoop mov c0, xzr // Outer loop pulling down digits d=x[i], multiplying by y and reducing mov i, xzr Lbignum_amontmul_outerloop: // Multiply-add loop where we always have CF + previous high part h to add in // Note that in general we do need yet one more carry in this phase and hence // initialize c1 with the top carry. ldr d, [x, i, lsl #3] mov j, xzr adds h, xzr, xzr Lbignum_amontmul_maddloop: ldr a, [y, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l str e, [z, j, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_amontmul_maddloop adcs c0, c0, h adc c1, xzr, xzr // Montgomery reduction loop, similar but offsetting writebacks ldr e, [z] mul d, e, w ldr a, [m] mul l, d, a umulh h, d, a adds e, e, l // Will be zero but want the carry mov j, #1 sub t, k, #1 cbz t, Lbignum_amontmul_montend Lbignum_amontmul_montloop: ldr a, [m, j, lsl #3] ldr e, [z, j, lsl #3] mul l, d, a adcs e, e, h umulh h, d, a adc h, h, xzr adds e, e, l sub l, j, #1 str e, [z, l, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_amontmul_montloop Lbignum_amontmul_montend: adcs h, c0, h adc c0, c1, xzr sub l, j, #1 str h, [z, l, lsl #3] // End of outer loop add i, i, #1 cmp i, k bcc Lbignum_amontmul_outerloop // Now convert carry word, which is always in {0,1}, into a mask // and do a masked subtraction of m for the final almost-Montgomery result. neg c0, c0 subs j, xzr, xzr Lbignum_amontmul_corrloop: ldr a, [z, j, lsl #3] ldr e, [m, j, lsl #3] and e, e, c0 sbcs a, a, e str a, [z, j, lsl #3] add j, j, #1 sub t, j, k cbnz t, Lbignum_amontmul_corrloop Lbignum_amontmul_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_amontmul) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,102
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_divmod10.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Divide bignum by 10, returning remainder: z' := z div 10, return = z mod 10 // Inputs z[k]; outputs function return (remainder) and z[k] // // extern uint64_t bignum_divmod10(uint64_t k, uint64_t *z); // // Standard ARM ABI: X0 = k, X1 = z, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_divmod10) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_divmod10) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_divmod10) .text .balign 4 #define k x0 #define z x1 #define d x2 #define h x3 #define q x3 #define l x4 #define r x4 #define w x5 #define s x6 S2N_BN_SYMBOL(bignum_divmod10): CFI_START // If k = 0 then return; the return in x0 is indeed 0 mod 10 = 0 cbz k, Lbignum_divmod10_end // Straightforward top-down loop doing 10 * q + r' := 2^64 * r + d mov r, xzr mov w, 0x3333333333333333 add s, w, 1 and w, w, 0xfffffff Lbignum_divmod10_divloop: sub k, k, 1 ldr d, [z, k, lsl #3] // First re-split and shift so 2^28 * h + l = (2^64 * r + d) / 2 // Then (2^64 * r + d) / 10 = [(2^28 - 1) / 5] * h + (h + l) / 5 extr h, r, d, 29 ubfx l, d, 1, 28 add l, h, l mul h, h, w umulh l, l, s add q, h, l str q, [z, k, lsl #3] // Generate the new remainder r = d - 10 * q // Since r <= 9 we only need the low part computation ignoring carries add q, q, q, lsl #2 sub r, d, q, lsl #1 cbnz k, Lbignum_divmod10_divloop // Return the final remainder mov x0, r Lbignum_divmod10_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_divmod10) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,694
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_digit.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Select digit x[n] // Inputs x[k], n; output function return // // extern uint64_t bignum_digit(uint64_t k, const uint64_t *x, uint64_t n); // // n'th digit of a k-digit (digit=64 bits) bignum, in constant-time style. // Indexing starts at 0, which is the least significant digit (little-endian). // Returns zero if n >= k, i.e. we read a digit off the end of the bignum. // // Standard ARM ABI: X0 = k, X1 = x, X2 = n, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_digit) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_digit) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_digit) .text .balign 4 #define k x0 #define x x1 #define n x2 #define d x3 #define i x4 #define a x5 S2N_BN_SYMBOL(bignum_digit): CFI_START // For length zero finish immediately (the return value in x0 is 0) cbz k, Lbignum_digit_end // Set default of zero, run over all the digits and take note of the n'th one mov d, xzr mov i, xzr Lbignum_digit_loop: ldr a, [x, i, lsl #3] cmp i, n csel d, a, d, eq add i, i, #1 cmp i, k bcc Lbignum_digit_loop // Return mov x0, d Lbignum_digit_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_digit) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,500
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_gt.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Compare bignums, x > y // Inputs x[m], y[n]; output function return // // extern uint64_t bignum_gt(uint64_t m, const uint64_t *x, uint64_t n, // const uint64_t *y); // // Standard ARM ABI: X0 = m, X1 = x, X2 = n, X3 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_gt) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_gt) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_gt) .text .balign 4 #define m x0 #define x x1 #define n x2 #define y x3 #define i x4 #define a x5 #define d x6 S2N_BN_SYMBOL(bignum_gt): CFI_START // Zero the main index counter for both branches mov i, xzr // Speculatively form n := n - m and do case split subs n, n, m bcc Lbignum_gt_ylonger // The case where y is longer or of the same size (n >= m) // Note that CF=1 initially by the fact that we reach this point cbz m, Lbignum_gt_xtest Lbignum_gt_xmainloop: ldr a, [y, i, lsl #3] ldr d, [x, i, lsl #3] sbcs xzr, a, d add i, i, #1 sub m, m, #1 cbnz m, Lbignum_gt_xmainloop Lbignum_gt_xtest: cbz n, Lbignum_gt_xskip Lbignum_gt_xtoploop: ldr a, [y, i, lsl #3] sbcs xzr, a, xzr add i, i, #1 sub n, n, #1 cbnz n, Lbignum_gt_xtoploop Lbignum_gt_xskip: cset x0, cc ret // The case where x is longer (m > n) // The first "adds" also makes sure CF=1 initially in this branch Lbignum_gt_ylonger: adds n, n, m cbz n, Lbignum_gt_ytoploop sub m, m, n Lbignum_gt_ymainloop: ldr a, [y, i, lsl #3] ldr d, [x, i, lsl #3] sbcs xzr, a, d add i, i, #1 sub n, n, #1 cbnz n, Lbignum_gt_ymainloop Lbignum_gt_ytoploop: ldr a, [x, i, lsl #3] sbcs xzr, xzr, a add i, i, #1 sub m, m, #1 cbnz m, Lbignum_gt_ytoploop cset x0, cc CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_gt) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,501
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_le.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Compare bignums, x <= y // Inputs x[m], y[n]; output function return // // extern uint64_t bignum_le(uint64_t m, const uint64_t *x, uint64_t n, // const uint64_t *y); // // Standard ARM ABI: X0 = m, X1 = x, X2 = n, X3 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_le) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_le) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_le) .text .balign 4 #define m x0 #define x x1 #define n x2 #define y x3 #define i x4 #define a x5 #define d x6 S2N_BN_SYMBOL(bignum_le): CFI_START // Zero the main index counter for both branches mov i, xzr // Speculatively form n := n - m and do case split subs n, n, m bcc Lbignum_le_ylonger // The case where y is longer or of the same size (n >= m) // Note that CF=1 initially by the fact that we reach this point cbz m, Lbignum_le_xtest Lbignum_le_xmainloop: ldr a, [y, i, lsl #3] ldr d, [x, i, lsl #3] sbcs xzr, a, d add i, i, #1 sub m, m, #1 cbnz m, Lbignum_le_xmainloop Lbignum_le_xtest: cbz n, Lbignum_le_xskip Lbignum_le_xtoploop: ldr a, [y, i, lsl #3] sbcs xzr, a, xzr add i, i, #1 sub n, n, #1 cbnz n, Lbignum_le_xtoploop Lbignum_le_xskip: cset x0, cs ret // The case where x is longer (m > n) // The first "adds" also makes sure CF=1 initially in this branch Lbignum_le_ylonger: adds n, n, m cbz n, Lbignum_le_ytoploop sub m, m, n Lbignum_le_ymainloop: ldr a, [y, i, lsl #3] ldr d, [x, i, lsl #3] sbcs xzr, a, d add i, i, #1 sub n, n, #1 cbnz n, Lbignum_le_ymainloop Lbignum_le_ytoploop: ldr a, [x, i, lsl #3] sbcs xzr, xzr, a add i, i, #1 sub m, m, #1 cbnz m, Lbignum_le_ytoploop cset x0, cs CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_le) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,178
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_eq.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Test bignums for equality, x = y // Inputs x[m], y[n]; output function return // // extern uint64_t bignum_eq(uint64_t m, const uint64_t *x, uint64_t n, // const uint64_t *y); // // Standard ARM ABI: X0 = m, X1 = x, X2 = n, X3 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_eq) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_eq) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_eq) .text .balign 4 #define m x0 #define x x1 #define n x2 #define y x3 #define a x4 #define c x5 // We can re-use n for this, not needed when d appears #define d x2 S2N_BN_SYMBOL(bignum_eq): CFI_START // Initialize the accumulated OR of differences to zero mov c, xzr // If m >= n jump into the m > n loop at the final equality test // This will drop through for m = n cmp m, n bcs Lbignum_eq_mtest // Toploop for the case n > m Lbignum_eq_nloop: sub n, n, #1 ldr a, [y, n, lsl #3] orr c, c, a cmp m, n bne Lbignum_eq_nloop b Lbignum_eq_mmain // Toploop for the case m > n (or n = m which enters at "mtest") Lbignum_eq_mloop: sub m, m, #1 ldr a, [x, m, lsl #3] orr c, c, a cmp m, n Lbignum_eq_mtest: bne Lbignum_eq_mloop // Combined main loop for the min(m,n) lower words Lbignum_eq_mmain: cbz m, Lbignum_eq_end Lbignum_eq_loop: sub m, m, #1 ldr a, [x, m, lsl #3] ldr d, [y, m, lsl #3] eor a, a, d orr c, c, a cbnz m, Lbignum_eq_loop Lbignum_eq_end: cmp c, xzr cset x0, eq CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_eq) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,543
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_digitsize.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Return size of bignum in digits (64-bit word) // Input x[k]; output function return // // extern uint64_t bignum_digitsize(uint64_t k, const uint64_t *x); // // In the case of a zero bignum as input the result is 0 // // Standard ARM ABI: X0 = k, X1 = x, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_digitsize) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_digitsize) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_digitsize) .text .balign 4 #define k x0 #define x x1 #define i x2 #define a x3 #define j x4 S2N_BN_SYMBOL(bignum_digitsize): CFI_START // If the bignum is zero-length, x0 is already the right answer of 0 cbz k, Lbignum_digitsize_end // Run over the words j = 0..i-1, and set i := j + 1 when hitting nonzero a[j] mov i, xzr mov j, xzr Lbignum_digitsize_loop: ldr a, [x, j, lsl #3] add j, j, #1 cmp a, #0 csel i, j, i, ne cmp j, k bne Lbignum_digitsize_loop mov x0, i Lbignum_digitsize_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_digitsize) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,963
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_optsub.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Optionally subtract, z := x - y (if p nonzero) or z := x (if p zero) // Inputs x[k], p, y[k]; outputs function return (carry-out) and z[k] // // extern uint64_t bignum_optsub(uint64_t k, uint64_t *z, const uint64_t *x, // uint64_t p, const uint64_t *y); // // It is assumed that all numbers x, y and z have the same size k digits. // Returns carry-out as per usual subtraction, always 0 if p was zero. // // Standard ARM ABI: X0 = k, X1 = z, X2 = x, X3 = p, X4 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_optsub) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_optsub) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_optsub) .text .balign 4 #define k x0 #define z x1 #define x x2 #define p x3 #define m x3 #define y x4 #define a x5 #define b x6 #define i x7 S2N_BN_SYMBOL(bignum_optsub): CFI_START // if k = 0 do nothing. This is also the right top carry in X0 cbz k, Lbignum_optsub_end // Convert p into a strict bitmask (same register in fact) cmp p, xzr csetm m, ne // Set i = 0 *and* make sure initial ~CF = 0 subs i, xzr, xzr // Main loop Lbignum_optsub_loop: ldr a, [x, i] ldr b, [y, i] and b, b, m sbcs a, a, b str a, [z, i] add i, i, #8 sub k, k, #1 cbnz k, Lbignum_optsub_loop // Return (non-inverted) carry flag cset x0, cc Lbignum_optsub_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_optsub) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,331
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_iszero.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Test bignum for zero-ness, x = 0 // Input x[k]; output function return // // extern uint64_t bignum_iszero(uint64_t k, const uint64_t *x); // // Standard ARM ABI: X0 = k, X1 = x, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_iszero) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_iszero) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_iszero) .text .balign 4 #define k x0 #define x x1 #define a x2 #define c x3 S2N_BN_SYMBOL(bignum_iszero): CFI_START mov c, xzr // c will be or of the digits cbz k, Lbignum_iszero_end // if k = 0 skip the Lbignum_iszero_loop Lbignum_iszero_loop: sub k, k, #1 ldr a, [x, k, lsl #3] orr c, c, a cbnz k, Lbignum_iszero_loop Lbignum_iszero_end: cmp c, xzr cset x0, eq CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_iszero) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,690
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_copy.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Copy bignum with zero-extension or truncation, z := x // Input x[n]; output z[k] // // extern void bignum_copy(uint64_t k, uint64_t *z, uint64_t n, const uint64_t *x); // // Standard ARM ABI: X0 = k, X1 = z, X2 = n, X3 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_copy) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_copy) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_copy) .text .balign 4 #define k x0 #define z x1 #define n x2 #define x x3 #define i x4 #define a x5 S2N_BN_SYMBOL(bignum_copy): CFI_START // Replace n with min(k,n) so we are definitely safe copying those // Initialize the element counter to 0 cmp k, n csel n, k, n, cc mov i, #0 // If min(k,n) = 0 jump to the padding stage cbz n, Lbignum_copy_padding Lbignum_copy_copyloop: ldr a, [x, i, lsl #3] str a, [z, i, lsl #3] add i, i, #1 cmp i, n bcc Lbignum_copy_copyloop Lbignum_copy_padding: cmp i, k bcs Lbignum_copy_end Lbignum_copy_padloop: str xzr, [z, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_copy_padloop Lbignum_copy_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_copy) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
14,526
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_montifier.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Compute "montification" constant z := 2^{128k} mod m // Input m[k]; output z[k]; temporary buffer t[>=k] // // extern void bignum_montifier(uint64_t k, uint64_t *z, const uint64_t *m, // uint64_t *t); // // The last argument points to a temporary buffer t that should have size >= k. // This is called "montifier" because given any other k-digit number x, // whether or not it's reduced modulo m, it can be mapped to its Montgomery // representation (2^{64k} * x) mod m just by Montgomery multiplication by z. // // Standard ARM ABI: X0 = k, X1 = z, X2 = m, X3 = t // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_montifier) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_montifier) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_montifier) .text .balign 4 #define k x0 #define z x1 #define m x2 #define t x3 // Some variables // Modular inverse w is aliased to i, but we never use them together #define i x4 #define w x4 #define j x5 #define h x6 #define a x7 #define l x8 #define c x9 #define b x10 #define d x11 // Some aliases for the values b and d #define r x10 #define q x11 S2N_BN_SYMBOL(bignum_montifier): CFI_START // If k = 0 the whole operation is trivial cbz k, Lbignum_montifier_end // Copy the input m into the temporary buffer t. The temporary register // c matters since we want it to hold the highest digit, ready for the // normalization phase. mov i, xzr Lbignum_montifier_copyinloop: ldr c, [m, i, lsl #3] str c, [t, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_montifier_copyinloop // Do a rather stupid but constant-time digit normalization, conditionally // shifting left (k-1) times based on whether the top word is zero. // With careful binary striding this could be O(k*log(k)) instead of O(k^2) // while still retaining the constant-time style. // The "cmp c, xzr" sets the zeroness predicate (ZF) for the entire inner loop subs i, k, #1 beq Lbignum_montifier_normalized Lbignum_montifier_normloop: mov j, xzr cmp c, xzr mov a, xzr Lbignum_montifier_shufloop: mov c, a ldr a, [t, j, lsl #3] csel c, c, a, eq str c, [t, j, lsl #3] add j, j, #1 sub d, j, k cbnz d, Lbignum_montifier_shufloop subs i, i, #1 bne Lbignum_montifier_normloop // We now have the top digit nonzero, assuming the input was nonzero, // and as per the invariant of the loop above, c holds that digit. So // now just count c's leading zeros and shift t bitwise that many bits. Lbignum_montifier_normalized: clz c, c mov b, xzr mov i, xzr ands xzr, c, #63 csetm l, ne neg d, c Lbignum_montifier_bitloop: ldr j, [t, i, lsl #3] lsl a, j, c orr a, a, b lsr b, j, d and b, b, l str a, [t, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_montifier_bitloop // Let h be the high word of n, which in all the in-scope cases is >= 2^63. // Now successively form q = 2^i div h and r = 2^i mod h as i goes from // 64 to 126. We avoid just using division out of constant-time concerns // (at the least we would need to fix up h = 0 for out-of-scope inputs) and // don't bother with Newton-Raphson, since this stupid simple loop doesn't // contribute much of the overall runtime at typical sizes. sub h, k, #1 ldr h, [t, h, lsl #3] mov q, #1 neg r, h mov i, #62 Lbignum_montifier_estloop: add q, q, q mov a, h sub a, a, r cmp r, a // CF <=> r >= h - r <=> 2 * r >= h csetm a, cs sub q, q, a add r, r, r and a, a, h sub r, r, a subs i, i, #1 bne Lbignum_montifier_estloop // Strictly speaking the above loop doesn't quite give the true remainder // and quotient in the special case r = h = 2^63, so fix it up. We get // q = 2^63 - 1 and r = 2^63 and really want q = 2^63 and r = 0. This is // supererogatory, because the main property of q used below still holds // in this case unless the initial m = 1, and then anyway the overall // specification (congruence modulo m) holds degenerately. But it seems // nicer to get a "true" quotient and remainder. cmp r, h csinc q, q, q, ne // So now we have q and r with 2^126 = q * h + r (imagining r = 0 in the // fixed-up case above: note that we never actually use the computed // value of r below and so didn't adjust it). And we can assume the ranges // q <= 2^63 and r < h < 2^64. // // The idea is to use q as a first quotient estimate for a remainder // of 2^{p+62} mod n, where p = 64 * k. We have, splitting n into the // high and low parts h and l: // // 2^{p+62} - q * n = 2^{p+62} - q * (2^{p-64} * h + l) // = 2^{p+62} - (2^{p-64} * (q * h) + q * l) // = 2^{p+62} - 2^{p-64} * (2^126 - r) - q * l // = 2^{p-64} * r - q * l // // Note that 2^{p-64} * r < 2^{p-64} * h <= n // and also q * l < 2^63 * 2^{p-64} = 2^{p-1} <= n // so |diff| = |2^{p-64} * r - q * l| < n. // // If in fact diff >= 0 then it is already 2^{p+62} mod n. // otherwise diff + n is the right answer. // // To (maybe?) make the computation slightly easier we actually flip // the sign and compute d = q * n - 2^{p+62}. Then the answer is either // -d (when negative) or n - d; in either case we effectively negate d. // This negating tweak in fact spoils the result for cases where // 2^{p+62} mod n = 0, when we get n instead. However the only case // where this can happen is m = 1, when the whole spec holds trivially, // and actually the remainder of the logic below works anyway since // the latter part of the code only needs a congruence for the k-digit // result, not strict modular reduction (the doublings will maintain // the non-strict inequality). mov c, xzr adds i, xzr, xzr Lbignum_montifier_mulloop: ldr a, [t, i, lsl #3] mul l, q, a adcs l, l, c umulh c, q, a str l, [z, i, lsl #3] add i, i, #1 sub a, i, k cbnz a, Lbignum_montifier_mulloop adc c, c, xzr mov a, #0x4000000000000000 subs c, c, a csetm q, cs // Now do [c] * n - d for our final answer subs i, xzr, xzr Lbignum_montifier_remloop: ldr a, [t, i, lsl #3] ldr b, [z, i, lsl #3] and a, a, q sbcs a, a, b str a, [z, i, lsl #3] add i, i, #1 sub a, i, k cbnz a, Lbignum_montifier_remloop // Now still need to do a couple of modular doublings to get us all the // way up to 2^{p+64} == r from the initial 2^{p+62} == r (mod n). mov c, xzr subs j, xzr, xzr Lbignum_montifier_dubloop1: ldr a, [z, j, lsl #3] extr c, a, c, #63 ldr b, [t, j, lsl #3] sbcs c, c, b str c, [z, j, lsl #3] mov c, a add j, j, #1 sub a, j, k cbnz a, Lbignum_montifier_dubloop1 lsr c, c, #63 sbc c, c, xzr adds j, xzr, xzr Lbignum_montifier_corrloop1: ldr a, [z, j, lsl #3] ldr b, [t, j, lsl #3] and b, b, c adcs a, a, b str a, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_montifier_corrloop1 // This is not exactly the same: we also copy output to t giving the // initialization t_1 = r == 2^{p+64} mod n for the main loop next. mov c, xzr subs j, xzr, xzr Lbignum_montifier_dubloop2: ldr a, [z, j, lsl #3] extr c, a, c, #63 ldr b, [t, j, lsl #3] sbcs c, c, b str c, [z, j, lsl #3] mov c, a add j, j, #1 sub a, j, k cbnz a, Lbignum_montifier_dubloop2 lsr c, c, #63 sbc c, c, xzr adds j, xzr, xzr Lbignum_montifier_corrloop2: ldr a, [z, j, lsl #3] ldr b, [t, j, lsl #3] and b, b, c adcs a, a, b str a, [z, j, lsl #3] str a, [t, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_montifier_corrloop2 // We then successively generate (k+1)-digit values satisfying // t_i == 2^{p+64*i} mod n, each of which is stored in h::t. Finish // initialization by zeroing h initially mov h, xzr // Then if t_i = 2^{p} * h + l // we have t_{i+1} == 2^64 * t_i // = (2^{p+64} * h) + (2^64 * l) // == r * h + l<<64 // Do this 2*k more times so we end up == 2^{192*k+64}, one more than we want // // Writing B = 2^{64k}, the possible correction of adding r, which for // a (k+1)-digit result is equivalent to subtracting q = 2^{64*(k+1)} - r // would give the overall worst-case value minus q of // [ B * (B^k - 1) + (B - 1) * r ] - [B^{k+1} - r] // = B * (r - 1) < B^{k+1} so we keep inside k+1 digits as required. // // This implementation makes the shift implicit by starting b with the // "previous" digit (initially 0) to offset things by 1. add i, k, k Lbignum_montifier_modloop: mov j, xzr mov b, xzr adds c, xzr, xzr Lbignum_montifier_cmaloop: ldr a, [z, j, lsl #3] mul l, h, a adcs b, b, c umulh c, h, a adc c, c, xzr adds l, b, l ldr b, [t, j, lsl #3] str l, [t, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_montifier_cmaloop adcs h, b, c csetm l, cs adds j, xzr, xzr Lbignum_montifier_oaloop: ldr a, [t, j, lsl #3] ldr b, [z, j, lsl #3] and b, b, l adcs a, a, b str a, [t, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_montifier_oaloop adc h, h, xzr subs i, i, #1 bne Lbignum_montifier_modloop // Compute the negated modular inverse w (same register as i, not used again). ldr a, [m] lsl w, a, #2 sub w, a, w eor w, w, #2 mov l, #1 madd c, a, w, l mul b, c, c madd w, c, w, w mul c, b, b madd w, b, w, w mul b, c, c madd w, c, w, w madd w, b, w, w // Now do one almost-Montgomery reduction w.r.t. the original m // which lops off one 2^64 from the congruence and, with the usual // almost-Montgomery correction, gets us back inside k digits for // the end result. ldr b, [t] mul d, b, w mul l, d, a umulh c, d, a mov j, #1 sub a, k, #1 adds xzr, b, l cbz a, Lbignum_montifier_amontend Lbignum_montifier_amontloop: ldr a, [m, j, lsl #3] ldr b, [t, j, lsl #3] mul l, d, a adcs b, b, c umulh c, d, a adc c, c, xzr adds b, b, l sub a, j, #1 str b, [t, a, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_montifier_amontloop Lbignum_montifier_amontend: adcs h, h, c csetm l, cs sub a, k, #1 str h, [t, a, lsl #3] subs j, xzr, xzr Lbignum_montifier_osloop: ldr a, [t, j, lsl #3] ldr b, [m, j, lsl #3] and b, b, l sbcs a, a, b str a, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_montifier_osloop // So far, the code(basically a variant of bignum_amontifier) has produced // a k-digit value z == 2^{192k} (mod m), not necessarily fully reduced mod m. // We now do a short Montgomery reduction (similar to bignum_demont) so that // we achieve full reduction mod m while lopping 2^{64k} off the congruence. // We recycle h as the somewhat strangely-named outer loop counter. mov h, k Lbignum_montifier_montouterloop: ldr b, [z] mul d, b, w ldr a, [m] mul l, d, a umulh c, d, a mov j, #1 sub a, k, #1 adds xzr, b, l cbz a, Lbignum_montifier_montend Lbignum_montifier_montloop: ldr a, [m, j, lsl #3] ldr b, [z, j, lsl #3] mul l, d, a adcs b, b, c umulh c, d, a adc c, c, xzr adds b, b, l sub a, j, #1 str b, [z, a, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_montifier_montloop Lbignum_montifier_montend: adc c, c, xzr sub a, k, #1 str c, [z, a, lsl #3] subs h, h, #1 bne Lbignum_montifier_montouterloop // Now do a comparison of z with m to set a final correction mask // indicating that z >= m and so we need to subtract m. subs j, xzr, xzr Lbignum_montifier_cmploop: ldr a, [z, j, lsl #3] ldr b, [m, j, lsl #3] sbcs xzr, a, b add j, j, #1 sub a, j, k cbnz a, Lbignum_montifier_cmploop csetm h, cs // Now do a masked subtraction of m for the final reduced result. subs j, xzr, xzr Lbignum_montifier_corrloop: ldr a, [z, j, lsl #3] ldr b, [m, j, lsl #3] and b, b, h sbcs a, a, b str a, [z, j, lsl #3] add j, j, #1 sub a, j, k cbnz a, Lbignum_montifier_corrloop Lbignum_montifier_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_montifier) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
4,888
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_cdiv_exact.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Divide by a single word, z := x / m *when known to be exact* // Inputs x[n], m; output z[k] // // extern void bignum_cdiv_exact(uint64_t k, uint64_t *z, uint64_t n, // const uint64_t *x, uint64_t m); // // Does the "z := x / m" operation where x is n digits and result z is k, // *assuming* that m is nonzero and that the input x is in fact an // exact multiple of m. (If this isn't known, use the general bignum_cdiv // function instead.) In general the result is truncated to k digits. // // Standard ARM ABI: X0 = k, X1 = z, X2 = n, X3 = x, X4 = m // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_cdiv_exact) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_cdiv_exact) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_cdiv_exact) .text .balign 4 #define k x0 #define z x1 #define n x2 #define x x3 #define m x4 // Main variables #define w x5 #define i x6 #define a x7 #define c x8 #define d x9 #define e x10 #define f x11 #define l x12 // These two are the same #define h x13 #define q x13 // Variables for the negmodinv #define one x6 #define e1 x6 #define e2 x7 #define e4 x6 #define e8 x7 S2N_BN_SYMBOL(bignum_cdiv_exact): CFI_START // If k = 0 then there's nothing to be done cbz k, Lbignum_cdiv_exact_end // Let e be the number of trailing zeros in m. This implementation uses // 63 - clz(-m & m) which is a bit slicker than the main word_ctz function // but fails for m = 0. We don't have to worry about that case here. neg e, m and e, e, m clz e, e eor e, e, #63 // Also generate a corresponding bitmask f for selecting bottom 64 - e bits. mov f, #-1 lsr f, f, e // Now just shift m right by e bits. So hereafter we can assume m is odd // but we first need to shift the input right by e bits then divide by m. lsr m, m, e // Compute the negated modular inverse w with w * m + 1 == 0 (mod 2^64) // This is essentially the same as word_negmodinv. sub w, m, m, lsl #2 eor w, w, #2 mov one, #1 madd e1, m, w, one mul e2, e1, e1 madd w, e1, w, w mul e4, e2, e2 madd w, e2, w, w mul e8, e4, e4 madd w, e4, w, w madd w, e8, w, w // Consider x' = x + m and do a Montgomery reduction, keeping the cofactor z. // This gives us x' + m * z = 2^{64k} * c where c <= m. Assuming x = m * y // we then have m * y + m + m * z = 2^{64k} * c, i.e. // // m * (y + z + 1) = 2^{64k} * c // // This means m * (y + z + 1) == 0 (mod 2^{64k}), even when we truncate // x to k digits (if in fact k < n). Since m is odd, it's coprime to // 2^{64k} so we can cancel and get y + z + 1 == 0 (mod 2^{64k}), and // hence using logical complement y == ~z (mod 2^{64k}). Thus we can // write back the logical complements of the cofactor as the answer. // Start with carry word c = m to make the initial tweak x' = x + m. mov c, m mov i, xzr // Unless n = 0, preload the zeroth digit shifted right e places and bump // up the x pointer by 8 and n down by 1, to ease indexing and comparison // using the same variable i in the main loop. When n = 0 we leave it alone, // as the comparison i < n will always fail and the x pointer is unused. mov d, xzr cbz n, Lbignum_cdiv_exact_loop ldr d, [x], #8 lsr d, d, e sub n, n, 1 Lbignum_cdiv_exact_loop: // Load the next digit up to get [l,d] then shift right e places, // eventually setting d back to the other part of the newly loaded digit // ready for the next time round the loop. mov l, xzr cmp i, n bcs Lbignum_cdiv_exact_noload ldr l, [x, i, lsl #3] Lbignum_cdiv_exact_noload: rorv l, l, e bic a, l, f orr a, d, a and d, l, f // Now a is the next digit after shifting right by e places, c the carry-in. // Do the main Montgomery step with the (odd) m, writing back ~q. adds a, a, c mul q, a, w cset c, cs mvn l, q str l, [z, i, lsl #3] mul l, q, m umulh h, q, m adds l, l, a adc c, h, c add i, i, #1 cmp i, k bcc Lbignum_cdiv_exact_loop Lbignum_cdiv_exact_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_cdiv_exact) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,033
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_optneg.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Optionally negate, z := -x (if p nonzero) or z := x (if p zero) // Inputs p, x[k]; outputs function return (nonzero input) and z[k] // // extern uint64_t bignum_optneg(uint64_t k, uint64_t *z, uint64_t p, // const uint64_t *x); // // It is assumed that both numbers x and z have the same size k digits. // Returns a carry, which is equivalent to "x is nonzero". // // Standard ARM ABI: X0 = k, X1 = z, X2 = p, X3 = x, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_optneg) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_optneg) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_optneg) .text .balign 4 #define k x0 #define z x1 #define p x2 #define x x3 #define a x4 #define i x5 S2N_BN_SYMBOL(bignum_optneg): CFI_START // if k = 0 do nothing. This also has the right top carry zero in x0 cbz k, Lbignum_optneg_end // Convert p into a strict bitmask cmp p, xzr csetm p, ne // Generate an initial carry-in for the negating case only to add 1; this // is because we are actually going to do complements of the words of x adds xzr, p, p // Main loop mov i, xzr Lbignum_optneg_loop: ldr a, [x, i] eor a, a, p adcs a, a, xzr str a, [z, i] add i, i, #8 sub k, k, #1 cbnz k, Lbignum_optneg_loop // Return carry flag, fixing up inversion for negative case adc x0, xzr, xzr neg p, p eor x0, x0, p Lbignum_optneg_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_optneg) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,515
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_of_word.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Convert single digit to bignum, z := n // Input n; output z[k] // // extern void bignum_of_word(uint64_t k, uint64_t *z, uint64_t n); // // Create a k-digit (digit=64 bits) bignum at z with value n (mod 2^k) // where n is a word. The "mod 2^k" only matters in the degenerate k = 0 case. // // Standard ARM ABI: X0 = k, X1 = z, X2 = n // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_of_word) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_of_word) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_of_word) .text .balign 4 #define k x0 #define z x1 #define n x2 S2N_BN_SYMBOL(bignum_of_word): CFI_START cbz k, Lbignum_of_word_end // if k = 0 do nothing str n, [z] // Set zeroth word to n subs k, k, #1 // k := k - 1 beq Lbignum_of_word_end // and if that's 0, finish Lbignum_of_word_loop: str xzr, [z, k, lsl #3] subs k, k, #1 bne Lbignum_of_word_loop Lbignum_of_word_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_of_word) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,823
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_mux16.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Select element from 16-element table, z := xs[k*i] // Inputs xs[16*k], i; output z[k] // // extern void bignum_mux16(uint64_t k, uint64_t *z, const uint64_t *xs, // uint64_t i); // // It is assumed that all numbers xs[16] and the target z have the same size k // The pointer xs is to a contiguous array of size 16, elements size-k bignums // // Standard ARM ABI: X0 = k, X1 = z, X2 = xs, X3 = i // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mux16) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mux16) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mux16) .text .balign 4 #define k x0 #define z x1 #define x x2 #define i x3 #define a x4 #define b x5 #define j x6 #define n x7 S2N_BN_SYMBOL(bignum_mux16): CFI_START // Copy size into decrementable counter, skip everything if k = 0 adds n, k, xzr beq Lbignum_mux16_end // Multiply i by k so we can compare pointer offsets directly with it mul i, i, k Lbignum_mux16_loop: ldr a, [x] mov j, k .rep 15 ldr b, [x, j, lsl #3] cmp j, i csel a, b, a, eq add j, j, k .endr str a, [z] add z, z, #8 add x, x, #8 subs n, n, #1 bne Lbignum_mux16_loop Lbignum_mux16_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mux16) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
1,727
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_pow2.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Return bignum of power of 2, z := 2^n // Input n; output z[k] // // extern void bignum_pow2(uint64_t k, uint64_t *z, uint64_t n); // // The result is as usual mod 2^{64*k}, so will be zero if n >= 64*k. // // Standard ARM ABI: X0 = k, X1 = z, X2 = n // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_pow2) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_pow2) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_pow2) .text .balign 4 #define k x0 #define z x1 #define n x2 #define w x3 #define i x4 #define a x5 S2N_BN_SYMBOL(bignum_pow2): CFI_START // If k = 0 the result is trivially zero cbz k, Lbignum_pow2_end // Create the index n at which to write the nonzero word and the word w itself // Note that the ARM manual explicitly says that shift counts are taken modulo // the datasize, so we don't need to mask the lower 6 bits of n ourselves. mov w, #1 lsl w, w, n lsr n, n, #6 // Now in a constant-time fashion set the n'th word to w and others to zero mov i, xzr Lbignum_pow2_loop: cmp i, n csel a, w, xzr, eq str a, [z, i, lsl #3] add i, i, #1 cmp i, k bcc Lbignum_pow2_loop Lbignum_pow2_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_pow2) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
7,557
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/word_divstep59.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Perform 59 "divstep" iterations and return signed matrix of updates // Inputs d, f, g; output m[2][2] and function return (updated d) // // extern int64_t word_divstep59 // (int64_t m[2][2],int64_t d,uint64_t f,uint64_t g); // // Standard ARM ABI: X0 = m, X1 = d, X2 = f, X3 = g, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(word_divstep59) S2N_BN_FUNCTION_TYPE_DIRECTIVE(word_divstep59) S2N_BN_SYM_PRIVACY_DIRECTIVE(word_divstep59) .text .balign 4 #define m x0 #define d x1 #define f x2 #define g x3 #define fuv x4 #define grs x5 #define t x6 #define n x7 #define m00 x8 #define m01 x9 #define m10 x10 #define m11 x11 #define n00 x12 #define n01 x13 #define n10 x14 #define n11 x15 S2N_BN_SYMBOL(word_divstep59): CFI_START // Pack f and g into single registers with (negated) update matrices, // initially the identity matrix. The f_lo and g_lo are initially // the 20 lowest bits of f and g. // // fuv = f_lo - 2^41 * 1 - 2^62 * 0 // grs = g_lo - 2^41 * 0 - 2^62 * 1 and fuv, f, #0xFFFFF orr fuv, fuv, 0xFFFFFE0000000000 and grs, g, #0xFFFFF orr grs, grs, 0xc000000000000000 tst grs, #1 // Now do 20 divsteps on that packed format. // // At the i'th iteration (starting at i = 0, ending at i = 20) // the intermediate packed values are of the form // // fuv = f_lo - 2^{41-i} * m00 - 2^{62-i} * m01 // grs = g_lo - 2^{41-i} * m10 - 2^{62-i} * m11 // // where the following matrix indicates the updates to apply // to the original (full-sized) f and g for those iterations. // // [m00 m01] * [f_0] = [f_i] // [m10 m11] [g_0] [g_i] .set i, 0 .rep 20 csel t, fuv, xzr, ne ccmp d, xzr, #8, ne cneg d, d, ge cneg t, t, ge csel fuv, grs, fuv, ge add grs, grs, t add d, d, #2 .if (i< 19) tst grs, #2 .endif asr grs, grs, #1 .set i, (i+1) .endr // Extract the matrix entries, but keep them in negated form. add m00, fuv, #1048576 sbfx m00, m00, #21, #21 mov m11, #1048576 add m11, m11, m11, lsl #21 add m01, fuv, m11 asr m01, m01, #42 add m10, grs, #1048576 sbfx m10, m10, #21, #21 add m11, grs, m11 asr m11, m11, #42 // Compute updated f and g using the negated matrix entries; // this flips the signs of f and g but it doesn't matter. // // f = (m00 * f + m01 * g) / 2^20 // g = (m10 * f + m11 * g) / 2^20 // // Since we only need another 40 bits, we can do all of that // computation naively using (implicitly signed) 64-bit words. mul t, m00, f mul n, m01, g mul f, m10, f mul g, m11, g add fuv, t, n add grs, f, g asr f, fuv, #20 asr g, grs, #20 // Re-pack for 20 more rounds and fuv, f, #0xFFFFF orr fuv, fuv, 0xFFFFFE0000000000 and grs, g, #0xFFFFF orr grs, grs, 0xc000000000000000 tst grs, #1 // Second block of 20 divsteps in the same style .set i, 0 .rep 20 csel t, fuv, xzr, ne ccmp d, xzr, #8, ne cneg d, d, ge cneg t, t, ge csel fuv, grs, fuv, ge add grs, grs, t add d, d, #2 .if (i< 19) tst grs, #2 .endif asr grs, grs, #1 .set i, (i+1) .endr // Extract the next matrix entries, in negated form again add n00, fuv, #1048576 sbfx n00, n00, #21, #21 mov n11, #1048576 add n11, n11, n11, lsl #21 add n01, fuv, n11 asr n01, n01, #42 add n10, grs, #1048576 sbfx n10, n10, #21, #21 add n11, grs, n11 asr n11, n11, #42 // Compute updated f and g using the negated matrix entries, // and so again flipping (thus actually restoring) the signs. // // f = (n00 * f + n01 * g) / 2^20 // g = (n10 * f + n11 * g) / 2^20 mul t, n00, f mul n, n01, g mul f, n10, f mul g, n11, g add fuv, t, n add grs, f, g asr f, fuv, #20 asr g, grs, #20 // Re-pack for 19 more rounds and fuv, f, #0xFFFFF orr fuv, fuv, 0xFFFFFE0000000000 and grs, g, #0xFFFFF orr grs, grs, 0xc000000000000000 tst grs, #1 // Split the last divsteps into two blocks of 10 and 9 to insert the matrix // multiplication in between them. The first ten iterations: .set i, 0 .rep 10 csel t, fuv, xzr, ne ccmp d, xzr, #8, ne cneg d, d, ge cneg t, t, ge csel fuv, grs, fuv, ge add grs, grs, t add d, d, #2 tst grs, #2 asr grs, grs, #1 .set i, (i+1) .endr // Multiply the first two matrices. // // [m00 m01] = [n00 n01] * [m00 m01] // [m10 m11] [n10 n11] [m10 m11] // // The resulting matrix entries are: // // m00' = n00 * m00 + n01 * m10 // m01' = n00 * m01 + n01 * m11 // m10' = n10 * m00 + n11 * m10 // m11' = n10 * m01 + n11 * m11 mul f, n00, m00 mul g, n00, m01 mul t, n10, m00 mul n, n10, m01 madd m00, n01, m10, f madd m01, n01, m11, g madd m10, n11, m10, t madd m11, n11, m11, n // Now the final 9 divsteps .rep 9 csel t, fuv, xzr, ne ccmp d, xzr, #8, ne cneg d, d, ge cneg t, t, ge csel fuv, grs, fuv, ge add grs, grs, t add d, d, #2 .if (i< 18) tst grs, #2 .endif asr grs, grs, #1 .set i, (i+1) .endr // Extract the matrix entries from the final 19 divsteps add n00, fuv, #1048576 sbfx n00, n00, #22, #21 mov n11, #1048576 add n11, n11, n11, lsl #21 add n01, fuv, n11 asr n01, n01, #43 add n10, grs, #1048576 sbfx n10, n10, #22, #21 add n11, grs, n11 asr n11, n11, #43 // Multiply by this new matrix // // [m00 m01] = [n00 n01] * [m00 m01] // [m10 m11] [n10 n11] [m10 m11] // // The resulting matrix entries are: // // m00' = n00 * m00 + n01 * m10 // m01' = n00 * m01 + n01 * m11 // m10' = n10 * m00 + n11 * m10 // m11' = n10 * m01 + n11 * m11 // // Since we didn't negate the n matrix, all products are negated // here using "mneg" and "msub" in place of "mul" and "madd", so // we have the correct sign for the returned composite matrix. mneg f, n00, m00 mneg g, n00, m01 mneg fuv, n10, m00 mneg grs, n10, m01 msub m00, n01, m10, f msub m01, n01, m11, g msub m10, n11, m10, fuv msub m11, n11, m11, grs // Finally store back and return final d. stp m00, m01, [m] stp m10, m11, [m, #16] mov x0, d CFI_RET S2N_BN_SIZE_DIRECTIVE(word_divstep59) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,520
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_sqr.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Square z := x^2 // Input x[n]; output z[k] // // extern void bignum_sqr(uint64_t k, uint64_t *z, uint64_t n, const uint64_t *x); // // Does the "z := x^2" operation where x is n digits and result z is k. // Truncates the result in general unless k >= 2 * n // // Standard ARM ABI: X0 = k, X1 = z, X2 = n, X3 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sqr) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_sqr) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sqr) .text .balign 4 #define p x0 #define z x1 #define n x2 #define x x3 #define l x4 #define h x5 #define c x6 #define k x7 #define i x8 #define a x9 #define b x10 #define d x11 #define y x12 #define htop x13 #define hh x14 #define ll x15 S2N_BN_SYMBOL(bignum_sqr): CFI_START // If p = 0 the result is trivial and nothing needs doing cbz p, Lbignum_sqr_end // initialize (hh,ll) = 0 mov ll, xzr mov hh, xzr // Iterate outer loop from k = 0 ... k = p - 1 producing result digits mov k, xzr Lbignum_sqr_outerloop: // First let bot = MAX 0 (k + 1 - n) and top = MIN (k + 1) n // We want to accumulate all x[i] * x[k - i] for bot <= i < top // For the optimization of squaring we avoid duplication and do // 2 * x[i] * x[k - i] for i < htop, where htop = MIN ((k+1)/2) n // Initialize i = bot; in fact just compute bot as i directly. add i, k, #1 lsr htop, i, #1 cmp htop, n csel htop, htop, n, cc subs i, i, n csel i, i, xzr, cs // Initialize the three-part local sum (c,h,l) mov l, xzr mov h, xzr mov c, xzr // If htop <= bot then main doubled part of the sum is empty cmp htop, i bls Lbignum_sqr_nosumming // Use a moving pointer for [y] = x[k-i] for the cofactor sub y, k, i lsl y, y, #3 add y, x, y // Do the main part of the sum x[i] * x[k - i] for 2 * i < k Lbignum_sqr_innerloop: ldr a, [x, i, lsl #3] ldr b, [y], #-8 mul d, a, b umulh a, a, b adds l, l, d adcs h, h, a adc c, c, xzr add i, i, #1 cmp i, htop bne Lbignum_sqr_innerloop // Now double it adds l, l, l adcs h, h, h adc c, c, c // If k is even (which means 2 * i = k) and i < n add the extra x[i]^2 term Lbignum_sqr_nosumming: ands xzr, k, #1 bne Lbignum_sqr_innerend cmp i, n bcs Lbignum_sqr_innerend ldr a, [x, i, lsl #3] mul d, a, a umulh a, a, a adds ll, ll, d adcs hh, hh, a adc c, c, xzr // Now add the local sum into the global sum, store and shift Lbignum_sqr_innerend: adds l, l, ll str l, [z, k, lsl #3] adcs ll, h, hh adc hh, c, xzr add k, k, #1 cmp k, p bcc Lbignum_sqr_outerloop Lbignum_sqr_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_sqr) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,425
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_cmadd.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply-add with single-word multiplier, z := z + c * y // Inputs c, y[n]; outputs function return (carry-out) and z[k] // // extern uint64_t bignum_cmadd(uint64_t k, uint64_t *z, uint64_t c, uint64_t n, // const uint64_t *y); // // Does the "z := z + c * y" operation where y is n digits, result z is p. // Truncates the result in general. // // The return value is a high/carry word that is meaningful when p = n + 1, or // more generally when n <= p and the result fits in p + 1 digits. In these // cases it gives the top digit of the (p + 1)-digit result. // // Standard ARM ABI: X0 = k, X1 = z, X2 = c, X3 = n, X4 = y, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_cmadd) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_cmadd) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_cmadd) .text .balign 4 #define p x0 #define z x1 #define c x2 #define n x3 #define x x4 #define i x5 #define h x6 #define l x7 #define a x8 #define b x9 S2N_BN_SYMBOL(bignum_cmadd): CFI_START // First clamp the input size n := min(p,n) since we can never need to read // past the p'th term of the input to generate p-digit output. // Subtract p := p - min(n,p) so it holds the size of the extra tail needed cmp n, p csel n, p, n, cs sub p, p, n // Initialize high part h = 0; if n = 0 do nothing but return that zero adds h, xzr, xzr cbz n, Lbignum_cmadd_end // Initialization of the loop: 2^64 * CF + [h,z_0'] = z_0 + c * x_0 ldr a, [x] mul l, c, a umulh h, c, a ldr b, [z] adds b, b, l str b, [z] mov i, #8 sub n, n, #1 cbz n, Lbignum_cmadd_tail // Main loop, where we always have CF + previous high part h to add in Lbignum_cmadd_loop: ldr a, [x, i] ldr b, [z, i] mul l, c, a adcs b, b, h umulh h, c, a adc h, h, xzr adds b, b, l str b, [z, i] add i, i, #8 sub n, n, #1 cbnz n, Lbignum_cmadd_loop // Propagate the carry all the way to the end with h as extra carry word Lbignum_cmadd_tail: cbz p, Lbignum_cmadd_end ldr b, [z, i] adcs b, b, h str b, [z, i] mov h, xzr sub p, p, #1 cbz p, Lbignum_cmadd_end Lbignum_cmadd_tloop: add i, i, #8 ldr b, [z, i] adcs b, b, xzr str b, [z, i] sub p, p, #1 cbnz p, Lbignum_cmadd_tloop // Return the high/carry word. This gives the top word of the result provided // n <= p and the result fits in p + 1 digits. More generally, indeed, the // 2^64 * CF + return = the top part of the result whenever n <= p, though this // is not very exploitable from a C call. Lbignum_cmadd_end: adcs x0, h, xzr CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_cmadd) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
4,803
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_copy_row_from_table_32.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Given table: uint64_t[height*32], copy table[idx*32...(idx+1)*32-1] // into z[0..row-1]. // This function is constant-time with respect to the value of `idx`. This is // achieved by reading the whole table and using the bit-masking to get the // `idx`-th row. // // extern void bignum_copy_row_from_table_32 // (uint64_t *z, const uint64_t *table, uint64_t height, uint64_t idx); // // Initial version written by Hanno Becker // Standard ARM ABI: X0 = z, X1 = table, X2 = height, X3 = idx // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_copy_row_from_table_32) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_copy_row_from_table_32) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_copy_row_from_table_32) .text .balign 4 // ***************************************************** // Main code // ***************************************************** #define z x0 #define tbl x1 #define height x2 #define idx x3 #define mask x5 #define cnt x6 #define ventry0 v20 #define qentry0 q20 #define ventry1 v21 #define qentry1 q21 #define ventry2 v22 #define qentry2 q22 #define ventry3 v23 #define qentry3 q23 #define ventry4 v24 #define qentry4 q24 #define ventry5 v25 #define qentry5 q25 #define ventry6 v26 #define qentry6 q26 #define ventry7 v27 #define qentry7 q27 #define ventry8 v28 #define qentry8 q28 #define ventry9 v29 #define qentry9 q29 #define ventry10 v30 #define qentry10 q30 #define ventry11 v31 #define qentry11 q31 #define ventry12 v0 #define qentry12 q0 #define ventry13 v1 #define qentry13 q1 #define ventry14 v2 #define qentry14 q2 #define ventry15 v3 #define qentry15 q3 #define vtmp v16 #define qtmp q16 #define vmask v17 S2N_BN_SYMBOL(bignum_copy_row_from_table_32): CFI_START // Clear accumulator // Zeroing can be done via xor, but xor isn't formalized yet. dup ventry0.2d, xzr mov ventry1.16b, ventry0.16b mov ventry2.16b, ventry0.16b mov ventry3.16b, ventry0.16b mov ventry4.16b, ventry0.16b mov ventry5.16b, ventry0.16b mov ventry6.16b, ventry0.16b mov ventry7.16b, ventry0.16b mov ventry8.16b, ventry0.16b mov ventry9.16b, ventry0.16b mov ventry10.16b, ventry0.16b mov ventry11.16b, ventry0.16b mov ventry12.16b, ventry0.16b mov ventry13.16b, ventry0.16b mov ventry14.16b, ventry0.16b mov ventry15.16b, ventry0.16b mov cnt, #0 Lbignum_copy_row_from_table_32_loop: // Compute mask: Check if current index matches target index subs xzr, cnt, idx cinv mask, xzr, eq dup vmask.2d, mask ldr qtmp, [tbl, #16*0] bit ventry0.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*1] bit ventry1.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*2] bit ventry2.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*3] bit ventry3.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*4] bit ventry4.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*5] bit ventry5.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*6] bit ventry6.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*7] bit ventry7.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*8] bit ventry8.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*9] bit ventry9.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*10] bit ventry10.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*11] bit ventry11.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*12] bit ventry12.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*13] bit ventry13.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*14] bit ventry14.16b, vtmp.16b, vmask.16b ldr qtmp, [tbl, #16*15] bit ventry15.16b, vtmp.16b, vmask.16b add tbl, tbl, #32*8 add cnt, cnt, #1 subs xzr, height, cnt b.ne Lbignum_copy_row_from_table_32_loop Lbignum_copy_row_from_table_32_end: str qentry0, [z, #16*0] str qentry1, [z, #16*1] str qentry2, [z, #16*2] str qentry3, [z, #16*3] str qentry4, [z, #16*4] str qentry5, [z, #16*5] str qentry6, [z, #16*6] str qentry7, [z, #16*7] str qentry8, [z, #16*8] str qentry9, [z, #16*9] str qentry10, [z, #16*10] str qentry11, [z, #16*11] str qentry12, [z, #16*12] str qentry13, [z, #16*13] str qentry14, [z, #16*14] str qentry15, [z, #16*15] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_copy_row_from_table_32) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,993
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_mul.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply z := x * y // Inputs x[m], y[n]; output z[k] // // extern void bignum_mul(uint64_t k, uint64_t *z, uint64_t m, const uint64_t *x, // uint64_t n, const uint64_t *y); // // Does the "z := x * y" operation where x is m digits, y is n, result z is k. // Truncates the result in general unless k >= m + n // // Standard ARM ABI: X0 = k, X1 = z, X2 = m, X3 = x, X4 = n, X5 = y // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mul) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul) .text .balign 4 #define p x0 #define z x1 #define m x2 #define x x3 #define n x4 #define y x5 #define l x6 #define h x7 #define c x8 #define k x9 #define i x10 #define a x11 #define b x12 #define d x13 #define xx x14 #define yy x15 S2N_BN_SYMBOL(bignum_mul): CFI_START // If p = 0 the result is trivial and nothing needs doing cbz p, Lbignum_mul_end // initialize (h,l) = 0, saving c = 0 for inside the loop mov l, xzr mov h, xzr // Iterate outer loop from k = 0 ... k = p - 1 producing result digits mov k, xzr Lbignum_mul_outerloop: // Zero the carry for this stage mov c, xzr // First let a = MAX 0 (k + 1 - n) and b = MIN (k + 1) m // We want to accumulate all x[i] * y[k - i] for a <= i < b add a, k, #1 cmp a, m csel b, a, m, cc subs a, a, n csel a, a, xzr, cs // Set loop count i = b - a, and skip everything if it's <= 0 subs i, b, a bls Lbignum_mul_innerend // Use temporary pointers xx = x + 8 * a and yy = y + 8 * (k - b) // Increment xx per iteration but just use loop counter with yy // So we start with [xx] = x[a] and [yy] = y[(k - b) + (b - a)] = y[k - a] lsl xx, a, #3 add xx, xx, x sub yy, k, b lsl yy, yy, #3 add yy, yy, y // And index using the loop counter i = b - a, ..., i = 1 Lbignum_mul_innerloop: ldr a, [xx], #8 ldr b, [yy, i, lsl #3] mul d, a, b umulh a, a, b adds l, l, d adcs h, h, a adc c, c, xzr subs i, i, #1 bne Lbignum_mul_innerloop Lbignum_mul_innerend: str l, [z, k, lsl #3] mov l, h mov h, c add k, k, #1 cmp k, p bcc Lbignum_mul_outerloop // Inverted carry flag! Lbignum_mul_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mul) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,152
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_modoptneg.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Optionally negate modulo m, z := (-x) mod m (if p nonzero) or z := x // (if p zero), assuming x reduced // Inputs p, x[k], m[k]; output z[k] // // extern void bignum_modoptneg(uint64_t k, uint64_t *z, uint64_t p, // const uint64_t *x, const uint64_t *m); // // Standard ARM ABI: X0 = k, X1 = z, X2 = p, X3 = x, X4 = m // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_modoptneg) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_modoptneg) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_modoptneg) .text .balign 4 #define k x0 #define z x1 #define p x2 #define x x3 #define m x4 #define i x5 #define a x6 #define b x7 S2N_BN_SYMBOL(bignum_modoptneg): CFI_START // Do nothing if k = 0 cbz k, Lbignum_modoptneg_end // Make an additional check for zero input, and force p to zero in this case. // This can be skipped if the input is known not to be zero a priori. mov i, xzr mov a, xzr Lbignum_modoptneg_cmploop: ldr b, [x, i, lsl #3] orr a, a, b add i, i, #1 cmp i, k bcc Lbignum_modoptneg_cmploop cmp a, xzr csel p, p, xzr, ne // Turn the input p into a strict bitmask cmp p, xzr csetm p, ne // Main loop mov i, xzr adds xzr, p, p Lbignum_modoptneg_mainloop: ldr a, [m, i, lsl #3] ldr b, [x, i, lsl #3] and a, a, p eor b, b, p adcs a, a, b str a, [z, i, lsl #3] add i, i, #1 sub a, i, k cbnz a, Lbignum_modoptneg_mainloop Lbignum_modoptneg_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_modoptneg) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
4,021
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_negmodinv.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Negated modular inverse, z := (-1/x) mod 2^{64k} // Input x[k]; output z[k] // // extern void bignum_negmodinv(uint64_t k, uint64_t *z, const uint64_t *x); // // Assuming x is odd (otherwise nothing makes sense) the result satisfies // // x * z + 1 == 0 (mod 2^{64 * k}) // // but is not necessarily reduced mod x. // // Standard ARM ABI: X0 = k, X1 = z, X2 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_negmodinv) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_negmodinv) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_negmodinv) .text .balign 4 #define k x0 #define z x1 #define x x2 #define w x3 #define a x4 #define m x5 #define h x6 #define l x7 #define e x8 #define i x9 S2N_BN_SYMBOL(bignum_negmodinv): CFI_START // If k = 0 do nothing cbz k, Lbignum_negmodinv_end // Compute word-level negated modular inverse w for x[0]. ldr a, [x] lsl w, a, #2 sub w, a, w eor w, w, #2 mov h, #1 madd h, a, w, h mul l, h, h madd w, h, w, w mul h, l, l madd w, l, w, w mul l, h, h madd w, h, w, w madd w, l, w, w // Write that as lowest word of the output, then if k = 1 we're finished str w, [z] cmp k, #1 beq Lbignum_negmodinv_end // Otherwise compute and write the other digits (1..k-1) of w * x + 1. // Note that at this point CF was set by the comparison (subtraction) "k - 1". // Since k >= 2 if we got here, this subtraction didn't carry; allowing // for the inverted carry on ARM that means that CF is guaranteed to be set. // This allows us to ignore the nominal "a * w + 1" from adding the low // part of the product, since its only contribution is to set the carry // flag. Thus, we only calculate the high part of a * w explicitly. umulh h, a, w mov i, #1 Lbignum_negmodinv_initloop: ldr a, [x, i, lsl #3] mul l, a, w adcs l, l, h umulh h, a, w str l, [z, i, lsl #3] add i, i, #1 sub a, k, i cbnz a, Lbignum_negmodinv_initloop // For simpler indexing, z := z + 8 and k := k - 1 per outer iteration // Then we can use the same index for x and for z and effective size k. // // But we also offset k by 1 so the "real" size is k + 1, which is why the // test at the end of the inner loop is i < k <=> i' = i + 1 < k + 1. // This lets us avoid some special cases inside the loop at the cost // of needing the additional "finale" tail for the final iteration // since we do one outer loop iteration too few. subs k, k, #2 beq Lbignum_negmodinv_finale Lbignum_negmodinv_outerloop: add z, z, #8 ldr e, [z] mul m, e, w str m, [z] ldr a, [x] umulh h, a, m subs xzr, e, #1 // Effective carry from a * m + e mov i, #1 Lbignum_negmodinv_innerloop: ldr a, [x, i, lsl #3] ldr e, [z, i, lsl #3] mul l, a, m adcs e, e, h umulh h, a, m adc h, h, xzr adds e, e, l str e, [z, i, lsl #3] sub a, i, k add i, i, #1 cbnz a, Lbignum_negmodinv_innerloop subs k, k, #1 bne Lbignum_negmodinv_outerloop Lbignum_negmodinv_finale: ldr e, [z, #8] mul m, e, w str m, [z, #8] Lbignum_negmodinv_end: CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_negmodinv) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,325
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/generic/word_negmodinv.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Single-word negated modular inverse (-1/a) mod 2^64 // Input a; output function return // // extern uint64_t word_negmodinv(uint64_t a); // // A 64-bit function that returns a negated multiplicative inverse mod 2^64 // of its input, assuming that input is odd. Given odd input a, the result z // will satisfy a * z + 1 == 0 (mod 2^64), i.e. a 64-bit word multiplication // a * z will give -1. // // Standard ARM ABI: X0 = a, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(word_negmodinv) S2N_BN_FUNCTION_TYPE_DIRECTIVE(word_negmodinv) S2N_BN_SYM_PRIVACY_DIRECTIVE(word_negmodinv) .text .balign 4 // Use some more intuitive variable names but these in general are aliased // to each other so need care when interpreting. Overall we only use the // registers x0, x1 and x2. // // There does seem a slight efficiency advantage in putting e' = e^2 // before the x' = x (1 + e) each time. That's the only reason for not // reversing those and hence being able to alias all the e values to the // same register. #define a x0 #define x x1 #define one x2 #define e1 x2 #define e2 x0 #define e4 x2 #define e8 x0 S2N_BN_SYMBOL(word_negmodinv): CFI_START // Initial magical 5-bit approximation x = (a - a<<2) xor 2 lsl x, a, #2 sub x, a, x eor x, x, #2 // Get error e = a * x + 1 for subsequent correction steps mov one, #1 madd e1, a, x, one // e2 = e^2, x' = x (1 + e) is good to 10 bits mul e2, e1, e1 madd x, e1, x, x // e4 = e^4, x' = x (1 + e^2) is good to 20 bits mul e4, e2, e2 madd x, e2, x, x // e8 = e^8, x' = x (1 + e^4) is good to 40 bits mul e8, e4, e4 madd x, e4, x, x // Final x' = x (1 + e^8) is good to the 64-bit word size madd x0, e8, x, x CFI_RET S2N_BN_SIZE_DIRECTIVE(word_negmodinv) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
3,547
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_mul_4_8_alt.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply z := x * y // Inputs x[4], y[4]; output z[8] // // extern void bignum_mul_4_8_alt(uint64_t z[static 8], const uint64_t x[static 4], // const uint64_t y[static 4]); // // Standard ARM ABI: X0 = z, X1 = x, X2 = y // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul_4_8_alt) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mul_4_8_alt) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul_4_8_alt) .text .balign 4 #define z x0 #define x x1 #define y x2 #define a0 x3 #define a1 x4 #define a2 x5 #define a3 x6 #define b0 x7 #define b1 x8 #define b2 x9 #define b3 x10 #define t x11 #define u0 x12 #define u1 x13 #define u2 x14 #define u3 x15 #define u4 x16 // These alias to the input arguments when no longer needed #define u5 a0 #define u6 a1 #define u7 a2 S2N_BN_SYMBOL(bignum_mul_4_8_alt): CFI_START // Load operands and set up row 0 = [u4;...;u0] = a0 * [b3;...;b0] ldp a0, a1, [x] ldp b0, b1, [y] mul u0, a0, b0 umulh u1, a0, b0 mul t, a0, b1 umulh u2, a0, b1 adds u1, u1, t ldp b2, b3, [y, #16] mul t, a0, b2 umulh u3, a0, b2 adcs u2, u2, t mul t, a0, b3 umulh u4, a0, b3 adcs u3, u3, t adc u4, u4, xzr ldp a2, a3, [x, #16] // Row 1 = [u5;...;u0] = [a1;a0] * [b3;...;b0] mul t, a1, b0 adds u1, u1, t mul t, a1, b1 adcs u2, u2, t mul t, a1, b2 adcs u3, u3, t mul t, a1, b3 adcs u4, u4, t umulh u5, a1, b3 adc u5, u5, xzr umulh t, a1, b0 adds u2, u2, t umulh t, a1, b1 adcs u3, u3, t umulh t, a1, b2 adcs u4, u4, t adc u5, u5, xzr // Row 2 = [u6;...;u0] = [a2;a1;a0] * [b3;...;b0] mul t, a2, b0 adds u2, u2, t mul t, a2, b1 adcs u3, u3, t mul t, a2, b2 adcs u4, u4, t mul t, a2, b3 adcs u5, u5, t umulh u6, a2, b3 adc u6, u6, xzr umulh t, a2, b0 adds u3, u3, t umulh t, a2, b1 adcs u4, u4, t umulh t, a2, b2 adcs u5, u5, t adc u6, u6, xzr // Row 3 = [u7;...;u0] = [a3;...a0] * [b3;...;b0] mul t, a3, b0 adds u3, u3, t mul t, a3, b1 adcs u4, u4, t mul t, a3, b2 adcs u5, u5, t mul t, a3, b3 adcs u6, u6, t umulh u7, a3, b3 adc u7, u7, xzr umulh t, a3, b0 adds u4, u4, t umulh t, a3, b1 adcs u5, u5, t umulh t, a3, b2 adcs u6, u6, t adc u7, u7, xzr // Store back final result [a3;...a0] * [b3;...;b0] = a * b stp u0, u1, [z] stp u2, u3, [z, #16] stp u4, u5, [z, #32] stp u6, u7, [z, #48] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mul_4_8_alt) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
6,178
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_mul_6_12_alt.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply z := x * y // Inputs x[6], y[6]; output z[12] // // extern void bignum_mul_6_12_alt(uint64_t z[static 12], // const uint64_t x[static 6], // const uint64_t y[static 6]); // // Standard ARM ABI: X0 = z, X1 = x, X2 = y // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul_6_12_alt) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mul_6_12_alt) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul_6_12_alt) .text .balign 4 #define z x0 #define x x1 #define y x2 // These are repeated mod 2 as we load pairs of inputs #define a0 x3 #define a1 x4 #define a2 x3 #define a3 x4 #define a4 x3 #define a5 x4 #define b0 x5 #define b1 x6 #define b2 x7 #define b3 x8 #define b4 x9 #define b5 x10 #define t x11 // These repeat mod 8 as we write back #define u0 x12 #define u1 x13 #define u2 x14 #define u3 x15 #define u4 x16 #define u5 x17 #define u6 x19 #define u7 x20 #define u8 x12 #define u9 x13 #define u10 x14 #define u11 x15 S2N_BN_SYMBOL(bignum_mul_6_12_alt): CFI_START // Save more registers CFI_PUSH2(x19,x20) // Load operands and set up row 0 = [u6;...;u0] = a0 * [b5;...;b0] ldp a0, a1, [x] ldp b0, b1, [y] mul u0, a0, b0 umulh u1, a0, b0 mul t, a0, b1 umulh u2, a0, b1 adds u1, u1, t ldp b2, b3, [y, #16] mul t, a0, b2 umulh u3, a0, b2 adcs u2, u2, t mul t, a0, b3 umulh u4, a0, b3 adcs u3, u3, t ldp b4, b5, [y, #32] mul t, a0, b4 umulh u5, a0, b4 adcs u4, u4, t mul t, a0, b5 umulh u6, a0, b5 adcs u5, u5, t adc u6, u6, xzr // Row 1 = [u7;...;u0] = [a1;a0] * [b5;...;b0] mul t, a1, b0 adds u1, u1, t mul t, a1, b1 adcs u2, u2, t mul t, a1, b2 adcs u3, u3, t mul t, a1, b3 adcs u4, u4, t mul t, a1, b4 adcs u5, u5, t mul t, a1, b5 adcs u6, u6, t cset u7, cs umulh t, a1, b0 adds u2, u2, t umulh t, a1, b1 adcs u3, u3, t umulh t, a1, b2 adcs u4, u4, t umulh t, a1, b3 adcs u5, u5, t umulh t, a1, b4 adcs u6, u6, t umulh t, a1, b5 adc u7, u7, t stp u0, u1, [z] // Row 2 = [u8;...;u0] = [a2;a1;a0] * [b5;...;b0] ldp a2, a3, [x, #16] mul t, a2, b0 adds u2, u2, t mul t, a2, b1 adcs u3, u3, t mul t, a2, b2 adcs u4, u4, t mul t, a2, b3 adcs u5, u5, t mul t, a2, b4 adcs u6, u6, t mul t, a2, b5 adcs u7, u7, t cset u8, cs umulh t, a2, b0 adds u3, u3, t umulh t, a2, b1 adcs u4, u4, t umulh t, a2, b2 adcs u5, u5, t umulh t, a2, b3 adcs u6, u6, t umulh t, a2, b4 adcs u7, u7, t umulh t, a2, b5 adc u8, u8, t // Row 3 = [u9;...;u0] = [a3;a2;a1;a0] * [b5;...;b0] mul t, a3, b0 adds u3, u3, t mul t, a3, b1 adcs u4, u4, t mul t, a3, b2 adcs u5, u5, t mul t, a3, b3 adcs u6, u6, t mul t, a3, b4 adcs u7, u7, t mul t, a3, b5 adcs u8, u8, t cset u9, cs umulh t, a3, b0 adds u4, u4, t umulh t, a3, b1 adcs u5, u5, t umulh t, a3, b2 adcs u6, u6, t umulh t, a3, b3 adcs u7, u7, t umulh t, a3, b4 adcs u8, u8, t umulh t, a3, b5 adc u9, u9, t stp u2, u3, [z, #16] // Row 4 = [u10;...;u0] = [a4;a3;a2;a1;a0] * [b5;...;b0] ldp a4, a5, [x, #32] mul t, a4, b0 adds u4, u4, t mul t, a4, b1 adcs u5, u5, t mul t, a4, b2 adcs u6, u6, t mul t, a4, b3 adcs u7, u7, t mul t, a4, b4 adcs u8, u8, t mul t, a4, b5 adcs u9, u9, t cset u10, cs umulh t, a4, b0 adds u5, u5, t umulh t, a4, b1 adcs u6, u6, t umulh t, a4, b2 adcs u7, u7, t umulh t, a4, b3 adcs u8, u8, t umulh t, a4, b4 adcs u9, u9, t umulh t, a4, b5 adc u10, u10, t // Row 5 = [u11;...;u0] = [a5;a4;a3;a2;a1;a0] * [b5;...;b0] mul t, a5, b0 adds u5, u5, t mul t, a5, b1 adcs u6, u6, t mul t, a5, b2 adcs u7, u7, t mul t, a5, b3 adcs u8, u8, t mul t, a5, b4 adcs u9, u9, t mul t, a5, b5 adcs u10, u10, t cset u11, cs umulh t, a5, b0 adds u6, u6, t umulh t, a5, b1 adcs u7, u7, t umulh t, a5, b2 adcs u8, u8, t umulh t, a5, b3 adcs u9, u9, t umulh t, a5, b4 adcs u10, u10, t umulh t, a5, b5 adc u11, u11, t stp u4, u5, [z, #32] // Store back remaining digits of final result stp u6, u7, [z, #48] stp u8, u9, [z, #64] stp u10, u11, [z, #80] // Restore registers and return CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mul_6_12_alt) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
38,341
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_kmul_32_64.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply z := x * y // Inputs x[32], y[32]; output z[64]; temporary buffer t[>=96] // // extern void bignum_kmul_32_64(uint64_t z[static 64], // const uint64_t x[static 32], // const uint64_t y[static 32], // uint64_t t[static 96]); // // This is a Karatsuba-style function multiplying half-sized results // internally and using temporary buffer t for intermediate results. // // Standard ARM ABI: X0 = z, X1 = x, X2 = y, X3 = t // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_kmul_32_64) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_kmul_32_64) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_kmul_32_64) .text .balign 4 #define K 16 #define L 8 // this is (K/2) #define z x19 #define x x20 #define y x21 #define t x22 #define c x16 S2N_BN_SYMBOL(bignum_kmul_32_64): CFI_START // Save extra registers and return address, store parameters safely CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x24) CFI_PUSH2(x25,x26) CFI_PUSH2(x27,x28) CFI_PUSH2(x29,x30) mov z, x0 mov x, x1 mov y, x2 mov t, x3 // Compute L = x_lo * y_lo in bottom half of buffer (size 16 x 16 -> 32) CFI_BL(Lbignum_kmul_32_64_local_kmul_16_32) // Compute H = x_hi * y_hi in top half of buffer (size 16 x 16 -> 32) add x0, z, #16*K add x1, x, #8*K add x2, y, #8*K mov x3, t CFI_BL(Lbignum_kmul_32_64_local_kmul_16_32) // Compute absolute difference [t..] = |x_lo - x_hi| // and the sign x = sgn(x_lo - x_hi) as a bitmask (all 1s for negative) // Note that we overwrite the pointer x itself with this sign, // which is safe since we no longer need it. ldp x0, x1, [x, #128] ldp x16, x17, [x] subs x0, x0, x16 sbcs x1, x1, x17 ldp x2, x3, [x, #144] ldp x16, x17, [x, #16] sbcs x2, x2, x16 sbcs x3, x3, x17 ldp x4, x5, [x, #160] ldp x16, x17, [x, #32] sbcs x4, x4, x16 sbcs x5, x5, x17 ldp x6, x7, [x, #176] ldp x16, x17, [x, #48] sbcs x6, x6, x16 sbcs x7, x7, x17 ldp x8, x9, [x, #192] ldp x16, x17, [x, #64] sbcs x8, x8, x16 sbcs x9, x9, x17 ldp x10, x11, [x, #208] ldp x16, x17, [x, #80] sbcs x10, x10, x16 sbcs x11, x11, x17 ldp x12, x13, [x, #224] ldp x16, x17, [x, #96] sbcs x12, x12, x16 sbcs x13, x13, x17 ldp x14, x15, [x, #240] ldp x16, x17, [x, #112] sbcs x14, x14, x16 sbcs x15, x15, x17 sbc x, xzr, xzr adds xzr, x, x eor x0, x0, x adcs x0, x0, xzr eor x1, x1, x adcs x1, x1, xzr stp x0, x1, [t] eor x2, x2, x adcs x2, x2, xzr eor x3, x3, x adcs x3, x3, xzr stp x2, x3, [t, #16] eor x4, x4, x adcs x4, x4, xzr eor x5, x5, x adcs x5, x5, xzr stp x4, x5, [t, #32] eor x6, x6, x adcs x6, x6, xzr eor x7, x7, x adcs x7, x7, xzr stp x6, x7, [t, #48] eor x8, x8, x adcs x8, x8, xzr eor x9, x9, x adcs x9, x9, xzr stp x8, x9, [t, #64] eor x10, x10, x adcs x10, x10, xzr eor x11, x11, x adcs x11, x11, xzr stp x10, x11, [t, #80] eor x12, x12, x adcs x12, x12, xzr eor x13, x13, x adcs x13, x13, xzr stp x12, x13, [t, #96] eor x14, x14, x adcs x14, x14, xzr eor x15, x15, x adc x15, x15, xzr stp x14, x15, [t, #112] // Compute the other absolute difference [t+8*K..] = |y_hi - y_lo| // Collect the combined product sign bitmask (all 1s for negative) as // y = sgn((x_lo - x_hi) * (y_hi - y_lo)), overwriting the y pointer. ldp x0, x1, [y] ldp x16, x17, [y, #128] subs x0, x0, x16 sbcs x1, x1, x17 ldp x2, x3, [y, #16] ldp x16, x17, [y, #144] sbcs x2, x2, x16 sbcs x3, x3, x17 ldp x4, x5, [y, #32] ldp x16, x17, [y, #160] sbcs x4, x4, x16 sbcs x5, x5, x17 ldp x6, x7, [y, #48] ldp x16, x17, [y, #176] sbcs x6, x6, x16 sbcs x7, x7, x17 ldp x8, x9, [y, #64] ldp x16, x17, [y, #192] sbcs x8, x8, x16 sbcs x9, x9, x17 ldp x10, x11, [y, #80] ldp x16, x17, [y, #208] sbcs x10, x10, x16 sbcs x11, x11, x17 ldp x12, x13, [y, #96] ldp x16, x17, [y, #224] sbcs x12, x12, x16 sbcs x13, x13, x17 ldp x14, x15, [y, #112] ldp x16, x17, [y, #240] sbcs x14, x14, x16 sbcs x15, x15, x17 sbc y, xzr, xzr adds xzr, y, y eor x0, x0, y adcs x0, x0, xzr eor x1, x1, y adcs x1, x1, xzr stp x0, x1, [t, #128] eor x2, x2, y adcs x2, x2, xzr eor x3, x3, y adcs x3, x3, xzr stp x2, x3, [t, #128+16] eor x4, x4, y adcs x4, x4, xzr eor x5, x5, y adcs x5, x5, xzr stp x4, x5, [t, #128+32] eor x6, x6, y adcs x6, x6, xzr eor x7, x7, y adcs x7, x7, xzr stp x6, x7, [t, #128+48] eor x8, x8, y adcs x8, x8, xzr eor x9, x9, y adcs x9, x9, xzr stp x8, x9, [t, #128+64] eor x10, x10, y adcs x10, x10, xzr eor x11, x11, y adcs x11, x11, xzr stp x10, x11, [t, #128+80] eor x12, x12, y adcs x12, x12, xzr eor x13, x13, y adcs x13, x13, xzr stp x12, x13, [t, #128+96] eor x14, x14, y adcs x14, x14, xzr eor x15, x15, y adc x15, x15, xzr stp x14, x15, [t, #128+112] eor y, y, x // Compute H' = H + L_top in place of H (it cannot overflow) ldp x0, x1, [z, #16*16] ldp x2, x3, [z, #16*L] adds x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*16] ldp x0, x1, [z, #16*17] ldp x2, x3, [z, #16*9] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*17] ldp x0, x1, [z, #16*18] ldp x2, x3, [z, #16*10] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*18] ldp x0, x1, [z, #16*19] ldp x2, x3, [z, #16*11] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*19] ldp x0, x1, [z, #16*20] ldp x2, x3, [z, #16*12] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*20] ldp x0, x1, [z, #16*21] ldp x2, x3, [z, #16*13] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*21] ldp x0, x1, [z, #16*22] ldp x2, x3, [z, #16*14] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*22] ldp x0, x1, [z, #16*23] ldp x2, x3, [z, #16*15] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*23] ldp x0, x1, [z, #16*24] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*24] ldp x0, x1, [z, #16*25] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*25] ldp x0, x1, [z, #16*26] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*26] ldp x0, x1, [z, #16*27] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*27] ldp x0, x1, [z, #16*28] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*28] ldp x0, x1, [z, #16*29] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*29] ldp x0, x1, [z, #16*30] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*30] ldp x0, x1, [z, #16*31] adcs x0, x0, xzr adc x1, x1, xzr stp x0, x1, [z, #16*31] // Compute M = |x_lo - x_hi| * |y_hi - y_lo|, size 32 add x0, t, #16*K mov x1, t add x2, t, #8*K add x3, t, #32*K CFI_BL(Lbignum_kmul_32_64_local_kmul_16_32) // Add the interlocking H' and L_bot terms // Intercept the carry at the 3k position and store it in x. // Again, we no longer need the input x was pointing at. ldp x0, x1, [z, #16*16] ldp x2, x3, [z] adds x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*8] ldp x0, x1, [z, #16*17] ldp x2, x3, [z, #16*1] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*9] ldp x0, x1, [z, #16*18] ldp x2, x3, [z, #16*2] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*10] ldp x0, x1, [z, #16*19] ldp x2, x3, [z, #16*3] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*11] ldp x0, x1, [z, #16*20] ldp x2, x3, [z, #16*4] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*12] ldp x0, x1, [z, #16*21] ldp x2, x3, [z, #16*5] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*13] ldp x0, x1, [z, #16*22] ldp x2, x3, [z, #16*6] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*14] ldp x0, x1, [z, #16*23] ldp x2, x3, [z, #16*7] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*15] ldp x0, x1, [z, #16*16] ldp x2, x3, [z, #16*24] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*16] ldp x0, x1, [z, #16*17] ldp x2, x3, [z, #16*25] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*17] ldp x0, x1, [z, #16*18] ldp x2, x3, [z, #16*26] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*18] ldp x0, x1, [z, #16*19] ldp x2, x3, [z, #16*27] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*19] ldp x0, x1, [z, #16*20] ldp x2, x3, [z, #16*28] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*20] ldp x0, x1, [z, #16*21] ldp x2, x3, [z, #16*29] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*21] ldp x0, x1, [z, #16*22] ldp x2, x3, [z, #16*30] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*22] ldp x0, x1, [z, #16*23] ldp x2, x3, [z, #16*31] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*23] cset x, cs // Add the sign-adjusted mid-term cross product M cmn y, y ldp x0, x1, [z, #128] ldp x2, x3, [t, #128+128] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #128] ldp x0, x1, [z, #144] ldp x2, x3, [t, #128+144] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #144] ldp x0, x1, [z, #160] ldp x2, x3, [t, #128+160] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #160] ldp x0, x1, [z, #176] ldp x2, x3, [t, #128+176] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #176] ldp x0, x1, [z, #192] ldp x2, x3, [t, #128+192] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #192] ldp x0, x1, [z, #208] ldp x2, x3, [t, #128+208] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #208] ldp x0, x1, [z, #224] ldp x2, x3, [t, #128+224] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #224] ldp x0, x1, [z, #240] ldp x2, x3, [t, #128+240] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #240] ldp x0, x1, [z, #256] ldp x2, x3, [t, #128+256] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #256] ldp x0, x1, [z, #272] ldp x2, x3, [t, #128+272] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #272] ldp x0, x1, [z, #288] ldp x2, x3, [t, #128+288] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #288] ldp x0, x1, [z, #304] ldp x2, x3, [t, #128+304] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #304] ldp x0, x1, [z, #320] ldp x2, x3, [t, #128+320] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #320] ldp x0, x1, [z, #336] ldp x2, x3, [t, #128+336] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #336] ldp x0, x1, [z, #352] ldp x2, x3, [t, #128+352] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #352] ldp x0, x1, [z, #368] ldp x2, x3, [t, #128+368] eor x2, x2, y adcs x0, x0, x2 eor x3, x3, y adcs x1, x1, x3 stp x0, x1, [z, #368] // Get the next digits effectively resulting so far starting at 3k // [...,c,c,c,c,x] adcs x, y, x adc c, y, xzr // Now propagate through the top quarter of the result ldp x0, x1, [z, #16*24] adds x0, x0, x adcs x1, x1, c stp x0, x1, [z, #16*24] ldp x0, x1, [z, #16*25] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*25] ldp x0, x1, [z, #16*26] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*26] ldp x0, x1, [z, #16*27] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*27] ldp x0, x1, [z, #16*28] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*28] ldp x0, x1, [z, #16*29] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*29] ldp x0, x1, [z, #16*30] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*30] ldp x0, x1, [z, #16*31] adcs x0, x0, c adc x1, x1, c stp x0, x1, [z, #16*31] // Restore and return CFI_POP2(x29,x30) CFI_POP2(x27,x28) CFI_POP2(x25,x26) CFI_POP2(x23,x24) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_kmul_32_64) // Local copy of bignum_kmul_16_32, identical to main one except that it // only preserves the key registers we need to be stable in the main code. // This includes in turn a copy of bignum_mul_8_16. S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_kmul_32_64_local_kmul_16_32) Lbignum_kmul_32_64_local_kmul_16_32: CFI_START CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x30) mov x25, x0 mov x26, x1 mov x27, x2 mov x28, x3 CFI_BL(Lbignum_kmul_32_64_local_mul_8_16) ldp x10, x11, [x26] ldp x8, x9, [x26, #64] subs x10, x10, x8 sbcs x11, x11, x9 ldp x12, x13, [x26, #16] ldp x8, x9, [x26, #80] sbcs x12, x12, x8 sbcs x13, x13, x9 ldp x14, x15, [x26, #32] ldp x8, x9, [x26, #96] sbcs x14, x14, x8 sbcs x15, x15, x9 ldp x16, x17, [x26, #48] ldp x8, x9, [x26, #112] sbcs x16, x16, x8 sbcs x17, x17, x9 csetm x29, cc cmn x29, x29 eor x10, x10, x29 adcs x10, x10, xzr eor x11, x11, x29 adcs x11, x11, xzr stp x10, x11, [x28] eor x12, x12, x29 adcs x12, x12, xzr eor x13, x13, x29 adcs x13, x13, xzr stp x12, x13, [x28, #16] eor x14, x14, x29 adcs x14, x14, xzr eor x15, x15, x29 adcs x15, x15, xzr stp x14, x15, [x28, #32] eor x16, x16, x29 adcs x16, x16, xzr eor x17, x17, x29 adcs x17, x17, xzr stp x16, x17, [x28, #48] add x0, x25, #0x80 add x1, x26, #0x40 add x2, x27, #0x40 CFI_BL(Lbignum_kmul_32_64_local_mul_8_16) ldp x10, x11, [x27] ldp x8, x9, [x27, #64] subs x10, x8, x10 sbcs x11, x9, x11 ldp x12, x13, [x27, #16] ldp x8, x9, [x27, #80] sbcs x12, x8, x12 sbcs x13, x9, x13 ldp x14, x15, [x27, #32] ldp x8, x9, [x27, #96] sbcs x14, x8, x14 sbcs x15, x9, x15 ldp x16, x17, [x27, #48] ldp x8, x9, [x27, #112] sbcs x16, x8, x16 sbcs x17, x9, x17 csetm x19, cc cmn x19, x19 eor x10, x10, x19 adcs x10, x10, xzr eor x11, x11, x19 adcs x11, x11, xzr stp x10, x11, [x28, #64] eor x12, x12, x19 adcs x12, x12, xzr eor x13, x13, x19 adcs x13, x13, xzr stp x12, x13, [x28, #80] eor x14, x14, x19 adcs x14, x14, xzr eor x15, x15, x19 adcs x15, x15, xzr stp x14, x15, [x28, #96] eor x16, x16, x19 adcs x16, x16, xzr eor x17, x17, x19 adcs x17, x17, xzr stp x16, x17, [x28, #112] eor x29, x29, x19 ldp x10, x11, [x25, #128] ldp x12, x13, [x25, #64] adds x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [x25, #128] ldp x10, x11, [x25, #144] ldp x12, x13, [x25, #80] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [x25, #144] ldp x10, x11, [x25, #160] ldp x12, x13, [x25, #96] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [x25, #160] ldp x10, x11, [x25, #176] ldp x12, x13, [x25, #112] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [x25, #176] ldp x10, x11, [x25, #192] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [x25, #192] ldp x10, x11, [x25, #208] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [x25, #208] ldp x10, x11, [x25, #224] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [x25, #224] ldp x10, x11, [x25, #240] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [x25, #240] add x0, x28, #0x80 mov x1, x28 add x2, x28, #0x40 CFI_BL(Lbignum_kmul_32_64_local_mul_8_16) ldp x0, x1, [x25] ldp x16, x17, [x25, #128] adds x0, x0, x16 adcs x1, x1, x17 ldp x2, x3, [x25, #16] ldp x16, x17, [x25, #144] adcs x2, x2, x16 adcs x3, x3, x17 ldp x4, x5, [x25, #32] ldp x16, x17, [x25, #160] adcs x4, x4, x16 adcs x5, x5, x17 ldp x6, x7, [x25, #48] ldp x16, x17, [x25, #176] adcs x6, x6, x16 adcs x7, x7, x17 ldp x8, x9, [x25, #128] ldp x16, x17, [x25, #192] adcs x8, x8, x16 adcs x9, x9, x17 ldp x10, x11, [x25, #144] ldp x16, x17, [x25, #208] adcs x10, x10, x16 adcs x11, x11, x17 ldp x12, x13, [x25, #160] ldp x16, x17, [x25, #224] adcs x12, x12, x16 adcs x13, x13, x17 ldp x14, x15, [x25, #176] ldp x16, x17, [x25, #240] adcs x14, x14, x16 adcs x15, x15, x17 cset x26, cs cmn x29, x29 ldp x16, x17, [x28, #128] eor x16, x16, x29 adcs x0, x0, x16 eor x17, x17, x29 adcs x1, x1, x17 stp x0, x1, [x25, #64] ldp x16, x17, [x28, #144] eor x16, x16, x29 adcs x2, x2, x16 eor x17, x17, x29 adcs x3, x3, x17 stp x2, x3, [x25, #80] ldp x16, x17, [x28, #160] eor x16, x16, x29 adcs x4, x4, x16 eor x17, x17, x29 adcs x5, x5, x17 stp x4, x5, [x25, #96] ldp x16, x17, [x28, #176] eor x16, x16, x29 adcs x6, x6, x16 eor x17, x17, x29 adcs x7, x7, x17 stp x6, x7, [x25, #112] ldp x16, x17, [x28, #192] eor x16, x16, x29 adcs x8, x8, x16 eor x17, x17, x29 adcs x9, x9, x17 stp x8, x9, [x25, #128] ldp x16, x17, [x28, #208] eor x16, x16, x29 adcs x10, x10, x16 eor x17, x17, x29 adcs x11, x11, x17 stp x10, x11, [x25, #144] ldp x16, x17, [x28, #224] eor x16, x16, x29 adcs x12, x12, x16 eor x17, x17, x29 adcs x13, x13, x17 stp x12, x13, [x25, #160] ldp x16, x17, [x28, #240] eor x16, x16, x29 adcs x14, x14, x16 eor x17, x17, x29 adcs x15, x15, x17 stp x14, x15, [x25, #176] adcs x27, x29, x26 adc x28, x29, xzr ldp x10, x11, [x25, #192] adds x10, x10, x27 adcs x11, x11, x28 stp x10, x11, [x25, #192] ldp x10, x11, [x25, #208] adcs x10, x10, x28 adcs x11, x11, x28 stp x10, x11, [x25, #208] ldp x10, x11, [x25, #224] adcs x10, x10, x28 adcs x11, x11, x28 stp x10, x11, [x25, #224] ldp x10, x11, [x25, #240] adcs x10, x10, x28 adcs x11, x11, x28 stp x10, x11, [x25, #240] CFI_POP2(x23,x30) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_kmul_32_64_local_kmul_16_32) S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_kmul_32_64_local_mul_8_16) Lbignum_kmul_32_64_local_mul_8_16: CFI_START ldp x3, x4, [x1] ldr q0, [x1] ldp x7, x8, [x2] ldr q1, [x2] ldp x5, x6, [x1, #16] ldr q2, [x1, #16] ldp x9, x10, [x2, #16] ldr q3, [x2, #16] uzp1 v4.4s, v1.4s, v0.4s rev64 v1.4s, v1.4s uzp1 v5.4s, v0.4s, v0.4s mul v0.4s, v1.4s, v0.4s uaddlp v0.2d, v0.4s shl v0.2d, v0.2d, #32 umlal v0.2d, v5.2s, v4.2s mov x11, v0.d[0] mov x15, v0.d[1] uzp1 v0.4s, v3.4s, v2.4s rev64 v1.4s, v3.4s uzp1 v3.4s, v2.4s, v2.4s mul v1.4s, v1.4s, v2.4s uaddlp v1.2d, v1.4s shl v1.2d, v1.2d, #32 umlal v1.2d, v3.2s, v0.2s mov x16, v1.d[0] mov x17, v1.d[1] ldr q0, [x1, #32] ldr q1, [x2, #32] ldr q2, [x1, #48] ldr q3, [x2, #48] umulh x19, x3, x7 adds x15, x15, x19 umulh x19, x4, x8 adcs x16, x16, x19 umulh x19, x5, x9 adcs x17, x17, x19 umulh x19, x6, x10 uzp1 v4.4s, v1.4s, v0.4s rev64 v1.4s, v1.4s uzp1 v5.4s, v0.4s, v0.4s mul v0.4s, v1.4s, v0.4s uaddlp v0.2d, v0.4s shl v0.2d, v0.2d, #32 umlal v0.2d, v5.2s, v4.2s adc x19, x19, xzr adds x12, x15, x11 adcs x15, x16, x15 adcs x16, x17, x16 adcs x17, x19, x17 adc x19, xzr, x19 adds x13, x15, x11 adcs x14, x16, x12 adcs x15, x17, x15 adcs x16, x19, x16 adcs x17, xzr, x17 adc x19, xzr, x19 subs x24, x5, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x9 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x16, x16, x22 eor x21, x21, x20 adcs x17, x17, x21 adc x19, x19, x20 subs x24, x3, x4 cneg x24, x24, cc csetm x20, cc subs x21, x8, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x12, x12, x22 eor x21, x21, x20 adcs x13, x13, x21 adcs x14, x14, x20 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x15, x15, x22 eor x21, x21, x20 adcs x16, x16, x21 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x13, x13, x22 eor x21, x21, x20 adcs x14, x14, x21 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 ldp x3, x4, [x1, #32] stp x11, x12, [x0] ldp x7, x8, [x2, #32] stp x13, x14, [x0, #16] ldp x5, x6, [x1, #48] stp x15, x16, [x0, #32] ldp x9, x10, [x2, #48] stp x17, x19, [x0, #48] mov x11, v0.d[0] mov x15, v0.d[1] uzp1 v0.4s, v3.4s, v2.4s rev64 v1.4s, v3.4s uzp1 v3.4s, v2.4s, v2.4s mul v1.4s, v1.4s, v2.4s uaddlp v1.2d, v1.4s shl v1.2d, v1.2d, #32 umlal v1.2d, v3.2s, v0.2s mov x16, v1.d[0] mov x17, v1.d[1] umulh x19, x3, x7 adds x15, x15, x19 umulh x19, x4, x8 adcs x16, x16, x19 umulh x19, x5, x9 adcs x17, x17, x19 umulh x19, x6, x10 adc x19, x19, xzr adds x12, x15, x11 adcs x15, x16, x15 adcs x16, x17, x16 adcs x17, x19, x17 adc x19, xzr, x19 adds x13, x15, x11 adcs x14, x16, x12 adcs x15, x17, x15 adcs x16, x19, x16 adcs x17, xzr, x17 adc x19, xzr, x19 ldp x22, x21, [x0, #32] adds x11, x11, x22 adcs x12, x12, x21 ldp x22, x21, [x0, #48] adcs x13, x13, x22 adcs x14, x14, x21 adcs x15, x15, xzr adcs x16, x16, xzr adcs x17, x17, xzr adc x19, x19, xzr subs x24, x5, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x9 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x16, x16, x22 eor x21, x21, x20 adcs x17, x17, x21 adc x19, x19, x20 subs x24, x3, x4 cneg x24, x24, cc csetm x20, cc subs x21, x8, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x12, x12, x22 eor x21, x21, x20 adcs x13, x13, x21 adcs x14, x14, x20 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x15, x15, x22 eor x21, x21, x20 adcs x16, x16, x21 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x13, x13, x22 eor x21, x21, x20 adcs x14, x14, x21 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 ldp x22, x21, [x1] subs x3, x3, x22 sbcs x4, x4, x21 ldp x22, x21, [x1, #16] sbcs x5, x5, x22 sbcs x6, x6, x21 csetm x24, cc stp x11, x12, [x0, #64] ldp x22, x21, [x2] subs x7, x22, x7 sbcs x8, x21, x8 ldp x22, x21, [x2, #16] sbcs x9, x22, x9 sbcs x10, x21, x10 csetm x1, cc stp x13, x14, [x0, #80] eor x3, x3, x24 subs x3, x3, x24 eor x4, x4, x24 sbcs x4, x4, x24 eor x5, x5, x24 sbcs x5, x5, x24 eor x6, x6, x24 sbc x6, x6, x24 stp x15, x16, [x0, #96] eor x7, x7, x1 subs x7, x7, x1 eor x8, x8, x1 sbcs x8, x8, x1 eor x9, x9, x1 sbcs x9, x9, x1 eor x10, x10, x1 sbc x10, x10, x1 stp x17, x19, [x0, #112] eor x1, x1, x24 mul x11, x3, x7 mul x15, x4, x8 mul x16, x5, x9 mul x17, x6, x10 umulh x19, x3, x7 adds x15, x15, x19 umulh x19, x4, x8 adcs x16, x16, x19 umulh x19, x5, x9 adcs x17, x17, x19 umulh x19, x6, x10 adc x19, x19, xzr adds x12, x15, x11 adcs x15, x16, x15 adcs x16, x17, x16 adcs x17, x19, x17 adc x19, xzr, x19 adds x13, x15, x11 adcs x14, x16, x12 adcs x15, x17, x15 adcs x16, x19, x16 adcs x17, xzr, x17 adc x19, xzr, x19 subs x24, x5, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x9 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x16, x16, x22 eor x21, x21, x20 adcs x17, x17, x21 adc x19, x19, x20 subs x24, x3, x4 cneg x24, x24, cc csetm x20, cc subs x21, x8, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x12, x12, x22 eor x21, x21, x20 adcs x13, x13, x21 adcs x14, x14, x20 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x15, x15, x22 eor x21, x21, x20 adcs x16, x16, x21 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x13, x13, x22 eor x21, x21, x20 adcs x14, x14, x21 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 ldp x3, x4, [x0] ldp x7, x8, [x0, #64] adds x3, x3, x7 adcs x4, x4, x8 ldp x5, x6, [x0, #16] ldp x9, x10, [x0, #80] adcs x5, x5, x9 adcs x6, x6, x10 ldp x20, x21, [x0, #96] adcs x7, x7, x20 adcs x8, x8, x21 ldp x22, x23, [x0, #112] adcs x9, x9, x22 adcs x10, x10, x23 adcs x24, x1, xzr adc x2, x1, xzr cmn x1, #0x1 eor x11, x11, x1 adcs x3, x11, x3 eor x12, x12, x1 adcs x4, x12, x4 eor x13, x13, x1 adcs x5, x13, x5 eor x14, x14, x1 adcs x6, x14, x6 eor x15, x15, x1 adcs x7, x15, x7 eor x16, x16, x1 adcs x8, x16, x8 eor x17, x17, x1 adcs x9, x17, x9 eor x19, x19, x1 adcs x10, x19, x10 adcs x20, x20, x24 adcs x21, x21, x2 adcs x22, x22, x2 adc x23, x23, x2 stp x3, x4, [x0, #32] stp x5, x6, [x0, #48] stp x7, x8, [x0, #64] stp x9, x10, [x0, #80] stp x20, x21, [x0, #96] stp x22, x23, [x0, #112] CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_kmul_32_64_local_mul_8_16) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
4,191
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_sqr_4_8.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Square, z := x^2 // Input x[4]; output z[8] // // extern void bignum_sqr_4_8(uint64_t z[static 8], const uint64_t x[static 4]); // // Standard ARM ABI: X0 = z, X1 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sqr_4_8) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_sqr_4_8) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sqr_4_8) .text .balign 4 // --------------------------------------------------------------------------- // 2x2 squaring macro: [s3;s2;s1;s0] := [a1;a0]^2 with t0,t1,t2 temporaries // This uses 32x32->64 multiplications to reduce the number of UMULHs // --------------------------------------------------------------------------- #define sqr2(s3,s2,s1,s0, a1,a1short,a0,a0short, t2,t1,t0,t0short) \ umull s0, a0short, a0short __LF \ lsr t0, a0, #32 __LF \ umull s1, t0short, t0short __LF \ umull t0, a0short, t0short __LF \ adds s0, s0, t0, lsl #33 __LF \ lsr t0, t0, #31 __LF \ adc s1, s1, t0 __LF \ umull s2, a1short, a1short __LF \ lsr t0, a1, #32 __LF \ umull s3, t0short, t0short __LF \ umull t0, a1short, t0short __LF \ mul t1, a0, a1 __LF \ umulh t2, a0, a1 __LF \ adds s2, s2, t0, lsl #33 __LF \ lsr t0, t0, #31 __LF \ adc s3, s3, t0 __LF \ adds t1, t1, t1 __LF \ adcs t2, t2, t2 __LF \ adc s3, s3, xzr __LF \ adds s1, s1, t1 __LF \ adcs s2, s2, t2 __LF \ adc s3, s3, xzr // Main code #define z x0 #define x x1 #define a0 x2 #define a1 x3 #define a2 x4 #define a3 x5 #define s0 x6 #define s1 x7 #define s2 x8 #define s3 x9 #define s4 x10 #define s5 x11 #define s6 x12 #define s7 x13 #define d0 x14 #define d1 x15 #define d2 x16 // Short versions #define a0short w2 #define a1short w3 #define a2short w4 #define a3short w5 #define d2short w16 #define s3short w9 S2N_BN_SYMBOL(bignum_sqr_4_8): CFI_START // Load all the elements ldp a0, a1, [x] ldp a2, a3, [x, #16] // Compute L = [s3;s2;s1;s0] = square of lower half sqr2(s3,s2,s1,s0, a1,a1short,a0,a0short, d0,d1,d2,d2short) // Compute H = [s7;s6;s5;s4] = square of upper half sqr2(s7,s6,s5,s4, a3,a3short,a2,a2short, d0,d1,d2,d2short) // Let [a1;a0] = |[a3;a2] - [a1;a0]| be the absolute difference subs a0, a0, a2 sbcs a1, a1, a3 csetm d0, cc eor a0, a0, d0 subs a0, a0, d0 eor a1, a1, d0 sbc a1, a1, d0 // Form H' = H + L_hi (which fits in 4 words) adds s4, s4, s2 adcs s5, s5, s3 adcs s6, s6, xzr adc s7, s7, xzr // Let M = [d2;d1;a3;a2] = ([a3;a2] - [a1;a0])^2 sqr2(d2,d1,a3,a2, a1,a1short,a0,a0short, d0,s2,s3,s3short) // Now form (2^64 + 1) * (H'::L), with a bit of carry-shortening adds s2, s0, s4 adcs s3, s1, s5 adcs s4, s4, s6 adcs s5, s5, s7 csetm d0, cc // Subtract the middle term M subs s2, s2, a2 sbcs s3, s3, a3 sbcs s4, s4, d1 sbcs s5, s5, d2 adcs s6, s6, d0 adc s7, s7, d0 // Store back stp s0, s1, [z] stp s2, s3, [z, 16] stp s4, s5, [z, 32] stp s6, s7, [z, 48] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_sqr_4_8) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
12,940
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_sqr_8_16.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Square, z := x^2 // Input x[8]; output z[16] // // extern void bignum_sqr_8_16(uint64_t z[static 16], const uint64_t x[static 8]); // // Standard ARM ABI: X0 = z, X1 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sqr_8_16) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_sqr_8_16) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sqr_8_16) .text .balign 4 S2N_BN_SYMBOL(bignum_sqr_8_16): CFI_START // Save registers CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) // Load registers. ldp x2, x3, [x1] ldr q20, [x1] ldp x4, x5, [x1, #16] ldr q21, [x1, #16] ldp x6, x7, [x1, #32] ldr q22, [x1, #32] ldp x8, x9, [x1, #48] ldr q23, [x1, #48] movi v30.2d, #0xffffffff mul x17, x2, x4 mul x14, x3, x5 // Scalar+NEON: square the lower half with a near-clone of bignum_sqr_4_8 // NEON: prepare 64x64->128 squaring of two 64-bit ints (x2, x3) ext v1.16b, v20.16b, v20.16b, #8 umulh x20, x2, x4 shrn v2.2s, v20.2d, #32 subs x21, x2, x3 zip1 v0.2s, v20.2s, v1.2s cneg x21, x21, cc // cc = lo, ul, last umull v5.2d, v2.2s, v2.2s csetm x11, cc // cc = lo, ul, last umull v6.2d, v2.2s, v0.2s subs x12, x5, x4 umull v3.2d, v0.2s, v0.2s cneg x12, x12, cc // cc = lo, ul, last mov v1.16b, v6.16b mul x13, x21, x12 usra v1.2d, v3.2d, #32 umulh x12, x21, x12 and v4.16b, v1.16b, v30.16b cinv x11, x11, cc // cc = lo, ul, last add v4.2d, v4.2d, v6.2d eor x13, x13, x11 usra v5.2d, v4.2d, #32 eor x12, x12, x11 sli v3.2d, v4.2d, #32 adds x19, x17, x20 usra v5.2d, v1.2d, #32 adc x20, x20, xzr // NEON: prepare 64x64->128 squaring of two 64-bit ints (x4, x5) ext v1.16b, v21.16b, v21.16b, #8 umulh x21, x3, x5 shrn v2.2s, v21.2d, #32 adds x19, x19, x14 zip1 v0.2s, v21.2s, v1.2s adcs x20, x20, x21 adc x21, x21, xzr adds x20, x20, x14 adc x21, x21, xzr cmn x11, #0x1 adcs x19, x19, x13 mov x13, v3.d[1] // mul x13, x3, x3 adcs x20, x20, x12 mov x14, v5.d[1] // umulh x14, x3, x3 adc x21, x21, x11 mov x12, v3.d[0] // mul x12, x2, x2 adds x17, x17, x17 mov x11, v5.d[0] // umulh x11, x2, x2 adcs x19, x19, x19 umull v5.2d, v2.2s, v2.2s adcs x20, x20, x20 umull v6.2d, v2.2s, v0.2s adcs x21, x21, x21 umull v3.2d, v0.2s, v0.2s adc x10, xzr, xzr mov v1.16b, v6.16b mul x15, x2, x3 usra v1.2d, v3.2d, #32 umulh x16, x2, x3 and v4.16b, v1.16b, v30.16b adds x11, x11, x15 add v4.2d, v4.2d, v6.2d adcs x13, x13, x16 usra v5.2d, v4.2d, #32 adc x14, x14, xzr sli v3.2d, v4.2d, #32 adds x11, x11, x15 usra v5.2d, v1.2d, #32 adcs x13, x13, x16 adc x14, x14, xzr stp x12, x11, [x0] mov x11, v5.d[0] // umulh x11, x4, x4 adds x17, x17, x13 mov x13, v3.d[1] // mul x13, x5, x5 adcs x19, x19, x14 mov x14, v5.d[1] // umulh x14, x5, x5 adcs x20, x20, xzr mov x12, v3.d[0] // mul x12, x4, x4 adcs x21, x21, xzr // NEON: prepare muls in the upper half ext v1.16b, v22.16b, v22.16b, #8 adc x10, x10, xzr shrn v2.2s, v22.2d, #32 stp x17, x19, [x0, #16] zip1 v0.2s, v22.2s, v1.2s mul x15, x4, x5 umull v5.2d, v2.2s, v2.2s umulh x16, x4, x5 umull v6.2d, v2.2s, v0.2s adds x11, x11, x15 umull v3.2d, v0.2s, v0.2s adcs x13, x13, x16 mov v1.16b, v6.16b adc x14, x14, xzr usra v1.2d, v3.2d, #32 adds x11, x11, x15 and v4.16b, v1.16b, v30.16b adcs x13, x13, x16 add v4.2d, v4.2d, v6.2d adc x14, x14, xzr usra v5.2d, v4.2d, #32 adds x12, x12, x20 sli v3.2d, v4.2d, #32 adcs x11, x11, x21 usra v5.2d, v1.2d, #32 stp x12, x11, [x0, #32] // NEON: prepare muls in the upper half ext v1.16b, v23.16b, v23.16b, #8 adcs x13, x13, x10 shrn v2.2s, v23.2d, #32 adc x14, x14, xzr zip1 v0.2s, v23.2s, v1.2s stp x13, x14, [x0, #48] // Scalar: square the upper half with a slight variant of the previous block mul x17, x6, x8 umull v16.2d, v2.2s, v2.2s mul x14, x7, x9 umull v6.2d, v2.2s, v0.2s umulh x20, x6, x8 umull v18.2d, v0.2s, v0.2s subs x21, x6, x7 cneg x21, x21, cc // cc = lo, ul, last mov v1.16b, v6.16b csetm x11, cc // cc = lo, ul, last subs x12, x9, x8 cneg x12, x12, cc // cc = lo, ul, last usra v1.2d, v18.2d, #32 mul x13, x21, x12 and v4.16b, v1.16b, v30.16b umulh x12, x21, x12 add v4.2d, v4.2d, v6.2d cinv x11, x11, cc // cc = lo, ul, last eor x13, x13, x11 eor x12, x12, x11 usra v16.2d, v4.2d, #32 adds x19, x17, x20 adc x20, x20, xzr sli v18.2d, v4.2d, #32 umulh x21, x7, x9 adds x19, x19, x14 adcs x20, x20, x21 adc x21, x21, xzr adds x20, x20, x14 mov x14, v5.d[1] adc x21, x21, xzr cmn x11, #0x1 adcs x19, x19, x13 mov x13, v3.d[1] adcs x20, x20, x12 mov x12, v3.d[0] adc x21, x21, x11 mov x11, v5.d[0] adds x17, x17, x17 adcs x19, x19, x19 usra v16.2d, v1.2d, #32 adcs x20, x20, x20 adcs x21, x21, x21 adc x10, xzr, xzr // NEON: two mul+umulhs for the next stage uzp2 v17.4s, v21.4s, v23.4s mul x15, x6, x7 xtn v4.2s, v23.2d umulh x16, x6, x7 mov x22, v16.d[0] adds x11, x11, x15 adcs x13, x13, x16 xtn v5.2s, v21.2d adc x14, x14, xzr adds x11, x11, x15 rev64 v1.4s, v21.4s adcs x13, x13, x16 adc x14, x14, xzr stp x12, x11, [x0, #64] adds x17, x17, x13 mov x13, v18.d[1] adcs x19, x19, x14 mov x14, v16.d[1] adcs x20, x20, xzr mov x12, v18.d[0] adcs x21, x21, xzr adc x10, x10, xzr umull v6.2d, v4.2s, v5.2s stp x17, x19, [x0, #80] umull v7.2d, v4.2s, v17.2s mul x15, x8, x9 uzp2 v16.4s, v23.4s, v23.4s umulh x16, x8, x9 mul v0.4s, v1.4s, v23.4s adds x11, x22, x15 adcs x13, x13, x16 usra v7.2d, v6.2d, #32 adc x14, x14, xzr adds x11, x11, x15 umull v1.2d, v16.2s, v17.2s adcs x13, x13, x16 adc x14, x14, xzr uaddlp v0.2d, v0.4s adds x12, x12, x20 adcs x11, x11, x21 and v2.16b, v7.16b, v30.16b umlal v2.2d, v16.2s, v5.2s shl v0.2d, v0.2d, #32 usra v1.2d, v7.2d, #32 umlal v0.2d, v4.2s, v5.2s mov x16, v0.d[1] mov x15, v0.d[0] usra v1.2d, v2.2d, #32 mov x20, v1.d[0] mov x21, v1.d[1] stp x12, x11, [x0, #96] adcs x13, x13, x10 adc x14, x14, xzr stp x13, x14, [x0, #112] // Now get the cross-product in [s7,...,s0] and double it as [c,s7,...,s0] mul x10, x2, x6 mul x14, x3, x7 umulh x17, x2, x6 adds x14, x14, x17 umulh x17, x3, x7 adcs x15, x15, x17 adcs x16, x16, x20 adc x17, x21, xzr adds x11, x14, x10 adcs x14, x15, x14 adcs x15, x16, x15 adcs x16, x17, x16 adc x17, xzr, x17 adds x12, x14, x10 adcs x13, x15, x11 adcs x14, x16, x14 adcs x15, x17, x15 adcs x16, xzr, x16 adc x17, xzr, x17 subs x22, x4, x5 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x9, x8 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x15, x15, x21 eor x20, x20, x19 adcs x16, x16, x20 adc x17, x17, x19 subs x22, x2, x3 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x7, x6 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x11, x11, x21 eor x20, x20, x19 adcs x12, x12, x20 adcs x13, x13, x19 adcs x14, x14, x19 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x3, x5 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x9, x7 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x14, x14, x21 eor x20, x20, x19 adcs x15, x15, x20 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x2, x4 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x8, x6 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x12, x12, x21 eor x20, x20, x19 adcs x13, x13, x20 adcs x14, x14, x19 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x2, x5 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x9, x6 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x13, x13, x21 eor x20, x20, x19 adcs x14, x14, x20 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x3, x4 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x8, x7 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x13, x13, x21 eor x20, x20, x19 adcs x14, x14, x20 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 adds x10, x10, x10 adcs x11, x11, x11 adcs x12, x12, x12 adcs x13, x13, x13 adcs x14, x14, x14 adcs x15, x15, x15 adcs x16, x16, x16 adcs x17, x17, x17 adc x19, xzr, xzr // Add it back to the buffer ldp x2, x3, [x0, #32] adds x10, x10, x2 adcs x11, x11, x3 stp x10, x11, [x0, #32] ldp x2, x3, [x0, #48] adcs x12, x12, x2 adcs x13, x13, x3 stp x12, x13, [x0, #48] ldp x2, x3, [x0, #64] adcs x14, x14, x2 adcs x15, x15, x3 stp x14, x15, [x0, #64] ldp x2, x3, [x0, #80] adcs x16, x16, x2 adcs x17, x17, x3 stp x16, x17, [x0, #80] ldp x2, x3, [x0, #96] adcs x2, x2, x19 adcs x3, x3, xzr stp x2, x3, [x0, #96] ldp x2, x3, [x0, #112] adcs x2, x2, xzr adc x3, x3, xzr stp x2, x3, [x0, #112] CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_sqr_8_16) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
23,501
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_kmul_16_32.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply z := x * y // Inputs x[16], y[16]; output z[32]; temporary buffer t[>=32] // // extern void bignum_kmul_16_32(uint64_t z[static 32], // const uint64_t x[static 16], // const uint64_t y[static 16], // uint64_t t[static 32]); // // This is a Karatsuba-style function multiplying half-sized results // internally and using temporary buffer t for intermediate results. // // Standard ARM ABI: X0 = z, X1 = x, X2 = y, X3 = t // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_kmul_16_32) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_kmul_16_32) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_kmul_16_32) .text .balign 4 // Subroutine-safe copies of the output, inputs and temporary buffer pointers #define z x25 #define x x26 #define y x27 #define t x28 // More variables for sign masks, with s also necessarily subroutine-safe #define s x29 #define m x19 S2N_BN_SYMBOL(bignum_kmul_16_32): CFI_START // Save registers, including return address CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x24) CFI_PUSH2(x25,x26) CFI_PUSH2(x27,x28) CFI_PUSH2(x29,x30) // Move parameters into subroutine-safe places mov z, x0 mov x, x1 mov y, x2 mov t, x3 // Compute L = x_lo * y_lo in bottom half of buffer (size 8 x 8 -> 16) CFI_BL(Lbignum_kmul_16_32_local_mul_8_16) // Compute absolute difference [t..] = |x_lo - x_hi| // and the sign s = sgn(x_lo - x_hi) as a bitmask (all 1s for negative) ldp x10, x11, [x] ldp x8, x9, [x, #64] subs x10, x10, x8 sbcs x11, x11, x9 ldp x12, x13, [x, #16] ldp x8, x9, [x, #80] sbcs x12, x12, x8 sbcs x13, x13, x9 ldp x14, x15, [x, #32] ldp x8, x9, [x, #96] sbcs x14, x14, x8 sbcs x15, x15, x9 ldp x16, x17, [x, #48] ldp x8, x9, [x, #112] sbcs x16, x16, x8 sbcs x17, x17, x9 csetm s, cc adds xzr, s, s eor x10, x10, s adcs x10, x10, xzr eor x11, x11, s adcs x11, x11, xzr stp x10, x11, [t] eor x12, x12, s adcs x12, x12, xzr eor x13, x13, s adcs x13, x13, xzr stp x12, x13, [t, #16] eor x14, x14, s adcs x14, x14, xzr eor x15, x15, s adcs x15, x15, xzr stp x14, x15, [t, #32] eor x16, x16, s adcs x16, x16, xzr eor x17, x17, s adcs x17, x17, xzr stp x16, x17, [t, #48] // Compute H = x_hi * y_hi in top half of buffer (size 8 x 8 -> 16) add x0, z, #128 add x1, x, #64 add x2, y, #64 CFI_BL(Lbignum_kmul_16_32_local_mul_8_16) // Compute the other absolute difference [t+8..] = |y_hi - y_lo| // Collect the combined product sign bitmask (all 1s for negative) in s ldp x10, x11, [y] ldp x8, x9, [y, #64] subs x10, x8, x10 sbcs x11, x9, x11 ldp x12, x13, [y, #16] ldp x8, x9, [y, #80] sbcs x12, x8, x12 sbcs x13, x9, x13 ldp x14, x15, [y, #32] ldp x8, x9, [y, #96] sbcs x14, x8, x14 sbcs x15, x9, x15 ldp x16, x17, [y, #48] ldp x8, x9, [y, #112] sbcs x16, x8, x16 sbcs x17, x9, x17 csetm m, cc adds xzr, m, m eor x10, x10, m adcs x10, x10, xzr eor x11, x11, m adcs x11, x11, xzr stp x10, x11, [t, #64] eor x12, x12, m adcs x12, x12, xzr eor x13, x13, m adcs x13, x13, xzr stp x12, x13, [t, #80] eor x14, x14, m adcs x14, x14, xzr eor x15, x15, m adcs x15, x15, xzr stp x14, x15, [t, #96] eor x16, x16, m adcs x16, x16, xzr eor x17, x17, m adcs x17, x17, xzr stp x16, x17, [t, #112] eor s, s, m // Compute H' = H + L_top in place of H (it cannot overflow) // First add 8-sized block then propagate carry through next 8 ldp x10, x11, [z, #128] ldp x12, x13, [z, #64] adds x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [z, #128] ldp x10, x11, [z, #128+16] ldp x12, x13, [z, #64+16] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [z, #128+16] ldp x10, x11, [z, #128+32] ldp x12, x13, [z, #64+32] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [z, #128+32] ldp x10, x11, [z, #128+48] ldp x12, x13, [z, #64+48] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [z, #128+48] ldp x10, x11, [z, #128+64] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [z, #128+64] ldp x10, x11, [z, #128+80] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [z, #128+80] ldp x10, x11, [z, #128+96] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [z, #128+96] ldp x10, x11, [z, #128+112] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [z, #128+112] // Compute M = |x_lo - x_hi| * |y_hi - y_lo| in [t+16...], size 16 add x0, t, #128 mov x1, t add x2, t, #64 CFI_BL(Lbignum_kmul_16_32_local_mul_8_16) // Add the interlocking H' and L_bot terms, storing in registers x15..x0 // Intercept the carry at the 8 + 16 = 24 position and store it in x. // (Note that we no longer need the input x was pointing at.) ldp x0, x1, [z] ldp x16, x17, [z, #128] adds x0, x0, x16 adcs x1, x1, x17 ldp x2, x3, [z, #16] ldp x16, x17, [z, #144] adcs x2, x2, x16 adcs x3, x3, x17 ldp x4, x5, [z, #32] ldp x16, x17, [z, #160] adcs x4, x4, x16 adcs x5, x5, x17 ldp x6, x7, [z, #48] ldp x16, x17, [z, #176] adcs x6, x6, x16 adcs x7, x7, x17 ldp x8, x9, [z, #128] ldp x16, x17, [z, #192] adcs x8, x8, x16 adcs x9, x9, x17 ldp x10, x11, [z, #144] ldp x16, x17, [z, #208] adcs x10, x10, x16 adcs x11, x11, x17 ldp x12, x13, [z, #160] ldp x16, x17, [z, #224] adcs x12, x12, x16 adcs x13, x13, x17 ldp x14, x15, [z, #176] ldp x16, x17, [z, #240] adcs x14, x14, x16 adcs x15, x15, x17 cset x, cs // Add the sign-adjusted mid-term cross product M cmn s, s ldp x16, x17, [t, #128] eor x16, x16, s adcs x0, x0, x16 eor x17, x17, s adcs x1, x1, x17 stp x0, x1, [z, #64] ldp x16, x17, [t, #144] eor x16, x16, s adcs x2, x2, x16 eor x17, x17, s adcs x3, x3, x17 stp x2, x3, [z, #80] ldp x16, x17, [t, #160] eor x16, x16, s adcs x4, x4, x16 eor x17, x17, s adcs x5, x5, x17 stp x4, x5, [z, #96] ldp x16, x17, [t, #176] eor x16, x16, s adcs x6, x6, x16 eor x17, x17, s adcs x7, x7, x17 stp x6, x7, [z, #112] ldp x16, x17, [t, #192] eor x16, x16, s adcs x8, x8, x16 eor x17, x17, s adcs x9, x9, x17 stp x8, x9, [z, #128] ldp x16, x17, [t, #208] eor x16, x16, s adcs x10, x10, x16 eor x17, x17, s adcs x11, x11, x17 stp x10, x11, [z, #144] ldp x16, x17, [t, #224] eor x16, x16, s adcs x12, x12, x16 eor x17, x17, s adcs x13, x13, x17 stp x12, x13, [z, #160] ldp x16, x17, [t, #240] eor x16, x16, s adcs x14, x14, x16 eor x17, x17, s adcs x15, x15, x17 stp x14, x15, [z, #176] // Get the next digits effectively resulting so far starting at 24 adcs y, s, x adc t, s, xzr // Now the final 8 digits of padding; the first one is special in using y // and also in getting the carry chain started ldp x10, x11, [z, #192] adds x10, x10, y adcs x11, x11, t stp x10, x11, [z, #192] ldp x10, x11, [z, #208] adcs x10, x10, t adcs x11, x11, t stp x10, x11, [z, #208] ldp x10, x11, [z, #224] adcs x10, x10, t adcs x11, x11, t stp x10, x11, [z, #224] ldp x10, x11, [z, #240] adcs x10, x10, t adcs x11, x11, t stp x10, x11, [z, #240] // Restore registers and return CFI_POP2(x29,x30) CFI_POP2(x27,x28) CFI_POP2(x25,x26) CFI_POP2(x23,x24) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_kmul_16_32) // ---------------------------------------------------------------------------- // Local copy of bignum_mul_8_16 without the scratch register save/restore // ---------------------------------------------------------------------------- S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_kmul_16_32_local_mul_8_16) Lbignum_kmul_16_32_local_mul_8_16: CFI_START ldp x3, x4, [x1] ldr q0, [x1] ldp x7, x8, [x2] ldr q1, [x2] ldp x5, x6, [x1, #16] ldr q2, [x1, #16] ldp x9, x10, [x2, #16] ldr q3, [x2, #16] uzp1 v4.4s, v1.4s, v0.4s rev64 v1.4s, v1.4s uzp1 v5.4s, v0.4s, v0.4s mul v0.4s, v1.4s, v0.4s uaddlp v0.2d, v0.4s shl v0.2d, v0.2d, #32 umlal v0.2d, v5.2s, v4.2s mov x11, v0.d[0] mov x15, v0.d[1] uzp1 v0.4s, v3.4s, v2.4s rev64 v1.4s, v3.4s uzp1 v3.4s, v2.4s, v2.4s mul v1.4s, v1.4s, v2.4s uaddlp v1.2d, v1.4s shl v1.2d, v1.2d, #32 umlal v1.2d, v3.2s, v0.2s mov x16, v1.d[0] mov x17, v1.d[1] ldr q0, [x1, #32] ldr q1, [x2, #32] ldr q2, [x1, #48] ldr q3, [x2, #48] umulh x19, x3, x7 adds x15, x15, x19 umulh x19, x4, x8 adcs x16, x16, x19 umulh x19, x5, x9 adcs x17, x17, x19 umulh x19, x6, x10 uzp1 v4.4s, v1.4s, v0.4s rev64 v1.4s, v1.4s uzp1 v5.4s, v0.4s, v0.4s mul v0.4s, v1.4s, v0.4s uaddlp v0.2d, v0.4s shl v0.2d, v0.2d, #32 umlal v0.2d, v5.2s, v4.2s adc x19, x19, xzr adds x12, x15, x11 adcs x15, x16, x15 adcs x16, x17, x16 adcs x17, x19, x17 adc x19, xzr, x19 adds x13, x15, x11 adcs x14, x16, x12 adcs x15, x17, x15 adcs x16, x19, x16 adcs x17, xzr, x17 adc x19, xzr, x19 subs x24, x5, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x9 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x16, x16, x22 eor x21, x21, x20 adcs x17, x17, x21 adc x19, x19, x20 subs x24, x3, x4 cneg x24, x24, cc csetm x20, cc subs x21, x8, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x12, x12, x22 eor x21, x21, x20 adcs x13, x13, x21 adcs x14, x14, x20 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x15, x15, x22 eor x21, x21, x20 adcs x16, x16, x21 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x13, x13, x22 eor x21, x21, x20 adcs x14, x14, x21 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 ldp x3, x4, [x1, #32] stp x11, x12, [x0] ldp x7, x8, [x2, #32] stp x13, x14, [x0, #16] ldp x5, x6, [x1, #48] stp x15, x16, [x0, #32] ldp x9, x10, [x2, #48] stp x17, x19, [x0, #48] mov x11, v0.d[0] mov x15, v0.d[1] uzp1 v0.4s, v3.4s, v2.4s rev64 v1.4s, v3.4s uzp1 v3.4s, v2.4s, v2.4s mul v1.4s, v1.4s, v2.4s uaddlp v1.2d, v1.4s shl v1.2d, v1.2d, #32 umlal v1.2d, v3.2s, v0.2s mov x16, v1.d[0] mov x17, v1.d[1] umulh x19, x3, x7 adds x15, x15, x19 umulh x19, x4, x8 adcs x16, x16, x19 umulh x19, x5, x9 adcs x17, x17, x19 umulh x19, x6, x10 adc x19, x19, xzr adds x12, x15, x11 adcs x15, x16, x15 adcs x16, x17, x16 adcs x17, x19, x17 adc x19, xzr, x19 adds x13, x15, x11 adcs x14, x16, x12 adcs x15, x17, x15 adcs x16, x19, x16 adcs x17, xzr, x17 adc x19, xzr, x19 ldp x22, x21, [x0, #32] adds x11, x11, x22 adcs x12, x12, x21 ldp x22, x21, [x0, #48] adcs x13, x13, x22 adcs x14, x14, x21 adcs x15, x15, xzr adcs x16, x16, xzr adcs x17, x17, xzr adc x19, x19, xzr subs x24, x5, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x9 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x16, x16, x22 eor x21, x21, x20 adcs x17, x17, x21 adc x19, x19, x20 subs x24, x3, x4 cneg x24, x24, cc csetm x20, cc subs x21, x8, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x12, x12, x22 eor x21, x21, x20 adcs x13, x13, x21 adcs x14, x14, x20 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x15, x15, x22 eor x21, x21, x20 adcs x16, x16, x21 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x13, x13, x22 eor x21, x21, x20 adcs x14, x14, x21 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 ldp x22, x21, [x1] subs x3, x3, x22 sbcs x4, x4, x21 ldp x22, x21, [x1, #16] sbcs x5, x5, x22 sbcs x6, x6, x21 csetm x24, cc stp x11, x12, [x0, #64] ldp x22, x21, [x2] subs x7, x22, x7 sbcs x8, x21, x8 ldp x22, x21, [x2, #16] sbcs x9, x22, x9 sbcs x10, x21, x10 csetm x1, cc stp x13, x14, [x0, #80] eor x3, x3, x24 subs x3, x3, x24 eor x4, x4, x24 sbcs x4, x4, x24 eor x5, x5, x24 sbcs x5, x5, x24 eor x6, x6, x24 sbc x6, x6, x24 stp x15, x16, [x0, #96] eor x7, x7, x1 subs x7, x7, x1 eor x8, x8, x1 sbcs x8, x8, x1 eor x9, x9, x1 sbcs x9, x9, x1 eor x10, x10, x1 sbc x10, x10, x1 stp x17, x19, [x0, #112] eor x1, x1, x24 mul x11, x3, x7 mul x15, x4, x8 mul x16, x5, x9 mul x17, x6, x10 umulh x19, x3, x7 adds x15, x15, x19 umulh x19, x4, x8 adcs x16, x16, x19 umulh x19, x5, x9 adcs x17, x17, x19 umulh x19, x6, x10 adc x19, x19, xzr adds x12, x15, x11 adcs x15, x16, x15 adcs x16, x17, x16 adcs x17, x19, x17 adc x19, xzr, x19 adds x13, x15, x11 adcs x14, x16, x12 adcs x15, x17, x15 adcs x16, x19, x16 adcs x17, xzr, x17 adc x19, xzr, x19 subs x24, x5, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x9 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x16, x16, x22 eor x21, x21, x20 adcs x17, x17, x21 adc x19, x19, x20 subs x24, x3, x4 cneg x24, x24, cc csetm x20, cc subs x21, x8, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x12, x12, x22 eor x21, x21, x20 adcs x13, x13, x21 adcs x14, x14, x20 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x15, x15, x22 eor x21, x21, x20 adcs x16, x16, x21 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x13, x13, x22 eor x21, x21, x20 adcs x14, x14, x21 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 ldp x3, x4, [x0] ldp x7, x8, [x0, #64] adds x3, x3, x7 adcs x4, x4, x8 ldp x5, x6, [x0, #16] ldp x9, x10, [x0, #80] adcs x5, x5, x9 adcs x6, x6, x10 ldp x20, x21, [x0, #96] adcs x7, x7, x20 adcs x8, x8, x21 ldp x22, x23, [x0, #112] adcs x9, x9, x22 adcs x10, x10, x23 adcs x24, x1, xzr adc x2, x1, xzr cmn x1, #0x1 eor x11, x11, x1 adcs x3, x11, x3 eor x12, x12, x1 adcs x4, x12, x4 eor x13, x13, x1 adcs x5, x13, x5 eor x14, x14, x1 adcs x6, x14, x6 eor x15, x15, x1 adcs x7, x15, x7 eor x16, x16, x1 adcs x8, x16, x8 eor x17, x17, x1 adcs x9, x17, x9 eor x19, x19, x1 adcs x10, x19, x10 adcs x20, x20, x24 adcs x21, x21, x2 adcs x22, x22, x2 adc x23, x23, x2 stp x3, x4, [x0, #32] stp x5, x6, [x0, #48] stp x7, x8, [x0, #64] stp x9, x10, [x0, #80] stp x20, x21, [x0, #96] stp x22, x23, [x0, #112] CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_kmul_16_32_local_mul_8_16) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
7,029
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_mul_6_12.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply z := x * y // Inputs x[6], y[6]; output z[12] // // extern void bignum_mul_6_12(uint64_t z[static 12], const uint64_t x[static 6], // const uint64_t y[static 6]); // // Standard ARM ABI: X0 = z, X1 = x, X2 = y // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul_6_12) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mul_6_12) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul_6_12) .text .balign 4 // --------------------------------------------------------------------------- // Macro computing [c,b,a] := [b,a] + (x - y) * (w - z), adding with carry // to the [b,a] components but leaving CF aligned with the c term, which is // a sign bitmask for (x - y) * (w - z). Continued add-with-carry operations // with [c,...,c] will continue the carry chain correctly starting from // the c position if desired to add to a longer term of the form [...,b,a]. // // c,h,l,t should all be different and t,h should not overlap w,z. // --------------------------------------------------------------------------- .macro muldiffnadd b,a, c,h,l,t, x,y, w,z subs \t, \x, \y cneg \t, \t, cc csetm \c, cc subs \h, \w, \z cneg \h, \h, cc mul \l, \t, \h umulh \h, \t, \h cinv \c, \c, cc adds xzr, \c, #1 eor \l, \l, \c adcs \a, \a, \l eor \h, \h, \c adcs \b, \b, \h .endm #define z x0 #define x x1 #define y x2 #define a0 x3 #define a1 x4 #define a2 x5 #define b0 x6 #define b1 x7 #define b2 x8 #define l0 x9 #define l1 x10 #define l2 x11 #define h0 x12 #define h1 x13 #define h2 x14 #define s1 x15 #define s2 x16 #define s3 x17 #define s4 x19 #define s5 x9 #define c x10 #define h x11 #define l x12 #define t x13 #define s0 x20 #define u0 x3 #define u1 x4 #define u2 x5 #define u3 x6 #define u4 x7 #define u5 x8 // These alias c,h,l but it doesn't matter #define u6 x10 #define u7 x11 #define u8 x12 // We recycle the input pointers near the end #define s x1 #define d x2 // --------------------------------------------------------------------------- // Core 3x3->6 ADK multiplication macro // Does [s5,s4,s3,s2,s1,s0] = [a2,a1,a0] * [b2,b1,b0] // // If the input parameter is 1, it also adds in [z+24,z+32,z+40] // existing contents; if the parameter is 0 it just does the pure multiply // --------------------------------------------------------------------------- .macro mul3 afl mul s0, a0, b0 mul l1, a1, b1 mul l2, a2, b2 umulh h0, a0, b0 umulh h1, a1, b1 umulh h2, a2, b2 adds h0, h0, l1 adcs h1, h1, l2 adc h2, h2, xzr adds s1, h0, s0 adcs s2, h1, h0 adcs s3, h2, h1 adc s4, h2, xzr adds s2, s2, s0 adcs s3, s3, h0 adcs s4, s4, h1 adc s5, h2, xzr // Optionally add the existing z contents .rep \afl ldr l, [z,#24] adds s0, s0, l ldp l, h, [z,#32] adcs s1, s1, l adcs s2, s2, h adcs s3, s3, xzr adcs s4, s4, xzr adc s5, s5, xzr .endr muldiffnadd s2,s1, c,h,l, t, a0,a1, b1,b0 adcs s3, s3, c adcs s4, s4, c adc s5, s5, c muldiffnadd s3,s2, c,h,l, t, a0,a2, b2,b0 adcs s4, s4, c adc s5, s5, c muldiffnadd s4,s3, c,h,l, t, a1,a2, b2,b1 adc s5, s5, c .endm S2N_BN_SYMBOL(bignum_mul_6_12): CFI_START CFI_PUSH2(x19,x20) // Multiply the low halves using ADK 3x3->6 ldp a0, a1, [x1] ldp b0, b1, [x2] ldr a2, [x1, #16] ldr b2, [x2, #16] mul3 0 stp s0, s1, [x0] stp s2, s3, [x0, #16] stp s4, s5, [x0, #32] // Multiply the high halves using ADK 3x3->6 ldp a0, a1, [x1,#24] ldp b0, b1, [x2,#24] ldr a2, [x1, #40] ldr b2, [x2, #40] mul3 1 stp s0, s1, [x0, #48] stp s2, s3, [x0, #64] stp s4, s5, [x0, #80] // Compute t,[a2,a1,a0] = x_hi - x_lo // and s,[b2,b1,b0] = y_lo - y_hi // sign-magnitude differences ldr t, [x1] subs a0, a0, t ldr t, [x1,#8] sbcs a1, a1, t ldr t, [x1,#16] sbcs a2, a2, t csetm t, cc ldr s, [x2] subs b0, s, b0 ldr s, [x2,#8] sbcs b1, s, b1 ldr s, [x2,#16] sbcs b2, s, b2 csetm s, cc eor a0, a0, t subs a0, a0, t eor a1, a1, t sbcs a1, a1, t eor a2, a2, t sbc a2, a2, t eor b0, b0, s subs b0, b0, s eor b1, b1, s sbcs b1, b1, s eor b2, b2, s sbc b2, b2, s // Save the correct sign for the sub-product eor s, s, t // Now yet another 3x3->6 ADK core, but not writing back, keeping s0..s5 mul3 0 // Now accumulate the positive mid-terms as [u5,u4,u3,u2,u1,u0] ldp u0, u1, [z] ldp u3, u4, [z,#48] adds u0, u0, u3 adcs u1, u1, u4 ldr u2, [z,#16] ldp u5, u6, [z,#64] adcs u2, u2, u5 adcs u3, u3, u6 ldp u7, u8, [z,#80] adcs u4, u4, u7 adcs u5, u5, u8 // Stop the carry here so we can reintroduce it, taking into account the // effective addition of s from sign-extension below. Note that we get // a duplicated word c+carry beyond the first one, so this upper part is // of the form [d,d,t]. adcs t, s, xzr adc d, s, xzr // Add in the sign-adjusted complex term adds xzr, s, #1 eor s0, s0, s adcs u0, s0, u0 eor s1, s1, s adcs u1, s1, u1 eor s2, s2, s adcs u2, s2, u2 eor s3, s3, s adcs u3, s3, u3 eor s4, s4, s adcs u4, s4, u4 eor s5, s5, s adcs u5, s5, u5 adcs u6, u6, t adcs u7, u7, d adc u8, u8, d // Store it back str u0, [x0,#24] stp u1, u2, [x0,#32] stp u3, u4, [x0,#48] stp u5, u6, [x0,#64] stp u7, u8, [x0,#80] // Restore regs and return CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mul_6_12) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
2,966
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_sqr_4_8_alt.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Square, z := x^2 // Input x[4]; output z[8] // // extern void bignum_sqr_4_8_alt(uint64_t z[static 8], // const uint64_t x[static 4]); // // Standard ARM ABI: X0 = z, X1 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sqr_4_8_alt) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_sqr_4_8_alt) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sqr_4_8_alt) .text .balign 4 #define z x0 #define x x1 #define a0 x2 #define a1 x3 #define a2 x4 #define a3 x5 #define l x6 #define h x7 #define u0 x8 #define u1 x9 #define u2 x10 #define u3 x11 #define u4 x12 #define u5 x13 #define u6 x14 // This one is the same as h, which is safe with this computation sequence #define u7 h S2N_BN_SYMBOL(bignum_sqr_4_8_alt): CFI_START // Load all the elements, set up an initial window [u6;...u1] = [23;03;01] // and chain in the addition of 02 + 12 + 13 (no carry-out is possible). // This gives all the "heterogeneous" terms of the squaring ready to double ldp a0, a1, [x] mul u1, a0, a1 umulh u2, a0, a1 ldp a2, a3, [x, #16] mul u3, a0, a3 umulh u4, a0, a3 mul l, a0, a2 umulh h, a0, a2 adds u2, u2, l adcs u3, u3, h mul l, a1, a2 umulh h, a1, a2 adc h, h, xzr adds u3, u3, l mul u5, a2, a3 umulh u6, a2, a3 adcs u4, u4, h mul l, a1, a3 umulh h, a1, a3 adc h, h, xzr adds u4, u4, l adcs u5, u5, h adc u6, u6, xzr // Now just double it; this simple approach seems to work better than extr adds u1, u1, u1 adcs u2, u2, u2 adcs u3, u3, u3 adcs u4, u4, u4 adcs u5, u5, u5 adcs u6, u6, u6 cset u7, cs // Add the homogeneous terms 00 + 11 + 22 + 33 umulh l, a0, a0 mul u0, a0, a0 adds u1, u1, l mul l, a1, a1 adcs u2, u2, l umulh l, a1, a1 adcs u3, u3, l mul l, a2, a2 adcs u4, u4, l umulh l, a2, a2 adcs u5, u5, l mul l, a3, a3 adcs u6, u6, l umulh l, a3, a3 adc u7, u7, l // Store back final result stp u0, u1, [z] stp u2, u3, [z, #16] stp u4, u5, [z, #32] stp u6, u7, [z, #48] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_sqr_4_8_alt) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
4,596
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_sqr_6_12_alt.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Square, z := x^2 // Input x[6]; output z[12] // // extern void bignum_sqr_6_12_alt(uint64_t z[static 12], // const uint64_t x[static 6]); // // Standard ARM ABI: X0 = z, X1 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sqr_6_12_alt) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_sqr_6_12_alt) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sqr_6_12_alt) .text .balign 4 #define z x0 #define x x1 #define a0 x2 #define a1 x3 #define a2 x4 #define a3 x5 #define a4 x6 #define a5 x7 #define l x8 #define u0 x2 // The same as a0, which is safe #define u1 x9 #define u2 x10 #define u3 x11 #define u4 x12 #define u5 x13 #define u6 x14 #define u7 x15 #define u8 x16 #define u9 x17 #define u10 x19 #define u11 x20 S2N_BN_SYMBOL(bignum_sqr_6_12_alt): CFI_START // It's convenient to have two more registers to play with CFI_PUSH2(x19,x20) // Load all the elements as [a5;a4;a3;a2;a1;a0], set up an initial // window [u8;u7; u6;u5; u4;u3; u2;u1] = [34;05;03;01], and then // chain in the addition of 02 + 12 + 13 + 14 + 15 to that window // (no carry-out possible since we add it to the top of a product). ldp a0, a1, [x] mul u1, a0, a1 umulh u2, a0, a1 ldp a2, a3, [x, #16] mul l, a0, a2 adds u2, u2, l mul u3, a0, a3 mul l, a1, a2 adcs u3, u3, l umulh u4, a0, a3 mul l, a1, a3 adcs u4, u4, l ldp a4, a5, [x, #32] mul u5, a0, a5 mul l, a1, a4 adcs u5, u5, l umulh u6, a0, a5 mul l, a1, a5 adcs u6, u6, l mul u7, a3, a4 adcs u7, u7, xzr umulh u8, a3, a4 adc u8, u8, xzr umulh l, a0, a2 adds u3, u3, l umulh l, a1, a2 adcs u4, u4, l umulh l, a1, a3 adcs u5, u5, l umulh l, a1, a4 adcs u6, u6, l umulh l, a1, a5 adcs u7, u7, l adc u8, u8, xzr // Now chain in the 04 + 23 + 24 + 25 + 35 + 45 terms mul l, a0, a4 adds u4, u4, l mul l, a2, a3 adcs u5, u5, l mul l, a2, a4 adcs u6, u6, l mul l, a2, a5 adcs u7, u7, l mul l, a3, a5 adcs u8, u8, l mul u9, a4, a5 adcs u9, u9, xzr umulh u10, a4, a5 adc u10, u10, xzr umulh l, a0, a4 adds u5, u5, l umulh l, a2, a3 adcs u6, u6, l umulh l, a2, a4 adcs u7, u7, l umulh l, a2, a5 adcs u8, u8, l umulh l, a3, a5 adcs u9, u9, l adc u10, u10, xzr // Double that, with h holding the top carry adds u1, u1, u1 adcs u2, u2, u2 adcs u3, u3, u3 adcs u4, u4, u4 adcs u5, u5, u5 adcs u6, u6, u6 adcs u7, u7, u7 adcs u8, u8, u8 adcs u9, u9, u9 adcs u10, u10, u10 cset u11, cs // Add the homogeneous terms 00 + 11 + 22 + 33 + 44 + 55 umulh l, a0, a0 mul u0, a0, a0 adds u1, u1, l mul l, a1, a1 adcs u2, u2, l umulh l, a1, a1 adcs u3, u3, l mul l, a2, a2 adcs u4, u4, l umulh l, a2, a2 adcs u5, u5, l mul l, a3, a3 adcs u6, u6, l umulh l, a3, a3 adcs u7, u7, l mul l, a4, a4 adcs u8, u8, l umulh l, a4, a4 adcs u9, u9, l mul l, a5, a5 adcs u10, u10, l umulh l, a5, a5 adc u11, u11, l // Store back final result stp u0, u1, [z] stp u2, u3, [z, #16] stp u4, u5, [z, #32] stp u6, u7, [z, #48] stp u8, u9, [z, #64] stp u10, u11, [z, #80] // Restore registers and return CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_sqr_6_12_alt) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
14,036
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_mul_8_16.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply z := x * y // Inputs x[8], y[8]; output z[16] // // extern void bignum_mul_8_16(uint64_t z[static 16], const uint64_t x[static 8], // const uint64_t y[static 8]); // // Standard ARM ABI: X0 = z, X1 = x, X2 = y // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul_8_16) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mul_8_16) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul_8_16) .text .balign 4 S2N_BN_SYMBOL(bignum_mul_8_16): CFI_START CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x24) ldp x3, x4, [x1] ldr q0, [x1] ldp x7, x8, [x2] ldr q1, [x2] ldp x5, x6, [x1, #16] ldr q2, [x1, #16] ldp x9, x10, [x2, #16] ldr q3, [x2, #16] uzp1 v4.4s, v1.4s, v0.4s rev64 v1.4s, v1.4s uzp1 v5.4s, v0.4s, v0.4s mul v0.4s, v1.4s, v0.4s uaddlp v0.2d, v0.4s shl v0.2d, v0.2d, #32 umlal v0.2d, v5.2s, v4.2s mov x11, v0.d[0] mov x15, v0.d[1] uzp1 v0.4s, v3.4s, v2.4s rev64 v1.4s, v3.4s uzp1 v3.4s, v2.4s, v2.4s mul v1.4s, v1.4s, v2.4s uaddlp v1.2d, v1.4s shl v1.2d, v1.2d, #32 umlal v1.2d, v3.2s, v0.2s mov x16, v1.d[0] mov x17, v1.d[1] ldr q0, [x1, #32] ldr q1, [x2, #32] ldr q2, [x1, #48] ldr q3, [x2, #48] umulh x19, x3, x7 adds x15, x15, x19 umulh x19, x4, x8 adcs x16, x16, x19 umulh x19, x5, x9 adcs x17, x17, x19 umulh x19, x6, x10 uzp1 v4.4s, v1.4s, v0.4s rev64 v1.4s, v1.4s uzp1 v5.4s, v0.4s, v0.4s mul v0.4s, v1.4s, v0.4s uaddlp v0.2d, v0.4s shl v0.2d, v0.2d, #32 umlal v0.2d, v5.2s, v4.2s adc x19, x19, xzr adds x12, x15, x11 adcs x15, x16, x15 adcs x16, x17, x16 adcs x17, x19, x17 adc x19, xzr, x19 adds x13, x15, x11 adcs x14, x16, x12 adcs x15, x17, x15 adcs x16, x19, x16 adcs x17, xzr, x17 adc x19, xzr, x19 subs x24, x5, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x9 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x16, x16, x22 eor x21, x21, x20 adcs x17, x17, x21 adc x19, x19, x20 subs x24, x3, x4 cneg x24, x24, cc csetm x20, cc subs x21, x8, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x12, x12, x22 eor x21, x21, x20 adcs x13, x13, x21 adcs x14, x14, x20 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x15, x15, x22 eor x21, x21, x20 adcs x16, x16, x21 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x13, x13, x22 eor x21, x21, x20 adcs x14, x14, x21 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 ldp x3, x4, [x1, #32] stp x11, x12, [x0] ldp x7, x8, [x2, #32] stp x13, x14, [x0, #16] ldp x5, x6, [x1, #48] stp x15, x16, [x0, #32] ldp x9, x10, [x2, #48] stp x17, x19, [x0, #48] mov x11, v0.d[0] mov x15, v0.d[1] uzp1 v0.4s, v3.4s, v2.4s rev64 v1.4s, v3.4s uzp1 v3.4s, v2.4s, v2.4s mul v1.4s, v1.4s, v2.4s uaddlp v1.2d, v1.4s shl v1.2d, v1.2d, #32 umlal v1.2d, v3.2s, v0.2s mov x16, v1.d[0] mov x17, v1.d[1] umulh x19, x3, x7 adds x15, x15, x19 umulh x19, x4, x8 adcs x16, x16, x19 umulh x19, x5, x9 adcs x17, x17, x19 umulh x19, x6, x10 adc x19, x19, xzr adds x12, x15, x11 adcs x15, x16, x15 adcs x16, x17, x16 adcs x17, x19, x17 adc x19, xzr, x19 adds x13, x15, x11 adcs x14, x16, x12 adcs x15, x17, x15 adcs x16, x19, x16 adcs x17, xzr, x17 adc x19, xzr, x19 ldp x22, x21, [x0, #32] adds x11, x11, x22 adcs x12, x12, x21 ldp x22, x21, [x0, #48] adcs x13, x13, x22 adcs x14, x14, x21 adcs x15, x15, xzr adcs x16, x16, xzr adcs x17, x17, xzr adc x19, x19, xzr subs x24, x5, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x9 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x16, x16, x22 eor x21, x21, x20 adcs x17, x17, x21 adc x19, x19, x20 subs x24, x3, x4 cneg x24, x24, cc csetm x20, cc subs x21, x8, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x12, x12, x22 eor x21, x21, x20 adcs x13, x13, x21 adcs x14, x14, x20 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x15, x15, x22 eor x21, x21, x20 adcs x16, x16, x21 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x13, x13, x22 eor x21, x21, x20 adcs x14, x14, x21 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 ldp x22, x21, [x1] subs x3, x3, x22 sbcs x4, x4, x21 ldp x22, x21, [x1, #16] sbcs x5, x5, x22 sbcs x6, x6, x21 csetm x24, cc stp x11, x12, [x0, #64] ldp x22, x21, [x2] subs x7, x22, x7 sbcs x8, x21, x8 ldp x22, x21, [x2, #16] sbcs x9, x22, x9 sbcs x10, x21, x10 csetm x1, cc stp x13, x14, [x0, #80] eor x3, x3, x24 subs x3, x3, x24 eor x4, x4, x24 sbcs x4, x4, x24 eor x5, x5, x24 sbcs x5, x5, x24 eor x6, x6, x24 sbc x6, x6, x24 stp x15, x16, [x0, #96] eor x7, x7, x1 subs x7, x7, x1 eor x8, x8, x1 sbcs x8, x8, x1 eor x9, x9, x1 sbcs x9, x9, x1 eor x10, x10, x1 sbc x10, x10, x1 stp x17, x19, [x0, #112] eor x1, x1, x24 mul x11, x3, x7 mul x15, x4, x8 mul x16, x5, x9 mul x17, x6, x10 umulh x19, x3, x7 adds x15, x15, x19 umulh x19, x4, x8 adcs x16, x16, x19 umulh x19, x5, x9 adcs x17, x17, x19 umulh x19, x6, x10 adc x19, x19, xzr adds x12, x15, x11 adcs x15, x16, x15 adcs x16, x17, x16 adcs x17, x19, x17 adc x19, xzr, x19 adds x13, x15, x11 adcs x14, x16, x12 adcs x15, x17, x15 adcs x16, x19, x16 adcs x17, xzr, x17 adc x19, xzr, x19 subs x24, x5, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x9 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x16, x16, x22 eor x21, x21, x20 adcs x17, x17, x21 adc x19, x19, x20 subs x24, x3, x4 cneg x24, x24, cc csetm x20, cc subs x21, x8, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x12, x12, x22 eor x21, x21, x20 adcs x13, x13, x21 adcs x14, x14, x20 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x15, x15, x22 eor x21, x21, x20 adcs x16, x16, x21 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x13, x13, x22 eor x21, x21, x20 adcs x14, x14, x21 adcs x15, x15, x20 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x3, x6 cneg x24, x24, cc csetm x20, cc subs x21, x10, x7 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 subs x24, x4, x5 cneg x24, x24, cc csetm x20, cc subs x21, x9, x8 cneg x21, x21, cc mul x22, x24, x21 umulh x21, x24, x21 cinv x20, x20, cc cmn x20, #0x1 eor x22, x22, x20 adcs x14, x14, x22 eor x21, x21, x20 adcs x15, x15, x21 adcs x16, x16, x20 adcs x17, x17, x20 adc x19, x19, x20 ldp x3, x4, [x0] ldp x7, x8, [x0, #64] adds x3, x3, x7 adcs x4, x4, x8 ldp x5, x6, [x0, #16] ldp x9, x10, [x0, #80] adcs x5, x5, x9 adcs x6, x6, x10 ldp x20, x21, [x0, #96] adcs x7, x7, x20 adcs x8, x8, x21 ldp x22, x23, [x0, #112] adcs x9, x9, x22 adcs x10, x10, x23 adcs x24, x1, xzr adc x2, x1, xzr cmn x1, #0x1 eor x11, x11, x1 adcs x3, x11, x3 eor x12, x12, x1 adcs x4, x12, x4 eor x13, x13, x1 adcs x5, x13, x5 eor x14, x14, x1 adcs x6, x14, x6 eor x15, x15, x1 adcs x7, x15, x7 eor x16, x16, x1 adcs x8, x16, x8 eor x17, x17, x1 adcs x9, x17, x9 eor x19, x19, x1 adcs x10, x19, x10 adcs x20, x20, x24 adcs x21, x21, x2 adcs x22, x22, x2 adc x23, x23, x2 stp x3, x4, [x0, #32] stp x5, x6, [x0, #48] stp x7, x8, [x0, #64] stp x9, x10, [x0, #80] stp x20, x21, [x0, #96] stp x22, x23, [x0, #112] CFI_POP2(x23,x24) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mul_8_16)
wlsfx/bnbb
114,247
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_emontredc_8n_cdiff.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC // ---------------------------------------------------------------------------- // Extend Montgomery reduce in 8-digit blocks, uses an extra storage to // temporarily cache multiplied differences appearing in ADK. // Results are stored in input-output buffer (z). // k must be divisible by 8 and not smaller than 16. // Inputs z[2*k], m[k], w; // Outputs function return (extra result bit) and z[2*k] // Temporary buffer m_precalc[12*(k/4-1)] // // extern uint64_t bignum_emontredc_8n_cdiff(uint64_t k, uint64_t *z, // const uint64_t *m, uint64_t w, // uint64_t *m_precalc); // // Standard ARM ABI: X0 = k, X1 = z, X2 = m, X3 = w, X4 = m_precalc // returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_emontredc_8n_cdiff) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_emontredc_8n_cdiff) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_emontredc_8n_cdiff) .text .balign 4 #define count x27 // Helper macro for the pre-computations #define cdiff(t, c, x, y) subs t, x, y; cneg t, t, cc; csetm c, cc // Some immediate offsets for cached differences+carry used // in the inner ADK multiplications #define cache_a01 (32+0*16) #define cache_a02 (32+1*16) #define cache_a03 (32+2*16) #define cache_a12 (32+3*16) #define cache_a13 (32+4*16) #define cache_a23 (32+5*16) #define cache_m10 (0*16) #define cache_m20 (1*16) #define cache_m30 (2*16) #define cache_m21 (3*16) #define cache_m31 (4*16) #define cache_m32 (5*16) #define a0 x4 #define a1 x5 #define a2 x6 #define a3 x7 // Registers for precalculation #define vpre00 v30 #define vpre01 v28 #define vpre02 v17 #define vpre10 v18 #define vpre11 v19 #define vpre12 v20 #define m x2 S2N_BN_SYMBOL(bignum_emontredc_8n_cdiff): CFI_START CFI_DEC_SP((10*16)) CFI_STACKSAVE2(x19,x20,(9*16)) CFI_STACKSAVE2(x21,x22,(8*16)) CFI_STACKSAVE2(x23,x24,(7*16)) CFI_STACKSAVE2(x25,x26,(6*16)) CFI_STACKSAVE2(x27,x28,(5*16)) CFI_STACKSAVE2(x29,x30,(4*16)) CFI_STACKSAVE2(d14,d15,(3*16)) CFI_STACKSAVE2(d12,d13,(2*16)) CFI_STACKSAVE2(d10,d11,(1*16)) CFI_STACKSAVE2(d8,d9,(0*16)) // Leave space for cached differences of words of a in inner loop CFI_DEC_SP((6*16)) CFI_DEC_SP(32) lsr x0, x0, #2 mov x26, x0 subs x12, x0, #1 bcc Lbignum_emontredc_8n_cdiff_end // x30 = buffer holding precomputed ADK carry-differences for modulus // // Start of precomputation // // Precompute and cache signed differences of modulus components // used in the ADK multiplication in the inner loop. // // Number of extra limbs required: // 6 * (number of limbs / 4 - 1) * 2 = 12 * (number_of_limbs/4 - 1) // mov x24, x4 mov x30, x4 // Save modulus pointer mov x25, m mov count, x12 Lbignum_emontredc_8n_cdiff_precomp: ldp a0, a1, [m, #32]! ldp a2, a3, [m, #16] #define t x28 #define c x29 cdiff(t, c, a1, a0) stp t, c, [x30, #cache_m10] cdiff(t, c, a2, a0) stp t, c, [x30, #cache_m20] cdiff(t, c, a3, a0) stp t, c, [x30, #cache_m30] cdiff(t, c, a2, a1) stp t, c, [x30, #cache_m21] cdiff(t, c, a3, a1) stp t, c, [x30, #cache_m31] cdiff(t, c, a3, a2) stp t, c, [x30, #cache_m32] add x30, x30, #(6*16) subs count, count, #1 cbnz count, Lbignum_emontredc_8n_cdiff_precomp // Set modulus pointer and buffer pointer back to its original value mov m, x25 mov x30, x24 // // End of precomputation // stp x3, x30, [sp] stp x26, xzr, [sp, #16] mov x28, xzr lsl x0, x12, #5 movi v29.2d, #0x000000ffffffff Lbignum_emontredc_8n_cdiff_outerloop: ldp x9, x13, [x1, #0] // .*.................................................................................................................................................................................................................. ldr x3, [sp] // *................................................................................................................................................................................................................... lsr x27, x0, #5 // ......................................................................................................................................*............................................................................. sub x27, x27, #1 // ...................................................................................................................................................................................................................* ldp x10, x12, [x1, #16] // ..*................................................................................................................................................................................................................. ldp x4, x15, [x2, #0] // ...*................................................................................................................................................................................................................ ldr q1, [x2, #16] // .....*.............................................................................................................................................................................................................. mul x11, x9, x3 // ......*............................................................................................................................................................................................................. uzp2 v18.4S, v1.4S, v1.4S // ........*........................................................................................................................................................................................................... dup v27.2D, x11 // .......*............................................................................................................................................................................................................ xtn v13.2S, v1.2D // ..........*......................................................................................................................................................................................................... rev64 v9.4S, v1.4S // ...........*........................................................................................................................................................................................................ mul x7, x11, x4 // ...........................*........................................................................................................................................................................................ rev64 v2.4S, v1.4S // ....................................................................................*............................................................................................................................... uzp2 v20.4S, v1.4S, v1.4S // .................................................................................*.................................................................................................................................. mul v31.4S, v9.4S, v27.4S // ...............*.................................................................................................................................................................................................... xtn v14.2S, v1.2D // ..............................................*..................................................................................................................................................................... uzp2 v21.4S, v1.4S, v1.4S // ............................................*....................................................................................................................................................................... umulh x22, x11, x15 // ................................*................................................................................................................................................................................... xtn v17.2S, v27.2D // .........*.......................................................................................................................................................................................................... adds x19, x9, x7 // ............................*....................................................................................................................................................................................... umull v28.2D, v17.2S, v13.2S // ............*....................................................................................................................................................................................................... umull v26.2D, v17.2S, v18.2S // .............*...................................................................................................................................................................................................... uaddlp v8.2D, v31.4S // ..................*................................................................................................................................................................................................. umulh x8, x11, x4 // .............................*...................................................................................................................................................................................... shl v7.2D, v8.2D, #32 // .....................*.............................................................................................................................................................................................. uzp2 v30.4S, v27.4S, v27.4S // ..............*..................................................................................................................................................................................................... umlal v7.2D, v17.2S, v13.2S // .......................*............................................................................................................................................................................................ mul x14, x11, x15 // ..............................*..................................................................................................................................................................................... usra v26.2D, v28.2D, #32 // ................*................................................................................................................................................................................................... umull v12.2D, v30.2S, v18.2S // .................*.................................................................................................................................................................................................. mov x24, v7.d[0] // .........................*.......................................................................................................................................................................................... adcs x29, x13, x14 // ...............................*.................................................................................................................................................................................... and v4.16B, v26.16B, v29.16B // ...................*................................................................................................................................................................................................ mov x17, v7.d[1] // ..........................*......................................................................................................................................................................................... rev64 v27.4S, v1.4S // ...............................................*.................................................................................................................................................................... adcs x5, x10, x24 // .................................*.................................................................................................................................................................................. umlal v4.2D, v30.2S, v13.2S // ....................*............................................................................................................................................................................................... usra v12.2D, v26.2D, #32 // ......................*............................................................................................................................................................................................. adcs x14, x12, x17 // ..................................*................................................................................................................................................................................. adc x23, xzr, xzr // .....................................*.............................................................................................................................................................................. adds x8, x29, x8 // ......................................*............................................................................................................................................................................. adcs x7, x5, x22 // .......................................*............................................................................................................................................................................ mul x25, x8, x3 // ..........................................*......................................................................................................................................................................... usra v12.2D, v4.2D, #32 // ........................*........................................................................................................................................................................................... dup v8.2D, x25 // ...........................................*........................................................................................................................................................................ stp x11, x25, [x1, #0] // ..............................................................................*..................................................................................................................................... mul x22, x25, x4 // ...............................................................*.................................................................................................................................................... mov x16, v12.d[1] // ....................................*............................................................................................................................................................................... ldr q16, [x1, #0] // .......................................................................................................................................*............................................................................ mov x21, v12.d[0] // ...................................*................................................................................................................................................................................ mul v31.4S, v27.4S, v8.4S // ...................................................*................................................................................................................................................................ adcs x20, x14, x21 // ........................................*........................................................................................................................................................................... xtn v27.2S, v8.2D // .............................................*...................................................................................................................................................................... adc x10, x23, x16 // .........................................*.......................................................................................................................................................................... subs x14, x11, x25 // .........................................................................................................................................*.......................................................................... rev64 v17.4S, v16.4S // ...................................................................................................................................................................*................................................ cneg x17, x14, cc // ..........................................................................................................................................*......................................................................... csetm x26, cc // ...........................................................................................................................................*........................................................................ uaddlp v26.2D, v31.4S // ......................................................*............................................................................................................................................................. mul x6, x25, x15 // ..................................................................*................................................................................................................................................. stp x17, x26, [sp, #cache_a01] // ............................................................................................................................................*....................................................................... umull v24.2D, v27.2S, v14.2S // ................................................*................................................................................................................................................................... uzp2 v30.4S, v16.4S, v16.4S // .................................................................................................................................................................*.................................................. shl v4.2D, v26.2D, #32 // .........................................................*.......................................................................................................................................................... uzp2 v5.4S, v8.4S, v8.4S // ..................................................*................................................................................................................................................................. umulh x17, x25, x4 // .................................................................*.................................................................................................................................................. umlal v4.2D, v27.2S, v14.2S // ...........................................................*........................................................................................................................................................ umull v8.2D, v27.2S, v21.2S // .................................................*.................................................................................................................................................................. mov x21, v4.d[0] // .............................................................*...................................................................................................................................................... adds x8, x8, x22 // ................................................................*................................................................................................................................................... mov x12, v4.d[1] // ..............................................................*..................................................................................................................................................... ldp x23, x14, [x2, #16] // ....*............................................................................................................................................................................................................... adcs x29, x7, x6 // ...................................................................*................................................................................................................................................ umulh x13, x25, x15 // ....................................................................*............................................................................................................................................... usra v8.2D, v24.2D, #32 // ....................................................*............................................................................................................................................................... ldp x8, x24, [x30, #cache_m20] // ...........................................................................................................................................................................................................*........ adcs x9, x20, x21 // .....................................................................*.............................................................................................................................................. ldr q9, [x2, #32]! // .......................................................................................................................................................................*............................................ xtn v28.2S, v16.2D // ..................................................................................................................................................................*................................................. adcs x19, x10, x12 // ......................................................................*............................................................................................................................................. ldr q13, [x2, #16] // ........................................................................................................................................................................*........................................... umull v18.2D, v5.2S, v21.2S // .....................................................*.............................................................................................................................................................. adc x7, xzr, xzr // .........................................................................*.......................................................................................................................................... adds x5, x29, x17 // ..........................................................................*......................................................................................................................................... xtn v21.2S, v1.2D // ...................................................................................*................................................................................................................................ mul x12, x5, x3 // ...............................................................................*.................................................................................................................................... and v4.16B, v8.16B, v29.16B // .......................................................*............................................................................................................................................................ adcs x21, x9, x13 // ...........................................................................*........................................................................................................................................ uzp2 v31.4S, v9.4S, v9.4S // ...............................................................................................................................................................................*.................................... xtn v23.2S, v9.2D // .........................................................................................................................................................................*.......................................... usra v18.2D, v8.2D, #32 // ..........................................................*......................................................................................................................................................... umlal v4.2D, v5.2S, v14.2S // ........................................................*........................................................................................................................................................... dup v5.2D, x12 // ................................................................................*................................................................................................................................... umull v16.2D, v23.2S, v30.2S // ............................................................................................................................................................................*....................................... umull v1.2D, v23.2S, v28.2S // ..............................................................................................................................................................................*..................................... umulh x29, x12, x15 // .........................................................................................................*.......................................................................................................... umull v8.2D, v31.2S, v30.2S // ....................................................................................................................................................................................*............................... xtn v24.2S, v13.2D // ..........................................................................................................................................................................*......................................... mul v25.4S, v2.4S, v5.4S // ........................................................................................*........................................................................................................................... usra v18.2D, v4.2D, #32 // ............................................................*....................................................................................................................................................... xtn v3.2S, v5.2D // ..................................................................................*................................................................................................................................. uzp2 v19.4S, v5.4S, v5.4S // .......................................................................................*............................................................................................................................ mul x10, x12, x15 // .......................................................................................................*............................................................................................................ umull v26.2D, v3.2S, v20.2S // ......................................................................................*............................................................................................................................. mov x22, v18.d[0] // .......................................................................*............................................................................................................................................ umull v10.2D, v3.2S, v21.2S // .....................................................................................*.............................................................................................................................. uaddlp v11.2D, v25.4S // ...........................................................................................*........................................................................................................................ mov x6, v18.d[1] // ........................................................................*........................................................................................................................................... mul x16, x12, x4 // ....................................................................................................*............................................................................................................... umull v4.2D, v19.2S, v20.2S // ..........................................................................................*......................................................................................................................... usra v16.2D, v1.2D, #32 // ...................................................................................................................................................................................*................................ adcs x13, x19, x22 // ............................................................................*....................................................................................................................................... shl v11.2D, v11.2D, #32 // ..............................................................................................*..................................................................................................................... adc x6, x7, x6 // .............................................................................*...................................................................................................................................... subs x7, x11, x12 // .............................................................................................................................................*...................................................................... usra v26.2D, v10.2D, #32 // .........................................................................................*.......................................................................................................................... csetm x26, cc // ...............................................................................................................................................*.................................................................... cneg x20, x7, cc // ..............................................................................................................................................*..................................................................... subs x19, x25, x12 // .....................................................................................................................................................*.............................................................. umlal v11.2D, v3.2S, v21.2S // ................................................................................................*................................................................................................................... cneg x9, x19, cc // ......................................................................................................................................................*............................................................. stp x20, x26, [sp, #cache_a02] // ................................................................................................................................................*................................................................... umulh x7, x12, x4 // ......................................................................................................*............................................................................................................. usra v8.2D, v16.2D, #32 // ........................................................................................................................................................................................*........................... mul v7.4S, v17.4S, v9.4S // ................................................................................................................................................................................................*................... csetm x26, cc // .......................................................................................................................................................*............................................................ adds x19, x5, x16 // .....................................................................................................*.............................................................................................................. and v1.16B, v16.16B, v29.16B // .......................................................................................................................................................................................*............................ adcs x21, x21, x10 // ........................................................................................................*........................................................................................................... stp x9, x26, [sp, #cache_a12] // ........................................................................................................................................................*........................................................... ldp x17, x20, [sp, #cache_a02] // .....................................................................................................................................................................................................*.............. usra v4.2D, v26.2D, #32 // ...............................................................................................*.................................................................................................................... and v18.16B, v26.16B, v29.16B // ............................................................................................*....................................................................................................................... umlal v1.2D, v31.2S, v28.2S // ..........................................................................................................................................................................................*......................... mov x22, v11.d[0] // ..................................................................................................*................................................................................................................. mov x16, v11.d[1] // ...................................................................................................*................................................................................................................ umlal v18.2D, v19.2S, v21.2S // .............................................................................................*...................................................................................................................... adcs x19, x13, x22 // ..........................................................................................................*......................................................................................................... mul x22, x17, x8 // ...............................................................................................................................................................................................................*.... uaddlp v5.2D, v7.4S // ..................................................................................................................................................................................................*................. adcs x13, x6, x16 // ...........................................................................................................*........................................................................................................ usra v8.2D, v1.2D, #32 // ..............................................................................................................................................................................................*..................... adc x9, xzr, xzr // ..............................................................................................................*..................................................................................................... adds x5, x21, x7 // ...............................................................................................................*.................................................................................................... usra v4.2D, v18.2D, #32 // .................................................................................................*.................................................................................................................. adcs x6, x19, x29 // .................................................................................................................*.................................................................................................. mul x19, x5, x3 // ................................................................................................................*................................................................................................... shl v15.2D, v5.2D, #32 // ......................................................................................................................................................................................................*............. mov x3, v8.d[1] // ...................................................................................................................................................................................................*................ umlal v15.2D, v23.2S, v28.2S // .......................................................................................................................................................................................................*............ mov x21, v4.d[0] // ............................................................................................................*....................................................................................................... mul x7, x19, x23 // .......................................................................................................................*............................................................................................ stp x12, x19, [x1, #16] // ....................................................................................................................*............................................................................................... mov x10, v4.d[1] // .............................................................................................................*...................................................................................................... ldr q9, [x1, #16] // ........................................................................................................................................*........................................................................... adcs x13, x13, x21 // ..................................................................................................................*................................................................................................. mov x21, v15.d[1] // ............................................................................................................................................................................................................*....... mul x16, x19, x4 // .....................................................................................................................*.............................................................................................. adc x9, x9, x10 // ...................................................................................................................*................................................................................................ subs x29, x25, x19 // .........................................................................................................................................................*.......................................................... csetm x26, cc // ...........................................................................................................................................................*........................................................ cneg x10, x29, cc // ..........................................................................................................................................................*......................................................... subs x29, x12, x19 // .............................................................................................................................................................*...................................................... stp x10, x26, [sp, #cache_a13] // ............................................................................................................................................................*....................................................... uzp2 v18.4S, v9.4S, v9.4S // ....................................................................................................................................................................*............................................... mul x12, x19, x15 // ......................................................................................................................*............................................................................................. rev64 v20.4S, v9.4S // ......................................................................................................................................................................*............................................. xtn v19.2S, v9.2D // .....................................................................................................................................................................*.............................................. umull v25.2D, v24.2S, v18.2S // .............................................................................................................................................................................*...................................... csetm x26, cc // ...............................................................................................................................................................*.................................................... umull v14.2D, v24.2S, v19.2S // ................................................................................................................................................................................*................................... cneg x29, x29, cc // ..............................................................................................................................................................*..................................................... umulh x10, x19, x23 // ..............................................................................................................................*..................................................................................... adds x25, x5, x16 // .........................................................................................................................*.......................................................................................... mul v7.4S, v20.4S, v13.4S // .................................................................................................................................................................................*.................................. adcs x12, x6, x12 // ...........................................................................................................................*........................................................................................ ldp x6, x5, [sp, #cache_a01] // ..........................................................................................................................................................................................................*......... mov x16, v8.d[0] // .........................................................................................................................................................................................................*.......... adcs x25, x13, x7 // .............................................................................................................................*...................................................................................... stp x29, x26, [sp, #cache_a23] // ................................................................................................................................................................*................................................... usra v25.2D, v14.2D, #32 // .....................................................................................................................................................................................*.............................. mul x29, x19, x14 // ........................................................................................................................*........................................................................................... uzp2 v1.4S, v13.4S, v13.4S // ...........................................................................................................................................................................*........................................ uaddlp v7.2D, v7.4S // ......................................................................................................................................................................................*............................. umull v0.2D, v1.2S, v18.2S // ..................................................................................................................................................................................*................................. umulh x13, x19, x4 // ..........................................................................................................................*......................................................................................... and v10.16B, v25.16B, v29.16B // .........................................................................................................................................................................................*.......................... shl v13.2D, v7.2D, #32 // ............................................................................................................................................................................................*....................... adcs x4, x9, x29 // ...............................................................................................................................*.................................................................................... umlal v10.2D, v1.2S, v19.2S // .............................................................................................................................................................................................*...................... adc x9, xzr, xzr // .................................................................................................................................*.................................................................................. subs x29, x11, x19 // .................................................................................................................................................*.................................................................. usra v0.2D, v25.2D, #32 // ...........................................................................................................................................................................................*........................ eor x11, x20, x24 // ................................................................................................................................................................................................................*... umulh x15, x19, x15 // ............................................................................................................................*....................................................................................... umlal v13.2D, v24.2S, v19.2S // ...............................................................................................................................................................................................*.................... cneg x7, x29, cc // ..................................................................................................................................................*................................................................. ldp x20, x29, [x1, #32]! // .................................................................................................................................................................................................................*.. csetm x26, cc // ...................................................................................................................................................*................................................................ usra v0.2D, v10.2D, #32 // .................................................................................................................................................................................................*.................. umulh x19, x19, x14 // ................................................................................................................................*................................................................................... mov x23, v13.d[1] // .............................................................................................................................................................................................................*...... stp x7, x26, [sp, #cache_a03] // ....................................................................................................................................................*............................................................... adds x12, x12, x13 // ..................................................................................................................................*................................................................................. adcs x13, x25, x15 // ...................................................................................................................................*................................................................................ mov x26, v0.d[0] // ....................................................................................................................................................................................................*............... umulh x8, x17, x8 // ..................................................................................................................................................................................................................*. adcs x14, x4, x10 // ....................................................................................................................................*............................................................................... mov x17, v13.d[0] // ........................................................................................................................................................................................................*........... adc x15, x9, x19 // .....................................................................................................................................*.............................................................................. ldp x24, x10, [x30], #96 // ..............................................................................................................................................................................................................*..... Lbignum_emontredc_8n_cdiff_maddloop_neon: ldr q14, [x2, #32]! // e.................................................................................................................................................... ldr q25, [x2, #16] // .e................................................................................................................................................... eor x19, x5, x10 // .................................................................................*................................................................... adds x25, x21, x16 // .....................................*............................................................................................................... mov x16, v0.d[1] // .................................*................................................................................................................... ldp x4, x7, [x1, #16] // .............................................*....................................................................................................... adcs x21, x17, x3 // ......................................*.............................................................................................................. eor x22, x22, x11 // .................................................................................................................*................................... adcs x23, x23, x26 // .......................................*............................................................................................................. adc x17, x16, xzr // ........................................*............................................................................................................ adds x16, x12, x20 // ...........................................*......................................................................................................... mul x5, x6, x24 // ..................................................................................*.................................................................. xtn v21.2S, v14.2D // ..e.................................................................................................................................................. xtn v31.2S, v25.2D // ................e.................................................................................................................................... adcs x9, x13, x29 // ............................................*........................................................................................................ uzp2 v24.4S, v25.4S, v25.4S // ...................e................................................................................................................................. mov x29, v15.d[0] // .........................................*........................................................................................................... adcs x4, x14, x4 // ..............................................*...................................................................................................... ldp x10, x13, [sp, #cache_a23] // ....................................................................*................................................................................ umull v5.2D, v21.2S, v30.2S // ....e................................................................................................................................................ umulh x20, x6, x24 // ...................................................................................*................................................................. adcs x24, x15, x7 // ...............................................*..................................................................................................... ldp x12, x7, [x30, #cache_m32 - 96] // .....................................................................*............................................................................... umull v16.2D, v31.2S, v18.2S // ..................e.................................................................................................................................. adc x6, xzr, xzr // ................................................*.................................................................................................... adds x14, x25, x29 // .................................................*................................................................................................... umull v13.2D, v21.2S, v28.2S // ...e................................................................................................................................................. uzp2 v10.4S, v14.4S, v14.4S // .....e............................................................................................................................................... eor x15, x8, x11 // ...................................................................................................................*................................. adcs x25, x21, x25 // ..................................................*.................................................................................................. umull v1.2D, v31.2S, v19.2S // .................e................................................................................................................................... adcs x8, x23, x21 // ...................................................*................................................................................................. mul v6.4S, v20.4S, v25.4S // ....................e................................................................................................................................ eor x7, x13, x7 // ......................................................................*.............................................................................. adcs x23, x17, x23 // ....................................................*................................................................................................ eor x21, x5, x19 // .....................................................................................*............................................................... adc x13, xzr, x17 // .....................................................*............................................................................................... adds x17, x25, x29 // ......................................................*.............................................................................................. umull v0.2D, v24.2S, v18.2S // ......................e.............................................................................................................................. usra v5.2D, v13.2D, #32 // .......e............................................................................................................................................. adcs x5, x8, x14 // .......................................................*............................................................................................. umull v2.2D, v10.2S, v30.2S // ........e............................................................................................................................................ adcs x25, x23, x25 // ........................................................*............................................................................................ usra v16.2D, v1.2D, #32 // .....................e............................................................................................................................... adcs x8, x13, x8 // .........................................................*........................................................................................... uaddlp v13.2D, v6.4S // .......................e............................................................................................................................. adcs x23, xzr, x23 // ..........................................................*.......................................................................................... and v7.16B, v5.16B, v29.16B // ..........e.......................................................................................................................................... adc x13, xzr, x13 // ...........................................................*......................................................................................... adds x29, x29, x16 // ............................................................*........................................................................................ mul x16, x10, x12 // .......................................................................*............................................................................. usra v2.2D, v5.2D, #32 // .............e....................................................................................................................................... adcs x9, x14, x9 // .............................................................*....................................................................................... and v25.16B, v16.16B, v29.16B // ........................e............................................................................................................................ adcs x17, x17, x4 // ..............................................................*...................................................................................... umlal v7.2D, v10.2S, v28.2S // ...........e......................................................................................................................................... umulh x12, x10, x12 // ........................................................................*............................................................................ adcs x10, x5, x24 // ...............................................................*..................................................................................... usra v0.2D, v16.2D, #32 // ...........................e......................................................................................................................... eor x5, x16, x7 // ..........................................................................*.......................................................................... ldp x16, x14, [x30, #cache_m31 - 96] // ................................................................................................*.................................................... adcs x6, x25, x6 // ................................................................*.................................................................................... shl v16.2D, v13.2D, #32 // ..........................e.......................................................................................................................... eor x24, x20, x19 // .......................................................................................*............................................................. adcs x4, x8, xzr // .................................................................*................................................................................... ldp x20, x25, [sp, #cache_a13] // ...............................................................................................*..................................................... umlal v25.2D, v24.2S, v19.2S // .........................e........................................................................................................................... adcs x23, x23, xzr // ..................................................................*.................................................................................. usra v2.2D, v7.2D, #32 // ...............e..................................................................................................................................... umlal v16.2D, v31.2S, v19.2S // ............................e........................................................................................................................ adc x8, x13, xzr // ...................................................................*................................................................................. adds xzr, x7, #1 // .........................................................................*........................................................................... mul v7.4S, v17.4S, v14.4S // ......e.............................................................................................................................................. adcs x4, x4, x5 // ...........................................................................*......................................................................... eor x5, x12, x7 // ............................................................................*........................................................................ adcs x23, x23, x5 // .............................................................................*....................................................................... mul x12, x20, x16 // ..................................................................................................*.................................................. adc x5, x8, x7 // ..............................................................................*...................................................................... adds xzr, x19, #1 // ....................................................................................*................................................................ adcs x21, x9, x21 // ......................................................................................*.............................................................. eor x8, x25, x14 // .................................................................................................*................................................... usra v0.2D, v25.2D, #32 // .............................e....................................................................................................................... adcs x13, x17, x24 // ........................................................................................*............................................................ stp x29, x21, [x1, #0] // ..............................................................................................*...................................................... umulh x20, x20, x16 // ...................................................................................................*................................................. uaddlp v10.2D, v7.4S // .........e........................................................................................................................................... adcs x17, x10, x19 // .........................................................................................*........................................................... mov x3, v2.d[1] // ................................e.................................................................................................................... ldp x29, x24, [sp, #cache_a03] // .........................................................................................................................*........................... adcs x25, x6, x19 // ..........................................................................................*.......................................................... ldp x6, x21, [x30, #cache_m30 - 96] // ..........................................................................................................................*.......................... eor x10, x12, x8 // .....................................................................................................*............................................... adcs x9, x4, x19 // ...........................................................................................*......................................................... mov x26, v0.d[0] // ...............................e..................................................................................................................... ldp x4, x16, [x30, #cache_m21 - 96] // .......................................................................................................................................*............. adcs x12, x23, x19 // ............................................................................................*........................................................ adc x5, x5, x19 // .............................................................................................*....................................................... adds xzr, x8, #1 // ....................................................................................................*................................................ ldp x7, x19, [sp, #cache_a12] // ......................................................................................................................................*.............. adcs x14, x25, x10 // ......................................................................................................*.............................................. mul x25, x29, x6 // ............................................................................................................................*........................ eor x20, x20, x8 // .......................................................................................................*............................................. adcs x23, x9, x20 // ........................................................................................................*............................................ ldp x9, x20, [sp, #cache_a02] // ...........................................................................................................e......................................... eor x24, x24, x21 // ...........................................................................................................................*......................... adcs x12, x12, x8 // .........................................................................................................*........................................... adc x10, x5, x8 // ..........................................................................................................*.......................................... adds xzr, x11, #1 // ................................................................................................................*.................................... umulh x5, x29, x6 // .............................................................................................................................*....................... shl v15.2D, v10.2D, #32 // ............e........................................................................................................................................ adcs x8, x13, x22 // ..................................................................................................................*.................................. eor x13, x25, x24 // ...............................................................................................................................*..................... adcs x29, x17, x15 // ....................................................................................................................*................................ umlal v15.2D, v21.2S, v28.2S // ..............e...................................................................................................................................... adcs x22, x14, x11 // .....................................................................................................................*............................... mov x17, v16.d[0] // ...................................e................................................................................................................. adcs x21, x23, x11 // ......................................................................................................................*.............................. mul x23, x7, x4 // .........................................................................................................................................*........... adcs x14, x12, x11 // .......................................................................................................................*............................. eor x12, x19, x16 // ........................................................................................................................................*............ mov x16, v2.d[0] // ..............................e...................................................................................................................... adc x15, x10, x11 // ........................................................................................................................*............................ adds xzr, x24, #1 // ..............................................................................................................................*...................... eor x19, x5, x24 // .................................................................................................................................*................... adcs x11, x29, x13 // ................................................................................................................................*.................... umulh x29, x7, x4 // ..........................................................................................................................................*.......... adcs x13, x22, x19 // ..................................................................................................................................*.................. ldp x6, x5, [sp, #cache_a01] // ...............................................................................e..................................................................... ldp x7, x25, [x30, #cache_m20] // ............................................................................................................e........................................ adcs x19, x21, x24 // ...................................................................................................................................*................. mov x21, v15.d[1] // ..................................e.................................................................................................................. eor x22, x23, x12 // ............................................................................................................................................*........ adcs x14, x14, x24 // ....................................................................................................................................*................ mov x23, v16.d[1] // ....................................e................................................................................................................ adc x15, x15, x24 // .....................................................................................................................................*............... adds xzr, x12, #1 // ...........................................................................................................................................*......... ldp x24, x10, [x30], #96 // ................................................................................e.................................................................... adcs x11, x11, x22 // .............................................................................................................................................*....... mul x22, x9, x7 // ..............................................................................................................e...................................... eor x4, x29, x12 // ...............................................................................................................................................*..... adcs x4, x13, x4 // ................................................................................................................................................*.... stp x8, x11, [x1, #16] // ..............................................................................................................................................*...... adcs x13, x19, x12 // .................................................................................................................................................*... eor x11, x20, x25 // .............................................................................................................e....................................... ldp x20, x29, [x1, #32]! // ..........................................e.......................................................................................................... adcs x14, x14, x12 // ..................................................................................................................................................*.. adc x15, x15, x12 // ...................................................................................................................................................*. mov x12, x4 // ....................................................................................................................................................* umulh x8, x9, x7 // ...............................................................................................................e..................................... sub count, count, #1 cbnz count, Lbignum_emontredc_8n_cdiff_maddloop_neon Lbignum_emontredc_8n_cdiff_inner_loop_postamble: umulh x19, x6, x24 // ..............*........................................................................................................... ldp x7, x9, [sp, #cache_a23] // .............*............................................................................................................ adds x4, x21, x16 // .*........................................................................................................................ mov x25, v0.d[1] // ..*....................................................................................................................... eor x5, x5, x10 // *......................................................................................................................... adcs x17, x17, x3 // ....*..................................................................................................................... ldp x16, x10, [x1, #16] // ...*...................................................................................................................... adcs x21, x23, x26 // ......*................................................................................................................... eor x8, x8, x11 // ...................*...................................................................................................... adc x23, x25, xzr // .......*.................................................................................................................. adds x20, x12, x20 // ........*................................................................................................................. adcs x12, x13, x29 // ..........*............................................................................................................... mov x25, v15.d[0] // ...........*.............................................................................................................. adcs x13, x14, x16 // ............*............................................................................................................. eor x16, x19, x5 // .........................................*................................................................................ adcs x29, x15, x10 // ...............*.......................................................................................................... ldp x14, x19, [x30, #cache_m32 - 96] // ................*......................................................................................................... mul x15, x6, x24 // .........*................................................................................................................ adc x24, xzr, xzr // .................*........................................................................................................ adds x6, x4, x25 // ..................*....................................................................................................... adcs x10, x17, x4 // ....................*..................................................................................................... eor x4, x22, x11 // .....*.................................................................................................................... adcs x17, x21, x17 // .....................*.................................................................................................... eor x22, x9, x19 // ......................*................................................................................................... adcs x9, x23, x21 // .......................*.................................................................................................. adc x21, xzr, x23 // .........................*................................................................................................ adds x23, x10, x25 // ..........................*............................................................................................... eor x15, x15, x5 // ........................*................................................................................................. adcs x19, x17, x6 // ...........................*.............................................................................................. ldp x26, xzr, [sp, #16] // ...........................................................................................................*.............. sub x2, x2, x0 // .....................................................................................................................*.... adcs x10, x9, x10 // ............................*............................................................................................. adcs x17, x21, x17 // .............................*............................................................................................ adcs x9, xzr, x9 // ..............................*........................................................................................... adc x21, xzr, x21 // ...............................*.......................................................................................... adds x25, x25, x20 // ................................*......................................................................................... mul x20, x7, x14 // .................................*........................................................................................ adcs x6, x6, x12 // ..................................*....................................................................................... adcs x23, x23, x13 // ...................................*...................................................................................... adcs x13, x19, x29 // .....................................*.................................................................................... umulh x19, x7, x14 // ....................................*..................................................................................... ldp x14, x29, [x30, #cache_m31 - 96] // .......................................*.................................................................................. adcs x10, x10, x24 // ........................................*................................................................................. ldp x12, x7, [sp, #cache_a13] // ...........................................*.............................................................................. adcs x17, x17, xzr // ..........................................*............................................................................... adcs x24, x9, xzr // ............................................*............................................................................. adc x9, x21, xzr // .............................................*............................................................................ adds xzr, x22, #1 // ..............................................*........................................................................... eor x21, x20, x22 // ......................................*................................................................................... adcs x20, x17, x21 // ...............................................*.......................................................................... eor x17, x19, x22 // ................................................*......................................................................... mul x19, x12, x14 // ..................................................*....................................................................... eor x29, x7, x29 // ......................................................*................................................................... adcs x17, x24, x17 // .................................................*........................................................................ adc x9, x9, x22 // ...................................................*...................................................................... adds xzr, x5, #1 // ....................................................*..................................................................... umulh x21, x12, x14 // .........................................................*................................................................ ldp x14, x24, [sp, #cache_a03] // ...........................................................*.............................................................. adcs x6, x6, x15 // .....................................................*.................................................................... adcs x7, x23, x16 // .......................................................*.................................................................. ldp x15, x12, [x30, #cache_m30 - 96] // .............................................................*............................................................ eor x19, x19, x29 // ..............................................................*........................................................... adcs x13, x13, x5 // ..........................................................*............................................................... stp x25, x6, [x1, #0] // ........................................................*................................................................. adcs x16, x10, x5 // ............................................................*............................................................. ldp x10, x6, [x30, #cache_m21 - 96] // ................................................................*......................................................... adcs x23, x20, x5 // ...............................................................*.......................................................... adcs x25, x17, x5 // .................................................................*........................................................ umulh x30, x14, x15 // .............................................................................*............................................ ldp x17, x22, [sp, #cache_a12] // ....................................................................*..................................................... adc x9, x9, x5 // ..................................................................*....................................................... adds xzr, x29, #1 // ...................................................................*...................................................... eor x21, x21, x29 // .......................................................................*.................................................. adcs x16, x16, x19 // .....................................................................*.................................................... adcs x5, x23, x21 // ........................................................................*................................................. eor x23, x24, x12 // .........................................................................*................................................ mul x12, x17, x10 // ...................................................................................*...................................... adcs x19, x25, x29 // ..........................................................................*............................................... adc x29, x9, x29 // ...........................................................................*.............................................. adds xzr, x11, #1 // ............................................................................*............................................. adcs x7, x7, x4 // ..............................................................................*........................................... adcs x21, x13, x8 // ................................................................................*......................................... mul x4, x14, x15 // ......................................................................*................................................... eor x9, x30, x23 // ........................................................................................*................................. adcs x30, x16, x11 // .................................................................................*........................................ adcs x24, x5, x11 // ..................................................................................*....................................... adcs x16, x19, x11 // ....................................................................................*..................................... adc x19, x29, x11 // ......................................................................................*................................... adds xzr, x23, #1 // .......................................................................................*.................................. eor x8, x4, x23 // ...............................................................................*.......................................... adcs x4, x21, x8 // .........................................................................................*................................ umulh x21, x17, x10 // ..........................................................................................*............................... adcs x8, x30, x9 // ...........................................................................................*.............................. ldp x10, x30, [x1, #32] // .........................................................................................................*................ adcs x25, x24, x23 // ............................................................................................*............................. eor x11, x22, x6 // .....................................................................................*.................................... adcs x22, x16, x23 // ..............................................................................................*........................... eor x5, x12, x11 // .............................................................................................*............................ adc x29, x19, x23 // ...............................................................................................*.......................... adds xzr, x11, #1 // ................................................................................................*......................... eor x14, x21, x11 // ..................................................................................................*....................... adcs x9, x4, x5 // .................................................................................................*........................ stp x7, x9, [x1, #16] // ....................................................................................................*..................... adcs x9, x8, x14 // ...................................................................................................*...................... adcs x19, x25, x11 // .....................................................................................................*.................... ldp x8, x21, [x1, #48] // ..........................................................................................................*............... mov x24, x9 // ........................................................................................................*................. adcs x5, x22, x11 // ......................................................................................................*................... adc x16, x29, x11 // .......................................................................................................*.................. adds xzr, x28, x28 // ............................................................................................................*............. adcs x17, x10, x24 // .............................................................................................................*............ adcs x14, x30, x19 // ..............................................................................................................*........... ldr x30, [sp, #8] // .........................................................................................................................* adcs x8, x8, x5 // ...............................................................................................................*.......... stp x17, x14, [x1, #32] // ..................................................................................................................*....... adcs x9, x21, x16 // ................................................................................................................*......... csetm x28, cs // .................................................................................................................*........ stp x8, x9, [x1, #48] // ...................................................................................................................*...... sub x26, x26, #1 // .......................................................................................................................*.. sub x1, x1, x0 // ....................................................................................................................*..... stp x26, xzr, [sp, #16] // ........................................................................................................................*. add x1, x1, #32 // ......................................................................................................................*... Lbignum_emontredc_8n_cdiff_outer_loop_end: cbnz x26, Lbignum_emontredc_8n_cdiff_outerloop neg x0, x28 Lbignum_emontredc_8n_cdiff_end: CFI_INC_SP(32) CFI_INC_SP((6*16)) CFI_STACKLOAD2(d8,d9,(0*16)) CFI_STACKLOAD2(d10,d11,(1*16)) CFI_STACKLOAD2(d12,d13,(2*16)) CFI_STACKLOAD2(d14,d15,(3*16)) CFI_STACKLOAD2(x29,x30,(4*16)) CFI_STACKLOAD2(x27,x28,(5*16)) CFI_STACKLOAD2(x25,x26,(6*16)) CFI_STACKLOAD2(x23,x24,(7*16)) CFI_STACKLOAD2(x21,x22,(8*16)) CFI_STACKLOAD2(x19,x20,(9*16)) CFI_INC_SP((10*16)) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_emontredc_8n_cdiff)
wlsfx/bnbb
6,032
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_mul_4_8.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply z := x * y // Inputs x[4], y[4]; output z[8] // // extern void bignum_mul_4_8(uint64_t z[static 8], const uint64_t x[static 4], // const uint64_t y[static 4]); // // Standard ARM ABI: X0 = z, X1 = x, X2 = y // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul_4_8) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mul_4_8) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul_4_8) .text .balign 4 #define z x0 #define x x1 #define y x2 #define a0 x3 #define a0short w3 #define a1 x4 #define b0 x5 #define b0short w5 #define b1 x6 #define u0 x7 #define u1 x8 #define u2 x9 #define u3 x10 #define u4 x11 #define u5 x12 #define u6 x13 #define u7 x14 #define t x15 #define sgn x16 #define ysgn x17 // These are aliases to registers used elsewhere including input pointers. // By the time they are used this does not conflict with other uses. #define m0 y #define m1 ysgn #define m2 t #define m3 x #define u u2 S2N_BN_SYMBOL(bignum_mul_4_8): CFI_START // Multiply the low halves using Karatsuba 2x2->4 to get [u3,u2,u1,u0] // The zeroth multiplication (only) is done via 32-bit breakdowns ldp a0, a1, [x] ldp b0, b1, [y] umull u0, a0short, b0short lsr x17, a0, #32 umull x15, w17, b0short lsr x16, b0, #32 umull u1, w16, w17 umull x16, a0short, w16 adds u0, u0, x15, lsl #32 lsr x15, x15, #32 adc u1, u1, x15 adds u0, u0, x16, lsl #32 lsr x16, x16, #32 adc u1, u1, x16 mul u2, a1, b1 umulh u3, a1, b1 subs a1, a1, a0 cneg a1, a1, cc csetm sgn, cc adds u2, u2, u1 adc u3, u3, xzr subs a0, b0, b1 cneg a0, a0, cc cinv sgn, sgn, cc mul t, a1, a0 umulh a0, a1, a0 adds u1, u0, u2 adcs u2, u2, u3 adc u3, u3, xzr adds xzr, sgn, #1 eor t, t, sgn adcs u1, t, u1 eor a0, a0, sgn adcs u2, a0, u2 adc u3, u3, sgn // Multiply the high halves using Karatsuba 2x2->4 to get [u7,u6,u5,u4] // Again, the zeroth multiplication (only) is done via 32-bit breakdowns ldp a0, a1, [x, #16] ldp b0, b1, [y, #16] umull u4, a0short, b0short lsr x17, a0, #32 umull x15, w17, b0short lsr x16, b0, #32 umull u5, w16, w17 umull x16, a0short, w16 adds u4, u4, x15, lsl #32 lsr x15, x15, #32 adc u5, u5, x15 adds u4, u4, x16, lsl #32 lsr x16, x16, #32 adc u5, u5, x16 mul u6, a1, b1 umulh u7, a1, b1 subs a1, a1, a0 cneg a1, a1, cc csetm sgn, cc adds u6, u6, u5 adc u7, u7, xzr subs a0, b0, b1 cneg a0, a0, cc cinv sgn, sgn, cc mul t, a1, a0 umulh a0, a1, a0 adds u5, u4, u6 adcs u6, u6, u7 adc u7, u7, xzr adds xzr, sgn, #1 eor t, t, sgn adcs u5, t, u5 eor a0, a0, sgn adcs u6, a0, u6 adc u7, u7, sgn // Compute sgn,[a1,a0] = x_hi - x_lo // and ysgn,[b1,b0] = y_lo - y_hi // sign-magnitude differences ldp a0, a1, [x, #16] ldp t, sgn, [x] subs a0, a0, t sbcs a1, a1, sgn csetm sgn, cc ldp t, ysgn, [y] subs b0, t, b0 sbcs b1, ysgn, b1 csetm ysgn, cc eor a0, a0, sgn subs a0, a0, sgn eor a1, a1, sgn sbc a1, a1, sgn eor b0, b0, ysgn subs b0, b0, ysgn eor b1, b1, ysgn sbc b1, b1, ysgn // Save the correct sign for the sub-product eor sgn, ysgn, sgn // Add H' = H + L_top, still in [u7,u6,u5,u4] adds u4, u4, u2 adcs u5, u5, u3 adcs u6, u6, xzr adc u7, u7, xzr // Now compute the mid-product as [m3,m2,m1,m0] mul m0, a0, b0 umulh m1, a0, b0 mul m2, a1, b1 umulh m3, a1, b1 subs a1, a1, a0 cneg a1, a1, cc csetm u, cc adds m2, m2, m1 adc m3, m3, xzr subs b1, b0, b1 cneg b1, b1, cc cinv u, u, cc mul b0, a1, b1 umulh b1, a1, b1 adds m1, m0, m2 adcs m2, m2, m3 adc m3, m3, xzr adds xzr, u, #1 eor b0, b0, u adcs m1, b0, m1 eor b1, b1, u adcs m2, b1, m2 adc m3, m3, u // Accumulate the positive mid-terms as [u7,u6,u5,u4,u3,u2] adds u2, u4, u0 adcs u3, u5, u1 adcs u4, u6, u4 adcs u5, u7, u5 adcs u6, u6, xzr adc u7, u7, xzr // Add in the sign-adjusted complex term adds xzr, sgn, #1 eor m0, m0, sgn adcs u2, m0, u2 eor m1, m1, sgn adcs u3, m1, u3 eor m2, m2, sgn adcs u4, m2, u4 eor m3, m3, sgn adcs u5, m3, u5 adcs u6, u6, sgn adc u7, u7, sgn // Store back the result stp u0, u1, [z] stp u2, u3, [z, #16] stp u4, u5, [z, #32] stp u6, u7, [z, #48] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mul_4_8) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
6,674
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_sqr_8_16_alt.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Square, z := x^2 // Input x[8]; output z[16] // // extern void bignum_sqr_8_16_alt(uint64_t z[static 16], // const uint64_t x[static 8]); // // Standard ARM ABI: X0 = z, X1 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sqr_8_16_alt) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_sqr_8_16_alt) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sqr_8_16_alt) .text .balign 4 #define z x0 #define x x1 #define a0 x2 #define a1 x3 #define a2 x4 #define a3 x5 #define a4 x6 #define a5 x7 #define a6 x8 #define a7 x9 #define l x10 #define u0 x2 // The same as a0, which is safe #define u1 x11 #define u2 x12 #define u3 x13 #define u4 x14 #define u5 x15 #define u6 x16 #define u7 x17 #define u8 x19 #define u9 x20 #define u10 x21 #define u11 x22 #define u12 x23 #define u13 x24 #define u14 x25 #define u15 x26 S2N_BN_SYMBOL(bignum_sqr_8_16_alt): CFI_START // It's convenient to have more registers to play with CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x24) CFI_PUSH2(x25,x26) // Load all the elements as [a7;a6;a5;a4;a3;a2;a1;a0], set up an initial // window [u8;u7;u6;u5;u4;u3;u2;u1] = 10 + 20 + 30 + 40 + 50 + 60 + 70 ldp a0, a1, [x] mul u1, a0, a1 umulh u2, a0, a1 ldp a2, a3, [x, #16] mul l, a0, a2 umulh u3, a0, a2 adds u2, u2, l ldp a4, a5, [x, #32] mul l, a0, a3 umulh u4, a0, a3 adcs u3, u3, l ldp a6, a7, [x, #48] mul l, a0, a4 umulh u5, a0, a4 adcs u4, u4, l mul l, a0, a5 umulh u6, a0, a5 adcs u5, u5, l mul l, a0, a6 umulh u7, a0, a6 adcs u6, u6, l mul l, a0, a7 umulh u8, a0, a7 adcs u7, u7, l adc u8, u8, xzr // Add in the next diagonal = 21 + 31 + 41 + 51 + 61 + 71 + 54 mul l, a1, a2 adds u3, u3, l mul l, a1, a3 adcs u4, u4, l mul l, a1, a4 adcs u5, u5, l mul l, a1, a5 adcs u6, u6, l mul l, a1, a6 adcs u7, u7, l mul l, a1, a7 adcs u8, u8, l cset u9, cs umulh l, a1, a2 adds u4, u4, l umulh l, a1, a3 adcs u5, u5, l umulh l, a1, a4 adcs u6, u6, l umulh l, a1, a5 adcs u7, u7, l umulh l, a1, a6 adcs u8, u8, l umulh l, a1, a7 adc u9, u9, l mul l, a4, a5 umulh u10, a4, a5 adds u9, u9, l adc u10, u10, xzr // And the next one = 32 + 42 + 52 + 62 + 72 + 64 + 65 mul l, a2, a3 adds u5, u5, l mul l, a2, a4 adcs u6, u6, l mul l, a2, a5 adcs u7, u7, l mul l, a2, a6 adcs u8, u8, l mul l, a2, a7 adcs u9, u9, l mul l, a4, a6 adcs u10, u10, l cset u11, cs umulh l, a2, a3 adds u6, u6, l umulh l, a2, a4 adcs u7, u7, l umulh l, a2, a5 adcs u8, u8, l umulh l, a2, a6 adcs u9, u9, l umulh l, a2, a7 adcs u10, u10, l umulh l, a4, a6 adc u11, u11, l mul l, a5, a6 umulh u12, a5, a6 adds u11, u11, l adc u12, u12, xzr // And the final one = 43 + 53 + 63 + 73 + 74 + 75 + 76 mul l, a3, a4 adds u7, u7, l mul l, a3, a5 adcs u8, u8, l mul l, a3, a6 adcs u9, u9, l mul l, a3, a7 adcs u10, u10, l mul l, a4, a7 adcs u11, u11, l mul l, a5, a7 adcs u12, u12, l cset u13, cs umulh l, a3, a4 adds u8, u8, l umulh l, a3, a5 adcs u9, u9, l umulh l, a3, a6 adcs u10, u10, l umulh l, a3, a7 adcs u11, u11, l umulh l, a4, a7 adcs u12, u12, l umulh l, a5, a7 adc u13, u13, l mul l, a6, a7 umulh u14, a6, a7 adds u13, u13, l adc u14, u14, xzr // Double that, with u15 holding the top carry adds u1, u1, u1 adcs u2, u2, u2 adcs u3, u3, u3 adcs u4, u4, u4 adcs u5, u5, u5 adcs u6, u6, u6 adcs u7, u7, u7 adcs u8, u8, u8 adcs u9, u9, u9 adcs u10, u10, u10 adcs u11, u11, u11 adcs u12, u12, u12 adcs u13, u13, u13 adcs u14, u14, u14 cset u15, cs // Add the homogeneous terms 00 + 11 + 22 + 33 + 44 + 55 + 66 + 77 umulh l, a0, a0 mul u0, a0, a0 adds u1, u1, l mul l, a1, a1 adcs u2, u2, l umulh l, a1, a1 adcs u3, u3, l mul l, a2, a2 adcs u4, u4, l umulh l, a2, a2 adcs u5, u5, l mul l, a3, a3 adcs u6, u6, l umulh l, a3, a3 adcs u7, u7, l mul l, a4, a4 adcs u8, u8, l umulh l, a4, a4 adcs u9, u9, l mul l, a5, a5 adcs u10, u10, l umulh l, a5, a5 adcs u11, u11, l mul l, a6, a6 adcs u12, u12, l umulh l, a6, a6 adcs u13, u13, l mul l, a7, a7 adcs u14, u14, l umulh l, a7, a7 adc u15, u15, l // Store back final result stp u0, u1, [z] stp u2, u3, [z, #16] stp u4, u5, [z, #32] stp u6, u7, [z, #48] stp u8, u9, [z, #64] stp u10, u11, [z, #80] stp u12, u13, [z, #96] stp u14, u15, [z, #112] // Restore registers and return CFI_POP2(x25,x26) CFI_POP2(x23,x24) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_sqr_8_16_alt) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
31,451
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_ksqr_32_64.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Square, z := x^2 // Input x[32]; output z[64]; temporary buffer t[>=72] // // extern void bignum_ksqr_32_64(uint64_t z[static 64], // const uint64_t x[static 32], // uint64_t t[static 72]); // // This is a Karatsuba-style function squaring half-sized results // and using temporary buffer t for intermediate results. // // Standard ARM ABI: X0 = z, X1 = x, X2 = t // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_ksqr_32_64) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_ksqr_32_64) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_ksqr_32_64) .text .balign 4 #define K 16 #define L 8 // (K/2) #define z x19 #define x x20 #define t x21 #define c x16 S2N_BN_SYMBOL(bignum_ksqr_32_64): CFI_START // Save extra registers and return address, store parameters safely CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x30) mov z, x0 mov x, x1 mov t, x2 // Compute L = x_lo * y_lo in bottom half of buffer (size 16 x 16 -> 32) CFI_BL(Lbignum_ksqr_32_64_local_ksqr_16_32) // Compute H = x_hi * y_hi in top half of buffer (size 16 x 16 -> 32) add x0, z, #16*K add x1, x, #8*K mov x2, t CFI_BL(Lbignum_ksqr_32_64_local_ksqr_16_32) // Compute H' = H + L_top in place of H (it cannot overflow) ldp x0, x1, [z, #16*16] ldp x2, x3, [z, #16*8] adds x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*16] ldp x0, x1, [z, #16*17] ldp x2, x3, [z, #16*9] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*17] ldp x0, x1, [z, #16*18] ldp x2, x3, [z, #16*10] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*18] ldp x0, x1, [z, #16*19] ldp x2, x3, [z, #16*11] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*19] ldp x0, x1, [z, #16*20] ldp x2, x3, [z, #16*12] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*20] ldp x0, x1, [z, #16*21] ldp x2, x3, [z, #16*13] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*21] ldp x0, x1, [z, #16*22] ldp x2, x3, [z, #16*14] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*22] ldp x0, x1, [z, #16*23] ldp x2, x3, [z, #16*15] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*23] ldp x0, x1, [z, #16*24] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*24] ldp x0, x1, [z, #16*25] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*25] ldp x0, x1, [z, #16*26] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*26] ldp x0, x1, [z, #16*27] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*27] ldp x0, x1, [z, #16*28] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*28] ldp x0, x1, [z, #16*29] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*29] ldp x0, x1, [z, #16*30] adcs x0, x0, xzr adcs x1, x1, xzr stp x0, x1, [z, #16*30] ldp x0, x1, [z, #16*31] adcs x0, x0, xzr adc x1, x1, xzr stp x0, x1, [z, #16*31] // Compute absolute difference [t..] = |x_lo - x_hi| ldp x0, x1, [x, #128] ldp x16, x17, [x] subs x0, x0, x16 sbcs x1, x1, x17 ldp x2, x3, [x, #144] ldp x16, x17, [x, #16] sbcs x2, x2, x16 sbcs x3, x3, x17 ldp x4, x5, [x, #160] ldp x16, x17, [x, #32] sbcs x4, x4, x16 sbcs x5, x5, x17 ldp x6, x7, [x, #176] ldp x16, x17, [x, #48] sbcs x6, x6, x16 sbcs x7, x7, x17 ldp x8, x9, [x, #192] ldp x16, x17, [x, #64] sbcs x8, x8, x16 sbcs x9, x9, x17 ldp x10, x11, [x, #208] ldp x16, x17, [x, #80] sbcs x10, x10, x16 sbcs x11, x11, x17 ldp x12, x13, [x, #224] ldp x16, x17, [x, #96] sbcs x12, x12, x16 sbcs x13, x13, x17 ldp x14, x15, [x, #240] ldp x16, x17, [x, #112] sbcs x14, x14, x16 sbcs x15, x15, x17 sbc c, xzr, xzr adds xzr, c, c eor x0, x0, c adcs x0, x0, xzr eor x1, x1, c adcs x1, x1, xzr stp x0, x1, [t] eor x2, x2, c adcs x2, x2, xzr eor x3, x3, c adcs x3, x3, xzr stp x2, x3, [t, #16] eor x4, x4, c adcs x4, x4, xzr eor x5, x5, c adcs x5, x5, xzr stp x4, x5, [t, #32] eor x6, x6, c adcs x6, x6, xzr eor x7, x7, c adcs x7, x7, xzr stp x6, x7, [t, #48] eor x8, x8, c adcs x8, x8, xzr eor x9, x9, c adcs x9, x9, xzr stp x8, x9, [t, #64] eor x10, x10, c adcs x10, x10, xzr eor x11, x11, c adcs x11, x11, xzr stp x10, x11, [t, #80] eor x12, x12, c adcs x12, x12, xzr eor x13, x13, c adcs x13, x13, xzr stp x12, x13, [t, #96] eor x14, x14, c adcs x14, x14, xzr eor x15, x15, c adc x15, x15, xzr stp x14, x15, [t, #112] // Compute M = |x_lo - x_hi|^2, size 32 add x0, t, #8*K mov x1, t add x2, t, #24*K CFI_BL(Lbignum_ksqr_32_64_local_ksqr_16_32) // Add the interlocking H' and L_bot terms // Intercept the carry at the 3k position and store it in x. // (Note that we no longer need the input x was pointing at.) ldp x0, x1, [z, #16*16] ldp x2, x3, [z] adds x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*8] ldp x0, x1, [z, #16*17] ldp x2, x3, [z, #16*1] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*9] ldp x0, x1, [z, #16*18] ldp x2, x3, [z, #16*2] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*10] ldp x0, x1, [z, #16*19] ldp x2, x3, [z, #16*3] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*11] ldp x0, x1, [z, #16*20] ldp x2, x3, [z, #16*4] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*12] ldp x0, x1, [z, #16*21] ldp x2, x3, [z, #16*5] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*13] ldp x0, x1, [z, #16*22] ldp x2, x3, [z, #16*6] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*14] ldp x0, x1, [z, #16*23] ldp x2, x3, [z, #16*7] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*15] ldp x0, x1, [z, #16*16] ldp x2, x3, [z, #16*24] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*16] ldp x0, x1, [z, #16*17] ldp x2, x3, [z, #16*25] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*17] ldp x0, x1, [z, #16*18] ldp x2, x3, [z, #16*26] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*18] ldp x0, x1, [z, #16*19] ldp x2, x3, [z, #16*27] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*19] ldp x0, x1, [z, #16*20] ldp x2, x3, [z, #16*28] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*20] ldp x0, x1, [z, #16*21] ldp x2, x3, [z, #16*29] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*21] ldp x0, x1, [z, #16*22] ldp x2, x3, [z, #16*30] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*22] ldp x0, x1, [z, #16*23] ldp x2, x3, [z, #16*31] adcs x0, x0, x2 adcs x1, x1, x3 stp x0, x1, [z, #16*23] cset x, cs // Subtract the mid-term cross product M ldp x0, x1, [z, #16*L] ldp x2, x3, [t, #16*L] subs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*L] ldp x0, x1, [z, #16*9] ldp x2, x3, [t, #16*9] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*9] ldp x0, x1, [z, #16*10] ldp x2, x3, [t, #16*10] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*10] ldp x0, x1, [z, #16*11] ldp x2, x3, [t, #16*11] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*11] ldp x0, x1, [z, #16*12] ldp x2, x3, [t, #16*12] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*12] ldp x0, x1, [z, #16*13] ldp x2, x3, [t, #16*13] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*13] ldp x0, x1, [z, #16*14] ldp x2, x3, [t, #16*14] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*14] ldp x0, x1, [z, #16*15] ldp x2, x3, [t, #16*15] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*15] ldp x0, x1, [z, #16*16] ldp x2, x3, [t, #16*16] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*16] ldp x0, x1, [z, #16*17] ldp x2, x3, [t, #16*17] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*17] ldp x0, x1, [z, #16*18] ldp x2, x3, [t, #16*18] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*18] ldp x0, x1, [z, #16*19] ldp x2, x3, [t, #16*19] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*19] ldp x0, x1, [z, #16*20] ldp x2, x3, [t, #16*20] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*20] ldp x0, x1, [z, #16*21] ldp x2, x3, [t, #16*21] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*21] ldp x0, x1, [z, #16*22] ldp x2, x3, [t, #16*22] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*22] ldp x0, x1, [z, #16*23] ldp x2, x3, [t, #16*23] sbcs x0, x0, x2 sbcs x1, x1, x3 stp x0, x1, [z, #16*23] // Get the next digits effectively resulting so far starting at 3k // [...,c,c,c,c,x] sbcs x, x, xzr csetm c, cc // Now propagate through the top quarter of the result ldp x0, x1, [z, #16*24] adds x0, x0, x adcs x1, x1, c stp x0, x1, [z, #16*24] ldp x0, x1, [z, #16*25] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*25] ldp x0, x1, [z, #16*26] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*26] ldp x0, x1, [z, #16*27] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*27] ldp x0, x1, [z, #16*28] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*28] ldp x0, x1, [z, #16*29] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*29] ldp x0, x1, [z, #16*30] adcs x0, x0, c adcs x1, x1, c stp x0, x1, [z, #16*30] ldp x0, x1, [z, #16*31] adcs x0, x0, c adc x1, x1, c stp x0, x1, [z, #16*31] // Restore CFI_POP2(x21,x30) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_ksqr_32_64) // Local copy of bignum_ksqr_16_32, identical to main one. // This includes in turn a copy of bignum_sqr_8_16. S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_ksqr_32_64_local_ksqr_16_32) Lbignum_ksqr_32_64_local_ksqr_16_32: CFI_START CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x24) CFI_PUSH2(x25,x30) mov x23, x0 mov x24, x1 mov x25, x2 CFI_BL(Lbignum_ksqr_32_64_local_sqr_8_16) ldp x10, x11, [x24] ldp x8, x9, [x24, #64] subs x10, x10, x8 sbcs x11, x11, x9 ldp x12, x13, [x24, #16] ldp x8, x9, [x24, #80] sbcs x12, x12, x8 sbcs x13, x13, x9 ldp x14, x15, [x24, #32] ldp x8, x9, [x24, #96] sbcs x14, x14, x8 sbcs x15, x15, x9 ldp x16, x17, [x24, #48] ldp x8, x9, [x24, #112] sbcs x16, x16, x8 sbcs x17, x17, x9 csetm x19, cc cmn x19, x19 eor x10, x10, x19 adcs x10, x10, xzr eor x11, x11, x19 adcs x11, x11, xzr stp x10, x11, [x25] eor x12, x12, x19 adcs x12, x12, xzr eor x13, x13, x19 adcs x13, x13, xzr stp x12, x13, [x25, #16] eor x14, x14, x19 adcs x14, x14, xzr eor x15, x15, x19 adcs x15, x15, xzr stp x14, x15, [x25, #32] eor x16, x16, x19 adcs x16, x16, xzr eor x17, x17, x19 adcs x17, x17, xzr stp x16, x17, [x25, #48] add x0, x23, #0x80 add x1, x24, #0x40 CFI_BL(Lbignum_ksqr_32_64_local_sqr_8_16) ldp x10, x11, [x23, #128] ldp x12, x13, [x23, #64] adds x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [x23, #128] ldp x10, x11, [x23, #144] ldp x12, x13, [x23, #80] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [x23, #144] ldp x10, x11, [x23, #160] ldp x12, x13, [x23, #96] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [x23, #160] ldp x10, x11, [x23, #176] ldp x12, x13, [x23, #112] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [x23, #176] ldp x10, x11, [x23, #192] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [x23, #192] ldp x10, x11, [x23, #208] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [x23, #208] ldp x10, x11, [x23, #224] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [x23, #224] ldp x10, x11, [x23, #240] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [x23, #240] add x0, x25, #0x40 mov x1, x25 CFI_BL(Lbignum_ksqr_32_64_local_sqr_8_16) ldp x0, x1, [x23] ldp x16, x17, [x23, #128] adds x0, x0, x16 adcs x1, x1, x17 ldp x2, x3, [x23, #16] ldp x16, x17, [x23, #144] adcs x2, x2, x16 adcs x3, x3, x17 ldp x4, x5, [x23, #32] ldp x16, x17, [x23, #160] adcs x4, x4, x16 adcs x5, x5, x17 ldp x6, x7, [x23, #48] ldp x16, x17, [x23, #176] adcs x6, x6, x16 adcs x7, x7, x17 ldp x8, x9, [x23, #128] ldp x16, x17, [x23, #192] adcs x8, x8, x16 adcs x9, x9, x17 ldp x10, x11, [x23, #144] ldp x16, x17, [x23, #208] adcs x10, x10, x16 adcs x11, x11, x17 ldp x12, x13, [x23, #160] ldp x16, x17, [x23, #224] adcs x12, x12, x16 adcs x13, x13, x17 ldp x14, x15, [x23, #176] ldp x16, x17, [x23, #240] adcs x14, x14, x16 adcs x15, x15, x17 cset x24, cs ldp x16, x17, [x25, #64] subs x0, x0, x16 sbcs x1, x1, x17 stp x0, x1, [x23, #64] ldp x16, x17, [x25, #80] sbcs x2, x2, x16 sbcs x3, x3, x17 stp x2, x3, [x23, #80] ldp x16, x17, [x25, #96] sbcs x4, x4, x16 sbcs x5, x5, x17 stp x4, x5, [x23, #96] ldp x16, x17, [x25, #112] sbcs x6, x6, x16 sbcs x7, x7, x17 stp x6, x7, [x23, #112] ldp x16, x17, [x25, #128] sbcs x8, x8, x16 sbcs x9, x9, x17 stp x8, x9, [x23, #128] ldp x16, x17, [x25, #144] sbcs x10, x10, x16 sbcs x11, x11, x17 stp x10, x11, [x23, #144] ldp x16, x17, [x25, #160] sbcs x12, x12, x16 sbcs x13, x13, x17 stp x12, x13, [x23, #160] ldp x16, x17, [x25, #176] sbcs x14, x14, x16 sbcs x15, x15, x17 stp x14, x15, [x23, #176] sbcs x24, x24, xzr csetm x25, cc ldp x10, x11, [x23, #192] adds x10, x10, x24 adcs x11, x11, x25 stp x10, x11, [x23, #192] ldp x10, x11, [x23, #208] adcs x10, x10, x25 adcs x11, x11, x25 stp x10, x11, [x23, #208] ldp x10, x11, [x23, #224] adcs x10, x10, x25 adcs x11, x11, x25 stp x10, x11, [x23, #224] ldp x10, x11, [x23, #240] adcs x10, x10, x25 adcs x11, x11, x25 stp x10, x11, [x23, #240] CFI_POP2(x25,x30) CFI_POP2(x23,x24) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_ksqr_32_64_local_ksqr_16_32) S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_ksqr_32_64_local_sqr_8_16) Lbignum_ksqr_32_64_local_sqr_8_16: CFI_START // Load registers. ldp x2, x3, [x1] ldr q20, [x1] ldp x4, x5, [x1, #16] ldr q21, [x1, #16] ldp x6, x7, [x1, #32] ldr q22, [x1, #32] ldp x8, x9, [x1, #48] ldr q23, [x1, #48] movi v30.2d, #0xffffffff mul x17, x2, x4 mul x14, x3, x5 // Scalar+NEON: square the lower half with a near-clone of bignum_sqr_4_8 // NEON: prepare 64x64->128 squaring of two 64-bit ints (x2, x3) ext v1.16b, v20.16b, v20.16b, #8 umulh x20, x2, x4 shrn v2.2s, v20.2d, #32 subs x21, x2, x3 zip1 v0.2s, v20.2s, v1.2s cneg x21, x21, cc // cc = lo, ul, last umull v5.2d, v2.2s, v2.2s csetm x11, cc // cc = lo, ul, last umull v6.2d, v2.2s, v0.2s subs x12, x5, x4 umull v3.2d, v0.2s, v0.2s cneg x12, x12, cc // cc = lo, ul, last mov v1.16b, v6.16b mul x13, x21, x12 usra v1.2d, v3.2d, #32 umulh x12, x21, x12 and v4.16b, v1.16b, v30.16b cinv x11, x11, cc // cc = lo, ul, last add v4.2d, v4.2d, v6.2d eor x13, x13, x11 usra v5.2d, v4.2d, #32 eor x12, x12, x11 sli v3.2d, v4.2d, #32 adds x19, x17, x20 usra v5.2d, v1.2d, #32 adc x20, x20, xzr // NEON: prepare 64x64->128 squaring of two 64-bit ints (x4, x5) ext v1.16b, v21.16b, v21.16b, #8 umulh x21, x3, x5 shrn v2.2s, v21.2d, #32 adds x19, x19, x14 zip1 v0.2s, v21.2s, v1.2s adcs x20, x20, x21 adc x21, x21, xzr adds x20, x20, x14 adc x21, x21, xzr cmn x11, #0x1 adcs x19, x19, x13 mov x13, v3.d[1] // mul x13, x3, x3 adcs x20, x20, x12 mov x14, v5.d[1] // umulh x14, x3, x3 adc x21, x21, x11 mov x12, v3.d[0] // mul x12, x2, x2 adds x17, x17, x17 mov x11, v5.d[0] // umulh x11, x2, x2 adcs x19, x19, x19 umull v5.2d, v2.2s, v2.2s adcs x20, x20, x20 umull v6.2d, v2.2s, v0.2s adcs x21, x21, x21 umull v3.2d, v0.2s, v0.2s adc x10, xzr, xzr mov v1.16b, v6.16b mul x15, x2, x3 usra v1.2d, v3.2d, #32 umulh x16, x2, x3 and v4.16b, v1.16b, v30.16b adds x11, x11, x15 add v4.2d, v4.2d, v6.2d adcs x13, x13, x16 usra v5.2d, v4.2d, #32 adc x14, x14, xzr sli v3.2d, v4.2d, #32 adds x11, x11, x15 usra v5.2d, v1.2d, #32 adcs x13, x13, x16 adc x14, x14, xzr stp x12, x11, [x0] mov x11, v5.d[0] // umulh x11, x4, x4 adds x17, x17, x13 mov x13, v3.d[1] // mul x13, x5, x5 adcs x19, x19, x14 mov x14, v5.d[1] // umulh x14, x5, x5 adcs x20, x20, xzr mov x12, v3.d[0] // mul x12, x4, x4 adcs x21, x21, xzr // NEON: prepare muls in the upper half ext v1.16b, v22.16b, v22.16b, #8 adc x10, x10, xzr shrn v2.2s, v22.2d, #32 stp x17, x19, [x0, #16] zip1 v0.2s, v22.2s, v1.2s mul x15, x4, x5 umull v5.2d, v2.2s, v2.2s umulh x16, x4, x5 umull v6.2d, v2.2s, v0.2s adds x11, x11, x15 umull v3.2d, v0.2s, v0.2s adcs x13, x13, x16 mov v1.16b, v6.16b adc x14, x14, xzr usra v1.2d, v3.2d, #32 adds x11, x11, x15 and v4.16b, v1.16b, v30.16b adcs x13, x13, x16 add v4.2d, v4.2d, v6.2d adc x14, x14, xzr usra v5.2d, v4.2d, #32 adds x12, x12, x20 sli v3.2d, v4.2d, #32 adcs x11, x11, x21 usra v5.2d, v1.2d, #32 stp x12, x11, [x0, #32] // NEON: prepare muls in the upper half ext v1.16b, v23.16b, v23.16b, #8 adcs x13, x13, x10 shrn v2.2s, v23.2d, #32 adc x14, x14, xzr zip1 v0.2s, v23.2s, v1.2s stp x13, x14, [x0, #48] // Scalar: square the upper half with a slight variant of the previous block mul x17, x6, x8 umull v16.2d, v2.2s, v2.2s mul x14, x7, x9 umull v6.2d, v2.2s, v0.2s umulh x20, x6, x8 umull v18.2d, v0.2s, v0.2s subs x21, x6, x7 cneg x21, x21, cc // cc = lo, ul, last mov v1.16b, v6.16b csetm x11, cc // cc = lo, ul, last subs x12, x9, x8 cneg x12, x12, cc // cc = lo, ul, last usra v1.2d, v18.2d, #32 mul x13, x21, x12 and v4.16b, v1.16b, v30.16b umulh x12, x21, x12 add v4.2d, v4.2d, v6.2d cinv x11, x11, cc // cc = lo, ul, last eor x13, x13, x11 eor x12, x12, x11 usra v16.2d, v4.2d, #32 adds x19, x17, x20 adc x20, x20, xzr sli v18.2d, v4.2d, #32 umulh x21, x7, x9 adds x19, x19, x14 adcs x20, x20, x21 adc x21, x21, xzr adds x20, x20, x14 mov x14, v5.d[1] adc x21, x21, xzr cmn x11, #0x1 adcs x19, x19, x13 mov x13, v3.d[1] adcs x20, x20, x12 mov x12, v3.d[0] adc x21, x21, x11 mov x11, v5.d[0] adds x17, x17, x17 adcs x19, x19, x19 usra v16.2d, v1.2d, #32 adcs x20, x20, x20 adcs x21, x21, x21 adc x10, xzr, xzr // NEON: two mul+umulhs for the next stage uzp2 v17.4s, v21.4s, v23.4s mul x15, x6, x7 xtn v4.2s, v23.2d umulh x16, x6, x7 mov x22, v16.d[0] adds x11, x11, x15 adcs x13, x13, x16 xtn v5.2s, v21.2d adc x14, x14, xzr adds x11, x11, x15 rev64 v1.4s, v21.4s adcs x13, x13, x16 adc x14, x14, xzr stp x12, x11, [x0, #64] adds x17, x17, x13 mov x13, v18.d[1] adcs x19, x19, x14 mov x14, v16.d[1] adcs x20, x20, xzr mov x12, v18.d[0] adcs x21, x21, xzr adc x10, x10, xzr umull v6.2d, v4.2s, v5.2s stp x17, x19, [x0, #80] umull v7.2d, v4.2s, v17.2s mul x15, x8, x9 uzp2 v16.4s, v23.4s, v23.4s umulh x16, x8, x9 mul v0.4s, v1.4s, v23.4s adds x11, x22, x15 adcs x13, x13, x16 usra v7.2d, v6.2d, #32 adc x14, x14, xzr adds x11, x11, x15 umull v1.2d, v16.2s, v17.2s adcs x13, x13, x16 adc x14, x14, xzr uaddlp v0.2d, v0.4s adds x12, x12, x20 adcs x11, x11, x21 and v2.16b, v7.16b, v30.16b umlal v2.2d, v16.2s, v5.2s shl v0.2d, v0.2d, #32 usra v1.2d, v7.2d, #32 umlal v0.2d, v4.2s, v5.2s mov x16, v0.d[1] mov x15, v0.d[0] usra v1.2d, v2.2d, #32 mov x20, v1.d[0] mov x21, v1.d[1] stp x12, x11, [x0, #96] adcs x13, x13, x10 adc x14, x14, xzr stp x13, x14, [x0, #112] // Now get the cross-product in [s7,...,s0] and double it as [c,s7,...,s0] mul x10, x2, x6 mul x14, x3, x7 umulh x17, x2, x6 adds x14, x14, x17 umulh x17, x3, x7 adcs x15, x15, x17 adcs x16, x16, x20 adc x17, x21, xzr adds x11, x14, x10 adcs x14, x15, x14 adcs x15, x16, x15 adcs x16, x17, x16 adc x17, xzr, x17 adds x12, x14, x10 adcs x13, x15, x11 adcs x14, x16, x14 adcs x15, x17, x15 adcs x16, xzr, x16 adc x17, xzr, x17 subs x22, x4, x5 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x9, x8 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x15, x15, x21 eor x20, x20, x19 adcs x16, x16, x20 adc x17, x17, x19 subs x22, x2, x3 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x7, x6 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x11, x11, x21 eor x20, x20, x19 adcs x12, x12, x20 adcs x13, x13, x19 adcs x14, x14, x19 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x3, x5 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x9, x7 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x14, x14, x21 eor x20, x20, x19 adcs x15, x15, x20 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x2, x4 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x8, x6 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x12, x12, x21 eor x20, x20, x19 adcs x13, x13, x20 adcs x14, x14, x19 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x2, x5 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x9, x6 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x13, x13, x21 eor x20, x20, x19 adcs x14, x14, x20 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x3, x4 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x8, x7 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x13, x13, x21 eor x20, x20, x19 adcs x14, x14, x20 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 adds x10, x10, x10 adcs x11, x11, x11 adcs x12, x12, x12 adcs x13, x13, x13 adcs x14, x14, x14 adcs x15, x15, x15 adcs x16, x16, x16 adcs x17, x17, x17 adc x19, xzr, xzr // Add it back to the buffer ldp x2, x3, [x0, #32] adds x10, x10, x2 adcs x11, x11, x3 stp x10, x11, [x0, #32] ldp x2, x3, [x0, #48] adcs x12, x12, x2 adcs x13, x13, x3 stp x12, x13, [x0, #48] ldp x2, x3, [x0, #64] adcs x14, x14, x2 adcs x15, x15, x3 stp x14, x15, [x0, #64] ldp x2, x3, [x0, #80] adcs x16, x16, x2 adcs x17, x17, x3 stp x16, x17, [x0, #80] ldp x2, x3, [x0, #96] adcs x2, x2, x19 adcs x3, x3, xzr stp x2, x3, [x0, #96] ldp x2, x3, [x0, #112] adcs x2, x2, xzr adc x3, x3, xzr stp x2, x3, [x0, #112] CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_ksqr_32_64_local_sqr_8_16) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
9,652
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_mul_8_16_alt.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Multiply z := x * y // Inputs x[8], y[8]; output z[16] // // extern void bignum_mul_8_16_alt(uint64_t z[static 16], // const uint64_t x[static 8], // const uint64_t y[static 8]); // // Standard ARM ABI: X0 = z, X1 = x, X2 = y // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul_8_16_alt) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mul_8_16_alt) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul_8_16_alt) .text .balign 4 #define z x0 #define x x1 #define y x2 // These are repeated mod 2 as we load paris of inputs #define a0 x3 #define a1 x4 #define a2 x3 #define a3 x4 #define a4 x3 #define a5 x4 #define a6 x3 #define a7 x4 #define b0 x5 #define b1 x6 #define b2 x7 #define b3 x8 #define b4 x9 #define b5 x10 #define b6 x11 #define b7 x12 #define t x13 // These repeat mod 10 as we write back #define u0 x14 #define u1 x15 #define u2 x16 #define u3 x17 #define u4 x19 #define u5 x20 #define u6 x21 #define u7 x22 #define u8 x23 #define u9 x24 #define u10 x14 #define u11 x15 #define u12 x16 #define u13 x17 #define u14 x19 #define u15 x20 S2N_BN_SYMBOL(bignum_mul_8_16_alt): CFI_START // Save more registers CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x24) // Load operands and set up row 0 = [u8;...;u0] = a0 * [b7;...;b0] ldp a0, a1, [x] ldp b0, b1, [y] mul u0, a0, b0 umulh u1, a0, b0 mul t, a0, b1 umulh u2, a0, b1 adds u1, u1, t ldp b2, b3, [y, #16] mul t, a0, b2 umulh u3, a0, b2 adcs u2, u2, t mul t, a0, b3 umulh u4, a0, b3 adcs u3, u3, t ldp b4, b5, [y, #32] mul t, a0, b4 umulh u5, a0, b4 adcs u4, u4, t mul t, a0, b5 umulh u6, a0, b5 adcs u5, u5, t ldp b6, b7, [y, #48] mul t, a0, b6 umulh u7, a0, b6 adcs u6, u6, t mul t, a0, b7 umulh u8, a0, b7 adcs u7, u7, t adc u8, u8, xzr // Row 1 = [u9;...;u0] = [a1;a0] * [b7;...;b0] mul t, a1, b0 adds u1, u1, t mul t, a1, b1 adcs u2, u2, t mul t, a1, b2 adcs u3, u3, t mul t, a1, b3 adcs u4, u4, t mul t, a1, b4 adcs u5, u5, t mul t, a1, b5 adcs u6, u6, t mul t, a1, b6 adcs u7, u7, t mul t, a1, b7 adcs u8, u8, t cset u9, cs umulh t, a1, b0 adds u2, u2, t umulh t, a1, b1 adcs u3, u3, t umulh t, a1, b2 adcs u4, u4, t umulh t, a1, b3 adcs u5, u5, t umulh t, a1, b4 adcs u6, u6, t umulh t, a1, b5 adcs u7, u7, t umulh t, a1, b6 adcs u8, u8, t umulh t, a1, b7 adc u9, u9, t stp u0, u1, [z] // Row 2 = [u10;...;u0] = [a2;a1;a0] * [b7;...;b0] ldp a2, a3, [x, #16] mul t, a2, b0 adds u2, u2, t mul t, a2, b1 adcs u3, u3, t mul t, a2, b2 adcs u4, u4, t mul t, a2, b3 adcs u5, u5, t mul t, a2, b4 adcs u6, u6, t mul t, a2, b5 adcs u7, u7, t mul t, a2, b6 adcs u8, u8, t mul t, a2, b7 adcs u9, u9, t cset u10, cs umulh t, a2, b0 adds u3, u3, t umulh t, a2, b1 adcs u4, u4, t umulh t, a2, b2 adcs u5, u5, t umulh t, a2, b3 adcs u6, u6, t umulh t, a2, b4 adcs u7, u7, t umulh t, a2, b5 adcs u8, u8, t umulh t, a2, b6 adcs u9, u9, t umulh t, a2, b7 adc u10, u10, t // Row 3 = [u11;...;u0] = [a3;a2;a1;a0] * [b7;...;b0] mul t, a3, b0 adds u3, u3, t mul t, a3, b1 adcs u4, u4, t mul t, a3, b2 adcs u5, u5, t mul t, a3, b3 adcs u6, u6, t mul t, a3, b4 adcs u7, u7, t mul t, a3, b5 adcs u8, u8, t mul t, a3, b6 adcs u9, u9, t mul t, a3, b7 adcs u10, u10, t cset u11, cs umulh t, a3, b0 adds u4, u4, t umulh t, a3, b1 adcs u5, u5, t umulh t, a3, b2 adcs u6, u6, t umulh t, a3, b3 adcs u7, u7, t umulh t, a3, b4 adcs u8, u8, t umulh t, a3, b5 adcs u9, u9, t umulh t, a3, b6 adcs u10, u10, t umulh t, a3, b7 adc u11, u11, t stp u2, u3, [z, #16] // Row 4 = [u12;...;u0] = [a4;a3;a2;a1;a0] * [b7;...;b0] ldp a4, a5, [x, #32] mul t, a4, b0 adds u4, u4, t mul t, a4, b1 adcs u5, u5, t mul t, a4, b2 adcs u6, u6, t mul t, a4, b3 adcs u7, u7, t mul t, a4, b4 adcs u8, u8, t mul t, a4, b5 adcs u9, u9, t mul t, a4, b6 adcs u10, u10, t mul t, a4, b7 adcs u11, u11, t cset u12, cs umulh t, a4, b0 adds u5, u5, t umulh t, a4, b1 adcs u6, u6, t umulh t, a4, b2 adcs u7, u7, t umulh t, a4, b3 adcs u8, u8, t umulh t, a4, b4 adcs u9, u9, t umulh t, a4, b5 adcs u10, u10, t umulh t, a4, b6 adcs u11, u11, t umulh t, a4, b7 adc u12, u12, t // Row 5 = [u13;...;u0] = [a5;a4;a3;a2;a1;a0] * [b7;...;b0] mul t, a5, b0 adds u5, u5, t mul t, a5, b1 adcs u6, u6, t mul t, a5, b2 adcs u7, u7, t mul t, a5, b3 adcs u8, u8, t mul t, a5, b4 adcs u9, u9, t mul t, a5, b5 adcs u10, u10, t mul t, a5, b6 adcs u11, u11, t mul t, a5, b7 adcs u12, u12, t cset u13, cs umulh t, a5, b0 adds u6, u6, t umulh t, a5, b1 adcs u7, u7, t umulh t, a5, b2 adcs u8, u8, t umulh t, a5, b3 adcs u9, u9, t umulh t, a5, b4 adcs u10, u10, t umulh t, a5, b5 adcs u11, u11, t umulh t, a5, b6 adcs u12, u12, t umulh t, a5, b7 adc u13, u13, t stp u4, u5, [z, #32] // Row 6 = [u14;...;u0] = [a6;a5;a4;a3;a2;a1;a0] * [b7;...;b0] ldp a6, a7, [x, #48] mul t, a6, b0 adds u6, u6, t mul t, a6, b1 adcs u7, u7, t mul t, a6, b2 adcs u8, u8, t mul t, a6, b3 adcs u9, u9, t mul t, a6, b4 adcs u10, u10, t mul t, a6, b5 adcs u11, u11, t mul t, a6, b6 adcs u12, u12, t mul t, a6, b7 adcs u13, u13, t cset u14, cs umulh t, a6, b0 adds u7, u7, t umulh t, a6, b1 adcs u8, u8, t umulh t, a6, b2 adcs u9, u9, t umulh t, a6, b3 adcs u10, u10, t umulh t, a6, b4 adcs u11, u11, t umulh t, a6, b5 adcs u12, u12, t umulh t, a6, b6 adcs u13, u13, t umulh t, a6, b7 adc u14, u14, t // Row 7 = [u15;...;u0] = [a7;a6;a5;a4;a3;a2;a1;a0] * [b7;...;b0] mul t, a7, b0 adds u7, u7, t mul t, a7, b1 adcs u8, u8, t mul t, a7, b2 adcs u9, u9, t mul t, a7, b3 adcs u10, u10, t mul t, a7, b4 adcs u11, u11, t mul t, a7, b5 adcs u12, u12, t mul t, a7, b6 adcs u13, u13, t mul t, a7, b7 adcs u14, u14, t cset u15, cs umulh t, a7, b0 adds u8, u8, t umulh t, a7, b1 adcs u9, u9, t umulh t, a7, b2 adcs u10, u10, t umulh t, a7, b3 adcs u11, u11, t umulh t, a7, b4 adcs u12, u12, t umulh t, a7, b5 adcs u13, u13, t umulh t, a7, b6 adcs u14, u14, t umulh t, a7, b7 adc u15, u15, t stp u6, u7, [z, #48] // Store back remaining digits of final result stp u8, u9, [z, #64] stp u10, u11, [z, #80] stp u12, u13, [z, #96] stp u14, u15, [z, #112] // Restore registers CFI_POP2(x23,x24) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mul_8_16_alt) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
20,319
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_ksqr_16_32.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Square, z := x^2 // Input x[16]; output z[32]; temporary buffer t[>=24] // // extern void bignum_ksqr_16_32(uint64_t z[static 32], // const uint64_t x[static 16], // uint64_t t[static 24]); // // This is a Karatsuba-style function squaring half-sized results // and using temporary buffer t for intermediate results. // // Standard ARM ABI: X0 = z, X1 = x, X2 = t // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_ksqr_16_32) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_ksqr_16_32) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_ksqr_16_32) .text .balign 4 // Subroutine-safe copies of the output, inputs and temporary buffer pointers #define z x23 #define x x24 #define t x25 // More variables for sign masks, with s also necessarily subroutine-safe #define s x19 S2N_BN_SYMBOL(bignum_ksqr_16_32): CFI_START // Save registers, including return address CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x24) CFI_PUSH2(x25,x30) // Move parameters into subroutine-safe places mov z, x0 mov x, x1 mov t, x2 // Compute L = x_lo * y_lo in bottom half of buffer (size 8 x 8 -> 16) CFI_BL(Lbignum_ksqr_16_32_local_sqr_8_16) // Compute absolute difference [t..] = |x_lo - x_hi| ldp x10, x11, [x] ldp x8, x9, [x, #64] subs x10, x10, x8 sbcs x11, x11, x9 ldp x12, x13, [x, #16] ldp x8, x9, [x, #80] sbcs x12, x12, x8 sbcs x13, x13, x9 ldp x14, x15, [x, #32] ldp x8, x9, [x, #96] sbcs x14, x14, x8 sbcs x15, x15, x9 ldp x16, x17, [x, #48] ldp x8, x9, [x, #112] sbcs x16, x16, x8 sbcs x17, x17, x9 csetm s, cc adds xzr, s, s eor x10, x10, s adcs x10, x10, xzr eor x11, x11, s adcs x11, x11, xzr stp x10, x11, [t] eor x12, x12, s adcs x12, x12, xzr eor x13, x13, s adcs x13, x13, xzr stp x12, x13, [t, #16] eor x14, x14, s adcs x14, x14, xzr eor x15, x15, s adcs x15, x15, xzr stp x14, x15, [t, #32] eor x16, x16, s adcs x16, x16, xzr eor x17, x17, s adcs x17, x17, xzr stp x16, x17, [t, #48] // Compute H = x_hi * y_hi in top half of buffer (size 8 x 8 -> 16) add x0, z, #128 add x1, x, #64 CFI_BL(Lbignum_ksqr_16_32_local_sqr_8_16) // Compute H' = H + L_top in place of H (it cannot overflow) // First add 8-sized block then propagate carry through next 8 ldp x10, x11, [z, #128] ldp x12, x13, [z, #64] adds x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [z, #128] ldp x10, x11, [z, #128+16] ldp x12, x13, [z, #64+16] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [z, #128+16] ldp x10, x11, [z, #128+32] ldp x12, x13, [z, #64+32] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [z, #128+32] ldp x10, x11, [z, #128+48] ldp x12, x13, [z, #64+48] adcs x10, x10, x12 adcs x11, x11, x13 stp x10, x11, [z, #128+48] ldp x10, x11, [z, #128+64] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [z, #128+64] ldp x10, x11, [z, #128+80] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [z, #128+80] ldp x10, x11, [z, #128+96] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [z, #128+96] ldp x10, x11, [z, #128+112] adcs x10, x10, xzr adcs x11, x11, xzr stp x10, x11, [z, #128+112] // Compute M = |x_lo - x_hi| * |y_hi - y_lo| in [t+8...], size 16 add x0, t, #64 mov x1, t CFI_BL(Lbignum_ksqr_16_32_local_sqr_8_16) // Add the interlocking H' and L_bot terms, storing in registers x15..x0 // Intercept the carry at the 8 + 16 = 24 position and store it in x. // (Note that we no longer need the input x was pointing at.) ldp x0, x1, [z] ldp x16, x17, [z, #128] adds x0, x0, x16 adcs x1, x1, x17 ldp x2, x3, [z, #16] ldp x16, x17, [z, #144] adcs x2, x2, x16 adcs x3, x3, x17 ldp x4, x5, [z, #32] ldp x16, x17, [z, #160] adcs x4, x4, x16 adcs x5, x5, x17 ldp x6, x7, [z, #48] ldp x16, x17, [z, #176] adcs x6, x6, x16 adcs x7, x7, x17 ldp x8, x9, [z, #128] ldp x16, x17, [z, #192] adcs x8, x8, x16 adcs x9, x9, x17 ldp x10, x11, [z, #144] ldp x16, x17, [z, #208] adcs x10, x10, x16 adcs x11, x11, x17 ldp x12, x13, [z, #160] ldp x16, x17, [z, #224] adcs x12, x12, x16 adcs x13, x13, x17 ldp x14, x15, [z, #176] ldp x16, x17, [z, #240] adcs x14, x14, x16 adcs x15, x15, x17 cset x, cs // Subtract the mid-term cross product M ldp x16, x17, [t, #64] subs x0, x0, x16 sbcs x1, x1, x17 stp x0, x1, [z, #64] ldp x16, x17, [t, #80] sbcs x2, x2, x16 sbcs x3, x3, x17 stp x2, x3, [z, #80] ldp x16, x17, [t, #96] sbcs x4, x4, x16 sbcs x5, x5, x17 stp x4, x5, [z, #96] ldp x16, x17, [t, #112] sbcs x6, x6, x16 sbcs x7, x7, x17 stp x6, x7, [z, #112] ldp x16, x17, [t, #128] sbcs x8, x8, x16 sbcs x9, x9, x17 stp x8, x9, [z, #128] ldp x16, x17, [t, #144] sbcs x10, x10, x16 sbcs x11, x11, x17 stp x10, x11, [z, #144] ldp x16, x17, [t, #160] sbcs x12, x12, x16 sbcs x13, x13, x17 stp x12, x13, [z, #160] ldp x16, x17, [t, #176] sbcs x14, x14, x16 sbcs x15, x15, x17 stp x14, x15, [z, #176] // Get the next digits effectively resulting so far starting at 24 sbcs x, x, xzr csetm t, cc // Now the final 8 digits of padding; the first one is special in using x // and also in getting the carry chain started ldp x10, x11, [z, #192] adds x10, x10, x adcs x11, x11, t stp x10, x11, [z, #192] ldp x10, x11, [z, #208] adcs x10, x10, t adcs x11, x11, t stp x10, x11, [z, #208] ldp x10, x11, [z, #224] adcs x10, x10, t adcs x11, x11, t stp x10, x11, [z, #224] ldp x10, x11, [z, #240] adcs x10, x10, t adcs x11, x11, t stp x10, x11, [z, #240] // Restore registers and return CFI_POP2(x25,x30) CFI_POP2(x23,x24) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_ksqr_16_32) // ----------------------------------------------------------------------------- // Local 8x8->16 squaring routine, shared to reduce code size. Effectively // the same as bignum_sqr_8_16 without the scratch register preservation. // ----------------------------------------------------------------------------- S2N_BN_FUNCTION_TYPE_DIRECTIVE(Lbignum_ksqr_16_32_local_sqr_8_16) Lbignum_ksqr_16_32_local_sqr_8_16: CFI_START // Load registers. ldp x2, x3, [x1] ldr q20, [x1] ldp x4, x5, [x1, #16] ldr q21, [x1, #16] ldp x6, x7, [x1, #32] ldr q22, [x1, #32] ldp x8, x9, [x1, #48] ldr q23, [x1, #48] movi v30.2d, #0xffffffff mul x17, x2, x4 mul x14, x3, x5 // Scalar+NEON: square the lower half with a near-clone of bignum_sqr_4_8 // NEON: prepare 64x64->128 squaring of two 64-bit ints (x2, x3) ext v1.16b, v20.16b, v20.16b, #8 umulh x20, x2, x4 shrn v2.2s, v20.2d, #32 subs x21, x2, x3 zip1 v0.2s, v20.2s, v1.2s cneg x21, x21, cc // cc = lo, ul, last umull v5.2d, v2.2s, v2.2s csetm x11, cc // cc = lo, ul, last umull v6.2d, v2.2s, v0.2s subs x12, x5, x4 umull v3.2d, v0.2s, v0.2s cneg x12, x12, cc // cc = lo, ul, last mov v1.16b, v6.16b mul x13, x21, x12 usra v1.2d, v3.2d, #32 umulh x12, x21, x12 and v4.16b, v1.16b, v30.16b cinv x11, x11, cc // cc = lo, ul, last add v4.2d, v4.2d, v6.2d eor x13, x13, x11 usra v5.2d, v4.2d, #32 eor x12, x12, x11 sli v3.2d, v4.2d, #32 adds x19, x17, x20 usra v5.2d, v1.2d, #32 adc x20, x20, xzr // NEON: prepare 64x64->128 squaring of two 64-bit ints (x4, x5) ext v1.16b, v21.16b, v21.16b, #8 umulh x21, x3, x5 shrn v2.2s, v21.2d, #32 adds x19, x19, x14 zip1 v0.2s, v21.2s, v1.2s adcs x20, x20, x21 adc x21, x21, xzr adds x20, x20, x14 adc x21, x21, xzr cmn x11, #0x1 adcs x19, x19, x13 mov x13, v3.d[1] // mul x13, x3, x3 adcs x20, x20, x12 mov x14, v5.d[1] // umulh x14, x3, x3 adc x21, x21, x11 mov x12, v3.d[0] // mul x12, x2, x2 adds x17, x17, x17 mov x11, v5.d[0] // umulh x11, x2, x2 adcs x19, x19, x19 umull v5.2d, v2.2s, v2.2s adcs x20, x20, x20 umull v6.2d, v2.2s, v0.2s adcs x21, x21, x21 umull v3.2d, v0.2s, v0.2s adc x10, xzr, xzr mov v1.16b, v6.16b mul x15, x2, x3 usra v1.2d, v3.2d, #32 umulh x16, x2, x3 and v4.16b, v1.16b, v30.16b adds x11, x11, x15 add v4.2d, v4.2d, v6.2d adcs x13, x13, x16 usra v5.2d, v4.2d, #32 adc x14, x14, xzr sli v3.2d, v4.2d, #32 adds x11, x11, x15 usra v5.2d, v1.2d, #32 adcs x13, x13, x16 adc x14, x14, xzr stp x12, x11, [x0] mov x11, v5.d[0] // umulh x11, x4, x4 adds x17, x17, x13 mov x13, v3.d[1] // mul x13, x5, x5 adcs x19, x19, x14 mov x14, v5.d[1] // umulh x14, x5, x5 adcs x20, x20, xzr mov x12, v3.d[0] // mul x12, x4, x4 adcs x21, x21, xzr // NEON: prepare muls in the upper half ext v1.16b, v22.16b, v22.16b, #8 adc x10, x10, xzr shrn v2.2s, v22.2d, #32 stp x17, x19, [x0, #16] zip1 v0.2s, v22.2s, v1.2s mul x15, x4, x5 umull v5.2d, v2.2s, v2.2s umulh x16, x4, x5 umull v6.2d, v2.2s, v0.2s adds x11, x11, x15 umull v3.2d, v0.2s, v0.2s adcs x13, x13, x16 mov v1.16b, v6.16b adc x14, x14, xzr usra v1.2d, v3.2d, #32 adds x11, x11, x15 and v4.16b, v1.16b, v30.16b adcs x13, x13, x16 add v4.2d, v4.2d, v6.2d adc x14, x14, xzr usra v5.2d, v4.2d, #32 adds x12, x12, x20 sli v3.2d, v4.2d, #32 adcs x11, x11, x21 usra v5.2d, v1.2d, #32 stp x12, x11, [x0, #32] // NEON: prepare muls in the upper half ext v1.16b, v23.16b, v23.16b, #8 adcs x13, x13, x10 shrn v2.2s, v23.2d, #32 adc x14, x14, xzr zip1 v0.2s, v23.2s, v1.2s stp x13, x14, [x0, #48] // Scalar: square the upper half with a slight variant of the previous block mul x17, x6, x8 umull v16.2d, v2.2s, v2.2s mul x14, x7, x9 umull v6.2d, v2.2s, v0.2s umulh x20, x6, x8 umull v18.2d, v0.2s, v0.2s subs x21, x6, x7 cneg x21, x21, cc // cc = lo, ul, last mov v1.16b, v6.16b csetm x11, cc // cc = lo, ul, last subs x12, x9, x8 cneg x12, x12, cc // cc = lo, ul, last usra v1.2d, v18.2d, #32 mul x13, x21, x12 and v4.16b, v1.16b, v30.16b umulh x12, x21, x12 add v4.2d, v4.2d, v6.2d cinv x11, x11, cc // cc = lo, ul, last eor x13, x13, x11 eor x12, x12, x11 usra v16.2d, v4.2d, #32 adds x19, x17, x20 adc x20, x20, xzr sli v18.2d, v4.2d, #32 umulh x21, x7, x9 adds x19, x19, x14 adcs x20, x20, x21 adc x21, x21, xzr adds x20, x20, x14 mov x14, v5.d[1] adc x21, x21, xzr cmn x11, #0x1 adcs x19, x19, x13 mov x13, v3.d[1] adcs x20, x20, x12 mov x12, v3.d[0] adc x21, x21, x11 mov x11, v5.d[0] adds x17, x17, x17 adcs x19, x19, x19 usra v16.2d, v1.2d, #32 adcs x20, x20, x20 adcs x21, x21, x21 adc x10, xzr, xzr // NEON: two mul+umulhs for the next stage uzp2 v17.4s, v21.4s, v23.4s mul x15, x6, x7 xtn v4.2s, v23.2d umulh x16, x6, x7 mov x22, v16.d[0] adds x11, x11, x15 adcs x13, x13, x16 xtn v5.2s, v21.2d adc x14, x14, xzr adds x11, x11, x15 rev64 v1.4s, v21.4s adcs x13, x13, x16 adc x14, x14, xzr stp x12, x11, [x0, #64] adds x17, x17, x13 mov x13, v18.d[1] adcs x19, x19, x14 mov x14, v16.d[1] adcs x20, x20, xzr mov x12, v18.d[0] adcs x21, x21, xzr adc x10, x10, xzr umull v6.2d, v4.2s, v5.2s stp x17, x19, [x0, #80] umull v7.2d, v4.2s, v17.2s mul x15, x8, x9 uzp2 v16.4s, v23.4s, v23.4s umulh x16, x8, x9 mul v0.4s, v1.4s, v23.4s adds x11, x22, x15 adcs x13, x13, x16 usra v7.2d, v6.2d, #32 adc x14, x14, xzr adds x11, x11, x15 umull v1.2d, v16.2s, v17.2s adcs x13, x13, x16 adc x14, x14, xzr uaddlp v0.2d, v0.4s adds x12, x12, x20 adcs x11, x11, x21 and v2.16b, v7.16b, v30.16b umlal v2.2d, v16.2s, v5.2s shl v0.2d, v0.2d, #32 usra v1.2d, v7.2d, #32 umlal v0.2d, v4.2s, v5.2s mov x16, v0.d[1] mov x15, v0.d[0] usra v1.2d, v2.2d, #32 mov x20, v1.d[0] mov x21, v1.d[1] stp x12, x11, [x0, #96] adcs x13, x13, x10 adc x14, x14, xzr stp x13, x14, [x0, #112] // Now get the cross-product in [s7,...,s0] and double it as [c,s7,...,s0] mul x10, x2, x6 mul x14, x3, x7 umulh x17, x2, x6 adds x14, x14, x17 umulh x17, x3, x7 adcs x15, x15, x17 adcs x16, x16, x20 adc x17, x21, xzr adds x11, x14, x10 adcs x14, x15, x14 adcs x15, x16, x15 adcs x16, x17, x16 adc x17, xzr, x17 adds x12, x14, x10 adcs x13, x15, x11 adcs x14, x16, x14 adcs x15, x17, x15 adcs x16, xzr, x16 adc x17, xzr, x17 subs x22, x4, x5 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x9, x8 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x15, x15, x21 eor x20, x20, x19 adcs x16, x16, x20 adc x17, x17, x19 subs x22, x2, x3 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x7, x6 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x11, x11, x21 eor x20, x20, x19 adcs x12, x12, x20 adcs x13, x13, x19 adcs x14, x14, x19 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x3, x5 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x9, x7 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x14, x14, x21 eor x20, x20, x19 adcs x15, x15, x20 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x2, x4 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x8, x6 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x12, x12, x21 eor x20, x20, x19 adcs x13, x13, x20 adcs x14, x14, x19 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x2, x5 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x9, x6 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x13, x13, x21 eor x20, x20, x19 adcs x14, x14, x20 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 subs x22, x3, x4 cneg x22, x22, cc // cc = lo, ul, last csetm x19, cc // cc = lo, ul, last subs x20, x8, x7 cneg x20, x20, cc // cc = lo, ul, last mul x21, x22, x20 umulh x20, x22, x20 cinv x19, x19, cc // cc = lo, ul, last cmn x19, #0x1 eor x21, x21, x19 adcs x13, x13, x21 eor x20, x20, x19 adcs x14, x14, x20 adcs x15, x15, x19 adcs x16, x16, x19 adc x17, x17, x19 adds x10, x10, x10 adcs x11, x11, x11 adcs x12, x12, x12 adcs x13, x13, x13 adcs x14, x14, x14 adcs x15, x15, x15 adcs x16, x16, x16 adcs x17, x17, x17 adc x19, xzr, xzr // Add it back to the buffer ldp x2, x3, [x0, #32] adds x10, x10, x2 adcs x11, x11, x3 stp x10, x11, [x0, #32] ldp x2, x3, [x0, #48] adcs x12, x12, x2 adcs x13, x13, x3 stp x12, x13, [x0, #48] ldp x2, x3, [x0, #64] adcs x14, x14, x2 adcs x15, x15, x3 stp x14, x15, [x0, #64] ldp x2, x3, [x0, #80] adcs x16, x16, x2 adcs x17, x17, x3 stp x16, x17, [x0, #80] ldp x2, x3, [x0, #96] adcs x2, x2, x19 adcs x3, x3, xzr stp x2, x3, [x0, #96] ldp x2, x3, [x0, #112] adcs x2, x2, xzr adc x3, x3, xzr stp x2, x3, [x0, #112] CFI_RET S2N_BN_SIZE_DIRECTIVE(Lbignum_ksqr_16_32_local_sqr_8_16) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
6,044
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_sqr_6_12.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Square, z := x^2 // Input x[6]; output z[12] // // extern void bignum_sqr_6_12(uint64_t z[static 12], const uint64_t x[static 6]); // // Standard ARM ABI: X0 = z, X1 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sqr_6_12) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_sqr_6_12) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sqr_6_12) .text .balign 4 // --------------------------------------------------------------------------- // Macro returning (c,h,l) = 3-word 1s complement (x - y) * (w - z) // c,h,l,t should all be different // t,h should not overlap w,z // --------------------------------------------------------------------------- .macro muldiffn c,h,l, t, x,y, w,z subs \t, \x, \y cneg \t, \t, cc csetm \c, cc subs \h, \w, \z cneg \h, \h, cc mul \l, \t, \h umulh \h, \t, \h cinv \c, \c, cc eor \l, \l, \c eor \h, \h, \c .endm #define a0 x2 #define a1 x3 #define a2 x4 #define a3 x5 #define a4 x6 #define a5 x7 #define c0 x8 #define c1 x9 #define c2 x10 #define c3 x11 #define c4 x12 #define c5 x13 #define d1 x14 #define d2 x15 #define d3 x16 #define d4 x17 S2N_BN_SYMBOL(bignum_sqr_6_12): CFI_START // Load in all words of the input ldp a0, a1, [x1] ldp a2, a3, [x1, #16] ldp a4, a5, [x1, #32] // Square the low half mul d1, a0, a1 mul d2, a0, a2 mul d3, a1, a2 mul c0, a0, a0 str c0, [x0] mul c2, a1, a1 mul c4, a2, a2 umulh d4, a0, a1 adds d2, d2, d4 umulh d4, a0, a2 adcs d3, d3, d4 umulh d4, a1, a2 adcs d4, d4, xzr umulh c1, a0, a0 umulh c3, a1, a1 umulh c5, a2, a2 adds d1, d1, d1 adcs d2, d2, d2 adcs d3, d3, d3 adcs d4, d4, d4 adc c5, c5, xzr adds c1, c1, d1 str c1, [x0,#8] adcs c2, c2, d2 str c2, [x0,#16] adcs c3, c3, d3 str c3, [x0,#24] adcs c4, c4, d4 str c4, [x0,#32] adc c5, c5, xzr str c5, [x0,#40] // Square the high half mul d1, a3, a4 mul d2, a3, a5 mul d3, a4, a5 mul c0, a3, a3 str c0, [x0,#48] mul c2, a4, a4 mul c4, a5, a5 umulh d4, a3, a4 adds d2, d2, d4 umulh d4, a3, a5 adcs d3, d3, d4 umulh d4, a4, a5 adcs d4, d4, xzr umulh c1, a3, a3 umulh c3, a4, a4 umulh c5, a5, a5 adds d1, d1, d1 adcs d2, d2, d2 adcs d3, d3, d3 adcs d4, d4, d4 adc c5, c5, xzr adds c1, c1, d1 str c1, [x0,#56] adcs c2, c2, d2 str c2, [x0,#64] adcs c3, c3, d3 str c3, [x0,#72] adcs c4, c4, d4 str c4, [x0,#80] adc c5, c5, xzr str c5, [x0,#88] // Compute product of the cross-term with ADK 3x3->6 multiplier #define a0 x2 #define a1 x3 #define a2 x4 #define a3 x5 #define a4 x6 #define a5 x7 #define s0 x8 #define s1 x9 #define s2 x10 #define s3 x11 #define s4 x12 #define s5 x13 #define l1 x14 #define l2 x15 #define h0 x16 #define h1 x17 #define h2 x13 #define s6 h1 #define c l1 #define h l2 #define l h0 #define t h1 mul s0, a0, a3 mul l1, a1, a4 mul l2, a2, a5 umulh h0, a0, a3 umulh h1, a1, a4 umulh h2, a2, a5 adds h0, h0, l1 adcs h1, h1, l2 adc h2, h2, xzr adds s1, h0, s0 adcs s2, h1, h0 adcs s3, h2, h1 adc s4, h2, xzr adds s2, s2, s0 adcs s3, s3, h0 adcs s4, s4, h1 adc s5, h2, xzr muldiffn c,h,l, t, a0,a1, a4,a3 adds xzr, c, #1 adcs s1, s1, l adcs s2, s2, h adcs s3, s3, c adcs s4, s4, c adc s5, s5, c muldiffn c,h,l, t, a0,a2, a5,a3 adds xzr, c, #1 adcs s2, s2, l adcs s3, s3, h adcs s4, s4, c adc s5, s5, c muldiffn c,h,l, t, a1,a2, a5,a4 adds xzr, c, #1 adcs s3, s3, l adcs s4, s4, h adc s5, s5, c // Double it, catching the carry adds s0, s0, s0 adcs s1, s1, s1 adcs s2, s2, s2 adcs s3, s3, s3 adcs s4, s4, s4 adcs s5, s5, s5 adc s6, xzr, xzr // Finally, add it into the term ldr a0, [x0, #24] adds a0, a0, s0 str a0, [x0, #24] ldr a0, [x0, #32] adcs a0, a0, s1 str a0, [x0, #32] ldr a0, [x0, #40] adcs a0, a0, s2 str a0, [x0, #40] ldr a0, [x0, #48] adcs a0, a0, s3 str a0, [x0, #48] ldr a0, [x0, #56] adcs a0, a0, s4 str a0, [x0, #56] ldr a0, [x0, #64] adcs a0, a0, s5 str a0, [x0, #64] ldr a0, [x0, #72] adcs a0, a0, s6 str a0, [x0, #72] ldr a0, [x0, #80] adcs a0, a0, xzr str a0, [x0, #80] ldr a0, [x0, #88] adc a0, a0, xzr str a0, [x0, #88] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_sqr_6_12) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif
wlsfx/bnbb
29,261
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_emontredc_8n.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Extended Montgomery reduce in 8-digit blocks, results in input-output buffer // Inputs z[2*k], m[k], w; outputs function return (extra result bit) and z[2*k] // // extern uint64_t bignum_emontredc_8n(uint64_t k, uint64_t *z, const uint64_t *m, // uint64_t w); // // Functionally equivalent to bignum_emontredc (see that file for more detail). // But in general assumes that the input k is a multiple of 8. // bignum_emontredc_8n is a vectorized version of // unopt/bignum_emontredc_8n_base. // // Standard ARM ABI: X0 = k, X1 = z, X2 = m, X3 = w, returns X0 // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_emontredc_8n) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_emontredc_8n) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_emontredc_8n) .text .balign 4 S2N_BN_SYMBOL(bignum_emontredc_8n): CFI_START CFI_PUSH2(x19,x20) CFI_PUSH2(x21,x22) CFI_PUSH2(x23,x24) CFI_PUSH2(x25,x26) CFI_PUSH2(x27,x28) CFI_DEC_SP(32) lsr x0, x0, #2 mov x26, x0 subs x12, x0, #1 bcc Lbignum_emontredc_8n_end stp x3, xzr, [sp] stp x26, xzr, [sp, #16] mov x28, xzr lsl x0, x12, #5 Lbignum_emontredc_8n_outerloop: ldp x3, xzr, [sp] ldp x17, x19, [x1] ldp x20, x21, [x1, #16] ldp x8, x9, [x2] ldp x10, x11, [x2, #16] ldr q21, [x2, #16] // Montgomery step 0 mul x4, x17, x3 // NEON: Calculate x4 * (x10, x11) that does two 64x64->128-bit multiplications. dup v0.2d, x4 uzp2 v3.4s, v21.4s, v0.4s xtn v4.2s, v0.2d xtn v5.2s, v21.2d mul x12, x4, x8 adds x17, x17, x12 umulh x12, x4, x8 mul x13, x4, x9 rev64 v1.4s, v21.4s umull v6.2d, v4.2s, v5.2s umull v7.2d, v4.2s, v3.2s uzp2 v16.4s, v0.4s, v0.4s mul v0.4s, v1.4s, v0.4s movi v2.2d, #0x000000ffffffff usra v7.2d, v6.2d, #32 umull v1.2d, v16.2s, v3.2s uaddlp v0.2d, v0.4s and v2.16b, v7.16b, v2.16b umlal v2.2d, v16.2s, v5.2s shl v0.2d, v0.2d, #32 usra v1.2d, v7.2d, #32 umlal v0.2d, v4.2s, v5.2s mov x14, v0.d[0] mov x15, v0.d[1] adcs x19, x19, x13 umulh x13, x4, x9 adcs x20, x20, x14 usra v1.2d, v2.2d, #32 mov x14, v1.d[0] adcs x21, x21, x15 mov x15, v1.d[1] adc x22, xzr, xzr adds x19, x19, x12 mul x5, x19, x3 // hoisted from step 1 adcs x20, x20, x13 adcs x21, x21, x14 adc x22, x22, x15 // Montgomery step 1 // NEON: Calculate x5 * (x10, x11) that does two 64x64->128-bit multiplications. dup v0.2d, x5 uzp2 v3.4s, v21.4s, v0.4s xtn v4.2s, v0.2d xtn v5.2s, v21.2d mul x12, x5, x8 adds x19, x19, x12 umulh x12, x5, x8 mul x13, x5, x9 rev64 v1.4s, v21.4s umull v6.2d, v4.2s, v5.2s umull v7.2d, v4.2s, v3.2s uzp2 v16.4s, v0.4s, v0.4s mul v0.4s, v1.4s, v0.4s movi v2.2d, #0x000000ffffffff usra v7.2d, v6.2d, #32 umull v1.2d, v16.2s, v3.2s uaddlp v0.2d, v0.4s and v2.16b, v7.16b, v2.16b umlal v2.2d, v16.2s, v5.2s shl v0.2d, v0.2d, #32 usra v1.2d, v7.2d, #32 umlal v0.2d, v4.2s, v5.2s mov x14, v0.d[0] mov x15, v0.d[1] adcs x20, x20, x13 umulh x13, x5, x9 adcs x21, x21, x14 usra v1.2d, v2.2d, #32 mov x14, v1.d[0] adcs x22, x22, x15 mov x15, v1.d[1] adc x23, xzr, xzr adds x20, x20, x12 mul x6, x20, x3 // hoisted from step 2 // NEON: For montgomery step 2, // calculate x6 * (x10, x11) that does two 64x64->128-bit multiplications. dup v0.2d, x6 #define in1 v21 #define in2 v0 #define out_lo v0 #define out_hi v1 uzp2 v3.4s, in2.4s, in1.4s xtn v4.2s, in1.2d xtn v5.2s, in2.2d adcs x21, x21, x13 adcs x22, x22, x14 adc x23, x23, x15 stp x4, x5, [x1] // hoisted from maddloop_firstitr ldr q20, [x1] // q21 will be loaded later. ldr q22, [x2, #32] ldr q23, [x2, #48] // Montgomery step 2 rev64 v1.4s, in2.4s umull v6.2d, v4.2s, v5.2s umull v7.2d, v4.2s, v3.2s uzp2 v16.4s, in1.4s, in1.4s mul x12, x6, x8 adds x20, x20, x12 mul v0.4s, v1.4s, in1.4s movi v2.2d, #0x000000ffffffff usra v7.2d, v6.2d, #32 umull out_hi.2d, v16.2s, v3.2s umulh x12, x6, x8 mul x13, x6, x9 uaddlp v0.2d, v0.4s and v2.16b, v7.16b, v2.16b umlal v2.2d, v16.2s, v5.2s shl out_lo.2d, v0.2d, #32 adcs x21, x21, x13 umulh x13, x6, x9 usra out_hi.2d, v7.2d, #32 umlal out_lo.2d, v4.2s, v5.2s mov x14, out_lo.d[0] mov x15, out_lo.d[1] usra out_hi.2d, v2.2d, #32 #undef in1 #undef in2 #undef out_lo #undef out_hi adcs x22, x22, x14 adcs x23, x23, x15 mov x14, v1.d[0] mov x15, v1.d[1] adc x24, xzr, xzr adds x21, x21, x12 mul x7, x21, x3 adcs x22, x22, x13 adcs x23, x23, x14 adc x24, x24, x15 stp x6, x7, [x1, #16] // hoisted from maddloop_firstitr ldr q21, [x1, #16] // pre-calculate 2mul+2umulhs in maddloop_firstitr // v25++v24 = hi and lo of (x4 * x8, x5 * x9) #define in1 v20 #define in2 v22 #define out_lo v24 #define out_hi v25 uzp2 v3.4s, in2.4s, in1.4s xtn v4.2s, in1.2d // Montgomery step 3 mul x12, x7, x8 mul x13, x7, x9 xtn v5.2s, in2.2d rev64 v1.4s, in2.4s umull v6.2d, v4.2s, v5.2s umull v7.2d, v4.2s, v3.2s mul x14, x7, x10 mul x15, x7, x11 uzp2 v16.4s, in1.4s, in1.4s mul v0.4s, v1.4s, in1.4s movi v2.2d, #0x000000ffffffff usra v7.2d, v6.2d, #32 umull out_hi.2d, v16.2s, v3.2s uaddlp v0.2d, v0.4s and v2.16b, v7.16b, v2.16b umlal v2.2d, v16.2s, v5.2s adds x21, x21, x12 umulh x12, x7, x8 adcs x22, x22, x13 umulh x13, x7, x9 shl out_lo.2d, v0.2d, #32 usra out_hi.2d, v7.2d, #32 umlal out_lo.2d, v4.2s, v5.2s usra out_hi.2d, v2.2d, #32 #undef in1 #undef in2 #undef out_lo #undef out_hi adcs x23, x23, x14 umulh x14, x7, x10 adcs x24, x24, x15 umulh x15, x7, x11 // v27++v26 = hi and lo of (x6 * x10, x7 * x11) #define in1 v21 #define in2 v23 #define out_lo v26 #define out_hi v27 uzp2 v3.4s, in2.4s, in1.4s xtn v4.2s, in1.2d xtn v5.2s, in2.2d rev64 v1.4s, in2.4s // hoisted from maddloop_firstitr and maddloop_x0one ldp x8, x9, [x2, #32] ldp x10, x11, [x2, #48] umull v6.2d, v4.2s, v5.2s umull v7.2d, v4.2s, v3.2s uzp2 v16.4s, in1.4s, in1.4s mul v0.4s, v1.4s, in1.4s adc x25, xzr, xzr adds x12, x22, x12 adcs x13, x23, x13 adcs x14, x24, x14 adc x15, x25, x15 movi v2.2d, #0x000000ffffffff usra v7.2d, v6.2d, #32 umull out_hi.2d, v16.2s, v3.2s uaddlp v0.2d, v0.4s and v2.16b, v7.16b, v2.16b umlal v2.2d, v16.2s, v5.2s shl out_lo.2d, v0.2d, #32 usra out_hi.2d, v7.2d, #32 umlal out_lo.2d, v4.2s, v5.2s usra out_hi.2d, v2.2d, #32 #undef in1 #undef in2 #undef out_lo #undef out_hi cbz x0, Lbignum_emontredc_8n_madddone mov x27, x0 cmp x0, #32 bne Lbignum_emontredc_8n_maddloop_firstitr Lbignum_emontredc_8n_maddloop_x0one: add x2, x2, #0x20 add x1, x1, #0x20 mul x17, x4, x8 mul x22, x5, x9 mul x23, x6, x10 mul x24, x7, x11 umulh x16, x4, x8 adds x22, x22, x16 umulh x16, x5, x9 adcs x23, x23, x16 umulh x16, x6, x10 adcs x24, x24, x16 umulh x16, x7, x11 adc x25, x16, xzr ldp x20, x21, [x1] adds x12, x12, x20 adcs x13, x13, x21 ldp x20, x21, [x1, #16] adcs x14, x14, x20 adcs x15, x15, x21 adc x16, xzr, xzr adds x19, x22, x17 adcs x22, x23, x22 adcs x23, x24, x23 adcs x24, x25, x24 adc x25, xzr, x25 adds x20, x22, x17 adcs x21, x23, x19 adcs x22, x24, x22 adcs x23, x25, x23 adcs x24, xzr, x24 adc x25, xzr, x25 adds x17, x17, x12 adcs x19, x19, x13 adcs x20, x20, x14 adcs x21, x21, x15 adcs x22, x22, x16 adcs x23, x23, xzr adcs x24, x24, xzr adc x25, x25, xzr subs x15, x6, x7 cneg x15, x15, cc // cc = lo, ul, last csetm x12, cc // cc = lo, ul, last subs x13, x11, x10 cneg x13, x13, cc // cc = lo, ul, last mul x14, x15, x13 umulh x13, x15, x13 cinv x12, x12, cc // cc = lo, ul, last cmn x12, #0x1 eor x14, x14, x12 adcs x23, x23, x14 eor x13, x13, x12 adcs x24, x24, x13 adc x25, x25, x12 subs x15, x4, x5 cneg x15, x15, cc // cc = lo, ul, last csetm x12, cc // cc = lo, ul, last subs x13, x9, x8 cneg x13, x13, cc // cc = lo, ul, last mul x14, x15, x13 umulh x13, x15, x13 cinv x12, x12, cc // cc = lo, ul, last cmn x12, #0x1 eor x14, x14, x12 adcs x19, x19, x14 eor x13, x13, x12 adcs x20, x20, x13 adcs x21, x21, x12 adcs x22, x22, x12 adcs x23, x23, x12 adcs x24, x24, x12 adc x25, x25, x12 subs x15, x5, x7 cneg x15, x15, cc // cc = lo, ul, last csetm x12, cc // cc = lo, ul, last subs x13, x11, x9 cneg x13, x13, cc // cc = lo, ul, last mul x14, x15, x13 umulh x13, x15, x13 cinv x12, x12, cc // cc = lo, ul, last cmn x12, #0x1 eor x14, x14, x12 adcs x22, x22, x14 eor x13, x13, x12 adcs x23, x23, x13 adcs x24, x24, x12 adc x25, x25, x12 subs x15, x4, x6 cneg x15, x15, cc // cc = lo, ul, last csetm x12, cc // cc = lo, ul, last subs x13, x10, x8 cneg x13, x13, cc // cc = lo, ul, last mul x14, x15, x13 umulh x13, x15, x13 cinv x12, x12, cc // cc = lo, ul, last cmn x12, #0x1 eor x14, x14, x12 adcs x20, x20, x14 eor x13, x13, x12 adcs x21, x21, x13 adcs x22, x22, x12 adcs x23, x23, x12 adcs x24, x24, x12 adc x25, x25, x12 subs x15, x4, x7 cneg x15, x15, cc // cc = lo, ul, last csetm x12, cc // cc = lo, ul, last subs x13, x11, x8 cneg x13, x13, cc // cc = lo, ul, last mul x14, x15, x13 umulh x13, x15, x13 cinv x12, x12, cc // cc = lo, ul, last cmn x12, #0x1 eor x14, x14, x12 adcs x21, x21, x14 eor x13, x13, x12 adcs x22, x22, x13 adcs x23, x23, x12 adcs x24, x24, x12 adc x25, x25, x12 subs x15, x5, x6 cneg x15, x15, cc // cc = lo, ul, last csetm x12, cc // cc = lo, ul, last subs x13, x10, x9 cneg x13, x13, cc // cc = lo, ul, last mul x14, x15, x13 umulh x13, x15, x13 cinv x12, x12, cc // cc = lo, ul, last cmn x12, #0x1 eor x14, x14, x12 adcs x21, x21, x14 eor x13, x13, x12 adcs x22, x22, x13 adcs x13, x23, x12 adcs x14, x24, x12 adc x15, x25, x12 mov x12, x22 stp x17, x19, [x1] stp x20, x21, [x1, #16] sub x27, x27, #0x20 b Lbignum_emontredc_8n_madddone Lbignum_emontredc_8n_maddloop_firstitr: mov x16, v25.d[0] //umulh x16,x4,x8 mov x22, v24.d[1] //mul x22, x5, x9 mov x20, v25.d[1] //umulh x20,x5,x9 mov x23, v26.d[0] //mul x23, x6, x10 mov x21, v27.d[0] //umulh x21,x6,x10 mov x24, v26.d[1] //mul x24, x7, x11 mov x3, v27.d[1] //umulh x3,x7,x11 mov x17, v24.d[0] //mul x17, x4, x8 adds x22,x22,x16 adcs x23,x23,x20 adcs x24,x24,x21 adc x25,x3,xzr // pre-calculate the multiplications for the next iter. // v25 ++ v24 = hi, lo of (x4 * x8, x5 * x9) ldr q22, [x2, #64] ldr q23, [x2, #80] add x2, x2, #32 add x1, x1, #32 #define in1 v20 #define in2 v22 #define out_lo v24 #define out_hi v25 uzp2 v3.4s, in2.4s, in1.4s xtn v4.2s, in1.2d xtn v5.2s, in2.2d rev64 v1.4s, in2.4s ldp x20,x21,[x1] adds x12,x12,x20 adcs x13,x13,x21 ldp x20,x21,[x1,#16] umull v6.2d, v4.2s, v5.2s umull v7.2d, v4.2s, v3.2s uzp2 v16.4s, in1.4s, in1.4s mul v0.4s, v1.4s, in1.4s adcs x14,x14,x20 adcs x15,x15,x21 adc x16,xzr,xzr adds x19,x22,x17 movi v2.2d, #0x000000ffffffff usra v7.2d, v6.2d, #32 umull out_hi.2d, v16.2s, v3.2s uaddlp v0.2d, v0.4s adcs x22,x23,x22 adcs x23,x24,x23 adcs x24,x25,x24 adc x25,xzr,x25 and v2.16b, v7.16b, v2.16b umlal v2.2d, v16.2s, v5.2s shl out_lo.2d, v0.2d, #32 usra out_hi.2d, v7.2d, #32 adds x20,x22,x17 adcs x21,x23,x19 adcs x22,x24,x22 adcs x23,x25,x23 umlal out_lo.2d, v4.2s, v5.2s usra out_hi.2d, v2.2d, #32 #undef in1 #undef in2 #undef out_lo #undef out_hi adcs x24,xzr,x24 adc x25,xzr,x25 adds x17,x17,x12 adcs x19,x19,x13 #define in1 v21 #define in2 v23 #define out_lo v26 #define out_hi v27 uzp2 v3.4s, in2.4s, in1.4s xtn v4.2s, in1.2d xtn v5.2s, in2.2d rev64 v1.4s, in2.4s adcs x20,x20,x14 adcs x21,x21,x15 adcs x22,x22,x16 adcs x23,x23,xzr umull v6.2d, v4.2s, v5.2s umull v7.2d, v4.2s, v3.2s uzp2 v16.4s, in1.4s, in1.4s mul v0.4s, v1.4s, in1.4s adcs x24,x24,xzr adc x25,x25,xzr subs x15,x6,x7 cneg x15,x15,cc movi v2.2d, #0x000000ffffffff usra v7.2d, v6.2d, #32 umull out_hi.2d, v16.2s, v3.2s uaddlp v0.2d, v0.4s csetm x12,cc subs x13,x11,x10 cneg x13,x13,cc mul x14,x15,x13 and v2.16b, v7.16b, v2.16b umlal v2.2d, v16.2s, v5.2s shl out_lo.2d, v0.2d, #32 usra out_hi.2d, v7.2d, #32 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 umlal out_lo.2d, v4.2s, v5.2s usra out_hi.2d, v2.2d, #32 #undef in1 #undef in2 #undef out_lo #undef out_hi adcs x23,x23,x14 eor x13,x13,x12 adcs x24,x24,x13 adc x25,x25,x12 subs x15,x4,x5 cneg x15,x15,cc csetm x12,cc subs x13,x9,x8 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x19,x19,x14 eor x13,x13,x12 adcs x20,x20,x13 adcs x21,x21,x12 adcs x22,x22,x12 adcs x23,x23,x12 adcs x24,x24,x12 adc x25,x25,x12 stp x17,x19,[x1] mov x16, v25.d[0] // hi bits of (x4 * x8) mov x26, v27.d[0] // hi bits of (x6 * x10) mov x3, v25.d[1] // hi bits of (x5 * x9) mov x17, v27.d[1] // hi bits of (x6 * x10) subs x15,x5,x7 cneg x15,x15,cc csetm x12,cc subs x13,x11,x9 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x22,x22,x14 eor x13,x13,x12 adcs x23,x23,x13 adcs x24,x24,x12 adc x25,x25,x12 subs x15,x4,x6 cneg x15,x15,cc csetm x12,cc subs x13,x10,x8 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x20,x20,x14 eor x13,x13,x12 adcs x21,x21,x13 adcs x22,x22,x12 adcs x23,x23,x12 adcs x24,x24,x12 adc x25,x25,x12 subs x15,x4,x7 cneg x15,x15,cc csetm x12,cc subs x13,x11,x8 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x21,x21,x14 eor x13,x13,x12 adcs x22,x22,x13 adcs x23,x23,x12 adcs x24,x24,x12 adc x25,x25,x12 subs x15,x5,x6 cneg x15,x15,cc csetm x12,cc subs x13,x10,x9 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x21,x21,x14 stp x20,x21,[x1,#16] mov x20, v24.d[1] // lo bits of (x5 * x9) mov x21, v26.d[0] // lo bits of (x6 * x10) eor x13,x13,x12 adcs x22,x22,x13 adcs x13,x23,x12 adcs x14,x24,x12 adc x15,x25,x12 mov x12,x22 mov x24, v26.d[1] // lo bits of (x7 * x11) sub x27, x27, #32 cmp x27, #32 beq Lbignum_emontredc_8n_maddloop_last Lbignum_emontredc_8n_maddloop: ldp x8, x9, [x2, #32] ldp x10, x11, [x2, #48] // pre-calculate the multiplications for the next iter. // v25 ++ v24 = hi, lo of (x4 * x8, x5 * x9) ldr q22, [x2, #64] ldr q23, [x2, #80] add x2, x2, #32 add x1, x1, #32 adds x22,x20,x16 adcs x23,x21,x3 adcs x24,x24,x26 adc x25,x17,xzr mov x17, v24.d[0] // lo bits of (x4 * x8) #define in1 v20 #define in2 v22 #define out_lo v24 #define out_hi v25 uzp2 v3.4s, in2.4s, in1.4s xtn v4.2s, in1.2d xtn v5.2s, in2.2d rev64 v1.4s, in2.4s ldp x20,x21,[x1] adds x12,x12,x20 adcs x13,x13,x21 ldp x20,x21,[x1,#16] umull v6.2d, v4.2s, v5.2s umull v7.2d, v4.2s, v3.2s uzp2 v16.4s, in1.4s, in1.4s mul v0.4s, v1.4s, in1.4s adcs x14,x14,x20 adcs x15,x15,x21 adc x16,xzr,xzr adds x19,x22,x17 movi v2.2d, #0x000000ffffffff usra v7.2d, v6.2d, #32 umull out_hi.2d, v16.2s, v3.2s uaddlp v0.2d, v0.4s adcs x22,x23,x22 adcs x23,x24,x23 adcs x24,x25,x24 adc x25,xzr,x25 and v2.16b, v7.16b, v2.16b umlal v2.2d, v16.2s, v5.2s shl out_lo.2d, v0.2d, #32 usra out_hi.2d, v7.2d, #32 adds x20,x22,x17 adcs x21,x23,x19 adcs x22,x24,x22 adcs x23,x25,x23 umlal out_lo.2d, v4.2s, v5.2s usra out_hi.2d, v2.2d, #32 #undef in1 #undef in2 #undef out_lo #undef out_hi adcs x24,xzr,x24 adc x25,xzr,x25 adds x17,x17,x12 adcs x19,x19,x13 #define in1 v21 #define in2 v23 #define out_lo v26 #define out_hi v27 uzp2 v3.4s, in2.4s, in1.4s xtn v4.2s, in1.2d xtn v5.2s, in2.2d rev64 v1.4s, in2.4s adcs x20,x20,x14 adcs x21,x21,x15 adcs x22,x22,x16 adcs x23,x23,xzr umull v6.2d, v4.2s, v5.2s umull v7.2d, v4.2s, v3.2s uzp2 v16.4s, in1.4s, in1.4s mul v0.4s, v1.4s, in1.4s adcs x24,x24,xzr adc x25,x25,xzr subs x15,x6,x7 cneg x15,x15,cc movi v2.2d, #0x000000ffffffff usra v7.2d, v6.2d, #32 umull out_hi.2d, v16.2s, v3.2s uaddlp v0.2d, v0.4s csetm x12,cc subs x13,x11,x10 cneg x13,x13,cc mul x14,x15,x13 and v2.16b, v7.16b, v2.16b umlal v2.2d, v16.2s, v5.2s shl out_lo.2d, v0.2d, #32 usra out_hi.2d, v7.2d, #32 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 umlal out_lo.2d, v4.2s, v5.2s usra out_hi.2d, v2.2d, #32 #undef in1 #undef in2 #undef out_lo #undef out_hi adcs x23,x23,x14 eor x13,x13,x12 adcs x24,x24,x13 adc x25,x25,x12 subs x15,x4,x5 cneg x15,x15,cc csetm x12,cc subs x13,x9,x8 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x19,x19,x14 eor x13,x13,x12 adcs x20,x20,x13 adcs x21,x21,x12 adcs x22,x22,x12 adcs x23,x23,x12 adcs x24,x24,x12 adc x25,x25,x12 stp x17,x19,[x1] mov x16, v25.d[0] // hi bits of (x4 * x8) mov x26, v27.d[0] // hi bits of (x6 * x10) mov x3, v25.d[1] // hi bits of (x5 * x9) mov x17, v27.d[1] // hi bits of (x6 * x10) subs x15,x5,x7 cneg x15,x15,cc csetm x12,cc subs x13,x11,x9 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x22,x22,x14 eor x13,x13,x12 adcs x23,x23,x13 adcs x24,x24,x12 adc x25,x25,x12 subs x15,x4,x6 cneg x15,x15,cc csetm x12,cc subs x13,x10,x8 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x20,x20,x14 eor x13,x13,x12 adcs x21,x21,x13 adcs x22,x22,x12 adcs x23,x23,x12 adcs x24,x24,x12 adc x25,x25,x12 subs x15,x4,x7 cneg x15,x15,cc csetm x12,cc subs x13,x11,x8 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x21,x21,x14 eor x13,x13,x12 adcs x22,x22,x13 adcs x23,x23,x12 adcs x24,x24,x12 adc x25,x25,x12 subs x15,x5,x6 cneg x15,x15,cc csetm x12,cc subs x13,x10,x9 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x21,x21,x14 stp x20,x21,[x1,#16] mov x20, v24.d[1] // lo bits of (x5 * x9) mov x21, v26.d[0] // lo bits of (x6 * x10) eor x13,x13,x12 adcs x22,x22,x13 adcs x13,x23,x12 adcs x14,x24,x12 adc x15,x25,x12 mov x12,x22 mov x24, v26.d[1] // lo bits of (x7 * x11) sub x27, x27, #32 cmp x27, #32 bne Lbignum_emontredc_8n_maddloop Lbignum_emontredc_8n_maddloop_last: ldp x8, x9, [x2, #32] ldp x10, x11, [x2, #48] add x2, x2, #32 add x1, x1, #32 adds x22,x20,x16 adcs x23,x21,x3 adcs x24,x24,x26 adc x25,x17,xzr mov x17, v24.d[0] // lo bits of (x4 * x8) ldp x20,x21,[x1] adds x12,x12,x20 adcs x13,x13,x21 ldp x20,x21,[x1,#16] adcs x14,x14,x20 adcs x15,x15,x21 adc x16,xzr,xzr adds x19,x22,x17 adcs x22,x23,x22 adcs x23,x24,x23 adcs x24,x25,x24 adc x25,xzr,x25 adds x20,x22,x17 adcs x21,x23,x19 adcs x22,x24,x22 adcs x23,x25,x23 adcs x24,xzr,x24 adc x25,xzr,x25 adds x17,x17,x12 adcs x19,x19,x13 adcs x20,x20,x14 adcs x21,x21,x15 adcs x22,x22,x16 adcs x23,x23,xzr adcs x24,x24,xzr adc x25,x25,xzr subs x15,x6,x7 cneg x15,x15,cc csetm x12,cc subs x13,x11,x10 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x23,x23,x14 eor x13,x13,x12 adcs x24,x24,x13 adc x25,x25,x12 subs x15,x4,x5 cneg x15,x15,cc csetm x12,cc subs x13,x9,x8 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x19,x19,x14 eor x13,x13,x12 adcs x20,x20,x13 adcs x21,x21,x12 adcs x22,x22,x12 adcs x23,x23,x12 adcs x24,x24,x12 adc x25,x25,x12 subs x15,x5,x7 cneg x15,x15,cc csetm x12,cc subs x13,x11,x9 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x22,x22,x14 eor x13,x13,x12 adcs x23,x23,x13 adcs x24,x24,x12 adc x25,x25,x12 subs x15,x4,x6 cneg x15,x15,cc csetm x12,cc subs x13,x10,x8 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x20,x20,x14 eor x13,x13,x12 adcs x21,x21,x13 adcs x22,x22,x12 adcs x23,x23,x12 adcs x24,x24,x12 adc x25,x25,x12 subs x15,x4,x7 cneg x15,x15,cc csetm x12,cc subs x13,x11,x8 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x21,x21,x14 eor x13,x13,x12 adcs x22,x22,x13 adcs x23,x23,x12 adcs x24,x24,x12 adc x25,x25,x12 subs x15,x5,x6 cneg x15,x15,cc csetm x12,cc subs x13,x10,x9 cneg x13,x13,cc mul x14,x15,x13 umulh x13,x15,x13 cinv x12,x12,cc adds xzr,x12,#1 eor x14,x14,x12 adcs x21,x21,x14 eor x13,x13,x12 adcs x22,x22,x13 adcs x13,x23,x12 adcs x14,x24,x12 adc x15,x25,x12 mov x12,x22 stp x17,x19,[x1] stp x20,x21,[x1,#16] subs x27, x27, #64 Lbignum_emontredc_8n_madddone: ldp x17, x19, [x1, #32] ldp x20, x21, [x1, #48] ldp x26, xzr, [sp, #16] adds xzr, x28, x28 adcs x17, x17, x12 adcs x19, x19, x13 adcs x20, x20, x14 adcs x21, x21, x15 csetm x28, cs stp x17, x19, [x1, #32] stp x20, x21, [x1, #48] sub x1, x1, x0 sub x2, x2, x0 add x1, x1, #32 subs x26, x26, #1 stp x26, xzr, [sp, #16] bne Lbignum_emontredc_8n_outerloop neg x0, x28 Lbignum_emontredc_8n_end: CFI_INC_SP(32) CFI_POP2(x27,x28) CFI_POP2(x25,x26) CFI_POP2(x23,x24) CFI_POP2(x21,x22) CFI_POP2(x19,x20) CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_emontredc_8n)
wlsfx/bnbb
2,632
.local/share/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_mod_n384_6.S
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 // ---------------------------------------------------------------------------- // Reduce modulo group order, z := x mod n_384 // Input x[6]; output z[6] // // extern void bignum_mod_n384_6(uint64_t z[static 6], const uint64_t x[static 6]); // // Reduction is modulo the group order of the NIST curve P-384. // // Standard ARM ABI: X0 = z, X1 = x // ---------------------------------------------------------------------------- #include "_internal_s2n_bignum_arm.h" S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mod_n384_6) S2N_BN_FUNCTION_TYPE_DIRECTIVE(bignum_mod_n384_6) S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mod_n384_6) .text .balign 4 #define z x0 #define x x1 #define n0 x2 #define n1 x3 #define n2 x4 #define n3 x5 #define n4 x6 #define n5 x7 #define d0 x8 #define d1 x9 #define d2 x10 #define d3 x11 #define d4 x12 #define d5 x13 #define movbig(nn,n3,n2,n1,n0) \ movz nn, n0 __LF \ movk nn, n1, lsl #16 __LF \ movk nn, n2, lsl #32 __LF \ movk nn, n3, lsl #48 S2N_BN_SYMBOL(bignum_mod_n384_6): CFI_START // Load the complicated lower three words of n_384 movbig( n0, #0xecec, #0x196a, #0xccc5, #0x2973) movbig( n1, #0x581a, #0x0db2, #0x48b0, #0xa77a) movbig( n2, #0xc763, #0x4d81, #0xf437, #0x2ddf) // Load the input number ldp d0, d1, [x] ldp d2, d3, [x, #16] ldp d4, d5, [x, #32] // Do the subtraction. Since the top three words of n_384 are all 1s // we can devolve the top to adding 0, thanks to the inverted carry. subs n0, d0, n0 sbcs n1, d1, n1 sbcs n2, d2, n2 adcs n3, d3, xzr adcs n4, d4, xzr adcs n5, d5, xzr // Now if the carry is *clear* (inversion at work) the subtraction carried // and hence we should have done nothing, so we reset each n_i = d_i csel n0, d0, n0, cc csel n1, d1, n1, cc csel n2, d2, n2, cc csel n3, d3, n3, cc csel n4, d4, n4, cc csel n5, d5, n5, cc // Store the end result stp n0, n1, [z] stp n2, n3, [z, #16] stp n4, n5, [z, #32] CFI_RET S2N_BN_SIZE_DIRECTIVE(bignum_mod_n384_6) #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif