bn.h
Functions
Name | |
---|---|
int | wolfSSL_BN_mod_exp(WOLFSSL_BIGNUM * r, const WOLFSSL_BIGNUM * a, const WOLFSSL_BIGNUM * p, const WOLFSSL_BIGNUM * m, WOLFSSL_BN_CTX * ctx) This function performs the following math “r = (a^p) % m”. |
Functions Documentation
function wolfSSL_BN_mod_exp
int wolfSSL_BN_mod_exp(
WOLFSSL_BIGNUM * r,
const WOLFSSL_BIGNUM * a,
const WOLFSSL_BIGNUM * p,
const WOLFSSL_BIGNUM * m,
WOLFSSL_BN_CTX * ctx
)
This function performs the following math “r = (a^p) % m”.
Parameters:
- r structure to hold result.
- a value to be raised by a power.
- p power to raise a by.
- m modulus to use.
- ctx currently not used with wolfSSL can be NULL.
See:
- wolfSSL_BN_new
- wolfSSL_BN_free
Return:
- SSL_SUCCESS On successfully performing math operation.
- SSL_FAILURE If an error case was encountered.
Example
WOLFSSL_BIGNUM r,a,p,m;
int ret;
// set big number values
ret = wolfSSL_BN_mod_exp(r, a, p, m, NULL);
// check ret value
Source code
int wolfSSL_BN_mod_exp(WOLFSSL_BIGNUM *r, const WOLFSSL_BIGNUM *a,
const WOLFSSL_BIGNUM *p, const WOLFSSL_BIGNUM *m, WOLFSSL_BN_CTX *ctx);
Updated on 2024-11-07 at 01:17:40 +0000