www.beck-ipc.com

@CHIP-RTOS C Library - TCP/IP API


Crypt_BN_Mod_Inverse

Big number modulo inverse.

int far Crypt_BN_Mod_Inverse ( Crypt_BigNumS      far *result,
                         const Crypt_BigNumConstS far *a,
                         const Crypt_BigNumConstS far *b) ;

Parameters

result

[out]   On success the modulo inverse of a is reported here.   This location may reference one of the other inputs, which would then be overwritten.   ( Note that pointers to Crypt_BigNumConstS type can be safely cast to pointers to Crypt_BigNumS type. )   The caller must provide
b->bnDigitCnt digits of space in the buffer referenced by result->bnDataPtr.   The bnDataPtr member is the only field at result which must be initialized by the caller.

a

[in]   Pointer to big number whose modulo inverse is to be found.

b

[in]   Pointer to the big number modulo value.

Return Value

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

Comments

This API performs the modulo inverse operation.

The function solves the following equation for 'result':

     1 == (a * result) mod b

In some cases, this equation has no solution.

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

This function requires a 12 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