![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
This section describes the programming interface of the CAU3 PKHA driver.
Data Structures | |
struct | cau3_pkha_ecc_point_t |
PKHA ECC point structure. More... | |
Enumerations | |
enum | cau3_pkha_timing_t { kCAU3_PKHA_NoTimingEqualized = 0U, kCAU3_PKHA_TimingEqualized = 1U } |
Use of timing equalized version of a PKHA function. More... | |
enum | cau3_pkha_f2m_t { kCAU3_PKHA_IntegerArith = 0U, kCAU3_PKHA_F2mArith = 1U } |
Integer vs binary polynomial arithmetic selection. More... | |
enum | cau3_pkha_montgomery_form_t { kCAU3_PKHA_NormalValue = 0U, kCAU3_PKHA_MontgomeryFormat = 1U } |
Montgomery or normal PKHA input format. More... | |
Functions | |
status_t | CAU3_PKHA_NormalToMontgomery (CAU3_Type *base, const uint8_t *N, size_t sizeN, uint8_t *A, size_t *sizeA, uint8_t *B, size_t *sizeB, uint8_t *R2, size_t *sizeR2, cau3_pkha_timing_t equalTime, cau3_pkha_f2m_t arithType) |
Converts from integer to Montgomery format. More... | |
status_t | CAU3_PKHA_MontgomeryToNormal (CAU3_Type *base, const uint8_t *N, size_t sizeN, uint8_t *A, size_t *sizeA, uint8_t *B, size_t *sizeB, cau3_pkha_timing_t equalTime, cau3_pkha_f2m_t arithType) |
Converts from Montgomery format to int. More... | |
status_t | CAU3_PKHA_ModAdd (CAU3_Type *base, const uint8_t *A, size_t sizeA, const uint8_t *B, size_t sizeB, const uint8_t *N, size_t sizeN, uint8_t *result, size_t *resultSize, cau3_pkha_f2m_t arithType) |
Performs modular addition - (A + B) mod N. More... | |
status_t | CAU3_PKHA_ModSub1 (CAU3_Type *base, const uint8_t *A, size_t sizeA, const uint8_t *B, size_t sizeB, const uint8_t *N, size_t sizeN, uint8_t *result, size_t *resultSize) |
Performs modular subtraction - (A - B) mod N. More... | |
status_t | CAU3_PKHA_ModSub2 (CAU3_Type *base, const uint8_t *A, size_t sizeA, const uint8_t *B, size_t sizeB, const uint8_t *N, size_t sizeN, uint8_t *result, size_t *resultSize) |
Performs modular subtraction - (B - A) mod N. More... | |
status_t | CAU3_PKHA_ModMul (CAU3_Type *base, const uint8_t *A, size_t sizeA, const uint8_t *B, size_t sizeB, const uint8_t *N, size_t sizeN, uint8_t *result, size_t *resultSize, cau3_pkha_f2m_t arithType, cau3_pkha_montgomery_form_t montIn, cau3_pkha_montgomery_form_t montOut, cau3_pkha_timing_t equalTime) |
Performs modular multiplication - (A x B) mod N. More... | |
status_t | CAU3_PKHA_ModExp (CAU3_Type *base, const uint8_t *A, size_t sizeA, const uint8_t *N, size_t sizeN, const uint8_t *E, size_t sizeE, uint8_t *result, size_t *resultSize, cau3_pkha_f2m_t arithType, cau3_pkha_montgomery_form_t montIn, cau3_pkha_timing_t equalTime) |
Performs modular exponentiation - (A^E) mod N. More... | |
status_t | CAU3_PKHA_ModSqrt (CAU3_Type *base, const uint8_t *A, size_t sizeA, const uint8_t *N, size_t sizeN, uint8_t *result, size_t *resultSize) |
Performs Modular Square Root. More... | |
status_t | CAU3_PKHA_ModRed (CAU3_Type *base, const uint8_t *A, size_t sizeA, const uint8_t *N, size_t sizeN, uint8_t *result, size_t *resultSize, cau3_pkha_f2m_t arithType) |
Performs modular reduction - (A) mod N. More... | |
status_t | CAU3_PKHA_ModInv (CAU3_Type *base, const uint8_t *A, size_t sizeA, const uint8_t *N, size_t sizeN, uint8_t *result, size_t *resultSize, cau3_pkha_f2m_t arithType) |
Performs modular inversion - (A^-1) mod N. More... | |
status_t | CAU3_PKHA_ModR2 (CAU3_Type *base, const uint8_t *N, size_t sizeN, uint8_t *result, size_t *resultSize, cau3_pkha_f2m_t arithType) |
Computes integer Montgomery factor R^2 mod N. More... | |
status_t | CAU3_PKHA_ModRR (CAU3_Type *base, const uint8_t *P, size_t sizeP, size_t sizeE, uint8_t *result, size_t *resultSize) |
Performs Integer RERP mod P. More... | |
status_t | CAU3_PKHA_ModGcd (CAU3_Type *base, const uint8_t *A, size_t sizeA, const uint8_t *N, size_t sizeN, uint8_t *result, size_t *resultSize, cau3_pkha_f2m_t arithType) |
Calculates the greatest common divisor - GCD (A, N). More... | |
status_t | CAU3_PKHA_PrimalityTest (CAU3_Type *base, const uint8_t *A, size_t sizeA, const uint8_t *B, size_t sizeB, const uint8_t *N, size_t sizeN, bool *res) |
Executes Miller-Rabin primality test. More... | |
status_t | CAU3_PKHA_ECC_PointAdd (CAU3_Type *base, const cau3_pkha_ecc_point_t *A, const cau3_pkha_ecc_point_t *B, const uint8_t *N, const uint8_t *R2modN, const uint8_t *aCurveParam, const uint8_t *bCurveParam, size_t size, cau3_pkha_f2m_t arithType, cau3_pkha_ecc_point_t *result) |
Adds elliptic curve points - A + B. More... | |
status_t | CAU3_PKHA_ECC_PointDouble (CAU3_Type *base, const cau3_pkha_ecc_point_t *B, const uint8_t *N, const uint8_t *aCurveParam, const uint8_t *bCurveParam, size_t size, cau3_pkha_f2m_t arithType, cau3_pkha_ecc_point_t *result) |
Doubles elliptic curve points - B + B. More... | |
status_t | CAU3_PKHA_ECC_PointMul (CAU3_Type *base, const cau3_pkha_ecc_point_t *A, const uint8_t *E, size_t sizeE, const uint8_t *N, const uint8_t *R2modN, const uint8_t *aCurveParam, const uint8_t *bCurveParam, size_t size, cau3_pkha_timing_t equalTime, cau3_pkha_f2m_t arithType, cau3_pkha_ecc_point_t *result) |
Multiplies an elliptic curve point by a scalar - E x (A0, A1). More... | |
status_t | CAU3_PKHA_ECM_PointMul (CAU3_Type *base, const uint8_t *E, size_t sizeE, const uint8_t *inputCoordinate, const uint8_t *A24, const uint8_t *N, const uint8_t *R2modN, size_t size, cau3_pkha_timing_t equalTime, uint8_t *outputCoordinate) |
Computes scalar multiplication of a point on an elliptic curve in Montgomery form. More... | |
status_t | CAU3_PKHA_ECT_PointMul (CAU3_Type *base, const cau3_pkha_ecc_point_t *A, const uint8_t *E, size_t sizeE, const uint8_t *N, const uint8_t *R2modN, const uint8_t *aCurveParam, const uint8_t *dCurveParam, size_t size, cau3_pkha_timing_t equalTime, cau3_pkha_ecc_point_t *result) |
Multiplies an Edwards-form elliptic curve point by a scalar - E x (A0, A1). More... | |
status_t | CAU3_PKHA_ECT_PointAdd (CAU3_Type *base, const cau3_pkha_ecc_point_t *A, const cau3_pkha_ecc_point_t *B, const uint8_t *N, const uint8_t *R2modN, const uint8_t *aCurveParam, const uint8_t *dCurveParam, size_t size, cau3_pkha_ecc_point_t *result) |
Adds an Edwards-form elliptic curve points - A + B. More... | |
struct cau3_pkha_ecc_point_t |
enum cau3_pkha_timing_t |
enum cau3_pkha_f2m_t |
status_t CAU3_PKHA_NormalToMontgomery | ( | CAU3_Type * | base, |
const uint8_t * | N, | ||
size_t | sizeN, | ||
uint8_t * | A, | ||
size_t * | sizeA, | ||
uint8_t * | B, | ||
size_t * | sizeB, | ||
uint8_t * | R2, | ||
size_t * | sizeR2, | ||
cau3_pkha_timing_t | equalTime, | ||
cau3_pkha_f2m_t | arithType | ||
) |
This function computes R2 mod N and optionally converts A or B into Montgomery format of A or B.
base | CAU3 peripheral base address | |
N | modulus | |
sizeN | size of N in bytes | |
[in,out] | A | The first input in non-Montgomery format. Output Montgomery format of the first input. |
[in,out] | sizeA | pointer to size variable. On input it holds size of input A in bytes. On output it holds size of Montgomery format of A in bytes. |
[in,out] | B | Second input in non-Montgomery format. Output Montgomery format of the second input. |
[in,out] | sizeB | pointer to size variable. On input it holds size of input B in bytes. On output it holds size of Montgomery format of B in bytes. |
[out] | R2 | Output Montgomery factor R2 mod N. |
[out] | sizeR2 | pointer to size variable. On output it holds size of Montgomery factor R2 mod N in bytes. |
equalTime | Run the function time equalized or no timing equalization. | |
arithType | Type of arithmetic to perform (integer or F2m) |
status_t CAU3_PKHA_MontgomeryToNormal | ( | CAU3_Type * | base, |
const uint8_t * | N, | ||
size_t | sizeN, | ||
uint8_t * | A, | ||
size_t * | sizeA, | ||
uint8_t * | B, | ||
size_t * | sizeB, | ||
cau3_pkha_timing_t | equalTime, | ||
cau3_pkha_f2m_t | arithType | ||
) |
This function converts Montgomery format of A or B into int A or B.
base | CAU3 peripheral base address | |
N | modulus. | |
sizeN | size of N modulus in bytes. | |
[in,out] | A | Input first number in Montgomery format. Output is non-Montgomery format. |
[in,out] | sizeA | pointer to size variable. On input it holds size of the input A in bytes. On output it holds size of non-Montgomery A in bytes. |
[in,out] | B | Input first number in Montgomery format. Output is non-Montgomery format. |
[in,out] | sizeB | pointer to size variable. On input it holds size of the input B in bytes. On output it holds size of non-Montgomery B in bytes. |
equalTime | Run the function time equalized or no timing equalization. | |
arithType | Type of arithmetic to perform (integer or F2m) |
status_t CAU3_PKHA_ModAdd | ( | CAU3_Type * | base, |
const uint8_t * | A, | ||
size_t | sizeA, | ||
const uint8_t * | B, | ||
size_t | sizeB, | ||
const uint8_t * | N, | ||
size_t | sizeN, | ||
uint8_t * | result, | ||
size_t * | resultSize, | ||
cau3_pkha_f2m_t | arithType | ||
) |
This function performs modular addition of (A + B) mod N, with either integer or binary polynomial (F2m) inputs. In the F2m form, this function is equivalent to a bitwise XOR and it is functionally the same as subtraction.
base | CAU3 peripheral base address | |
A | first addend (integer or binary polynomial) | |
sizeA | Size of A in bytes | |
B | second addend (integer or binary polynomial) | |
sizeB | Size of B in bytes | |
N | modulus. | |
sizeN | Size of N in bytes. | |
[out] | result | Output array to store result of operation |
[out] | resultSize | Output size of operation in bytes |
arithType | Type of arithmetic to perform (integer or F2m) |
status_t CAU3_PKHA_ModSub1 | ( | CAU3_Type * | base, |
const uint8_t * | A, | ||
size_t | sizeA, | ||
const uint8_t * | B, | ||
size_t | sizeB, | ||
const uint8_t * | N, | ||
size_t | sizeN, | ||
uint8_t * | result, | ||
size_t * | resultSize | ||
) |
This function performs modular subtraction of (A - B) mod N with integer inputs.
base | CAU3 peripheral base address | |
A | first addend (integer or binary polynomial) | |
sizeA | Size of A in bytes | |
B | second addend (integer or binary polynomial) | |
sizeB | Size of B in bytes | |
N | modulus | |
sizeN | Size of N in bytes | |
[out] | result | Output array to store result of operation |
[out] | resultSize | Output size of operation in bytes |
status_t CAU3_PKHA_ModSub2 | ( | CAU3_Type * | base, |
const uint8_t * | A, | ||
size_t | sizeA, | ||
const uint8_t * | B, | ||
size_t | sizeB, | ||
const uint8_t * | N, | ||
size_t | sizeN, | ||
uint8_t * | result, | ||
size_t * | resultSize | ||
) |
This function performs modular subtraction of (B - A) mod N, with integer inputs.
base | CAU3 peripheral base address | |
A | first addend (integer or binary polynomial) | |
sizeA | Size of A in bytes | |
B | second addend (integer or binary polynomial) | |
sizeB | Size of B in bytes | |
N | modulus | |
sizeN | Size of N in bytes | |
[out] | result | Output array to store result of operation |
[out] | resultSize | Output size of operation in bytes |
status_t CAU3_PKHA_ModMul | ( | CAU3_Type * | base, |
const uint8_t * | A, | ||
size_t | sizeA, | ||
const uint8_t * | B, | ||
size_t | sizeB, | ||
const uint8_t * | N, | ||
size_t | sizeN, | ||
uint8_t * | result, | ||
size_t * | resultSize, | ||
cau3_pkha_f2m_t | arithType, | ||
cau3_pkha_montgomery_form_t | montIn, | ||
cau3_pkha_montgomery_form_t | montOut, | ||
cau3_pkha_timing_t | equalTime | ||
) |
This function performs modular multiplication with either integer or binary polynomial (F2m) inputs. It can optionally specify whether inputs and/or outputs will be in Montgomery form or not.
base | CAU3 peripheral base address | |
A | first addend (integer or binary polynomial) | |
sizeA | Size of A in bytes | |
B | second addend (integer or binary polynomial) | |
sizeB | Size of B in bytes | |
N | modulus. | |
sizeN | Size of N in bytes | |
[out] | result | Output array to store result of operation |
[out] | resultSize | Output size of operation in bytes |
arithType | Type of arithmetic to perform (integer or F2m) | |
montIn | Format of inputs | |
montOut | Format of output | |
equalTime | Run the function time equalized or no timing equalization. This argument is ignored for F2m modular multiplication. |
status_t CAU3_PKHA_ModExp | ( | CAU3_Type * | base, |
const uint8_t * | A, | ||
size_t | sizeA, | ||
const uint8_t * | N, | ||
size_t | sizeN, | ||
const uint8_t * | E, | ||
size_t | sizeE, | ||
uint8_t * | result, | ||
size_t * | resultSize, | ||
cau3_pkha_f2m_t | arithType, | ||
cau3_pkha_montgomery_form_t | montIn, | ||
cau3_pkha_timing_t | equalTime | ||
) |
This function performs modular exponentiation with either integer or binary polynomial (F2m) inputs.
base | CAU3 peripheral base address | |
A | first addend (integer or binary polynomial) | |
sizeA | Size of A in bytes | |
N | modulus | |
sizeN | Size of N in bytes | |
E | exponent | |
sizeE | Size of E in bytes | |
[out] | result | Output array to store result of operation |
[out] | resultSize | Output size of operation in bytes |
montIn | Format of A input (normal or Montgomery) | |
arithType | Type of arithmetic to perform (integer or F2m) | |
equalTime | Run the function time equalized or no timing equalization. |
status_t CAU3_PKHA_ModSqrt | ( | CAU3_Type * | base, |
const uint8_t * | A, | ||
size_t | sizeA, | ||
const uint8_t * | N, | ||
size_t | sizeN, | ||
uint8_t * | result, | ||
size_t * | resultSize | ||
) |
This function performs modular square root with integer inputs. The modular square root function computes output result B, such that ( B x B ) mod N = input A. If no such B result exists, the result will be set to 0 and the PKHA "prime" flag will be set. Input values A and B are limited to a maximum size of 128 bytes. Note that two such square root values may exist. This algorithm will find either one of them, if any exist. The second possible square root (B') can be found by calculating B' = N - B.
base | CAU3 peripheral base address | |
A | input value, for which a square root is to be calculated | |
sizeA | Size of A in bytes | |
N | modulus | |
sizeN | Size of N in bytes | |
[out] | result | Output array to store result of operation |
[out] | resultSize | Output size of operation in bytes |
status_t CAU3_PKHA_ModRed | ( | CAU3_Type * | base, |
const uint8_t * | A, | ||
size_t | sizeA, | ||
const uint8_t * | N, | ||
size_t | sizeN, | ||
uint8_t * | result, | ||
size_t * | resultSize, | ||
cau3_pkha_f2m_t | arithType | ||
) |
This function performs modular reduction with either integer or binary polynomial (F2m) inputs.
base | CAU3 peripheral base address | |
A | first addend (integer or binary polynomial) | |
sizeA | Size of A in bytes | |
N | modulus | |
sizeN | Size of N in bytes | |
[out] | result | Output array to store result of operation |
[out] | resultSize | Output size of operation in bytes |
arithType | Type of arithmetic to perform (integer or F2m) |
status_t CAU3_PKHA_ModInv | ( | CAU3_Type * | base, |
const uint8_t * | A, | ||
size_t | sizeA, | ||
const uint8_t * | N, | ||
size_t | sizeN, | ||
uint8_t * | result, | ||
size_t * | resultSize, | ||
cau3_pkha_f2m_t | arithType | ||
) |
This function performs modular inversion with either integer or binary polynomial (F2m) inputs.
base | CAU3 peripheral base address | |
A | first addend (integer or binary polynomial) | |
sizeA | Size of A in bytes | |
N | modulus | |
sizeN | Size of N in bytes | |
[out] | result | Output array to store result of operation |
[out] | resultSize | Output size of operation in bytes |
arithType | Type of arithmetic to perform (integer or F2m) |
status_t CAU3_PKHA_ModR2 | ( | CAU3_Type * | base, |
const uint8_t * | N, | ||
size_t | sizeN, | ||
uint8_t * | result, | ||
size_t * | resultSize, | ||
cau3_pkha_f2m_t | arithType | ||
) |
This function computes a constant to assist in converting operands into the Montgomery residue system representation.
base | CAU3 peripheral base address | |
N | modulus | |
sizeN | Size of N in bytes | |
[out] | result | Output array to store result of operation |
[out] | resultSize | Output size of operation in bytes |
arithType | Type of arithmetic to perform (integer or F2m) |
status_t CAU3_PKHA_ModRR | ( | CAU3_Type * | base, |
const uint8_t * | P, | ||
size_t | sizeP, | ||
size_t | sizeE, | ||
uint8_t * | result, | ||
size_t * | resultSize | ||
) |
This function is used to compute a constant to assist in converting operands into the Montgomery residue system representation specifically for Chinese Remainder Theorem while performing RSA with a CRT implementation where a modulus E=P x Q, and P and Q are prime numbers. Although labeled RERP mod P, this routine (function) can also compute RERQ mod Q.
base | CAU3 peripheral base address | |
P | modulus P or Q of CRT, an odd integer | |
sizeP | Size of P in bytes | |
sizeE | Number of bytes of E = P x Q (this size must be given, though content of E itself is not used). | |
[out] | result | Output array to store result of operation |
[out] | resultSize | Output size of operation in bytes |
status_t CAU3_PKHA_ModGcd | ( | CAU3_Type * | base, |
const uint8_t * | A, | ||
size_t | sizeA, | ||
const uint8_t * | N, | ||
size_t | sizeN, | ||
uint8_t * | result, | ||
size_t * | resultSize, | ||
cau3_pkha_f2m_t | arithType | ||
) |
This function calculates the greatest common divisor of two inputs with either integer or binary polynomial (F2m) inputs.
base | CAU3 peripheral base address | |
A | first value (must be smaller than or equal to N) | |
sizeA | Size of A in bytes | |
N | second value (must be non-zero) | |
sizeN | Size of N in bytes | |
[out] | result | Output array to store result of operation |
[out] | resultSize | Output size of operation in bytes |
arithType | Type of arithmetic to perform (integer or F2m) |
status_t CAU3_PKHA_PrimalityTest | ( | CAU3_Type * | base, |
const uint8_t * | A, | ||
size_t | sizeA, | ||
const uint8_t * | B, | ||
size_t | sizeB, | ||
const uint8_t * | N, | ||
size_t | sizeN, | ||
bool * | res | ||
) |
This function calculates whether or not a candidate prime number is likely to be a prime.
base | CAU3 peripheral base address | |
A | initial random seed | |
sizeA | Size of A in bytes | |
B | number of trial runs | |
sizeB | Size of B in bytes | |
N | candidate prime integer | |
sizeN | Size of N in bytes | |
[out] | res | True if the value is likely prime or false otherwise |
status_t CAU3_PKHA_ECC_PointAdd | ( | CAU3_Type * | base, |
const cau3_pkha_ecc_point_t * | A, | ||
const cau3_pkha_ecc_point_t * | B, | ||
const uint8_t * | N, | ||
const uint8_t * | R2modN, | ||
const uint8_t * | aCurveParam, | ||
const uint8_t * | bCurveParam, | ||
size_t | size, | ||
cau3_pkha_f2m_t | arithType, | ||
cau3_pkha_ecc_point_t * | result | ||
) |
This function performs ECC point addition over a prime field (Fp) or binary field (F2m) using affine coordinates.
base | CAU3 peripheral base address | |
A | Left-hand point | |
B | Right-hand point | |
N | Prime modulus of the field | |
R2modN | NULL (the function computes R2modN internally) or pointer to pre-computed R2modN (obtained from CAU3_PKHA_ModR2() function). | |
aCurveParam | A parameter from curve equation | |
bCurveParam | B parameter from curve equation (constant) | |
size | Size in bytes of curve points and parameters | |
arithType | Type of arithmetic to perform (integer or F2m) | |
[out] | result | Result point |
status_t CAU3_PKHA_ECC_PointDouble | ( | CAU3_Type * | base, |
const cau3_pkha_ecc_point_t * | B, | ||
const uint8_t * | N, | ||
const uint8_t * | aCurveParam, | ||
const uint8_t * | bCurveParam, | ||
size_t | size, | ||
cau3_pkha_f2m_t | arithType, | ||
cau3_pkha_ecc_point_t * | result | ||
) |
This function performs ECC point doubling over a prime field (Fp) or binary field (F2m) using affine coordinates.
base | CAU3 peripheral base address | |
B | Point to double | |
N | Prime modulus of the field | |
aCurveParam | A parameter from curve equation | |
bCurveParam | B parameter from curve equation (constant) | |
size | Size in bytes of curve points and parameters | |
arithType | Type of arithmetic to perform (integer or F2m) | |
[out] | result | Result point |
status_t CAU3_PKHA_ECC_PointMul | ( | CAU3_Type * | base, |
const cau3_pkha_ecc_point_t * | A, | ||
const uint8_t * | E, | ||
size_t | sizeE, | ||
const uint8_t * | N, | ||
const uint8_t * | R2modN, | ||
const uint8_t * | aCurveParam, | ||
const uint8_t * | bCurveParam, | ||
size_t | size, | ||
cau3_pkha_timing_t | equalTime, | ||
cau3_pkha_f2m_t | arithType, | ||
cau3_pkha_ecc_point_t * | result | ||
) |
This function performs ECC point multiplication to multiply an ECC point by a scalar integer multiplier over a prime field (Fp) or a binary field (F2m).
base | CAU3 peripheral base address | |
A | Point as multiplicand | |
E | Scalar multiple | |
sizeE | The size of E, in bytes | |
N | Modulus, a prime number for the Fp field or Irreducible polynomial for F2m field. | |
R2modN | NULL (the function computes R2modN internally) or pointer to pre-computed R2modN (obtained from CAU3_PKHA_ModR2() function). | |
aCurveParam | A parameter from curve equation | |
bCurveParam | B parameter from curve equation (C parameter for operation over F2m). | |
size | Size in bytes of curve points and parameters | |
equalTime | Run the function time equalized or no timing equalization. | |
arithType | Type of arithmetic to perform (integer or F2m) | |
[out] | result | Result point |
status_t CAU3_PKHA_ECM_PointMul | ( | CAU3_Type * | base, |
const uint8_t * | E, | ||
size_t | sizeE, | ||
const uint8_t * | inputCoordinate, | ||
const uint8_t * | A24, | ||
const uint8_t * | N, | ||
const uint8_t * | R2modN, | ||
size_t | size, | ||
cau3_pkha_timing_t | equalTime, | ||
uint8_t * | outputCoordinate | ||
) |
This function computes the scalar multiplication of a point on an elliptic curve in Montgomery form. The input and output are just the x coordinates of the points. The points on a curve are defined by the equation E: B*y^2 = x^3 + A*x^2 + x mod p This function computes a point multiplication on a Montgomery curve, using Montgomery values, by means of a Montgomery ladder. At the end of the ladder, P2 = P3 + P1, where P1 is the input and P3 is the result.
base | CAU3 peripheral base address | |
E | Scalar multiplier, any integer | |
sizeE | The size of E, in bytes | |
inputCoordinate | Point as multiplicand, an input point's affine x coordinate | |
A24 | elliptic curve a24 parameter, that is, (A+2)/4 | |
N | Modulus, a prime number. | |
R2modN | NULL (the function computes R2modN internally) or pointer to pre-computed R2modN (obtained from CAU3_PKHA_ModR2() function). | |
size | Size in bytes of curve points and parameters | |
equalTime | Run the function time equalized or no timing equalization. | |
[out] | outputCoordinate | Resulting poin's x affine coordinate. |
status_t CAU3_PKHA_ECT_PointMul | ( | CAU3_Type * | base, |
const cau3_pkha_ecc_point_t * | A, | ||
const uint8_t * | E, | ||
size_t | sizeE, | ||
const uint8_t * | N, | ||
const uint8_t * | R2modN, | ||
const uint8_t * | aCurveParam, | ||
const uint8_t * | dCurveParam, | ||
size_t | size, | ||
cau3_pkha_timing_t | equalTime, | ||
cau3_pkha_ecc_point_t * | result | ||
) |
This function performs scalar multiplication of an Edwards-form elliptic curve point in affine coordinates. The points on a curve are defined by the equation E: a*X^2 + d^2 = 1 + D^2*X^2*Y^2 mod N
base | CAU3 peripheral base address | |
A | Point as multiplicand | |
E | Scalar multiple | |
sizeE | The size of E, in bytes | |
N | Modulus, a prime number for the Fp field. | |
R2modN | NULL (the function computes R2modN internally) or pointer to pre-computed R2modN (obtained from CAU3_PKHA_ModR2() function). | |
aCurveParam | A parameter from curve equation | |
dCurveParam | D parameter from curve equation. | |
size | Size in bytes of curve points and parameters | |
equalTime | Run the function time equalized or no timing equalization. | |
[out] | result | Result point |
status_t CAU3_PKHA_ECT_PointAdd | ( | CAU3_Type * | base, |
const cau3_pkha_ecc_point_t * | A, | ||
const cau3_pkha_ecc_point_t * | B, | ||
const uint8_t * | N, | ||
const uint8_t * | R2modN, | ||
const uint8_t * | aCurveParam, | ||
const uint8_t * | dCurveParam, | ||
size_t | size, | ||
cau3_pkha_ecc_point_t * | result | ||
) |
This function performs Edwards-form elliptic curve point addition over a prime field (Fp) using affine coordinates. The points on a curve are defined by the equation E: a*X^2 + Y^2 = 1 + d^2*X^2*Y^2 mod N
base | CAU3 peripheral base address | |
A | Left-hand point | |
B | Right-hand point | |
N | Prime modulus of the field | |
R2modN | NULL (the function computes R2modN internally) or pointer to pre-computed R2modN (obtained from CAU3_PKHA_ModR2() function). | |
aCurveParam | A parameter from curve equation | |
dCurveParam | D parameter from curve equation | |
size | Size in bytes of curve points and parameters | |
[out] | result | Result point |