hu_ZModCalcExpo()

Computes integer modulo exponentiation.

Synopsis:

#include "huzmodcalc.h"
 
int hu_ZModCalcExpo(size_t baseLen, const unsigned char *baseValue, size_t expoLen, const unsigned char *expoValue, size_t modLen, const unsigned char *modValue, unsigned char *result, sb_YieldCtx yieldCtx, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

baseLen

Length of the base in bytes.

baseValue

Value of the base as an integer

expoLen

Length of the exponent in bytes.

expoValue

Value of the exponent as an integer.

modLen

Length of the modulus in bytes.

modValue

Value of the modulus as an integer. The modulus must be a prime number.

result

The result finite field element.

yieldCtx

Yield context.

sbCtx

A global context.

Library:

libhuapi (For the qcc command, use the -l huapi option to link against this library)

Description:

Inputs to this function are integers represented in octet string.

There can be leading 0 octets for base and exponent. However, leading 0 octet is not allowed for modulus.

The result is an element of a finite field. Thus, the result is represented in octet string, where the value is represented in the same number of octets as the modulus. If the value is smaller, it will be padded with 0 octets to the size of the modulus.

Returns:

SB_ERR_BAD_INPUT_LEN

Input parameter length is invalid.

SB_ERR_NULL_INPUT

Input parameter is NULL.

SB_ERR_BAD_INPUT

Input parameter value is invalid.

SB_FAIL_ALLOC

Memory allocation failure.

SB_FAILURE

Operation failed.

SB_SUCCESS

Success.