#include "pka.h"
Macros | |
#define | MAX(x, y) (((x) > (y)) ? (x) : (y)) |
#define | MIN(x, y) (((x) < (y)) ? (x) : (y)) |
#define | INRANGE(x, y, z) ((x) > (y) && (x) < (z)) |
#define | IS_WORD_ALIGNED(ptr) (((uintptr_t)(ptr) << 30) == 0U) |
#define | PKA_MAX_CURVE_SIZE_32_BIT_WORD 12 |
#define | PKA_MAX_LEN_IN_32_BIT_WORD PKA_MAX_CURVE_SIZE_32_BIT_WORD |
#define | PKA_NO_POINTER_REG 0xFF |
Functions | |
void | PKAClearPkaRam (void) |
Zeroizes PKA RAM. More... | |
static uint32_t | PKAWritePkaParam (const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset) |
static uint32_t | PKAWritePkaParamExtraOffset (const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset) |
static uint32_t | PKAGetBigNumResult (uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr) |
static uint32_t | PKAGetBigNumResultRemainder (uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr) |
static uint32_t | PKAGetECCResult (uint8_t *curvePointX, uint8_t *curvePointY, uint32_t resultPKAMemAddr, uint32_t length) |
uint32_t | PKAGetOpsStatus (void) |
Gets the PKA operation status. More... | |
bool | PKAArrayAllZeros (const uint8_t *array, uint32_t arrayLength) |
Checks whether and array only consists of zeros. More... | |
void | PKAZeroOutArray (const uint8_t *array, uint32_t arrayLength) |
Zeros-out an array. More... | |
uint32_t | PKABigNumModStart (const uint8_t *bigNum, uint32_t bigNumLength, const uint8_t *modulus, uint32_t modulusLength, uint32_t *resultPKAMemAddr) |
Starts a big number modulus operation. More... | |
uint32_t | PKABigNumModGetResult (uint8_t *resultBuf, uint32_t length, uint32_t resultPKAMemAddr) |
Gets the result of the big number modulus operation. More... | |
uint32_t | PKABigNumDivideStart (const uint8_t *dividend, uint32_t dividendLength, const uint8_t *divisor, uint32_t divisorLength, uint32_t *resultQuotientMemAddr, uint32_t *resultRemainderMemAddr) |
Starts a big number divide operation. More... | |
uint32_t | PKABigNumDivideGetQuotient (uint8_t *resultBuf, uint32_t *length, uint32_t resultQuotientMemAddr) |
Gets the quotient of the big number divide operation. More... | |
uint32_t | PKABigNumDivideGetRemainder (uint8_t *resultBuf, uint32_t *length, uint32_t resultQuotientMemAddr) |
Gets the remainder of the big number divide operation. More... | |
uint32_t | PKABigNumCmpStart (const uint8_t *bigNum1, const uint8_t *bigNum2, uint32_t length) |
Starts the comparison of two big numbers. More... | |
uint32_t | PKABigNumCmpGetResult (void) |
Gets the result of the comparison operation of two big numbers. More... | |
uint32_t | PKABigNumInvModStart (const uint8_t *bigNum, uint32_t bigNumLength, const uint8_t *modulus, uint32_t modulusLength, uint32_t *resultPKAMemAddr) |
Starts a big number inverse modulo operation. More... | |
uint32_t | PKABigNumInvModGetResult (uint8_t *resultBuf, uint32_t length, uint32_t resultPKAMemAddr) |
Gets the result of the big number inverse modulo operation. More... | |
uint32_t | PKABigNumExpModStart (const uint8_t *base, uint32_t baseLength, const uint8_t *exponent, uint32_t exponentLength, const uint8_t *modulus, uint32_t modulusLength, uint32_t *resultPKAMemAddr) |
Starts a big number modular exponentiation operation. More... | |
uint32_t | PKABigNumExpModGetResult (uint8_t *resultBuf, uint32_t length, uint32_t resultPKAMemAddr) |
Gets the result of the big number modular exponentiation operation. More... | |
uint32_t | PKABigNumMultiplyStart (const uint8_t *multiplicand, uint32_t multiplicandLength, const uint8_t *multiplier, uint32_t multiplierLength, uint32_t *resultPKAMemAddr) |
Starts the multiplication of two big numbers. More... | |
uint32_t | PKABigNumMultGetResult (uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr) |
Gets the result of the big number multiplication. More... | |
uint32_t | PKABigNumAddStart (const uint8_t *bigNum1, uint32_t bigNum1Length, const uint8_t *bigNum2, uint32_t bigNum2Length, uint32_t *resultPKAMemAddr) |
Starts the addition of two big numbers. More... | |
uint32_t | PKABigNumSubGetResult (uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr) |
Gets the result of the subtraction operation on two big numbers. More... | |
uint32_t | PKABigNumSubStart (const uint8_t *minuend, uint32_t minuendLength, const uint8_t *subtrahend, uint32_t subtrahendLength, uint32_t *resultPKAMemAddr) |
Starts the subtraction of one big number from another. More... | |
uint32_t | PKABigNumAddGetResult (uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr) |
Gets the result of the addition operation on two big numbers. More... | |
uint32_t | PKAEccMultiplyStart (const uint8_t *scalar, const uint8_t *curvePointX, const uint8_t *curvePointY, const uint8_t *prime, const uint8_t *a, const uint8_t *b, uint32_t length, uint32_t *resultPKAMemAddr) |
Starts ECC multiplication. More... | |
uint32_t | PKAEccMontgomeryMultiplyStart (const uint8_t *scalar, const uint8_t *curvePointX, const uint8_t *prime, const uint8_t *a, uint32_t length, uint32_t *resultPKAMemAddr) |
Starts ECC Montgomery multiplication. More... | |
uint32_t | PKAEccMultiplyGetResult (uint8_t *curvePointX, uint8_t *curvePointY, uint32_t resultPKAMemAddr, uint32_t length) |
Gets the result of ECC multiplication. More... | |
uint32_t | PKAEccAddStart (const uint8_t *curvePoint1X, const uint8_t *curvePoint1Y, const uint8_t *curvePoint2X, const uint8_t *curvePoint2Y, const uint8_t *prime, const uint8_t *a, uint32_t length, uint32_t *resultPKAMemAddr) |
Starts the ECC addition. More... | |
uint32_t | PKAEccAddGetResult (uint8_t *curvePointX, uint8_t *curvePointY, uint32_t resultPKAMemAddr, uint32_t length) |
Gets the result of the ECC addition. More... | |
uint32_t | PKAEccVerifyPublicKeyWeierstrassStart (const uint8_t *curvePointX, const uint8_t *curvePointY, const uint8_t *prime, const uint8_t *a, const uint8_t *b, const uint8_t *order, uint32_t length) |
Begins the validation of a public key against a Short-Weierstrass curve. More... | |
Variables | |
const PKA_EccPoint224 | NISTP224_generator |
X coordinate of the generator point of the NISTP224 curve. More... | |
const PKA_EccParam224 | NISTP224_prime |
Prime of the NISTP224 curve. More... | |
const PKA_EccParam224 | NISTP224_a |
a constant of the NISTP224 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam224 | NISTP224_b |
b constant of the NISTP224 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam224 | NISTP224_order |
Order of the NISTP224 curve. More... | |
const PKA_EccPoint256 | NISTP256_generator |
X coordinate of the generator point of the NISTP256 curve. More... | |
const PKA_EccParam256 | NISTP256_prime |
Prime of the NISTP256 curve. More... | |
const PKA_EccParam256 | NISTP256_a |
a constant of the NISTP256 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam256 | NISTP256_b |
b constant of the NISTP256 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam256 | NISTP256_order |
Order of the NISTP256 curve. More... | |
const PKA_EccPoint384 | NISTP384_generator |
X coordinate of the generator point of the NISTP384 curve. More... | |
const PKA_EccParam384 | NISTP384_prime |
Prime of the NISTP384 curve. More... | |
const PKA_EccParam384 | NISTP384_a |
a constant of the NISTP384 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam384 | NISTP384_b |
b constant of the NISTP384 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam384 | NISTP384_order |
Order of the NISTP384 curve. More... | |
const PKA_EccPoint521 | NISTP521_generator |
X coordinate of the generator point of the NISTP521 curve. More... | |
const PKA_EccParam521 | NISTP521_prime |
Prime of the NISTP521 curve. More... | |
const PKA_EccParam521 | NISTP521_a |
a constant of the NISTP521 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam521 | NISTP521_b |
b constant of the NISTP521 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam521 | NISTP521_order |
Order of the NISTP521 curve. More... | |
const PKA_EccPoint256 | BrainpoolP256R1_generator |
X coordinate of the generator point of the BrainpoolP256R1 curve. More... | |
const PKA_EccParam256 | BrainpoolP256R1_prime |
Prime of the BrainpoolP256R1 curve. More... | |
const PKA_EccParam256 | BrainpoolP256R1_a |
a constant of the BrainpoolP256R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam256 | BrainpoolP256R1_b |
b constant of the BrainpoolP256R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam256 | BrainpoolP256R1_order |
Order of the BrainpoolP256R1 curve. More... | |
const PKA_EccPoint384 | BrainpoolP384R1_generator |
X coordinate of the generator point of the BrainpoolP384R1 curve. More... | |
const PKA_EccParam384 | BrainpoolP384R1_prime |
Prime of the BrainpoolP384R1 curve. More... | |
const PKA_EccParam384 | BrainpoolP384R1_a |
a constant of the BrainpoolP384R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam384 | BrainpoolP384R1_b |
b constant of the BrainpoolP384R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam384 | BrainpoolP384R1_order |
Order of the BrainpoolP384R1 curve. More... | |
const PKA_EccPoint512 | BrainpoolP512R1_generator |
X coordinate of the generator point of the BrainpoolP512R1 curve. More... | |
const PKA_EccParam512 | BrainpoolP512R1_prime |
Prime of the BrainpoolP512R1 curve. More... | |
const PKA_EccParam512 | BrainpoolP512R1_a |
a constant of the BrainpoolP512R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam512 | BrainpoolP512R1_b |
b constant of the BrainpoolP512R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const PKA_EccParam512 | BrainpoolP512R1_order |
Order of the BrainpoolP512R1 curve. More... | |
const PKA_EccPoint256 | Curve25519_generator |
X coordinate of the generator point of the Curve25519 curve. More... | |
const PKA_EccParam256 | Curve25519_prime |
Prime of the Curve25519 curve. More... | |
const PKA_EccParam256 | Curve25519_a |
a constant of the Curve25519 curve when expressed in Montgomery form (By^2 = x^3 + a*x^2 + x). More... | |
const PKA_EccParam256 | Curve25519_b |
b constant of the Curve25519 curve when expressed in Montgomery form (By^2 = x^3 + a*x^2 + x). More... | |
const PKA_EccParam256 | Curve25519_order |
Order of the Curve25519 curve. More... | |
#define INRANGE | ( | x, | |
y, | |||
z | |||
) | ((x) > (y) && (x) < (z)) |
#define IS_WORD_ALIGNED | ( | ptr | ) | (((uintptr_t)(ptr) << 30) == 0U) |
Referenced by PKAGetECCResult().
#define MAX | ( | x, | |
y | |||
) | (((x) > (y)) ? (x) : (y)) |
#define MIN | ( | x, | |
y | |||
) | (((x) < (y)) ? (x) : (y)) |
#define PKA_MAX_CURVE_SIZE_32_BIT_WORD 12 |
Referenced by PKAEccMontgomeryMultiplyStart(), and PKAEccMultiplyStart().
#define PKA_MAX_LEN_IN_32_BIT_WORD PKA_MAX_CURVE_SIZE_32_BIT_WORD |
#define PKA_NO_POINTER_REG 0xFF |
Referenced by PKAEccAddStart(), PKAEccMontgomeryMultiplyStart(), and PKAEccMultiplyStart().
|
static |
Referenced by PKABigNumAddGetResult(), PKABigNumDivideGetQuotient(), PKABigNumExpModGetResult(), PKABigNumInvModGetResult(), PKABigNumMultGetResult(), and PKABigNumSubGetResult().
|
static |
Referenced by PKABigNumDivideGetRemainder(), and PKABigNumModGetResult().
|
static |
Referenced by PKAEccAddGetResult(), and PKAEccMultiplyGetResult().
|
static |
|
static |
Referenced by PKABigNumDivideStart(), PKABigNumExpModStart(), PKABigNumModStart(), PKAEccAddStart(), PKAEccMontgomeryMultiplyStart(), and PKAEccMultiplyStart().