MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClMath_Functions.h File Reference

APIs of mcuxClMath component. More...

#include <stdint.h>
#include <stdbool.h>
#include <mcuxCsslFlowProtection.h>
#include <mcuxClPkc.h>
#include <mcuxClMath_Types.h>

Go to the source code of this file.

Macros

#define MCUXCLMATH_FP_INITLOCALUPTRT(i3_i2_i1_i0, i7_i6_i5_i4, localPtrUptrt, noOfIndices)
 Helper macro to call mcuxClMath_InitLocalUptrt with flow protection. More...
 
#define MCUXCLMATH_FP_LEADINGZEROS(iX)
 Helper macro to call mcuxClMath_LeadingZeros with flow protection. More...
 
#define MCUXCLMATH_FP_TRAILINGZEROS(iX)
 Helper macro to call mcuxClMath_TrailingZeros with flow protection. More...
 
#define MCUXCLMATH_SHIFTMODULUS(iNShifted, iN)
 Helper macro for mcuxClMath_ShiftModulus. More...
 
#define MCUXCLMATH_FP_SHIFTMODULUS(iNShifted, iN)
 Helper macro for mcuxClMath_ShiftModulus with flow protection. More...
 
#define MCUXCLMATH_NDASH(iN, iT)
 Helper macro for mcuxClMath_NDash. More...
 
#define MCUXCLMATH_FP_NDASH(iN, iT)
 Helper macro for mcuxClMath_NDash with flow protection. More...
 
#define MCUXCLMATH_QDASH(iQDash, iNShifted, iN, iT, len)
 Helper macro for mcuxClMath_QDash. More...
 
#define MCUXCLMATH_FP_QDASH(iQDash, iNShifted, iN, iT, len)
 Helper macro for mcuxClMath_QDash with flow protection. More...
 
#define MCUXCLMATH_QSQUARED(iQSqr, iNShifted, iN, iT)
 Helper macro for mcuxClMath_QSquared. More...
 
#define MCUXCLMATH_FP_QSQUARED(iQSqr, iNShifted, iN, iT)
 Helper macro for mcuxClMath_QSquared with flow protection. More...
 
#define MCUXCLMATH_MODINV(iR, iX, iN, iT)
 Helper macro for mcuxClMath_ModInv. More...
 
#define MCUXCLMATH_FP_MODINV(iR, iX, iN, iT)
 Helper macro for mcuxClMath_ModInv with flow protection. More...
 
#define MCUXCLMATH_REDUCEMODEVEN(iR, iX, iN, iT0, iT1, iT2, iT3)
 Helper macro for mcuxClMath_ReduceModEven. More...
 
#define MCUXCLMATH_FP_REDUCEMODEVEN(iR, iX, iN, iT0, iT1, iT2, iT3)
 Helper macro for mcuxClMath_ReduceModEven with flow protection. More...
 
#define MCUXCLMATH_MODEXP_SQRMULTL2R(pExp, byteLenExp, iR, iX, iN, iT)
 Helper macro for mcuxClMath_ModExp_SqrMultL2R. More...
 
#define MCUXCLMATH_FP_MODEXP_SQRMULTL2R(pExp, byteLenExp, iR, iX, iN, iT)
 Helper macro for mcuxClMath_ModExp_SqrMultL2R with flow protection. More...
 
#define MCUXCLMATH_SECMODEXP(pExp, pExpTemp, byteLenExp, iR, iX, iN, iTE, iT0, iT1, iT2, iT3)
 Helper macro for mcuxClMath_SecModExp. More...
 
#define MCUXCLMATH_FP_SECMODEXP(pExp, pExpTemp, byteLenExp, iR, iX, iN, iTE, iT0, iT1, iT2, iT3)
 Helper macro for mcuxClMath_SecModExp with flow protection. More...
 
#define MCUXCLMATH_EXACTDIVIDEODD(iR, iX, iN, iT, pkcByteLenX, pkcByteLenY)
 Helper macro for mcuxClMath_ExactDivideOdd. More...
 
