www.beck-ipc.com

@CHIP-RTOS C Library - TCP/IP API


Crypt_BN_Mod_Exp

Big number modulo exponentiation.

int far Crypt_BN_Mod_Exp( Crypt_BigNumS      far *result,
                    const Crypt_BigNumConstS far *a,
                    const Crypt_BigNumConstS far *power,
                    const Crypt_BigNumConstS far *modulo) ;

Parameters

result

[out]   Pointer to big number where result will be written.   Caller must provide a buffer of sufficient size at result->bnDataPtr.   That is the only member of this referenced data structure which the caller must initialize.

a

[in]   Pointer to big number which will be raised to the specified exponent.

power

[in]   Pointer to big number to be used as the exponent.

modulo

[in]   Pointer to big number containing the large prime number to be used for the modulo value.

Return Value

error code:
    0 - Success (no error).
    1 - Memory allocation failed.
    3 - Invalid big number size.
    4 - The modulo prime number was not odd.
    5 - No solution found (e.g. divisor was zero).

Comments

This API performs the modulo exponentiation operation.   This operation is fundamental to many of the key exchange schemes.

The value computed is:

     result = (a ** power) MOD modulo ;

The big numbers must not exceed 512 bytes size or an error will result.

The prime number at modulo must be an odd number.

This function requires a 42 kByte workspace allocated from the system memory.   The function will execute significantly faster if this workspace memory is available in the system's fast memory area.

See Also

RTOS API

On the first call, this library function invokes a software interrupt which modifies the code at the calling site inside your application program.   A direct FAR JMP into the @CHIP-RTOS-x86 implementation for this function is installed so that on return and on any subsequent calls to this API this dynamic link reaches the function's implementation directly.

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3SC2x
    n/an/an/aV1.35V1.35

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.19

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document