CC26xx Driver Library
[pka.h] Public Key Accelerator

Data Structures

union  PKA_EccParam224
 
union  PKA_EccParam256
 
union  PKA_EccParam384
 
union  PKA_EccParam512
 
union  PKA_EccParam521
 
struct  PKA_EccPoint224_
 
struct  PKA_EccPoint256_
 
struct  PKA_EccPoint384_
 
struct  PKA_EccPoint512_
 
struct  PKA_EccPoint521_
 

Functions

void PKAClearPkaRam (void)
 Zeroizes PKA RAM. More...
 
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 resultRemainderMemAddr)
 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 PKABigNumAddGetResult (uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
 Gets the result of the addition 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 PKABigNumSubGetResult (uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
 Gets the result of the subtraction 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...
 

Detailed Description

Introduction

The PKA (Public Key Accelerator) API provides access to the Large Number Engine (LNME). The LNME allows for efficient math operations on numbers larger than those that fit within the ALU of the system CPU. It is significantly faster to perform these operations using the LNME than implementing the same functionality in software using regular word-wise math operations. While the LNME runs in the background, the system CPU may perform other operations or be turned off.

The LNME supports both primitive math operations and serialized primitive operations (sequencer operations).

These primitives and sequencer operations can be used to implement various public key encryption schemes. It is possible to implement the following schemes using the operations mentioned above:

The DriverLib PKA functions copy the relevant parameters into the dedicated PKA RAM. The LNME requires these parameters be present and correctly formatted in the PKA RAM and not system RAM. They are copied word-wise as the PKA RAM does not support byte-wise access. The CPU handles the alignment differences during the memory copy operation. Forcing buffer alignment in system RAM results in a significant speedup of the copy operation compared to unaligned buffers.

When the operation completes, the result is copied back into a buffer in system RAM specified by the application. The PKA RAM is then cleared to prevent sensitive keying material from remaining in PKA RAM.

Function Documentation

§ PKAArrayAllZeros()

bool PKAArrayAllZeros ( const uint8_t *  array,
uint32_t  arrayLength 
)

Checks whether and array only consists of zeros.

Parameters
[in]arrayis the array to check.
[in]arrayLengthis the length of the array.
Returns
Returns true if the array contains only zeros and false if one or more bits are set.
870 {
871  uint32_t i;
872  uint8_t arrayBits = 0;
873 
874  // We could speed things up by comparing word-wise rather than byte-wise.
875  // However, this extra overhead is inconsequential compared to running an
876  // actual PKA operation. Especially ECC operations.
877  for (i = 0; i < arrayLength; i++) {
878  arrayBits |= array[i];
879  }
880 
881  if (arrayBits) {
882  return false;
883  }
884  else {
885  return true;
886  }
887 
888 }

§ PKABigNumAddGetResult()

uint32_t PKABigNumAddGetResult ( uint8_t *  resultBuf,
uint32_t *  resultLength,
uint32_t  resultPKAMemAddr 
)

Gets the result of the addition operation on two big numbers.

Parameters
[out]resultBufis the pointer to buffer where the result needs to be stored.
[in,out]resultLengthis the address of the variable containing the length of the buffer. After the operation the actual length of the resultant is stored at this address.
[in]resultPKAMemAddris the address of the result location which was provided by the start function PKABigNumAddStart().
Returns
Returns a status code.
See also
PKABigNumAddStart()

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

1328 {
1329  return PKAGetBigNumResult(resultBuf, resultLength, resultPKAMemAddr);
1330 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:628
Here is the call graph for this function:

§ PKABigNumAddStart()

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.

Parameters
[in]bigNum1is the pointer to the buffer containing the first big number.
[in]bigNum1Lengthis the size of the first big number in bytes.
[in]bigNum2is the pointer to the buffer containing the second big number.
[in]bigNum2Lengthis the size of the second big number in bytes.
[out]resultPKAMemAddris the pointer to the result vector location which will be set by this function.
Returns
Returns a status code.
See also
PKABigNumAddGetResult()

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

1247 {
1248  uint32_t offset = 0;
1249 
1250  // Check for arguments.
1251  ASSERT(bigNum1);
1252  ASSERT(bigNum2);
1253  ASSERT(resultPKAMemAddr);
1254 
1255  // Make sure no operation is in progress.
1256  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1258  }
1259 
1260  offset = PKAWritePkaParam(bigNum1, bigNum1Length, offset, PKA_O_APTR);
1261 
1262  offset = PKAWritePkaParam(bigNum2, bigNum2Length, offset, PKA_O_BPTR);
1263 
1264  // Copy the result vector address location.
1265  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1266 
1267  // Load C pointer with the result location in PKA RAM.
1268  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
1269 
1270  // Set the function for the add operation and start the operation.
1271  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_ADD);
1272 
1273  return PKA_STATUS_SUCCESS;
1274 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:547
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
#define ASSERT(expr)
Definition: debug.h:71
Here is the call graph for this function:

§ PKABigNumCmpGetResult()

uint32_t PKABigNumCmpGetResult ( void  )

Gets the result of the comparison operation of two big numbers.

This function provides the results of the comparison of two big numbers which was started using the PKABigNumCmpStart().

Returns
Returns a status code.
See also
PKABigNumCmpStart()

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

1066 {
1067  uint32_t status;
1068 
1069  // verify that the operation is complete.
1070  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1072  }
1073 
1074  // Check the COMPARE register.
1075  switch(HWREG(PKA_BASE + PKA_O_COMPARE)) {
1076  case PKA_COMPARE_A_EQUALS_B:
1077  status = PKA_STATUS_EQUAL;
1078  break;
1079 
1080  case PKA_COMPARE_A_GREATER_THAN_B:
1081  status = PKA_STATUS_A_GREATER_THAN_B;
1082  break;
1083 
1084  case PKA_COMPARE_A_LESS_THAN_B:
1085  status = PKA_STATUS_A_LESS_THAN_B;
1086  break;
1087 
1088  default:
1089  status = PKA_STATUS_FAILURE;
1090  break;
1091  }
1092 
1093  return status;
1094 }
#define PKA_STATUS_FAILURE
Failure.
Definition: pka.h:122
#define PKA_STATUS_EQUAL
Big number compare return status if the first big number is equal to the second.
Definition: pka.h:128
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_A_LESS_THAN_B
Big number compare return status if the first big number is less than the second. ...
Definition: pka.h:127
#define PKA_STATUS_A_GREATER_THAN_B
Big number compare return status if the first big number is greater than the second.
Definition: pka.h:126

§ PKABigNumCmpStart()

uint32_t PKABigNumCmpStart ( const uint8_t *  bigNum1,
const uint8_t *  bigNum2,
uint32_t  length 
)

Starts the comparison of two big numbers.

This function starts the comparison of two big numbers pointed by bigNum1 and bigNum2.

Note
bigNum1 and bigNum2 must have same size.
Parameters
[in]bigNum1is the pointer to the first big number.
[in]bigNum2is the pointer to the second big number.
[in]lengthis the size of the big numbers in bytes.
Returns
Returns a status code.
See also
PKABigNumCmpGetResult()

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

1037 {
1038  uint32_t offset = 0;
1039 
1040  // Check the arguments.
1041  ASSERT(bigNum1);
1042  ASSERT(bigNum2);
1043 
1044  // Make sure no operation is in progress.
1045  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1047  }
1048 
1049  offset = PKAWritePkaParam(bigNum1, length, offset, PKA_O_APTR);
1050 
1051  offset = PKAWritePkaParam(bigNum2, length, offset, PKA_O_BPTR);
1052 
1053  // Set the PKA Function register for the Compare operation
1054  // and start the operation.
1055  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_COMPARE);
1056 
1057  return PKA_STATUS_SUCCESS;
1058 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:547
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
#define ASSERT(expr)
Definition: debug.h:71
Here is the call graph for this function:

