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^2 = x^3 + a*x + b). More...
 
const PKA_EccParam224 NISTP224_b
 b constant of the NISTP224 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b). More...
 
const PKA_EccParam256 NISTP256_b
 b constant of the NISTP256 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b). More...
 
const PKA_EccParam384 NISTP384_b
 b constant of the NISTP384 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b). More...
 
const PKA_EccParam521 NISTP521_b
 b constant of the NISTP521 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b). More...
 
const PKA_EccParam256 BrainpoolP256R1_b
 b constant of the BrainpoolP256R1 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b). More...
 
const PKA_EccParam384 BrainpoolP384R1_b
 b constant of the BrainpoolP384R1 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b). More...
 
const PKA_EccParam512 BrainpoolP512R1_b
 b constant of the BrainpoolP512R1 curve when expressed in short Weierstrass form (y^2 = x^3 + 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.
989 {
990  uint32_t i;
991  uint8_t arrayBits = 0;
992 
993  // We could speed things up by comparing word-wise rather than byte-wise.
994  // However, this extra overhead is inconsequential compared to running an
995  // actual PKA operation. Especially ECC operations.
996  for (i = 0; i < arrayLength; i++) {
997  arrayBits |= array[i];
998  }
999 
1000  if (arrayBits) {
1001  return false;
1002  }
1003  else {
1004  return true;
1005  }
1006 
1007 }

§ 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().

1447 {
1448  return PKAGetBigNumResult(resultBuf, resultLength, resultPKAMemAddr);
1449 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:665
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().

1366 {
1367  uint32_t offset = 0;
1368 
1369  // Check for arguments.
1370  ASSERT(bigNum1);
1371  ASSERT(bigNum2);
1372  ASSERT(resultPKAMemAddr);
1373 
1374  // Make sure no operation is in progress.
1375  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1377  }
1378 
1379  offset = PKAWritePkaParam(bigNum1, bigNum1Length, offset, PKA_O_APTR);
1380 
1381  offset = PKAWritePkaParam(bigNum2, bigNum2Length, offset, PKA_O_BPTR);
1382 
1383  // Copy the result vector address location.
1384  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1385 
1386  // Load C pointer with the result location in PKA RAM.
1387  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
1388 
1389  // Set the function for the add operation and start the operation.
1390  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_ADD);
1391 
1392  return PKA_STATUS_SUCCESS;
1393 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:550
#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().

1185 {
1186  uint32_t status;
1187 
1188  // verify that the operation is complete.
1189  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1191  }
1192 
1193  // Check the COMPARE register.
1194  switch(HWREG(PKA_BASE + PKA_O_COMPARE)) {
1195  case PKA_COMPARE_A_EQUALS_B:
1196  status = PKA_STATUS_EQUAL;
1197  break;
1198 
1199  case PKA_COMPARE_A_GREATER_THAN_B:
1200  status = PKA_STATUS_A_GREATER_THAN_B;
1201  break;
1202 
1203  case PKA_COMPARE_A_LESS_THAN_B:
1204  status = PKA_STATUS_A_LESS_THAN_B;
1205  break;
1206 
1207  default:
1208  status = PKA_STATUS_FAILURE;
1209  break;
1210  }
1211 
1212  return status;
1213 }
#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().

