Sortix main manual
This manual documents Sortix main. You can instead view this document in the latest official manual.
NAME
BN_GF2m_add, BN_GF2m_sub, BN_GF2m_cmp, BN_GF2m_mod_arr, BN_GF2m_mod, BN_GF2m_mod_mul_arr, BN_GF2m_mod_mul, BN_GF2m_mod_sqr_arr, BN_GF2m_mod_sqr, BN_GF2m_mod_inv, BN_GF2m_mod_inv_arr, BN_GF2m_mod_div, BN_GF2m_mod_div_arr, BN_GF2m_mod_exp_arr, BN_GF2m_mod_exp, BN_GF2m_mod_sqrt_arr, BN_GF2m_mod_sqrt, BN_GF2m_mod_solve_quad_arr, BN_GF2m_mod_solve_quad, BN_GF2m_poly2arr, BN_GF2m_arr2poly — arithmetic in Galois fields of power-of-2 orderSYNOPSIS
#include <openssl/bn.h>BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
BN_GF2m_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
BN_GF2m_cmp(const BIGNUM *a, const BIGNUM *b);
BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]);
BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p);
BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx);
BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx);
BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx);
BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx);
BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], BN_CTX *ctx);
BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx);
BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx);
BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *exponent, const int p[], BN_CTX *ctx);
BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *exponent, const BIGNUM *p, BN_CTX *ctx);
BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx);
BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx);
BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
BN_GF2m_poly2arr(const BIGNUM *poly_in, int arr_out[], int arr_size);
BN_GF2m_arr2poly(const int arr_in[], BIGNUM *poly_out);
DESCRIPTION
Two fields containing the same, finite number of elements are isomorphic, and the number of elements is called their order. The unique field of a given finite order is called the Galois field of that order. The following functions perform arithmetic operations on , the Galois fields of order , where is a natural number.RETURN VALUES
BN_GF2m_cmp() interprets a and b as integer numbers and returns -1 if , 0 if , or 1 if .- 0 if poly_in has the value 0;
- a number in the range from 2 to arr_size, inclusive, in case of success, specifying the number of elements that have been stored into the array;
- a number greater than arr_size if the function failed because the array was too small, specifying the array size that would have been needed.
ERRORS
After some cases of failure, the following diagnostics can be retrieved with ERR_get_error(3), ERR_GET_REASON(3), and ERR_reason_error_string(3):- BN_R_NO_SOLUTION “no solution”
- No solution exists for the equation that BN_GF2m_mod_solve_quad_arr() or BN_GF2m_mod_solve_quad() attempted to solve.
- BN_R_INVALID_LENGTH “invalid length”
- In one of the functions wrapping an *_arr() variant, the BIGNUM *p argument had a value of zero.