§ PKABigNumDivideGetQuotient()

uint32_t PKABigNumDivideGetQuotient ( uint8_t *  resultBuf,
uint32_t *  length,
uint32_t  resultQuotientMemAddr 
)

Gets the quotient of the big number divide operation.

This function gets the quotient of the big number divide operation which was previously started using the function PKABigNumDivideStart().

Parameters
[out]resultBufis the pointer to buffer where the result needs to be stored.
[in]lengthis the size of the provided buffer in bytes.
[in]resultQuotientMemAddris the address of the result location which was provided by the start function PKABigNumDivideStart().
Returns
Returns a status code.
See also
PKABigNumDivideStart()
1016 {
1017  return PKAGetBigNumResult(resultBuf, length, resultQuotientMemAddr);
1018 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:628
Here is the call graph for this function:

§ PKABigNumDivideGetRemainder()

uint32_t PKABigNumDivideGetRemainder ( uint8_t *  resultBuf,
uint32_t *  length,
uint32_t  resultRemainderMemAddr 
)

Gets the remainder of the big number divide operation.

This function gets the remainder of the big number divide operation which was previously started using the function PKABigNumDivideStart().

Parameters
[out]resultBufis the pointer to buffer where the result needs to be stored.
[in]lengthis the size of the provided buffer in bytes.
[in]resultRemainderMemAddris the address of the result location which was provided by the start function PKABigNumDivideStart().
Returns
Returns a status code.
See also
PKABigNumDivideStart()
1026 {
1027  return PKAGetBigNumResultRemainder(resultBuf, length, resultQuotientMemAddr);
1028 }
static uint32_t PKAGetBigNumResultRemainder(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:702
Here is the call graph for this function:

§ PKABigNumDivideStart()

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.

This function starts the dive operation on the big number bigNum using the divisor. The PKA RAM location where the result will be available is stored in resultPKAMemAddr.

Parameters
[in]dividendis the pointer to the big number to be divided.
[in]dividendLengthis the size of the big number dividend in bytes.
[in]divisoris the pointer to the divisor.
[in]divisorLengthis the size of the divisor in bytes.
[out]resultQuotientMemAddris the pointer to the quotient vector location which will be set by this function.
[out]resultRemainderMemAddris the pointer to the remainder vector location which will be set by this function.
Returns
Returns a status code.
See also
PKABigNumDivideGetResult()
969 {
970  uint32_t offset = 0;
971 
972  // Check the arguments.
973  ASSERT(dividend);
974  ASSERT(divisor);
975  ASSERT(resultQuotientMemAddr);
976  ASSERT(resultRemainderMemAddr);
977 
978  // Make sure no operation is in progress.
979  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
981  }
982 
983  offset = PKAWritePkaParam(dividend, dividendLength, offset, PKA_O_APTR);
984 
985  offset = PKAWritePkaParamExtraOffset(divisor, divisorLength, offset, PKA_O_BPTR);
986 
987  // Copy the remainder result vector address location.
988  if (resultRemainderMemAddr) {
989  *resultRemainderMemAddr = PKA_RAM_BASE + offset;
990  }
991 
992  // The remainder cannot ever be larger than the divisor. It should fit inside
993  // a buffer of that size.
994  offset = PKAWritePkaParamExtraOffset(0, divisorLength, offset, PKA_O_CPTR);
995 
996  // Copy the remainder result vector address location.
997  if (resultQuotientMemAddr) {
998  *resultQuotientMemAddr = PKA_RAM_BASE + offset;
999  }
1000 
1001  // Load D pointer with the quotient location in PKA RAM
1002  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1003 
1004  // Start the PKCP modulo operation by setting the PKA Function register.
1005  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_DIVIDE);
1006 
1007  return PKA_STATUS_SUCCESS;
1008 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:547
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
static uint32_t PKAWritePkaParamExtraOffset(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:617
#define ASSERT(expr)
Definition: debug.h:71
Here is the call graph for this function:

§ PKABigNumExpModGetResult()

uint32_t PKABigNumExpModGetResult ( uint8_t *  resultBuf,
uint32_t  length,
uint32_t  resultPKAMemAddr 
)

Gets the result of the big number modular exponentiation operation.

This function gets the result of the big number modular exponentiation operation previously started using the function PKABigNumExpModStart(). The function will zero-out resultBuf prior to copying in the result of the modular exponentiation operation.

Parameters
[out]resultBufis the pointer to buffer where the result needs to be stored.
[in]lengthis the size of the provided buffer in bytes.
[in]resultPKAMemAddris the address of the result location which was provided by the start function PKABigNumExpModStart().
Returns
Returns a status code.
See also
PKABigNumExpModStart()
1188 {
1189  // Zero-out array in case modulo result is shorter than length
1190  PKAZeroOutArray(resultBuf, length);
1191 
1192  return PKAGetBigNumResult(resultBuf, &length, resultPKAMemAddr);
1193 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:628
void PKAZeroOutArray(const uint8_t *array, uint32_t arrayLength)
Zeros-out an array.
Definition: pka.c:895
Here is the call graph for this function:

§ PKABigNumExpModStart()

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.

This function starts the exponentiation operation on base with exponent and modulo modulus.

Parameters
[in]baseis the pointer to the buffer containing the big number to exponentiate.
[in]baseLengthis the size of the base in bytes.
[in]exponentis the pointer to the buffer containing the big number that exponentiates.
[in]exponentLengthis the size of the exponent in bytes.
[in]modulusis the pointer to the buffer containing the divisor.
[in]modulusLengthis the size of the divisor in bytes.
[out]resultPKAMemAddris the pointer to the result vector location which will be set by this function.
Returns
Returns a status code.
See also
PKABigNumExpModGetResult()
1150 {
1151  uint32_t offset = 0;
1152 
1153  // Check the arguments.
1154  ASSERT(base);
1155  ASSERT(exponent);
1156  ASSERT(modulus);
1157  ASSERT(resultPKAMemAddr);
1158 
1159  // Make sure no operation is in progress.
1160  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1162  }
1163 
1164  offset = PKAWritePkaParam(exponent, exponentLength, offset, PKA_O_APTR);
1165 
1166  offset = PKAWritePkaParamExtraOffset(modulus, modulusLength, offset, PKA_O_BPTR);
1167 
1168  offset = PKAWritePkaParam(base, baseLength, offset, PKA_O_CPTR);
1169 
1170  // Copy the result vector address location.
1171  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1172 
1173  // Load D pointer with the result location in PKA RAM.
1174  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1175 
1176  // set the PKA function to ExpMod operation and the start the operation.
1177  HWREG(PKA_BASE + PKA_O_FUNCTION) = PKA_FUNCTION_RUN_M | (0x04 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1178 
1179  return PKA_STATUS_SUCCESS;
1180 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:547
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
static uint32_t PKAWritePkaParamExtraOffset(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:617
#define ASSERT(expr)
Definition: debug.h:71
Here is the call graph for this function:

§ PKABigNumInvModGetResult()

uint32_t PKABigNumInvModGetResult ( uint8_t *  resultBuf,
uint32_t  length,
uint32_t  resultPKAMemAddr 
)

Gets the result of the big number inverse modulo operation.

This function gets the result of the big number inverse modulo operation previously started using the function PKABigNumInvModStart(). The function will zero-out resultBuf prior to copying in the result of the inverse modulo operation.

Parameters
[out]resultBufis the pointer to buffer where the result needs to be stored.
[in]lengthis the size of the provided buffer in bytes.
[in]resultPKAMemAddris the address of the result location which was provided by the start function PKABigNumInvModStart().
Returns
Returns a status code.
See also
PKABigNumInvModStart()
1137 {
1138  // Zero-out array in case modulo result is shorter than length
1139  PKAZeroOutArray(resultBuf, length);
1140 
1141  return PKAGetBigNumResult(resultBuf, &length, resultPKAMemAddr);
1142 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:628
void PKAZeroOutArray(const uint8_t *array, uint32_t arrayLength)
Zeros-out an array.
Definition: pka.c:895
Here is the call graph for this function:

§ PKABigNumInvModStart()

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.

This function starts the inverse modulo operation on bigNum using the divisor modulus.

Parameters
[in]bigNumis the pointer to the buffer containing the big number (dividend).
[in]bigNumLengthis the size of the bigNum in bytes.
[in]modulusis the pointer to the buffer containing the divisor.
[in]modulusLengthis the size of the divisor in bytes.
[out]resultPKAMemAddris the pointer to the result vector location which will be set by this function.
Returns
Returns a status code.
See also
PKABigNumInvModGetResult()
1102 {
1103  uint32_t offset = 0;
1104 
1105  // Check the arguments.
1106  ASSERT(bigNum);
1107  ASSERT(modulus);
1108  ASSERT(resultPKAMemAddr);
1109 
1110  // Make sure no operation is in progress.
1111  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1113  }
1114 
1115  offset = PKAWritePkaParam(bigNum, bigNumLength, offset, PKA_O_APTR);
1116 
1117  offset = PKAWritePkaParam(modulus, modulusLength, offset, PKA_O_BPTR);
1118 
1119  // Copy the result vector address location.
1120  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1121 
1122  // Load D pointer with the result location in PKA RAM.
1123  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1124 
1125  // set the PKA function to InvMod operation and the start the operation.
1126  HWREG(PKA_BASE + PKA_O_FUNCTION) = 0x0000F000;
1127 
1128  return PKA_STATUS_SUCCESS;
1129 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:547
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
#define ASSERT(expr)
Definition: debug.h:71
Here is the call graph for this function:

§ PKABigNumModGetResult()

uint32_t PKABigNumModGetResult ( uint8_t *  resultBuf,
uint32_t  length,
uint32_t  resultPKAMemAddr 
)

Gets the result of the big number modulus operation.

This function gets the result of the big number modulus operation which was previously started using the function PKABigNumModStart(). The function will zero-out resultBuf prior to copying in the result of the modulo operation.

Parameters
[out]resultBufis the pointer to buffer where the result needs to be stored.
[in]lengthis the size of the provided buffer in bytes.
[in]resultPKAMemAddris the address of the result location which was provided by the start function PKABigNumModStart().
Returns
Returns a status code.
See also
PKABigNumModStart()

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

956 {
957  // Zero-out array in case modulo result is shorter than length
958  PKAZeroOutArray(resultBuf, length);
959 
960  return PKAGetBigNumResultRemainder(resultBuf, &length, resultPKAMemAddr);
961 }
static uint32_t PKAGetBigNumResultRemainder(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:702
void PKAZeroOutArray(const uint8_t *array, uint32_t arrayLength)
Zeros-out an array.
Definition: pka.c:895
Here is the call graph for this function:

§ PKABigNumModStart()

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.

This function starts the modulo operation on the big number bigNum using the divisor modulus. The PKA RAM location where the result will be available is stored in resultPKAMemAddr.

Parameters
[in]bigNumis the pointer to the big number on which modulo operation needs to be carried out.
[in]bigNumLengthis the size of the big number bigNum in bytes.
[in]modulusis the pointer to the divisor.
[in]modulusLengthis the size of the divisor modulus in bytes.
[out]resultPKAMemAddris the pointer to the result vector location which will be set by this function.
Returns
Returns a status code.
See also
PKABigNumModGetResult()

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

921 {
922  uint32_t offset = 0;
923 
924  // Check the arguments.
925  ASSERT(bigNum);
926  ASSERT(modulus);
927  ASSERT(resultPKAMemAddr);
928 
929  // Make sure no operation is in progress.
930  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
932  }
933 
934  offset = PKAWritePkaParam(bigNum, bigNumLength, offset, PKA_O_APTR);
935 
936  offset = PKAWritePkaParamExtraOffset(modulus, modulusLength, offset, PKA_O_BPTR);
937 
938  // Copy the result vector address location.
939  *resultPKAMemAddr = PKA_RAM_BASE + offset;
940 
941  // Load C pointer with the result location in PKA RAM
942  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
943 
944  // Start the PKCP modulo operation by setting the PKA Function register.
945  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_MODULO);
946 
947  return PKA_STATUS_SUCCESS;
948 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:547
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
static uint32_t PKAWritePkaParamExtraOffset(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:617
#define ASSERT(expr)
Definition: debug.h:71
Here is the call graph for this function:

§ PKABigNumMultGetResult()

uint32_t PKABigNumMultGetResult ( uint8_t *  resultBuf,
uint32_t *  resultLength,
uint32_t  resultPKAMemAddr 
)

Gets the result of the big number multiplication.

This function gets the result of the multiplication of two big numbers operation previously started using the function PKABigNumMultiplyStart().

Parameters
[out]resultBufis the pointer to buffer where the result needs to be stored.
[in,out]resultLengthis the address of the variable containing the length of the buffer in bytes. After the operation, the actual length of the resultant is stored at this address.
[in]resultPKAMemAddris the address of the result location which was provided by the start function PKABigNumMultiplyStart().
Returns
Returns a status code.
See also
PKABigNumMultiplyStart()

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

1237 {
1238  return PKAGetBigNumResult(resultBuf, resultLength, resultPKAMemAddr);
1239 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:628
Here is the call graph for this function:

§ PKABigNumMultiplyStart()

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.

Parameters
[in]multiplicandis the pointer to the buffer containing the big number multiplicand.
[in]multiplicandLengthis the size of the multiplicand in bytes.
[in]multiplieris the pointer to the buffer containing the big number multiplier.
[in]multiplierLengthis the size of the multiplier in bytes.
[out]resultPKAMemAddris the pointer to the result vector location which will be set by this function.
Returns
Returns a status code.
See also
PKABigNumMultGetResult()

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

1201 {
1202  uint32_t offset = 0;
1203 
1204  // Check for the arguments.
1205  ASSERT(multiplicand);
1206  ASSERT(multiplier);
1207  ASSERT(resultPKAMemAddr);
1208 
1209  // Make sure no operation is in progress.
1210  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1212  }
1213 
1214  offset = PKAWritePkaParam(multiplicand, multiplicandLength, offset, PKA_O_APTR);
1215 
1216  offset = PKAWritePkaParam(multiplier, multiplierLength, offset, PKA_O_BPTR);
1217 
1218 
1219  // Copy the result vector address location.
1220  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1221 
1222  // Load C pointer with the result location in PKA RAM.
1223  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
1224 
1225  // Set the PKA function to the multiplication and start it.
1226  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_MULTIPLY);
1227 
1228  return PKA_STATUS_SUCCESS;
1229 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:547
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
#define ASSERT(expr)
Definition: debug.h:71
Here is the call graph for this function:

§ PKABigNumSubGetResult()

uint32_t PKABigNumSubGetResult ( uint8_t *  resultBuf,
uint32_t *  resultLength,
uint32_t  resultPKAMemAddr 
)

Gets the result of the subtraction operation on two big numbers.

Parameters
[out]resultBufis the pointer to buffer where the result needs to be stored.
[in,out]resultLengthis the address of the variable containing the length of the buffer. After the operation the actual length of the resultant is stored at this address.
[in]resultPKAMemAddris the address of the result location which was provided by the start function PKABigNumAddStart().
Returns
Returns a status code.
See also
PKABigNumSubStart()
1282 {
1283  return PKAGetBigNumResult(resultBuf, resultLength, resultPKAMemAddr);
1284 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:628
Here is the call graph for this function:

§ PKABigNumSubStart()

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.

Parameters
[in]minuendis the pointer to the buffer containing the big number to be subtracted from.
[in]minuendLengthis the size of the minuend in bytes.
[in]subtrahendis the pointer to the buffer containing the big number to subtract from the minuend.
[in]subtrahendLengthis the size of the subtrahend in bytes.
[out]resultPKAMemAddris the pointer to the result vector location which will be set by this function.
Returns
Returns a status code.
See also
PKABigNumSubGetResult()
1292 {
1293  uint32_t offset = 0;
1294 
1295  // Check for arguments.
1296  ASSERT(minuend);
1297  ASSERT(subtrahend);
1298  ASSERT(resultPKAMemAddr);
1299 
1300 
1301  // Make sure no operation is in progress.
1302  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1304  }
1305 
1306  offset = PKAWritePkaParam(minuend, minuendLength, offset, PKA_O_APTR);
1307 
1308  offset = PKAWritePkaParam(subtrahend, subtrahendLength, offset, PKA_O_BPTR);
1309 
1310  // Copy the result vector address location.
1311  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1312 
1313  // Load C pointer with the result location in PKA RAM.
1314  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
1315 
1316  // Set the function for the add operation and start the operation.
1317  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_SUBTRACT);
1318 
1319  return PKA_STATUS_SUCCESS;
1320 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:547
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
#define ASSERT(expr)
Definition: debug.h:71
Here is the call graph for this function:

§ PKAClearPkaRam()

void PKAClearPkaRam ( void  )

Zeroizes PKA RAM.

This function uses the zeroization function in PRCM to clear the PKA RAM.

525  {
526  // Get initial state
527  uint32_t secdmaclkgr = HWREG(PRCM_BASE + PRCM_O_SECDMACLKGR);
528 
529  // OR in zeroize bit
530  secdmaclkgr |= PRCM_SECDMACLKGR_PKA_ZERIOZE_RESET_N;
531 
532  // Start zeroization
533  HWREG(PRCM_BASE + PRCM_O_SECDMACLKGR) = secdmaclkgr;
534 
535  // Wait 256 cycles for PKA RAM to be cleared
536  CPUdelay(256 / 4);
537 
538  // Turn off zeroization
539  HWREG(PRCM_BASE + PRCM_O_SECDMACLKGR) = secdmaclkgr & (~PRCM_SECDMACLKGR_PKA_ZERIOZE_RESET_N);
540 }
void CPUdelay(uint32_t ui32Count)
Provide a small non-zero delay using a simple loop counter.
Definition: cpu.c:342
Here is the call graph for this function:

§ PKAEccAddGetResult()

uint32_t PKAEccAddGetResult ( uint8_t *  curvePointX,
uint8_t *  curvePointY,
uint32_t  resultPKAMemAddr,
uint32_t  length 
)

Gets the result of the ECC addition.

This function gets the result of ECC point addition operation on the on the two given EC points, previously started using the function PKAEccAddStart().

Parameters
[out]curvePointXis the pointer to the structure where the X coordinate of the resultant EC point will be stored.
[out]curvePointYis the pointer to the structure where the Y coordinate of the resultant EC point will be stored.
[in]resultPKAMemAddris the address of the result location which was provided by the start function PKAEccAddGetResult().
[in]lengthis the length of the curve parameters in bytes.
Returns
Returns a status code.
See also
PKAEccAddStart()
1488 {
1489  return PKAGetECCResult(curvePointX, curvePointY, resultPKAMemAddr, length);
1490 }
static uint32_t PKAGetECCResult(uint8_t *curvePointX, uint8_t *curvePointY, uint32_t resultPKAMemAddr, uint32_t length)
Definition: pka.c:766
Here is the call graph for this function:

§ PKAEccAddStart()

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.

Parameters
[in]curvePoint1Xis the pointer to the buffer containing the X coordinate of the first elliptic curve point to be added. The point must be on the given curve.
[in]curvePoint1Yis the pointer to the buffer containing the Y coordinate of the first elliptic curve point to be added. The point must be on the given curve.
[in]curvePoint2Xis the pointer to the buffer containing the X coordinate of the second elliptic curve point to be added. The point must be on the given curve.
[in]curvePoint2Yis the pointer to the buffer containing the Y coordinate of the second elliptic curve point to be added. The point must be on the given curve.
[in]primeis the prime of the curve.
[in]ais the a constant of the curve when the curve equation is expressed in short Weierstrass form (y^3 = x^2 + a*x + b).
[in]lengthis the length of the curve parameters in bytes.
[out]resultPKAMemAddris the pointer to the result vector location which will be set by this function.
Returns
Returns a status code.
See also
PKAEccAddGetResult()
1443 {
1444  uint32_t offset = 0;
1445 
1446  // Check for the arguments.
1447  ASSERT(curvePoint1X);
1448  ASSERT(curvePoint1Y);
1449  ASSERT(curvePoint2X);
1450  ASSERT(curvePoint2Y);
1451  ASSERT(prime);
1452  ASSERT(a);
1453  ASSERT(resultPKAMemAddr);
1454 
1455  // Make sure no operation is in progress.
1456  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1458  }
1459 
1460  offset = PKAWritePkaParamExtraOffset(curvePoint1X, length, offset, PKA_O_APTR);
1461  offset = PKAWritePkaParamExtraOffset(curvePoint1Y, length, offset, PKA_NO_POINTER_REG);
1462 
1463 
1464  offset = PKAWritePkaParamExtraOffset(prime, length, offset, PKA_O_BPTR);
1465  offset = PKAWritePkaParamExtraOffset(a, length, offset, PKA_NO_POINTER_REG);
1466 
1467  offset = PKAWritePkaParamExtraOffset(curvePoint2X, length, offset, PKA_O_CPTR);
1468  offset = PKAWritePkaParamExtraOffset(curvePoint2Y, length, offset, PKA_NO_POINTER_REG);
1469 
1470  // Copy the result vector location.
1471  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1472 
1473  // Load D pointer with the result location in PKA RAM.
1474  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1475 
1476  // Set the PKA Function to ECC-ADD and start the operation.
1477  HWREG(PKA_BASE + PKA_O_FUNCTION ) = PKA_FUNCTION_RUN_M | (0x03 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1478 
1479  return PKA_STATUS_SUCCESS;
1480 }
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
static uint32_t PKAWritePkaParamExtraOffset(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:617
#define ASSERT(expr)
Definition: debug.h:71
#define PKA_NO_POINTER_REG
Definition: pka.c:133
Here is the call graph for this function:

§ PKAEccMontgomeryMultiplyStart()

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.

Parameters
[in]scalaris pointer to the buffer containing the scalar value to be multiplied.
[in]curvePointXis the pointer to the buffer containing the X coordinate of the elliptic curve point to be multiplied. The point must be on the given curve.
[in]primeis the prime of the curve.
[in]ais the a constant of the curve when the curve equation is expressed in short Weierstrass form (y^3 = x^2 + a*x + b).
[in]lengthis the length of the curve parameters in bytes.
[out]resultPKAMemAddris the pointer to the result vector location which will be set by this function.
Returns
Returns a status code.
See also
PKAEccMultiplyGetResult()
1388 {
1389  uint32_t offset = 0;
1390 
1391  // Check for the arguments.
1392  ASSERT(scalar);
1393  ASSERT(curvePointX);
1394  ASSERT(prime);
1395  ASSERT(a);
1396  ASSERT(length <= PKA_MAX_CURVE_SIZE_32_BIT_WORD * sizeof(uint32_t));
1397  ASSERT(resultPKAMemAddr);
1398 
1399  // Make sure no PKA operation is in progress.
1400  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1402  }
1403 
1404  offset = PKAWritePkaParam(scalar, length, offset, PKA_O_APTR);
1405 
1406  offset = PKAWritePkaParamExtraOffset(prime, length, offset, PKA_O_BPTR);
1407  offset = PKAWritePkaParamExtraOffset(a, length, offset, PKA_NO_POINTER_REG);
1408 
1409  offset = PKAWritePkaParamExtraOffset(curvePointX, length, offset, PKA_O_CPTR);
1410 
1411  // Update the result location.
1412  // The resultPKAMemAddr may be 0 if we only want to check that we generated the point at infinity
1413  if (resultPKAMemAddr) {
1414  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1415  }
1416 
1417  // Load D pointer with the result location in PKA RAM.
1418  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1419 
1420  // Set the PKA function to Montgomery ECC-MULT and start the operation.
1421  HWREG(PKA_BASE + PKA_O_FUNCTION) = PKA_FUNCTION_RUN_M | (0x02 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1422 
1423  return PKA_STATUS_SUCCESS;
1424 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:547
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
static uint32_t PKAWritePkaParamExtraOffset(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:617
#define ASSERT(expr)
Definition: debug.h:71
#define PKA_NO_POINTER_REG
Definition: pka.c:133
#define PKA_MAX_CURVE_SIZE_32_BIT_WORD
Definition: pka.c:117
Here is the call graph for this function:

§ PKAEccMultiplyGetResult()

uint32_t PKAEccMultiplyGetResult ( uint8_t *  curvePointX,
uint8_t *  curvePointY,
uint32_t  resultPKAMemAddr,
uint32_t  length 
)

Gets the result of ECC multiplication.

This function gets the result of ECC point multiplication operation on the EC point and the scalar value, previously started using the function PKAEccMultiplyStart().

Parameters
[out]curvePointXis the pointer to the structure where the X coordinate of the resultant EC point will be stored.
[out]curvePointYis the pointer to the structure where the Y coordinate of the resultant EC point will be stored.
[in]resultPKAMemAddris the address of the result location which was provided by the start function PKAEccMultiplyStart().
[in]lengthis the length of the curve parameters in bytes.
Returns
Returns a status code.
See also
PKAEccMultiplyStart()
1433 {
1434  return PKAGetECCResult(curvePointX, curvePointY, resultPKAMemAddr, length);
1435 }
static uint32_t PKAGetECCResult(uint8_t *curvePointX, uint8_t *curvePointY, uint32_t resultPKAMemAddr, uint32_t length)
Definition: pka.c:766
Here is the call graph for this function:

§ PKAEccMultiplyStart()

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.

Parameters
[in]scalaris pointer to the buffer containing the scalar value to be multiplied.
[in]curvePointXis the pointer to the buffer containing the X coordinate of the elliptic curve point to be multiplied. The point must be on the given curve.
[in]curvePointYis the pointer to the buffer containing the Y coordinate of the elliptic curve point to be multiplied. The point must be on the given curve.
[in]primeis the prime of the curve.
[in]ais the a constant of the curve when the curve equation is expressed in short Weierstrass form (y^3 = x^2 + a*x + b).
[in]bis the b constant of the curve when the curve equation is expressed in short Weierstrass form (y^3 = x^2 + a*x + b).
[in]lengthis the length of the curve parameters in bytes.
[out]resultPKAMemAddris the pointer to the result vector location which will be set by this function.
Returns
Returns a status code.
See also
PKAEccMultiplyGetResult()
1339 {
1340  uint32_t offset = 0;
1341 
1342  // Check for the arguments.
1343  ASSERT(scalar);
1344  ASSERT(curvePointX);
1345  ASSERT(curvePointY);
1346  ASSERT(prime);
1347  ASSERT(a);
1348  ASSERT(b);
1349  ASSERT(length <= PKA_MAX_CURVE_SIZE_32_BIT_WORD * sizeof(uint32_t));
1350  ASSERT(resultPKAMemAddr);
1351 
1352  // Make sure no PKA operation is in progress.
1353  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1355  }
1356 
1357  offset = PKAWritePkaParam(scalar, length, offset, PKA_O_APTR);
1358 
1359  offset = PKAWritePkaParamExtraOffset(prime, length, offset, PKA_O_BPTR);
1360  offset = PKAWritePkaParamExtraOffset(a, length, offset, PKA_NO_POINTER_REG);
1361  offset = PKAWritePkaParamExtraOffset(b, length, offset, PKA_NO_POINTER_REG);
1362 
1363  offset = PKAWritePkaParamExtraOffset(curvePointX, length, offset, PKA_O_CPTR);
1364  offset = PKAWritePkaParamExtraOffset(curvePointY, length, offset, PKA_NO_POINTER_REG);
1365 
1366  // Update the result location.
1367  // The resultPKAMemAddr may be 0 if we only want to check that we generated the point at infinity
1368  if (resultPKAMemAddr) {
1369  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1370  }
1371 
1372  // Load D pointer with the result location in PKA RAM.
1373  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1374 
1375  // Set the PKA function to ECC-MULT and start the operation.
1376  HWREG(PKA_BASE + PKA_O_FUNCTION) = PKA_FUNCTION_RUN_M | (0x05 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1377 
1378  return PKA_STATUS_SUCCESS;
1379 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:547
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
static uint32_t PKAWritePkaParamExtraOffset(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:617
#define ASSERT(expr)
Definition: debug.h:71
#define PKA_NO_POINTER_REG
Definition: pka.c:133
#define PKA_MAX_CURVE_SIZE_32_BIT_WORD
Definition: pka.c:117
Here is the call graph for this function:

§ PKAEccVerifyPublicKeyWeierstrassStart()

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.

This function validates a public key against a curve. After performing multiple smaller PKA operations in polling mode, it starts an ECC scalar multiplication.

The function verifies that:

  • X and Y are in the range [1, prime - 1]
  • The point is not the point at infinity
  • X and Y satisfy the Short-Weierstrass curve equation Y^2 = X^3 + a*X + b mod P
  • Multiplying the point by the order of the curve yields the point at infinity
Parameters
[in]curvePointXis the pointer to the buffer containing the X coordinate of the elliptic curve point to verify.
[in]curvePointYis the pointer to the buffer containing the Y coordinate of the elliptic curve point to verify.
[in]primeis the prime of the curve.
[in]ais the a constant of the curve when the curve equation is expressed in Short-Weierstrass form (y^3 = x^2 + a*x + b).
[in]bis the b constant of the curve when the curve equation is expressed in Short-Weierstrass form (y^3 = x^2 + a*x + b).
[in]orderis the order of the curve.
[in]lengthis the length of the curve parameters in bytes.
Returns
Returns a status code.
See also
PKAEccVerifyPublicKeyGetResult()
1498 {
1499  uint32_t pkaResult;
1500  uint32_t resultLength;
1501  uint32_t resultAddress = 0; // Assign a value to avoid compiler warnings.
1502  uint8_t *scratchBuffer = (uint8_t *)(PKA_RAM_BASE + PKA_RAM_TOT_BYTE_SIZE / 2);
1503  uint8_t *scratchBuffer2 = scratchBuffer + 512;
1504 
1505 
1506  // Verify X in range [0, prime - 1]
1507  PKABigNumCmpStart(curvePointX,
1508  prime,
1509  length);
1510 
1512 
1513  pkaResult = PKABigNumCmpGetResult();
1514 
1515  if (pkaResult != PKA_STATUS_A_LESS_THAN_B) {
1517  }
1518 
1519  // Verify Y in range [0, prime - 1]
1520  PKABigNumCmpStart(curvePointY,
1521  prime,
1522  length);
1523 
1525 
1526  pkaResult = PKABigNumCmpGetResult();
1527 
1528  if (pkaResult != PKA_STATUS_A_LESS_THAN_B) {
1530  }
1531 
1532  // Verify point on curve
1533  // Short-Weierstrass equation: Y ^ 2 = X ^3 + a * X + b mod P
1534  // Reduced: Y ^ 2 = X * (X ^ 2 + a) + b
1535 
1536  // tmp = X ^ 2
1537  PKABigNumMultiplyStart(curvePointX, length, curvePointX, length, &resultAddress);
1538 
1540 
1541  resultLength = 200;
1542  pkaResult = PKABigNumMultGetResult(scratchBuffer, &resultLength, resultAddress);
1543 
1544  if (pkaResult != PKA_STATUS_SUCCESS) {
1545  return PKA_STATUS_FAILURE;
1546  }
1547 
1548  // tmp += a
1549  PKABigNumAddStart(scratchBuffer, resultLength, a, length, &resultAddress);
1550 
1552 
1553  resultLength = 200;
1554  pkaResult = PKABigNumAddGetResult(scratchBuffer, &resultLength, resultAddress);
1555 
1556  if (pkaResult != PKA_STATUS_SUCCESS) {
1557  return PKA_STATUS_FAILURE;
1558  }
1559 
1560  // tmp *= x
1561  PKABigNumMultiplyStart(scratchBuffer, resultLength, curvePointX, length, &resultAddress);
1562 
1564 
1565  resultLength = 200;
1566  pkaResult = PKABigNumMultGetResult(scratchBuffer, &resultLength, resultAddress);
1567 
1568  if (pkaResult != PKA_STATUS_SUCCESS) {
1569  return PKA_STATUS_FAILURE;
1570  }
1571 
1572  // tmp += b
1573  PKABigNumAddStart(scratchBuffer, resultLength, b, length, &resultAddress);
1574 
1576 
1577  resultLength = 200;
1578  pkaResult = PKABigNumAddGetResult(scratchBuffer, &resultLength, resultAddress);
1579 
1580  if (pkaResult != PKA_STATUS_SUCCESS) {
1581  return PKA_STATUS_FAILURE;
1582  }
1583 
1584 
1585  // tmp2 = tmp % prime to ensure we have no fraction in the division.
1586  // The number will only shrink from here on out.
1587  PKABigNumModStart(scratchBuffer, resultLength, prime, length, &resultAddress);
1588 
1590 
1591  // If the result is not a multiple of the word-length, the PKA HW will round up
1592  // because it deals in words only. That means that using 'length' directly
1593  // would cause and underflow, since length refers to the actual length in bytes of
1594  // the curve parameters while the PKA HW reports that rounded up to the next
1595  // word boundary.
1596  // Use 200 as the resultLength instead since we are copying to the scratch buffer
1597  // anyway.
1598  // Practically, this only happens with curves such as NIST-P521 that are not word
1599  // multiples.
1600  resultLength = 200;
1601  pkaResult = PKABigNumModGetResult(scratchBuffer2, resultLength, resultAddress);
1602 
1603  if (pkaResult != PKA_STATUS_SUCCESS) {
1604  return PKA_STATUS_FAILURE;
1605  }
1606 
1607  // tmp = y^2
1608  PKABigNumMultiplyStart(curvePointY, length, curvePointY, length, &resultAddress);
1609 
1611 
1612  resultLength = 200;
1613  pkaResult = PKABigNumMultGetResult(scratchBuffer, &resultLength, resultAddress);
1614 
1615  if (pkaResult != PKA_STATUS_SUCCESS) {
1616  return PKA_STATUS_FAILURE;
1617  }
1618 
1619  // tmp %= prime
1620  PKABigNumModStart(scratchBuffer, resultLength, prime, length, &resultAddress);
1621 
1623 
1624  // If the result is not a multiple of the word-length, the PKA HW will round up
1625  // because it deals in words only. That means that using 'length' directly
1626  // would cause and underflow, since length refers to the actual length in bytes of
1627  // the curve parameters while the PKA HW reports that rounded up to the next
1628  // word boundary.
1629  // Use 200 as the resultLength instead since we are copying to the scratch buffer
1630  // anyway.
1631  // Practically, this only happens with curves such as NIST-P521 that are not word
1632  // multiples.
1633  resultLength = 200;
1634  pkaResult = PKABigNumModGetResult(scratchBuffer, resultLength, resultAddress);
1635 
1636  if (pkaResult != PKA_STATUS_SUCCESS) {
1637  return PKA_STATUS_FAILURE;
1638  }
1639 
1640  // tmp ?= tmp2
1641  PKABigNumCmpStart(scratchBuffer,
1642  scratchBuffer2,
1643  length);
1644 
1646 
1647  pkaResult = PKABigNumCmpGetResult();
1648 
1649  if (pkaResult != PKA_STATUS_EQUAL) {
1651  }
1652  else {
1653  return PKA_STATUS_SUCCESS;
1654  }
1655 }
#define PKA_STATUS_POINT_NOT_ON_CURVE
The public key is not on the specified elliptic curve.
Definition: pka.h:136
uint32_t PKABigNumModGetResult(uint8_t *resultBuf, uint32_t length, uint32_t resultPKAMemAddr)
Gets the result of the big number modulus operation.
Definition: pka.c:955
uint32_t PKABigNumAddGetResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Gets the result of the addition operation on two big numbers.
Definition: pka.c:1327
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.
Definition: pka.c:1246
uint32_t PKABigNumCmpStart(const uint8_t *bigNum1, const uint8_t *bigNum2, uint32_t length)
Starts the comparison of two big numbers.
Definition: pka.c:1036
#define PKA_STATUS_FAILURE
Failure.
Definition: pka.h:122
#define PKA_STATUS_Y_LARGER_THAN_PRIME
Y coordinate of public key is larger than the curve prime.
Definition: pka.h:135
#define PKA_STATUS_EQUAL
Big number compare return status if the first big number is equal to the second.
Definition: pka.h:128
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_X_LARGER_THAN_PRIME
X coordinate of public key is larger than the curve prime.
Definition: pka.h:134
#define PKA_STATUS_SUCCESS
Success.
Definition: pka.h:121
uint32_t PKABigNumMultGetResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Gets the result of the big number multiplication.
Definition: pka.c:1236
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.
Definition: pka.c:920
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.
Definition: pka.c:1200
#define PKA_STATUS_A_LESS_THAN_B
Big number compare return status if the first big number is less than the second. ...
Definition: pka.h:127
uint32_t PKAGetOpsStatus(void)
Gets the PKA operation status.
Definition: pka.c:854
uint32_t PKABigNumCmpGetResult(void)
Gets the result of the comparison operation of two big numbers.
Definition: pka.c:1065
Here is the call graph for this function:

§ PKAGetOpsStatus()

uint32_t PKAGetOpsStatus ( void  )

Gets the PKA operation status.

This function gets information on whether any PKA operation is in progress or not. This function allows to check the PKA operation status before starting any new PKA operation.

Returns
Returns a status code.

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

855 {
856  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN_M) {
858  }
859  else {
861  }
862 }
#define PKA_STATUS_OPERATION_BUSY
PKA operation is in progress.
Definition: pka.h:129
#define PKA_STATUS_OPERATION_RDY
No PKA operation is in progress.
Definition: pka.h:130

§ PKAZeroOutArray()

void PKAZeroOutArray ( const uint8_t *  array,
uint32_t  arrayLength 
)

Zeros-out an array.

Parameters
[in]arrayis the array to zero-out.
[in]arrayLengthis the length of the array.

Referenced by PKABigNumExpModGetResult(), PKABigNumInvModGetResult(), and PKABigNumModGetResult().

896 {
897  uint32_t i;
898  // Take the floor of paramLength in 32-bit words
899  uint32_t arrayLengthInWords = arrayLength / sizeof(uint32_t);
900 
901  // Zero-out the array word-wise until i >= arrayLength
902  for (i = 0; i < arrayLengthInWords * sizeof(uint32_t); i += 4) {
903  HWREG(array + i) = 0;
904  }
905 
906  // If i != arrayLength, there are some remaining bytes to zero-out
907  if (arrayLength % sizeof(uint32_t)) {
908  // Subtract 4 from i, since i has already overshot the array
909  for (i -= 4; i < arrayLength; i++) {
910  HWREGB(array + i * sizeof(uint32_t));
911  }
912  }
913 }

Macro Definition Documentation

§ BrainpoolP256R1_PARAM_SIZE_BYTES

#define BrainpoolP256R1_PARAM_SIZE_BYTES   32

§ BrainpoolP384R1_PARAM_SIZE_BYTES

#define BrainpoolP384R1_PARAM_SIZE_BYTES   48

§ BrainpoolP512R1_PARAM_SIZE_BYTES

#define BrainpoolP512R1_PARAM_SIZE_BYTES   64

§ Curve25519_PARAM_SIZE_BYTES

#define Curve25519_PARAM_SIZE_BYTES   32

§ NISTP224_PARAM_SIZE_BYTES

#define NISTP224_PARAM_SIZE_BYTES   28

§ NISTP256_PARAM_SIZE_BYTES

#define NISTP256_PARAM_SIZE_BYTES   32

§ NISTP384_PARAM_SIZE_BYTES

#define NISTP384_PARAM_SIZE_BYTES   48

§ NISTP521_PARAM_SIZE_BYTES

#define NISTP521_PARAM_SIZE_BYTES   66

§ PKA_STATUS_A_GREATER_THAN_B

#define PKA_STATUS_A_GREATER_THAN_B   5

Big number compare return status if the first big number is greater than the second.

Referenced by PKABigNumCmpGetResult().

§ PKA_STATUS_A_LESS_THAN_B

#define PKA_STATUS_A_LESS_THAN_B   6

Big number compare return status if the first big number is less than the second.

Referenced by PKABigNumCmpGetResult(), and PKAEccVerifyPublicKeyWeierstrassStart().

§ PKA_STATUS_BUF_UNDERFLOW

#define PKA_STATUS_BUF_UNDERFLOW   3

Buffer underflow.

Referenced by PKAGetBigNumResult(), and PKAGetBigNumResultRemainder().

§ PKA_STATUS_EQUAL

#define PKA_STATUS_EQUAL   7

Big number compare return status if the first big number is equal to the second.

Referenced by PKABigNumCmpGetResult(), and PKAEccVerifyPublicKeyWeierstrassStart().

§ PKA_STATUS_FAILURE

#define PKA_STATUS_FAILURE   1

§ PKA_STATUS_INVALID_PARAM

#define PKA_STATUS_INVALID_PARAM   2

Invalid parameter.

§ PKA_STATUS_LOCATION_IN_USE

#define PKA_STATUS_LOCATION_IN_USE   10

Location in PKA RAM is not available.

§ PKA_STATUS_OPERATION_BUSY

§ PKA_STATUS_OPERATION_RDY

#define PKA_STATUS_OPERATION_RDY   9

No PKA operation is in progress.

Referenced by PKAGetOpsStatus().

§ PKA_STATUS_POINT_AT_INFINITY

#define PKA_STATUS_POINT_AT_INFINITY   17

The ECC operation resulted in the point at infinity.

Referenced by PKAGetECCResult().

§ PKA_STATUS_POINT_NOT_ON_CURVE

#define PKA_STATUS_POINT_NOT_ON_CURVE   15

The public key is not on the specified elliptic curve.

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

§ PKA_STATUS_RESULT_0

#define PKA_STATUS_RESULT_0   4

Result is all zeros.

§ PKA_STATUS_RESULT_ADDRESS_INCORRECT

#define PKA_STATUS_RESULT_ADDRESS_INCORRECT   16

The address of the result passed into one of the PKA*GetResult functions is incorrect.

Referenced by PKAGetBigNumResult().

§ PKA_STATUS_SUCCESS

§ PKA_STATUS_X_LARGER_THAN_PRIME

#define PKA_STATUS_X_LARGER_THAN_PRIME   13

X coordinate of public key is larger than the curve prime.

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

§ PKA_STATUS_X_ZERO

#define PKA_STATUS_X_ZERO   11

X coordinate of public key is 0.

§ PKA_STATUS_Y_LARGER_THAN_PRIME

#define PKA_STATUS_Y_LARGER_THAN_PRIME   14

Y coordinate of public key is larger than the curve prime.

Referenced by PKAEccVerifyPublicKeyWeierstrassStart().

§ PKA_STATUS_Y_ZERO

#define PKA_STATUS_Y_ZERO   12

Y coordinate of public key is 0.

Variable Documentation

§ BrainpoolP256R1_a

const PKA_EccParam256 BrainpoolP256R1_a

a constant of the BrainpoolP256R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ BrainpoolP256R1_b

const PKA_EccParam256 BrainpoolP256R1_b

b constant of the BrainpoolP256R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ BrainpoolP256R1_generator

const PKA_EccPoint256 BrainpoolP256R1_generator

X coordinate of the generator point of the BrainpoolP256R1 curve.

§ BrainpoolP256R1_order

const PKA_EccParam256 BrainpoolP256R1_order

Order of the BrainpoolP256R1 curve.

§ BrainpoolP256R1_prime

const PKA_EccParam256 BrainpoolP256R1_prime

Prime of the BrainpoolP256R1 curve.

§ BrainpoolP384R1_a

const PKA_EccParam384 BrainpoolP384R1_a

a constant of the BrainpoolP384R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ BrainpoolP384R1_b

const PKA_EccParam384 BrainpoolP384R1_b

b constant of the BrainpoolP384R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ BrainpoolP384R1_generator

const PKA_EccPoint384 BrainpoolP384R1_generator

X coordinate of the generator point of the BrainpoolP384R1 curve.

§ BrainpoolP384R1_order

const PKA_EccParam384 BrainpoolP384R1_order

Order of the BrainpoolP384R1 curve.

§ BrainpoolP384R1_prime

const PKA_EccParam384 BrainpoolP384R1_prime

Prime of the BrainpoolP384R1 curve.

§ BrainpoolP512R1_a

const PKA_EccParam512 BrainpoolP512R1_a

a constant of the BrainpoolP512R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ BrainpoolP512R1_b

const PKA_EccParam512 BrainpoolP512R1_b

b constant of the BrainpoolP512R1 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ BrainpoolP512R1_generator

const PKA_EccPoint512 BrainpoolP512R1_generator

X coordinate of the generator point of the BrainpoolP512R1 curve.

§ BrainpoolP512R1_order

const PKA_EccParam512 BrainpoolP512R1_order

Order of the BrainpoolP512R1 curve.

§ BrainpoolP512R1_prime

const PKA_EccParam512 BrainpoolP512R1_prime

Prime of the BrainpoolP512R1 curve.

§ Curve25519_a

const PKA_EccParam256 Curve25519_a

a constant of the Curve25519 curve when expressed in Montgomery form (By^2 = x^3 + a*x^2 + x).

§ Curve25519_b

const PKA_EccParam256 Curve25519_b

b constant of the Curve25519 curve when expressed in Montgomery form (By^2 = x^3 + a*x^2 + x).

§ Curve25519_generator

const PKA_EccPoint256 Curve25519_generator

X coordinate of the generator point of the Curve25519 curve.

§ Curve25519_order

const PKA_EccParam256 Curve25519_order

Order of the Curve25519 curve.

§ Curve25519_prime

const PKA_EccParam256 Curve25519_prime

Prime of the Curve25519 curve.

§ NISTP224_a

const PKA_EccParam224 NISTP224_a

a constant of the NISTP224 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ NISTP224_b

const PKA_EccParam224 NISTP224_b

b constant of the NISTP224 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ NISTP224_generator

const PKA_EccPoint224 NISTP224_generator

X coordinate of the generator point of the NISTP224 curve.

§ NISTP224_order

const PKA_EccParam224 NISTP224_order

Order of the NISTP224 curve.

§ NISTP224_prime

const PKA_EccParam224 NISTP224_prime

Prime of the NISTP224 curve.

§ NISTP256_a

const PKA_EccParam256 NISTP256_a

a constant of the NISTP256 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ NISTP256_b

const PKA_EccParam256 NISTP256_b

b constant of the NISTP256 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ NISTP256_generator

const PKA_EccPoint256 NISTP256_generator

X coordinate of the generator point of the NISTP256 curve.

§ NISTP256_order

const PKA_EccParam256 NISTP256_order

Order of the NISTP256 curve.

§ NISTP256_prime

const PKA_EccParam256 NISTP256_prime

Prime of the NISTP256 curve.

§ NISTP384_a

const PKA_EccParam384 NISTP384_a

a constant of the NISTP384 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ NISTP384_b

const PKA_EccParam384 NISTP384_b

b constant of the NISTP384 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ NISTP384_generator

const PKA_EccPoint384 NISTP384_generator

X coordinate of the generator point of the NISTP384 curve.

§ NISTP384_order

const PKA_EccParam384 NISTP384_order

Order of the NISTP384 curve.

§ NISTP384_prime

const PKA_EccParam384 NISTP384_prime

Prime of the NISTP384 curve.

§ NISTP521_a

const PKA_EccParam521 NISTP521_a

a constant of the NISTP521 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ NISTP521_b

const PKA_EccParam521 NISTP521_b

b constant of the NISTP521 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).

§ NISTP521_generator

const PKA_EccPoint521 NISTP521_generator

X coordinate of the generator point of the NISTP521 curve.

§ NISTP521_order

const PKA_EccParam521 NISTP521_order

Order of the NISTP521 curve.

§ NISTP521_prime

const PKA_EccParam521 NISTP521_prime

Prime of the NISTP521 curve.