#define MCUXCLMATH_FP_EXACTDIVIDEODD(iR, iX, iN, iT, pkcByteLenX, pkcByteLenY)
 Helper macro for mcuxClMath_ExactDivideOdd with flow protection. More...
 
#define MCUXCLMATH_EXACTDIVIDE(iR, iX, iN, iT, pkcByteLenX, pkcByteLenY)
 Helper macro for mcuxClMath_ExactDivide. More...
 
#define MCUXCLMATH_FP_EXACTDIVIDE(iR, iX, iN, iT, pkcByteLenX, pkcByteLenY)
 Helper macro for mcuxClMath_ExactDivide with flow protection. More...
 

Functions

mcuxClMath_Status_Protected_t mcuxClMath_InitLocalUptrt (uint32_t i3_i2_i1_i0, uint32_t i7_i6_i5_i4, uint16_t *localPtrUptrt, uint8_t noOfIndices, const uint16_t **oldPtrUptrt)
 Initializes the new UPTRT and returns the address of existing UPTRT. More...
 
mcuxClMath_Status_Protected_t mcuxClMath_LeadingZeros (uint8_t iX, uint32_t *nLeadingZeros)
 Counts number of leading zeros of operand in the given buffer (length = ps1 OPLEN). More...
 
mcuxClMath_Status_Protected_t mcuxClMath_TrailingZeros (uint8_t iX, uint32_t *nTrailingZeros)
 Counts number of trailing zeros of operand in the given buffer (length = ps1 OPLEN). More...
 
mcuxClMath_Status_Protected_t mcuxClMath_ShiftModulus (uint16_t iNShifted_iN)
 Left shifts modulus until most significant bit of the buffer (length = ps1 OPLEN) is 1, and stores the result in the buffer specified. More...
 
mcuxClMath_Status_Protected_t mcuxClMath_NDash (uint16_t iN_iT)
 Prepares modulus buffer (initializes NDash) to be used in modular multiplication (inversion, ...) with odd modulus. More...
 
mcuxClMath_Status_Protected_t mcuxClMath_QDash (uint32_t iQDash_iNShifted_iN_iT, uint16_t len)
 Calculates Q * Q' mod n, where Q = 256^(ps1 OPLEN) mod n, and Q' = 256^len mod n. More...
 
mcuxClMath_Status_Protected_t mcuxClMath_QSquared (uint32_t iQSqr_iNShifted_iN_iT)
 Calculates Q^2 mod n, where Q = 256^(ps1 OPLEN) mod n. More...
 
mcuxClMath_Status_Protected_t mcuxClMath_ModInv (uint32_t iR_iX_iN_iT)
 Calculates modular inversion, X^(-1) mod n. More...
 
mcuxClMath_Status_Protected_t mcuxClMath_ReduceModEven (uint32_t iR_iX_iN_iT0, uint32_t iT1_iT2_iT3)
 Calculates modular reduction with even modulus, x mod n, where n is even. More...
 
mcuxClMath_Status_Protected_t mcuxClMath_ModExp_SqrMultL2R (const uint8_t *pExp, uint32_t byteLenExp, uint32_t iR_iX_iN_iT)
 Calculates modular exponentiation with left-to-right binary square and multiply algorithm. More...
 
mcuxClMath_Status_Protected_t mcuxClMath_SecModExp (const uint8_t *pExp, uint32_t *pExpTemp, uint32_t byteLenExp, uint32_t iT3_iX_iT2_iT1, uint32_t iN_iTE_iT0_iR)
 Securely calculates modular exponentiation. More...
 
mcuxClMath_Status_Protected_t mcuxClMath_ExactDivideOdd (uint32_t iR_iX_iY_iT, uint32_t pkcByteLenX, uint32_t pkcByteLenY)
 TODO 1.pkcByteLenX and pkcByteLenY shall be a multiple of pkc wordsize. More...
 
mcuxClMath_Status_Protected_t mcuxClMath_ExactDivide (uint32_t iR_iX_iY_iT, uint32_t pkcByteLenX, uint32_t pkcByteLenY)
 Exact division. More...
 

Detailed Description

APIs of mcuxClMath component.