8#ifndef BOTAN_CURVE25519_DONNA128_H_
9#define BOTAN_CURVE25519_DONNA128_H_
11#include <botan/internal/mul128.h>
28 const uint64_t
carry = z.h << (64 - shift);
30 z.l = (z.l >> shift) |
carry;
38 const uint64_t
carry = z.l >> (64 - shift);
40 z.h = (z.h << shift) |
carry;
57 const uint64_t
carry = (l < x.l);
64 const uint64_t
carry = (l < x);
69 uint64_t
lo()
const {
return l; }
71 uint64_t
hi()
const {
return h; }
74 uint64_t h = 0, l = 0;
78 BOTAN_ARG_CHECK(x.
hi() == 0,
"High 64 bits of donna128 set to zero during multiply");
80 uint64_t lo = 0, hi = 0;
106 return (a >> shift).lo();
114#if defined(BOTAN_TARGET_HAS_NATIVE_UINT128)
115inline uint64_t
carry_shift(
const uint128_t a,
size_t shift) {
116 return static_cast<uint64_t
>(a >> shift);
119inline uint64_t
combine_lower(
const uint128_t a,
size_t s1,
const uint128_t b,
size_t s2) {
120 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)
OctetString operator+(const OctetString &k1, const OctetString &k2)
uint64_t carry_shift(const donna128 &a, size_t shift)
uint64_t combine_lower(const donna128 &a, size_t s1, const donna128 &b, size_t s2)
void carry(int64_t &h0, int64_t &h1)
void mul64x64_128(uint64_t a, uint64_t b, uint64_t *lo, uint64_t *hi)