1156 {
1157  uint32_t offset = 0;
1158 
1159  // Check the arguments.
1160  ASSERT(bigNum1);
1161  ASSERT(bigNum2);
1162 
1163  // Make sure no operation is in progress.
1164  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1166  }
1167 
1168  offset = PKAWritePkaParam(bigNum1, length, offset, PKA_O_APTR);
1169 
1170  offset = PKAWritePkaParam(bigNum2, length, offset, PKA_O_BPTR);
1171 
1172  // Set the PKA Function register for the Compare operation
1173  // and start the operation.
1174  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_COMPARE);
1175 
1176  return PKA_STATUS_SUCCESS;
1177 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:550
#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()
1135 {
1136  return PKAGetBigNumResult(resultBuf, length, resultQuotientMemAddr);
1137 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:665
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()
1145 {
1146  return PKAGetBigNumResultRemainder(resultBuf, length, resultQuotientMemAddr);
1147 }
static uint32_t PKAGetBigNumResultRemainder(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:759
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()
1088 {
1089  uint32_t offset = 0;
1090 
1091  // Check the arguments.
1092  ASSERT(dividend);
1093  ASSERT(divisor);
1094  ASSERT(resultQuotientMemAddr);
1095  ASSERT(resultRemainderMemAddr);
1096 
1097  // Make sure no operation is in progress.
1098  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1100  }
1101 
1102  offset = PKAWritePkaParam(dividend, dividendLength, offset, PKA_O_APTR);
1103 
1104  offset = PKAWritePkaParamExtraOffset(divisor, divisorLength, offset, PKA_O_BPTR);
1105 
1106  // Copy the remainder result vector address location.
1107  if (resultRemainderMemAddr) {
1108  *resultRemainderMemAddr = PKA_RAM_BASE + offset;
1109  }
1110 
1111  // The remainder cannot ever be larger than the divisor. It should fit inside
1112  // a buffer of that size.
1113  offset = PKAWritePkaParamExtraOffset(0, divisorLength, offset, PKA_O_CPTR);
1114 
1115  // Copy the remainder result vector address location.
1116  if (resultQuotientMemAddr) {
1117  *resultQuotientMemAddr = PKA_RAM_BASE + offset;
1118  }
1119 
1120  // Load D pointer with the quotient location in PKA RAM
1121  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1122 
1123  // Start the PKCP modulo operation by setting the PKA Function register.
1124  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_DIVIDE);
1125 
1126  return PKA_STATUS_SUCCESS;
1127 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:550
#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:648
#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()
1307 {
1308  // Zero-out array in case modulo result is shorter than length
1309  PKAZeroOutArray(resultBuf, length);
1310 
1311  return PKAGetBigNumResult(resultBuf, &length, resultPKAMemAddr);
1312 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:665
void PKAZeroOutArray(const uint8_t *array, uint32_t arrayLength)
Zeros-out an array.
Definition: pka.c:1014
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()
1269 {
1270  uint32_t offset = 0;
1271 
1272  // Check the arguments.
1273  ASSERT(base);
1274  ASSERT(exponent);
1275  ASSERT(modulus);
1276  ASSERT(resultPKAMemAddr);
1277 
1278  // Make sure no operation is in progress.
1279  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1281  }
1282 
1283  offset = PKAWritePkaParam(exponent, exponentLength, offset, PKA_O_APTR);
1284 
1285  offset = PKAWritePkaParamExtraOffset(modulus, modulusLength, offset, PKA_O_BPTR);
1286 
1287  offset = PKAWritePkaParam(base, baseLength, offset, PKA_O_CPTR);
1288 
1289  // Copy the result vector address location.
1290  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1291 
1292  // Load D pointer with the result location in PKA RAM.
1293  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1294 
1295  // set the PKA function to ExpMod operation and the start the operation.
1296  HWREG(PKA_BASE + PKA_O_FUNCTION) = PKA_FUNCTION_RUN_M | (0x04 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1297 
1298  return PKA_STATUS_SUCCESS;
1299 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:550
#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:648
#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()
1256 {
1257  // Zero-out array in case modulo result is shorter than length
1258  PKAZeroOutArray(resultBuf, length);
1259 
1260  return PKAGetBigNumResult(resultBuf, &length, resultPKAMemAddr);
1261 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:665
void PKAZeroOutArray(const uint8_t *array, uint32_t arrayLength)
Zeros-out an array.
Definition: pka.c:1014
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()
1221 {
1222  uint32_t offset = 0;
1223 
1224  // Check the arguments.
1225  ASSERT(bigNum);
1226  ASSERT(modulus);
1227  ASSERT(resultPKAMemAddr);
1228 
1229  // Make sure no operation is in progress.
1230  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1232  }
1233 
1234  offset = PKAWritePkaParam(bigNum, bigNumLength, offset, PKA_O_APTR);
1235 
1236  offset = PKAWritePkaParam(modulus, modulusLength, offset, PKA_O_BPTR);
1237 
1238  // Copy the result vector address location.
1239  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1240 
1241  // Load D pointer with the result location in PKA RAM.
1242  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1243 
1244  // set the PKA function to InvMod operation and the start the operation.
1245  HWREG(PKA_BASE + PKA_O_FUNCTION) = 0x0000F000;
1246 
1247  return PKA_STATUS_SUCCESS;
1248 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:550
#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().

1075 {
1076  // Zero-out array in case modulo result is shorter than length
1077  PKAZeroOutArray(resultBuf, length);
1078 
1079  return PKAGetBigNumResultRemainder(resultBuf, &length, resultPKAMemAddr);
1080 }
static uint32_t PKAGetBigNumResultRemainder(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:759
void PKAZeroOutArray(const uint8_t *array, uint32_t arrayLength)
Zeros-out an array.
Definition: pka.c:1014
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().

1040 {
1041  uint32_t offset = 0;
1042 
1043  // Check the arguments.
1044  ASSERT(bigNum);
1045  ASSERT(modulus);
1046  ASSERT(resultPKAMemAddr);
1047 
1048  // Make sure no operation is in progress.
1049  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1051  }
1052 
1053  offset = PKAWritePkaParam(bigNum, bigNumLength, offset, PKA_O_APTR);
1054 
1055  offset = PKAWritePkaParamExtraOffset(modulus, modulusLength, offset, PKA_O_BPTR);
1056 
1057  // Copy the result vector address location.
1058  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1059 
1060  // Load C pointer with the result location in PKA RAM
1061  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
1062 
1063  // Start the PKCP modulo operation by setting the PKA Function register.
1064  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_MODULO);
1065 
1066  return PKA_STATUS_SUCCESS;
1067 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:550
#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:648
#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().

1356 {
1357  return PKAGetBigNumResult(resultBuf, resultLength, resultPKAMemAddr);
1358 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:665
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().

1320 {
1321  uint32_t offset = 0;
1322 
1323  // Check for the arguments.
1324  ASSERT(multiplicand);
1325  ASSERT(multiplier);
1326  ASSERT(resultPKAMemAddr);
1327 
1328  // Make sure no operation is in progress.
1329  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1331  }
1332 
1333  offset = PKAWritePkaParam(multiplicand, multiplicandLength, offset, PKA_O_APTR);
1334 
1335  offset = PKAWritePkaParam(multiplier, multiplierLength, offset, PKA_O_BPTR);
1336 
1337 
1338  // Copy the result vector address location.
1339  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1340 
1341  // Load C pointer with the result location in PKA RAM.
1342  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
1343 
1344  // Set the PKA function to the multiplication and start it.
1345  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_MULTIPLY);
1346 
1347  return PKA_STATUS_SUCCESS;
1348 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:550
#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()
1401 {
1402  return PKAGetBigNumResult(resultBuf, resultLength, resultPKAMemAddr);
1403 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:665
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()
1411 {
1412  uint32_t offset = 0;
1413 
1414  // Check for arguments.
1415  ASSERT(minuend);
1416  ASSERT(subtrahend);
1417  ASSERT(resultPKAMemAddr);
1418 
1419 
1420  // Make sure no operation is in progress.
1421  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1423  }
1424 
1425  offset = PKAWritePkaParam(minuend, minuendLength, offset, PKA_O_APTR);
1426 
1427  offset = PKAWritePkaParam(subtrahend, subtrahendLength, offset, PKA_O_BPTR);
1428 
1429  // Copy the result vector address location.
1430  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1431 
1432  // Load C pointer with the result location in PKA RAM.
1433  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
1434 
1435  // Set the function for the add operation and start the operation.
1436  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_SUBTRACT);
1437 
1438  return PKA_STATUS_SUCCESS;
1439 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:550
#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.

528 {
529  // Get initial state
530  uint32_t secdmaclkgr = HWREG(PRCM_BASE + PRCM_O_SECDMACLKGR);
531 
532  // OR in zeroize bit
533  secdmaclkgr |= PRCM_SECDMACLKGR_PKA_ZERIOZE_RESET_N;
534 
535  // Start zeroization
536  HWREG(PRCM_BASE + PRCM_O_SECDMACLKGR) = secdmaclkgr;
537 
538  // Wait 256 cycles for PKA RAM to be cleared
539  CPUdelay(256 / 4);
540 
541  // Turn off zeroization
542  HWREG(PRCM_BASE + PRCM_O_SECDMACLKGR) = secdmaclkgr & (~PRCM_SECDMACLKGR_PKA_ZERIOZE_RESET_N);
543 }
void CPUdelay(uint32_t ui32Count)
Provide a small non-zero delay using a simple loop counter.
Definition: cpu.c:408
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()
1607 {
1608  return PKAGetECCResult(curvePointX, curvePointY, resultPKAMemAddr, length);
1609 }
static uint32_t PKAGetECCResult(uint8_t *curvePointX, uint8_t *curvePointY, uint32_t resultPKAMemAddr, uint32_t length)
Definition: pka.c:847
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()
1562 {
1563  uint32_t offset = 0;
1564 
1565  // Check for the arguments.
1566  ASSERT(curvePoint1X);
1567  ASSERT(curvePoint1Y);
1568  ASSERT(curvePoint2X);
1569  ASSERT(curvePoint2Y);
1570  ASSERT(prime);
1571  ASSERT(a);
1572  ASSERT(resultPKAMemAddr);
1573 
1574  // Make sure no operation is in progress.
1575  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1577  }
1578 
1579  offset = PKAWritePkaParamExtraOffset(curvePoint1X, length, offset, PKA_O_APTR);
1580  offset = PKAWritePkaParamExtraOffset(curvePoint1Y, length, offset, PKA_NO_POINTER_REG);
1581 
1582 
1583  offset = PKAWritePkaParamExtraOffset(prime, length, offset, PKA_O_BPTR);
1584  offset = PKAWritePkaParamExtraOffset(a, length, offset, PKA_NO_POINTER_REG);
1585 
1586  offset = PKAWritePkaParamExtraOffset(curvePoint2X, length, offset, PKA_O_CPTR);
1587  offset = PKAWritePkaParamExtraOffset(curvePoint2Y, length, offset, PKA_NO_POINTER_REG);
1588 
1589  // Copy the result vector location.
1590  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1591 
1592  // Load D pointer with the result location in PKA RAM.
1593  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1594 
1595  // Set the PKA Function to ECC-ADD and start the operation.
1596  HWREG(PKA_BASE + PKA_O_FUNCTION ) = PKA_FUNCTION_RUN_M | (0x03 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1597 
1598  return PKA_STATUS_SUCCESS;
1599 }
#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:648
#define ASSERT(expr)
Definition: debug.h:71
#define PKA_NO_POINTER_REG
Definition: pka.c:135
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()
1507 {
1508  uint32_t offset = 0;
1509 
1510  // Check for the arguments.
1511  ASSERT(scalar);
1512  ASSERT(curvePointX);
1513  ASSERT(prime);
1514  ASSERT(a);
1515  ASSERT(length <= PKA_MAX_CURVE_SIZE_32_BIT_WORD * sizeof(uint32_t));
1516  ASSERT(resultPKAMemAddr);
1517 
1518  // Make sure no PKA operation is in progress.
1519  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1521  }
1522 
1523  offset = PKAWritePkaParam(scalar, length, offset, PKA_O_APTR);
1524 
1525  offset = PKAWritePkaParamExtraOffset(prime, length, offset, PKA_O_BPTR);
1526  offset = PKAWritePkaParamExtraOffset(a, length, offset, PKA_NO_POINTER_REG);
1527 
1528  offset = PKAWritePkaParamExtraOffset(curvePointX, length, offset, PKA_O_CPTR);
1529 
1530  // Update the result location.
1531  // The resultPKAMemAddr may be 0 if we only want to check that we generated the point at infinity
1532  if (resultPKAMemAddr) {
1533  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1534  }
1535 
1536  // Load D pointer with the result location in PKA RAM.
1537  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1538 
1539  // Set the PKA function to Montgomery ECC-MULT and start the operation.
1540  HWREG(PKA_BASE + PKA_O_FUNCTION) = PKA_FUNCTION_RUN_M | (0x02 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1541 
1542  return PKA_STATUS_SUCCESS;
1543 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:550
#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:648
#define ASSERT(expr)
Definition: debug.h:71
#define PKA_NO_POINTER_REG
Definition: pka.c:135
#define PKA_MAX_CURVE_SIZE_32_BIT_WORD
Definition: pka.c:119
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()
1552 {
1553  return PKAGetECCResult(curvePointX, curvePointY, resultPKAMemAddr, length);
1554 }
static uint32_t PKAGetECCResult(uint8_t *curvePointX, uint8_t *curvePointY, uint32_t resultPKAMemAddr, uint32_t length)
Definition: pka.c:847
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()
1458 {
1459  uint32_t offset = 0;
1460 
1461  // Check for the arguments.
1462  ASSERT(scalar);
1463  ASSERT(curvePointX);
1464  ASSERT(curvePointY);
1465  ASSERT(prime);
1466  ASSERT(a);
1467  ASSERT(b);
1468  ASSERT(length <= PKA_MAX_CURVE_SIZE_32_BIT_WORD * sizeof(uint32_t));
1469  ASSERT(resultPKAMemAddr);
1470 
1471  // Make sure no PKA operation is in progress.
1472  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1474  }
1475 
1476  offset = PKAWritePkaParam(scalar, length, offset, PKA_O_APTR);
1477 
1478  offset = PKAWritePkaParamExtraOffset(prime, length, offset, PKA_O_BPTR);
1479  offset = PKAWritePkaParamExtraOffset(a, length, offset, PKA_NO_POINTER_REG);
1480  offset = PKAWritePkaParamExtraOffset(b, length, offset, PKA_NO_POINTER_REG);
1481 
1482  offset = PKAWritePkaParamExtraOffset(curvePointX, length, offset, PKA_O_CPTR);
1483  offset = PKAWritePkaParamExtraOffset(curvePointY, length, offset, PKA_NO_POINTER_REG);
1484 
1485  // Update the result location.
1486  // The resultPKAMemAddr may be 0 if we only want to check that we generated the point at infinity
1487  if (resultPKAMemAddr) {
1488  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1489  }
1490 
1491  // Load D pointer with the result location in PKA RAM.
1492  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1493 
1494  // Set the PKA function to ECC-MULT and start the operation.
1495  HWREG(PKA_BASE + PKA_O_FUNCTION) = PKA_FUNCTION_RUN_M | (0x05 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1496 
1497  return PKA_STATUS_SUCCESS;
1498 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:550
#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:648
#define ASSERT(expr)
Definition: debug.h:71
#define PKA_NO_POINTER_REG
Definition: pka.c:135
#define PKA_MAX_CURVE_SIZE_32_BIT_WORD
Definition: pka.c:119
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()
1617 {
1618  uint32_t pkaResult;
1619  uint32_t resultLength;
1620  uint32_t resultAddress = 0; // Assign a value to avoid compiler warnings.
1621  uint8_t *scratchBuffer = (uint8_t *)(PKA_RAM_BASE + PKA_RAM_TOT_BYTE_SIZE / 2);
1622  uint8_t *scratchBuffer2 = scratchBuffer + 512;
1623 
1624 
1625  // Verify X in range [0, prime - 1]
1626  PKABigNumCmpStart(curvePointX,
1627  prime,
1628  length);
1629 
1631 
1632  pkaResult = PKABigNumCmpGetResult();
1633 
1634  if (pkaResult != PKA_STATUS_A_LESS_THAN_B) {
1636  }
1637 
1638  // Verify Y in range [0, prime - 1]
1639  PKABigNumCmpStart(curvePointY,
1640  prime,
1641  length);
1642 
1644 
1645  pkaResult = PKABigNumCmpGetResult();
1646 
1647  if (pkaResult != PKA_STATUS_A_LESS_THAN_B) {
1649  }
1650 
1651  // Verify point on curve
1652  // Short-Weierstrass equation: Y ^ 2 = X ^3 + a * X + b mod P
1653  // Reduced: Y ^ 2 = X * (X ^ 2 + a) + b
1654 
1655  // tmp = X ^ 2
1656  PKABigNumMultiplyStart(curvePointX, length, curvePointX, length, &resultAddress);
1657 
1659 
1660  resultLength = 200;
1661  pkaResult = PKABigNumMultGetResult(scratchBuffer, &resultLength, resultAddress);
1662 
1663  if (pkaResult != PKA_STATUS_SUCCESS) {
1664  return PKA_STATUS_FAILURE;
1665  }
1666 
1667  // tmp += a
1668  PKABigNumAddStart(scratchBuffer, resultLength, a, length, &resultAddress);
1669 
1671 
1672  resultLength = 200;
1673  pkaResult = PKABigNumAddGetResult(scratchBuffer, &resultLength, resultAddress);
1674 
1675  if (pkaResult != PKA_STATUS_SUCCESS) {
1676  return PKA_STATUS_FAILURE;
1677  }
1678 
1679  // tmp *= x
1680  PKABigNumMultiplyStart(scratchBuffer, resultLength, curvePointX, length, &resultAddress);
1681 
1683 
1684  resultLength = 200;
1685  pkaResult = PKABigNumMultGetResult(scratchBuffer, &resultLength, resultAddress);
1686 
1687  if (pkaResult != PKA_STATUS_SUCCESS) {
1688  return PKA_STATUS_FAILURE;
1689  }
1690 
1691  // tmp += b
1692  PKABigNumAddStart(scratchBuffer, resultLength, b, length, &resultAddress);
1693 
1695 
1696  resultLength = 200;
1697  pkaResult = PKABigNumAddGetResult(scratchBuffer, &resultLength, resultAddress);
1698 
1699  if (pkaResult != PKA_STATUS_SUCCESS) {
1700  return PKA_STATUS_FAILURE;
1701  }
1702 
1703 
1704  // tmp2 = tmp % prime to ensure we have no fraction in the division.
1705  // The number will only shrink from here on out.
1706  PKABigNumModStart(scratchBuffer, resultLength, prime, length, &resultAddress);
1707 
1709 
1710  // If the result is not a multiple of the word-length, the PKA HW will round up
1711  // because it deals in words only. That means that using 'length' directly
1712  // would cause and underflow, since length refers to the actual length in bytes of
1713  // the curve parameters while the PKA HW reports that rounded up to the next
1714  // word boundary.
1715  // Use 200 as the resultLength instead since we are copying to the scratch buffer
1716  // anyway.
1717  // Practically, this only happens with curves such as NIST-P521 that are not word
1718  // multiples.
1719  resultLength = 200;
1720  pkaResult = PKABigNumModGetResult(scratchBuffer2, resultLength, resultAddress);
1721 
1722  if (pkaResult != PKA_STATUS_SUCCESS) {
1723  return PKA_STATUS_FAILURE;
1724  }
1725 
1726  // tmp = y^2
1727  PKABigNumMultiplyStart(curvePointY, length, curvePointY, length, &resultAddress);
1728 
1730 
1731  resultLength = 200;
1732  pkaResult = PKABigNumMultGetResult(scratchBuffer, &resultLength, resultAddress);
1733 
1734  if (pkaResult != PKA_STATUS_SUCCESS) {
1735  return PKA_STATUS_FAILURE;
1736  }
1737 
1738  // tmp %= prime
1739  PKABigNumModStart(scratchBuffer, resultLength, prime, length, &resultAddress);
1740 
1742 
1743  // If the result is not a multiple of the word-length, the PKA HW will round up
1744  // because it deals in words only. That means that using 'length' directly
1745  // would cause and underflow, since length refers to the actual length in bytes of
1746  // the curve parameters while the PKA HW reports that rounded up to the next
1747  // word boundary.
1748  // Use 200 as the resultLength instead since we are copying to the scratch buffer
1749  // anyway.
1750  // Practically, this only happens with curves such as NIST-P521 that are not word
1751  // multiples.
1752  resultLength = 200;
1753  pkaResult = PKABigNumModGetResult(scratchBuffer, resultLength, resultAddress);
1754 
1755  if (pkaResult != PKA_STATUS_SUCCESS) {
1756  return PKA_STATUS_FAILURE;
1757  }
1758 
1759  // tmp ?= tmp2
1760  PKABigNumCmpStart(scratchBuffer,
1761  scratchBuffer2,
1762  length);
1763 
1765 
1766  pkaResult = PKABigNumCmpGetResult();
1767 
1768  if (pkaResult != PKA_STATUS_EQUAL) {
1770  }
1771  else {
1772  return PKA_STATUS_SUCCESS;
1773  }
1774 }
#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:1074
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:1446
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:1365
uint32_t PKABigNumCmpStart(const uint8_t *bigNum1, const uint8_t *bigNum2, uint32_t length)
Starts the comparison of two big numbers.
Definition: pka.c:1155
#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:1355
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:1039
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:1319
#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:973
uint32_t PKABigNumCmpGetResult(void)
Gets the result of the comparison operation of two big numbers.
Definition: pka.c:1184
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().

974 {
975  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN_M) {
977  }
978  else {
980  }
981 }
#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().

1015 {
1016  uint32_t i;
1017  // Take the floor of paramLength in 32-bit words
1018  uint32_t arrayLengthInWords = arrayLength / sizeof(uint32_t);
1019 
1020  // Zero-out the array word-wise until i >= arrayLength
1021  for (i = 0; i < arrayLengthInWords * sizeof(uint32_t); i += 4) {
1022  HWREG(array + i) = 0;
1023  }
1024 
1025  // If i != arrayLength, there are some remaining bytes to zero-out
1026  if (arrayLength % sizeof(uint32_t)) {
1027  // Subtract 4 from i, since i has already overshot the array
1028  for (i -= 4; i < arrayLength; i++) {
1029  HWREGB(array + i * sizeof(uint32_t));
1030  }
1031  }
1032 }

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^2 = x^3 + a*x + b).

§ BrainpoolP256R1_b

const PKA_EccParam256 BrainpoolP256R1_b

b constant of the BrainpoolP256R1 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b).

§ BrainpoolP384R1_b

const PKA_EccParam384 BrainpoolP384R1_b

b constant of the BrainpoolP384R1 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b).

§ BrainpoolP512R1_b

const PKA_EccParam512 BrainpoolP512R1_b

b constant of the BrainpoolP512R1 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b).

§ NISTP224_b

const PKA_EccParam224 NISTP224_b

b constant of the NISTP224 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b).

§ NISTP256_b

const PKA_EccParam256 NISTP256_b

b constant of the NISTP256 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b).

§ NISTP384_b

const PKA_EccParam384 NISTP384_b

b constant of the NISTP384 curve when expressed in short Weierstrass form (y^2 = x^3 + 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^2 = x^3 + a*x + b).

§ NISTP521_b

const PKA_EccParam521 NISTP521_b

b constant of the NISTP521 curve when expressed in short Weierstrass form (y^2 = x^3 + 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.