BigNum module provides APIs for performing big number operations.
============================================================================
#include <stdint.h>
#include <stdio.h>
Go to the source code of this file.
Macros | |
#define | BigNum_STATUS_SUCCESS ((int_fast16_t)0) |
Successful status code. More... | |
#define | BigNum_STATUS_ERROR ((int_fast16_t)-1) |
Generic error status code. More... | |
#define | BigNum_MOD_REDUCTION_MAX_INPUT_LEN_IN_WORDS 16 |
Maximum input length in words supported by modular reduction API. More... | |
Functions | |
int_fast16_t | BigNum_modularReduction (uint32_t *result, size_t resultLenBytes, const uint32_t *input, size_t inputLenBytes, const uint32_t *mod, size_t modLenBytes) |
Perform modular reduction on large integer array. More... | |
#define BigNum_STATUS_SUCCESS ((int_fast16_t)0) |
Successful status code.
Functions return BigNum_STATUS_SUCCESS if the function was executed successfully.
#define BigNum_STATUS_ERROR ((int_fast16_t)-1) |
Generic error status code.
Functions return BigNum_STATUS_ERROR if the function was not executed successfully and no more specific error is applicable.
#define BigNum_MOD_REDUCTION_MAX_INPUT_LEN_IN_WORDS 16 |
Maximum input length in words supported by modular reduction API.
int_fast16_t BigNum_modularReduction | ( | uint32_t * | result, |
size_t | resultLenBytes, | ||
const uint32_t * | input, | ||
size_t | inputLenBytes, | ||
const uint32_t * | mod, | ||
size_t | modLenBytes | ||
) |
Perform modular reduction on large integer array.
This function supports inputs up to BigNum_MOD_REDUCTION_MAX_INPUT_LEN_IN_WORDS in word length.
result | Pointer to a word-aligned buffer to store result in little-endian, where result[0] contains the least significant 32-bits of result. |
resultLenBytes | Result buffer length in bytes. |
input | Pointer to the word-aligned buffer containing input in little-endian, where input[0] contains the least significant 32-bits of input. |
inputLenBytes | Input buffer length in bytes. |
mod | Pointer to a word-aligned buffer containing the modulus in little-endian, where mod[0] contains the least significant 32-bits of mod. |
modLenBytes | Modulus buffer length in bytes. |
BigNum_STATUS_SUCCESS | The operation succeeded. |
BigNum_STATUS_ERROR | The operation failed. |