Donna128 128-bit Integer Arithmetic Functions. More...
#include "common.h"Go to the source code of this file.
Data Structures | |
| struct | uint128 |
| 128-bit integer structure. More... | |
Functions | |
| QSC_EXPORT_API uint128 | qsc_donna128_shift_right (const uint128 *x, size_t shift) |
| Right shift a 128-bit integer. | |
| QSC_EXPORT_API uint128 | qsc_donna128_shift_left (const uint128 *x, size_t shift) |
| Left shift a 128-bit integer. | |
| QSC_EXPORT_API uint64_t | qsc_donna128_andl (const uint128 *x, uint64_t mask) |
| Bitwise AND the low part of a 128-bit integer. | |
| QSC_EXPORT_API uint64_t | qsc_donna128_andh (const uint128 *x, uint64_t mask) |
| Bitwise AND the high part of a 128-bit integer. | |
| QSC_EXPORT_API uint128 | qsc_donna128_add (const uint128 *x, const uint128 *y) |
| Add two 128-bit integers. | |
| QSC_EXPORT_API uint128 | qsc_donna128_multiply (const uint128 *x, uint64_t y) |
| Multiply a 128-bit integer by a 64-bit integer. | |
| QSC_EXPORT_API uint128 | qsc_donna128_or (const uint128 *x, const uint128 *y) |
| Bitwise OR of two 128-bit integers. | |
Donna128 128-bit Integer Arithmetic Functions.
This module provides a comprehensive set of operations for performing arithmetic on 128-bit integers using a software-based implementation. The Donna128 arithmetic functions include operations such as addition, subtraction, multiplication, and modular reduction of 128-bit integers. This implementation is optimized for use in cryptographic applications where high-precision arithmetic is required, particularly in environments where native hardware support for 128-bit integers may be limited.
The functions are designed to operate in constant-time to mitigate timing attacks in sensitive cryptographic computations. They are integral to cryptographic primitives such as digital signatures, key exchange protocols, and other schemes that depend on multiprecision arithmetic.
| QSC_EXPORT_API uint128 qsc_donna128_add | ( | const uint128 * | x, |
| const uint128 * | y ) |
Add two 128-bit integers.
| x | [const uint128*] Pointer to the first integer. |
| y | [const uint128*] Pointer to the second integer. |
| QSC_EXPORT_API uint64_t qsc_donna128_andh | ( | const uint128 * | x, |
| uint64_t | mask ) |
Bitwise AND the high part of a 128-bit integer.
| x | [const uint128*] Pointer to the input integer. |
| mask | [uint64_t] The bitmask for the operation. |
| QSC_EXPORT_API uint64_t qsc_donna128_andl | ( | const uint128 * | x, |
| uint64_t | mask ) |
Bitwise AND the low part of a 128-bit integer.
| x | [const uint128*] Pointer to the input integer. |
| mask | [uint64_t] The bitmask for the operation. |
| QSC_EXPORT_API uint128 qsc_donna128_multiply | ( | const uint128 * | x, |
| uint64_t | y ) |
Multiply a 128-bit integer by a 64-bit integer.
| x | [const uint128*] Pointer to the first integer. |
| y | [uint64_t] The second integer. |
| QSC_EXPORT_API uint128 qsc_donna128_or | ( | const uint128 * | x, |
| const uint128 * | y ) |
Bitwise OR of two 128-bit integers.
| x | [const uint128*] Pointer to the first integer. |
| y | [const uint128*] Pointer to the second integer. |
| QSC_EXPORT_API uint128 qsc_donna128_shift_left | ( | const uint128 * | x, |
| size_t | shift ) |
Left shift a 128-bit integer.
| x | [const uint128*] Pointer to the input integer. |
| shift | [size_t] Number of bits to shift left. |
| QSC_EXPORT_API uint128 qsc_donna128_shift_right | ( | const uint128 * | x, |
| size_t | shift ) |
Right shift a 128-bit integer.
| x | [const uint128*] Pointer to the input integer. |
| shift | [size_t] Number of bits to shift right. |