BN_NIST_MOD_521(3)

NAME
BN_nist_mod_192, BN_nist_mod_224, BN_nist_mod_256, BN_nist_mod_384, BN_nist_mod_521 - reduction modulo NIST-recommended primes

SYNOPSIS
#include <openssl/bn.h>
int
BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
int
BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
int
BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
int
BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
int
BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);

DESCRIPTION
These functions are optimized versions of BN_nnmod(3) using precomputed tables. They ignore their m argument and use the following moduli instead:

BN_nist_mod_192()
    BN_get0_nist_prime_192(3)
BN_nist_mod_224()
    BN_get0_nist_prime_224(3)
BN_nist_mod_256()
    BN_get0_nist_prime_256(3)
BN_nist_mod_384()
    BN_get0_nist_prime_384(3)
BN_nist_mod_521()
    BN_get0_nist_prime_521(3)

They reduce a modulo the respective prime number and place the non-negative remainder in r.

These functions are designed to save time when performing multiplications in prime fields of these specific orders. Consequently, if a is negative or larger than the square of the modulus being used, they call BN_nnmod(3) instead of attempting any optimization.

RETURN VALUES
These functions return 1 on success or 0 on error.

SEE ALSO
BN_get0_nist_prime_521(3), BN_nnmod(3), EC_GFp_nist_method(3)

STANDARDS
Digital Signature Standard (DSS), National Institute of Standards and Technology, FIPS PUB 186-4, https://doi.org/10.6028/NIST.FIPS.186-4, Information Technology Laboratory, Gaithersburg, Maryland, July 2013, Appendix D.1.2 Curves over Prime Fields.