Botan 3.14.1
Crypto and TLS for C&
mp_monty_mulx.cpp File Reference
#include <botan/internal/mp_mulx.h>
#include <botan/mem_ops.h>
#include <botan/internal/mp_core.h>
#include <array>

Go to the source code of this file.

Namespaces

namespace  Botan

Macros

#define BOTAN_MULADD_ASM(STEPS)
#define BOTAN_MULADD_STEP(D)
#define BOTAN_MULADD_STEPS4
#define BOTAN_MULADD_STEPS8

Functions

void Botan::bigint_mulx_monty_mul (word z[], const word x[], const word y[], const word p[], size_t N, word p_dash, word ws[])
void Botan::bigint_mulx_monty_redc (word r[], word z[], const word p[], size_t N, word p_dash)
void Botan::bigint_mulx_monty_sqr (word z[], const word x[], const word p[], size_t N, word p_dash, word ws[])
void Botan::bigint_mulx_sqr (word z[], const word x[], size_t N)

Macro Definition Documentation

◆ BOTAN_MULADD_ASM

#define BOTAN_MULADD_ASM ( STEPS)
Value:
asm volatile("xorl %k[zero], %k[zero]\n\t" \
STEPS \
"adox %[zero], %[carry]\n\t" \
"adcx %[zero], %[carry]\n\t" \
: [carry] "+&r"(carry), [tmp] "=&r"(tmp), [lo] "=&r"(lo), [zero] "=&r"(zero) \
: [out] "r"(out), [t] "r"(t), [x] "r"(x), "d"(b) \
: "cc", "memory")

Definition at line 37 of file mp_monty_mulx.cpp.

37#define BOTAN_MULADD_ASM(STEPS) \
38 asm volatile("xorl %k[zero], %k[zero]\n\t" \
39 STEPS \
40 "adox %[zero], %[carry]\n\t" \
41 "adcx %[zero], %[carry]\n\t" \
42 : [carry] "+&r"(carry), [tmp] "=&r"(tmp), [lo] "=&r"(lo), [zero] "=&r"(zero) \
43 : [out] "r"(out), [t] "r"(t), [x] "r"(x), "d"(b) \
44 : "cc", "memory")

◆ BOTAN_MULADD_STEP

#define BOTAN_MULADD_STEP ( D)
Value:
"movq " D "(%[t]), %[tmp]\n\t" \
"adox %[carry], %[tmp]\n\t" \
"mulx " D "(%[x]), %[lo], %[carry]\n\t" \
"adcx %[lo], %[tmp]\n\t" \
"movq %[tmp], " D "(%[out])\n\t"

Definition at line 25 of file mp_monty_mulx.cpp.

25#define BOTAN_MULADD_STEP(D) \
26 "movq " D "(%[t]), %[tmp]\n\t" \
27 "adox %[carry], %[tmp]\n\t" \
28 "mulx " D "(%[x]), %[lo], %[carry]\n\t" \
29 "adcx %[lo], %[tmp]\n\t" \
30 "movq %[tmp], " D "(%[out])\n\t"

◆ BOTAN_MULADD_STEPS4

#define BOTAN_MULADD_STEPS4
Value:
BOTAN_MULADD_STEP("8") \
BOTAN_MULADD_STEP("16") \
BOTAN_MULADD_STEP("24")
#define BOTAN_MULADD_STEP(D)

Definition at line 46 of file mp_monty_mulx.cpp.

46#define BOTAN_MULADD_STEPS4 \
47 BOTAN_MULADD_STEP("0") \
48 BOTAN_MULADD_STEP("8") \
49 BOTAN_MULADD_STEP("16") \
50 BOTAN_MULADD_STEP("24")

◆ BOTAN_MULADD_STEPS8

#define BOTAN_MULADD_STEPS8
Value:
BOTAN_MULADD_STEPS4 \
BOTAN_MULADD_STEP("32") \
BOTAN_MULADD_STEP("40") \
BOTAN_MULADD_STEP("48") \
BOTAN_MULADD_STEP("56")

Definition at line 52 of file mp_monty_mulx.cpp.

52#define BOTAN_MULADD_STEPS8 \
53 BOTAN_MULADD_STEPS4 \
54 BOTAN_MULADD_STEP("32") \
55 BOTAN_MULADD_STEP("40") \
56 BOTAN_MULADD_STEP("48") \
57 BOTAN_MULADD_STEP("56")