8#ifndef BOTAN_CURVE25519_DONNA128_H_
9#define BOTAN_CURVE25519_DONNA128_H_
11#include <botan/internal/mul128.h>
18 donna128(uint64_t ll = 0, uint64_t hh = 0) { l = ll; h = hh; }
28 const uint64_t
carry = z.h << (64 - shift);
30 z.l = (z.l >> shift) |
carry;
40 const uint64_t
carry = z.l >> (64 - shift);
42 z.h = (z.h << shift) |
carry;
64 const uint64_t
carry = (l < x.l);
72 const uint64_t
carry = (l < x);
77 uint64_t
lo()
const {
return l; }
78 uint64_t
hi()
const {
return h; }
80 uint64_t h = 0, l = 0;
85 BOTAN_ARG_CHECK(x.
hi() == 0,
"High 64 bits of donna128 set to zero during multiply");
87 uint64_t lo = 0, hi = 0;
118 return (a >> shift).lo();
128#if defined(BOTAN_TARGET_HAS_NATIVE_UINT128)
129inline uint64_t
carry_shift(
const uint128_t a,
size_t shift)
131 return static_cast<uint64_t
>(a >> shift);
135 const uint128_t
b,
size_t s2)
137 return static_cast<uint64_t
>((a >> s1) | (
b << s2));
#define BOTAN_ARG_CHECK(expr, msg)
friend donna128 operator<<(const donna128 &x, size_t shift)
uint64_t operator&=(uint64_t mask)
friend uint64_t operator&(const donna128 &x, uint64_t mask)
friend donna128 operator>>(const donna128 &x, size_t shift)
donna128 & operator+=(const donna128 &x)
donna128(uint64_t ll=0, uint64_t hh=0)
donna128 & operator+=(uint64_t x)
donna128 & operator=(const donna128 &)=default
donna128(const donna128 &)=default
int(* final)(unsigned char *, CTX *)
ASN1_Type operator|(ASN1_Type x, ASN1_Type y)
BigInt operator*(const BigInt &x, const BigInt &y)
void carry(int64_t &h0, int64_t &h1)
uint64_t carry_shift(const donna128 &a, size_t shift)
OID operator+(const OID &oid, uint32_t new_comp)
uint64_t combine_lower(const donna128 &a, size_t s1, const donna128 &b, size_t s2)
void mul64x64_128(uint64_t a, uint64_t b, uint64_t *lo, uint64_t *hi)