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.
896 {
897  uint32_t i;
898  uint8_t arrayBits = 0;
899 
900  // We could speed things up by comparing word-wise rather than byte-wise.
901  // However, this extra overhead is inconsequential compared to running an
902  // actual PKA operation. Especially ECC operations.
903  for (i = 0; i < arrayLength; i++) {
904  arrayBits |= array[i];
905  }
906 
907  if (arrayBits) {
908  return false;
909  }
910  else {
911  return true;
912  }
913 
914 }

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

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

1273 {
1274  uint32_t offset = 0;
1275 
1276  // Check for arguments.
1277  ASSERT(bigNum1);
1278  ASSERT(bigNum2);
1279  ASSERT(resultPKAMemAddr);
1280 
1281  // Make sure no operation is in progress.
1282  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1284  }
1285 
1286  offset = PKAWritePkaParam(bigNum1, bigNum1Length, offset, PKA_O_APTR);
1287 
1288  offset = PKAWritePkaParam(bigNum2, bigNum2Length, offset, PKA_O_BPTR);
1289 
1290  // Copy the result vector address location.
1291  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1292 
1293  // Load C pointer with the result location in PKA RAM.
1294  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
1295 
1296  // Set the function for the add operation and start the operation.
1297  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_ADD);
1298 
1299  return PKA_STATUS_SUCCESS;
1300 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:549
#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().

1092 {
1093  uint32_t status;
1094 
1095  // verify that the operation is complete.
1096  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1098  }
1099 
1100  // Check the COMPARE register.
1101  switch(HWREG(PKA_BASE + PKA_O_COMPARE)) {
1102  case PKA_COMPARE_A_EQUALS_B:
1103  status = PKA_STATUS_EQUAL;
1104  break;
1105 
1106  case PKA_COMPARE_A_GREATER_THAN_B:
1107  status = PKA_STATUS_A_GREATER_THAN_B;
1108  break;
1109 
1110  case PKA_COMPARE_A_LESS_THAN_B:
1111  status = PKA_STATUS_A_LESS_THAN_B;
1112  break;
1113 
1114  default:
1115  status = PKA_STATUS_FAILURE;
1116  break;
1117  }
1118 
1119  return status;
1120 }
#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().

1063 {
1064  uint32_t offset = 0;
1065 
1066  // Check the arguments.
1067  ASSERT(bigNum1);
1068  ASSERT(bigNum2);
1069 
1070  // Make sure no operation is in progress.
1071  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1073  }
1074 
1075  offset = PKAWritePkaParam(bigNum1, length, offset, PKA_O_APTR);
1076 
1077  offset = PKAWritePkaParam(bigNum2, length, offset, PKA_O_BPTR);
1078 
1079  // Set the PKA Function register for the Compare operation
1080  // and start the operation.
1081  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_COMPARE);
1082 
1083  return PKA_STATUS_SUCCESS;
1084 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:549
#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()
1042 {
1043  return PKAGetBigNumResult(resultBuf, length, resultQuotientMemAddr);
1044 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:630
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()
1052 {
1053  return PKAGetBigNumResultRemainder(resultBuf, length, resultQuotientMemAddr);
1054 }
static uint32_t PKAGetBigNumResultRemainder(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:704
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()
995 {
996  uint32_t offset = 0;
997 
998  // Check the arguments.
999  ASSERT(dividend);
1000  ASSERT(divisor);
1001  ASSERT(resultQuotientMemAddr);
1002  ASSERT(resultRemainderMemAddr);
1003 
1004  // Make sure no operation is in progress.
1005  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1007  }
1008 
1009  offset = PKAWritePkaParam(dividend, dividendLength, offset, PKA_O_APTR);
1010 
1011  offset = PKAWritePkaParamExtraOffset(divisor, divisorLength, offset, PKA_O_BPTR);
1012 
1013  // Copy the remainder result vector address location.
1014  if (resultRemainderMemAddr) {
1015  *resultRemainderMemAddr = PKA_RAM_BASE + offset;
1016  }
1017 
1018  // The remainder cannot ever be larger than the divisor. It should fit inside
1019  // a buffer of that size.
1020  offset = PKAWritePkaParamExtraOffset(0, divisorLength, offset, PKA_O_CPTR);
1021 
1022  // Copy the remainder result vector address location.
1023  if (resultQuotientMemAddr) {
1024  *resultQuotientMemAddr = PKA_RAM_BASE + offset;
1025  }
1026 
1027  // Load D pointer with the quotient location in PKA RAM
1028  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1029 
1030  // Start the PKCP modulo operation by setting the PKA Function register.
1031  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_DIVIDE);
1032 
1033  return PKA_STATUS_SUCCESS;
1034 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:549
#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:619
#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()
1214 {
1215  // Zero-out array in case modulo result is shorter than length
1216  PKAZeroOutArray(resultBuf, length);
1217 
1218  return PKAGetBigNumResult(resultBuf, &length, resultPKAMemAddr);
1219 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:630
void PKAZeroOutArray(const uint8_t *array, uint32_t arrayLength)
Zeros-out an array.
Definition: pka.c:921
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()
1176 {
1177  uint32_t offset = 0;
1178 
1179  // Check the arguments.
1180  ASSERT(base);
1181  ASSERT(exponent);
1182  ASSERT(modulus);
1183  ASSERT(resultPKAMemAddr);
1184 
1185  // Make sure no operation is in progress.
1186  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1188  }
1189 
1190  offset = PKAWritePkaParam(exponent, exponentLength, offset, PKA_O_APTR);
1191 
1192  offset = PKAWritePkaParamExtraOffset(modulus, modulusLength, offset, PKA_O_BPTR);
1193 
1194  offset = PKAWritePkaParam(base, baseLength, offset, PKA_O_CPTR);
1195 
1196  // Copy the result vector address location.
1197  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1198 
1199  // Load D pointer with the result location in PKA RAM.
1200  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1201 
1202  // set the PKA function to ExpMod operation and the start the operation.
1203  HWREG(PKA_BASE + PKA_O_FUNCTION) = PKA_FUNCTION_RUN_M | (0x04 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1204 
1205  return PKA_STATUS_SUCCESS;
1206 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:549
#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:619
#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()
1163 {
1164  // Zero-out array in case modulo result is shorter than length
1165  PKAZeroOutArray(resultBuf, length);
1166 
1167  return PKAGetBigNumResult(resultBuf, &length, resultPKAMemAddr);
1168 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:630
void PKAZeroOutArray(const uint8_t *array, uint32_t arrayLength)
Zeros-out an array.
Definition: pka.c:921
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()
1128 {
1129  uint32_t offset = 0;
1130 
1131  // Check the arguments.
1132  ASSERT(bigNum);
1133  ASSERT(modulus);
1134  ASSERT(resultPKAMemAddr);
1135 
1136  // Make sure no operation is in progress.
1137  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1139  }
1140 
1141  offset = PKAWritePkaParam(bigNum, bigNumLength, offset, PKA_O_APTR);
1142 
1143  offset = PKAWritePkaParam(modulus, modulusLength, offset, PKA_O_BPTR);
1144 
1145  // Copy the result vector address location.
1146  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1147 
1148  // Load D pointer with the result location in PKA RAM.
1149  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1150 
1151  // set the PKA function to InvMod operation and the start the operation.
1152  HWREG(PKA_BASE + PKA_O_FUNCTION) = 0x0000F000;
1153 
1154  return PKA_STATUS_SUCCESS;
1155 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:549
#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().

982 {
983  // Zero-out array in case modulo result is shorter than length
984  PKAZeroOutArray(resultBuf, length);
985 
986  return PKAGetBigNumResultRemainder(resultBuf, &length, resultPKAMemAddr);
987 }
static uint32_t PKAGetBigNumResultRemainder(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:704
void PKAZeroOutArray(const uint8_t *array, uint32_t arrayLength)
Zeros-out an array.
Definition: pka.c:921
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().

947 {
948  uint32_t offset = 0;
949 
950  // Check the arguments.
951  ASSERT(bigNum);
952  ASSERT(modulus);
953  ASSERT(resultPKAMemAddr);
954 
955  // Make sure no operation is in progress.
956  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
958  }
959 
960  offset = PKAWritePkaParam(bigNum, bigNumLength, offset, PKA_O_APTR);
961 
962  offset = PKAWritePkaParamExtraOffset(modulus, modulusLength, offset, PKA_O_BPTR);
963 
964  // Copy the result vector address location.
965  *resultPKAMemAddr = PKA_RAM_BASE + offset;
966 
967  // Load C pointer with the result location in PKA RAM
968  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
969 
970  // Start the PKCP modulo operation by setting the PKA Function register.
971  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_MODULO);
972 
973  return PKA_STATUS_SUCCESS;
974 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:549
#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:619
#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().

1263 {
1264  return PKAGetBigNumResult(resultBuf, resultLength, resultPKAMemAddr);
1265 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:630
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().

1227 {
1228  uint32_t offset = 0;
1229 
1230  // Check for the arguments.
1231  ASSERT(multiplicand);
1232  ASSERT(multiplier);
1233  ASSERT(resultPKAMemAddr);
1234 
1235  // Make sure no operation is in progress.
1236  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1238  }
1239 
1240  offset = PKAWritePkaParam(multiplicand, multiplicandLength, offset, PKA_O_APTR);
1241 
1242  offset = PKAWritePkaParam(multiplier, multiplierLength, offset, PKA_O_BPTR);
1243 
1244 
1245  // Copy the result vector address location.
1246  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1247 
1248  // Load C pointer with the result location in PKA RAM.
1249  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
1250 
1251  // Set the PKA function to the multiplication and start it.
1252  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_MULTIPLY);
1253 
1254  return PKA_STATUS_SUCCESS;
1255 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:549
#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()
1308 {
1309  return PKAGetBigNumResult(resultBuf, resultLength, resultPKAMemAddr);
1310 }
static uint32_t PKAGetBigNumResult(uint8_t *resultBuf, uint32_t *resultLength, uint32_t resultPKAMemAddr)
Definition: pka.c:630
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()
1318 {
1319  uint32_t offset = 0;
1320 
1321  // Check for arguments.
1322  ASSERT(minuend);
1323  ASSERT(subtrahend);
1324  ASSERT(resultPKAMemAddr);
1325 
1326 
1327  // Make sure no operation is in progress.
1328  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1330  }
1331 
1332  offset = PKAWritePkaParam(minuend, minuendLength, offset, PKA_O_APTR);
1333 
1334  offset = PKAWritePkaParam(subtrahend, subtrahendLength, offset, PKA_O_BPTR);
1335 
1336  // Copy the result vector address location.
1337  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1338 
1339  // Load C pointer with the result location in PKA RAM.
1340  HWREG(PKA_BASE + PKA_O_CPTR) = offset >> 2;
1341 
1342  // Set the function for the add operation and start the operation.
1343  HWREG(PKA_BASE + PKA_O_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_SUBTRACT);
1344 
1345  return PKA_STATUS_SUCCESS;
1346 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:549
#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.

527  {
528  // Get initial state
529  uint32_t secdmaclkgr = HWREG(PRCM_BASE + PRCM_O_SECDMACLKGR);
530 
531  // OR in zeroize bit
532  secdmaclkgr |= PRCM_SECDMACLKGR_PKA_ZERIOZE_RESET_N;
533 
534  // Start zeroization
535  HWREG(PRCM_BASE + PRCM_O_SECDMACLKGR) = secdmaclkgr;
536 
537  // Wait 256 cycles for PKA RAM to be cleared
538  CPUdelay(256 / 4);
539 
540  // Turn off zeroization
541  HWREG(PRCM_BASE + PRCM_O_SECDMACLKGR) = secdmaclkgr & (~PRCM_SECDMACLKGR_PKA_ZERIOZE_RESET_N);
542 }
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()
1514 {
1515  return PKAGetECCResult(curvePointX, curvePointY, resultPKAMemAddr, length);
1516 }
static uint32_t PKAGetECCResult(uint8_t *curvePointX, uint8_t *curvePointY, uint32_t resultPKAMemAddr, uint32_t length)
Definition: pka.c:768
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()
1469 {
1470  uint32_t offset = 0;
1471 
1472  // Check for the arguments.
1473  ASSERT(curvePoint1X);
1474  ASSERT(curvePoint1Y);
1475  ASSERT(curvePoint2X);
1476  ASSERT(curvePoint2Y);
1477  ASSERT(prime);
1478  ASSERT(a);
1479  ASSERT(resultPKAMemAddr);
1480 
1481  // Make sure no operation is in progress.
1482  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1484  }
1485 
1486  offset = PKAWritePkaParamExtraOffset(curvePoint1X, length, offset, PKA_O_APTR);
1487  offset = PKAWritePkaParamExtraOffset(curvePoint1Y, length, offset, PKA_NO_POINTER_REG);
1488 
1489 
1490  offset = PKAWritePkaParamExtraOffset(prime, length, offset, PKA_O_BPTR);
1491  offset = PKAWritePkaParamExtraOffset(a, length, offset, PKA_NO_POINTER_REG);
1492 
1493  offset = PKAWritePkaParamExtraOffset(curvePoint2X, length, offset, PKA_O_CPTR);
1494  offset = PKAWritePkaParamExtraOffset(curvePoint2Y, length, offset, PKA_NO_POINTER_REG);
1495 
1496  // Copy the result vector location.
1497  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1498 
1499  // Load D pointer with the result location in PKA RAM.
1500  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1501 
1502  // Set the PKA Function to ECC-ADD and start the operation.
1503  HWREG(PKA_BASE + PKA_O_FUNCTION ) = PKA_FUNCTION_RUN_M | (0x03 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1504 
1505  return PKA_STATUS_SUCCESS;
1506 }
#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:619
#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()
1414 {
1415  uint32_t offset = 0;
1416 
1417  // Check for the arguments.
1418  ASSERT(scalar);
1419  ASSERT(curvePointX);
1420  ASSERT(prime);
1421  ASSERT(a);
1422  ASSERT(length <= PKA_MAX_CURVE_SIZE_32_BIT_WORD * sizeof(uint32_t));
1423  ASSERT(resultPKAMemAddr);
1424 
1425  // Make sure no PKA operation is in progress.
1426  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1428  }
1429 
1430  offset = PKAWritePkaParam(scalar, length, offset, PKA_O_APTR);
1431 
1432  offset = PKAWritePkaParamExtraOffset(prime, length, offset, PKA_O_BPTR);
1433  offset = PKAWritePkaParamExtraOffset(a, length, offset, PKA_NO_POINTER_REG);
1434 
1435  offset = PKAWritePkaParamExtraOffset(curvePointX, length, offset, PKA_O_CPTR);
1436 
1437  // Update the result location.
1438  // The resultPKAMemAddr may be 0 if we only want to check that we generated the point at infinity
1439  if (resultPKAMemAddr) {
1440  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1441  }
1442 
1443  // Load D pointer with the result location in PKA RAM.
1444  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1445 
1446  // Set the PKA function to Montgomery ECC-MULT and start the operation.
1447  HWREG(PKA_BASE + PKA_O_FUNCTION) = PKA_FUNCTION_RUN_M | (0x02 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1448 
1449  return PKA_STATUS_SUCCESS;
1450 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:549
#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:619
#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()
1459 {
1460  return PKAGetECCResult(curvePointX, curvePointY, resultPKAMemAddr, length);
1461 }
static uint32_t PKAGetECCResult(uint8_t *curvePointX, uint8_t *curvePointY, uint32_t resultPKAMemAddr, uint32_t length)
Definition: pka.c:768
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()
1365 {
1366  uint32_t offset = 0;
1367 
1368  // Check for the arguments.
1369  ASSERT(scalar);
1370  ASSERT(curvePointX);
1371  ASSERT(curvePointY);
1372  ASSERT(prime);
1373  ASSERT(a);
1374  ASSERT(b);
1375  ASSERT(length <= PKA_MAX_CURVE_SIZE_32_BIT_WORD * sizeof(uint32_t));
1376  ASSERT(resultPKAMemAddr);
1377 
1378  // Make sure no PKA operation is in progress.
1379  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN) {
1381  }
1382 
1383  offset = PKAWritePkaParam(scalar, length, offset, PKA_O_APTR);
1384 
1385  offset = PKAWritePkaParamExtraOffset(prime, length, offset, PKA_O_BPTR);
1386  offset = PKAWritePkaParamExtraOffset(a, length, offset, PKA_NO_POINTER_REG);
1387  offset = PKAWritePkaParamExtraOffset(b, length, offset, PKA_NO_POINTER_REG);
1388 
1389  offset = PKAWritePkaParamExtraOffset(curvePointX, length, offset, PKA_O_CPTR);
1390  offset = PKAWritePkaParamExtraOffset(curvePointY, length, offset, PKA_NO_POINTER_REG);
1391 
1392  // Update the result location.
1393  // The resultPKAMemAddr may be 0 if we only want to check that we generated the point at infinity
1394  if (resultPKAMemAddr) {
1395  *resultPKAMemAddr = PKA_RAM_BASE + offset;
1396  }
1397 
1398  // Load D pointer with the result location in PKA RAM.
1399  HWREG(PKA_BASE + PKA_O_DPTR) = offset >> 2;
1400 
1401  // Set the PKA function to ECC-MULT and start the operation.
1402  HWREG(PKA_BASE + PKA_O_FUNCTION) = PKA_FUNCTION_RUN_M | (0x05 << PKA_FUNCTION_SEQUENCER_OPERATIONS_S);
1403 
1404  return PKA_STATUS_SUCCESS;
1405 }
static uint32_t PKAWritePkaParam(const uint8_t *param, uint32_t paramLength, uint32_t paramOffset, uint32_t ptrRegOffset)
Definition: pka.c:549
#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:619
#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()
1524 {
1525  uint32_t pkaResult;
1526  uint32_t resultLength;
1527  uint32_t resultAddress = 0; // Assign a value to avoid compiler warnings.
1528  uint8_t *scratchBuffer = (uint8_t *)(PKA_RAM_BASE + PKA_RAM_TOT_BYTE_SIZE / 2);
1529  uint8_t *scratchBuffer2 = scratchBuffer + 512;
1530 
1531 
1532  // Verify X in range [0, prime - 1]
1533  PKABigNumCmpStart(curvePointX,
1534  prime,
1535  length);
1536 
1538 
1539  pkaResult = PKABigNumCmpGetResult();
1540 
1541  if (pkaResult != PKA_STATUS_A_LESS_THAN_B) {
1543  }
1544 
1545  // Verify Y in range [0, prime - 1]
1546  PKABigNumCmpStart(curvePointY,
1547  prime,
1548  length);
1549 
1551 
1552  pkaResult = PKABigNumCmpGetResult();
1553 
1554  if (pkaResult != PKA_STATUS_A_LESS_THAN_B) {
1556  }
1557 
1558  // Verify point on curve
1559  // Short-Weierstrass equation: Y ^ 2 = X ^3 + a * X + b mod P
1560  // Reduced: Y ^ 2 = X * (X ^ 2 + a) + b
1561 
1562  // tmp = X ^ 2
1563  PKABigNumMultiplyStart(curvePointX, length, curvePointX, length, &resultAddress);
1564 
1566 
1567  resultLength = 200;
1568  pkaResult = PKABigNumMultGetResult(scratchBuffer, &resultLength, resultAddress);
1569 
1570  if (pkaResult != PKA_STATUS_SUCCESS) {
1571  return PKA_STATUS_FAILURE;
1572  }
1573 
1574  // tmp += a
1575  PKABigNumAddStart(scratchBuffer, resultLength, a, length, &resultAddress);
1576 
1578 
1579  resultLength = 200;
1580  pkaResult = PKABigNumAddGetResult(scratchBuffer, &resultLength, resultAddress);
1581 
1582  if (pkaResult != PKA_STATUS_SUCCESS) {
1583  return PKA_STATUS_FAILURE;
1584  }
1585 
1586  // tmp *= x
1587  PKABigNumMultiplyStart(scratchBuffer, resultLength, curvePointX, length, &resultAddress);
1588 
1590 
1591  resultLength = 200;
1592  pkaResult = PKABigNumMultGetResult(scratchBuffer, &resultLength, resultAddress);
1593 
1594  if (pkaResult != PKA_STATUS_SUCCESS) {
1595  return PKA_STATUS_FAILURE;
1596  }
1597 
1598  // tmp += b
1599  PKABigNumAddStart(scratchBuffer, resultLength, b, length, &resultAddress);
1600 
1602 
1603  resultLength = 200;
1604  pkaResult = PKABigNumAddGetResult(scratchBuffer, &resultLength, resultAddress);
1605 
1606  if (pkaResult != PKA_STATUS_SUCCESS) {
1607  return PKA_STATUS_FAILURE;
1608  }
1609 
1610 
1611  // tmp2 = tmp % prime to ensure we have no fraction in the division.
1612  // The number will only shrink from here on out.
1613  PKABigNumModStart(scratchBuffer, resultLength, prime, length, &resultAddress);
1614 
1616 
1617  // If the result is not a multiple of the word-length, the PKA HW will round up
1618  // because it deals in words only. That means that using 'length' directly
1619  // would cause and underflow, since length refers to the actual length in bytes of
1620  // the curve parameters while the PKA HW reports that rounded up to the next
1621  // word boundary.
1622  // Use 200 as the resultLength instead since we are copying to the scratch buffer
1623  // anyway.
1624  // Practically, this only happens with curves such as NIST-P521 that are not word
1625  // multiples.
1626  resultLength = 200;
1627  pkaResult = PKABigNumModGetResult(scratchBuffer2, resultLength, resultAddress);
1628 
1629  if (pkaResult != PKA_STATUS_SUCCESS) {
1630  return PKA_STATUS_FAILURE;
1631  }
1632 
1633  // tmp = y^2
1634  PKABigNumMultiplyStart(curvePointY, length, curvePointY, length, &resultAddress);
1635 
1637 
1638  resultLength = 200;
1639  pkaResult = PKABigNumMultGetResult(scratchBuffer, &resultLength, resultAddress);
1640 
1641  if (pkaResult != PKA_STATUS_SUCCESS) {
1642  return PKA_STATUS_FAILURE;
1643  }
1644 
1645  // tmp %= prime
1646  PKABigNumModStart(scratchBuffer, resultLength, prime, length, &resultAddress);
1647 
1649 
1650  // If the result is not a multiple of the word-length, the PKA HW will round up
1651  // because it deals in words only. That means that using 'length' directly
1652  // would cause and underflow, since length refers to the actual length in bytes of
1653  // the curve parameters while the PKA HW reports that rounded up to the next
1654  // word boundary.
1655  // Use 200 as the resultLength instead since we are copying to the scratch buffer
1656  // anyway.
1657  // Practically, this only happens with curves such as NIST-P521 that are not word
1658  // multiples.
1659  resultLength = 200;
1660  pkaResult = PKABigNumModGetResult(scratchBuffer, resultLength, resultAddress);
1661 
1662  if (pkaResult != PKA_STATUS_SUCCESS) {
1663  return PKA_STATUS_FAILURE;
1664  }
1665 
1666  // tmp ?= tmp2
1667  PKABigNumCmpStart(scratchBuffer,
1668  scratchBuffer2,
1669  length);
1670 
1672 
1673  pkaResult = PKABigNumCmpGetResult();
1674 
1675  if (pkaResult != PKA_STATUS_EQUAL) {
1677  }
1678  else {
1679  return PKA_STATUS_SUCCESS;
1680  }
1681 }
#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:981
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:1353
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:1272
uint32_t PKABigNumCmpStart(const uint8_t *bigNum1, const uint8_t *bigNum2, uint32_t length)
Starts the comparison of two big numbers.
Definition: pka.c:1062
#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:1262
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:946
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:1226
#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:880
uint32_t PKABigNumCmpGetResult(void)
Gets the result of the comparison operation of two big numbers.
Definition: pka.c:1091
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().

881 {
882  if (HWREG(PKA_BASE + PKA_O_FUNCTION) & PKA_FUNCTION_RUN_M) {
884  }
885  else {
887  }
888 }
#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().

922 {
923  uint32_t i;
924  // Take the floor of paramLength in 32-bit words
925  uint32_t arrayLengthInWords = arrayLength / sizeof(uint32_t);
926 
927  // Zero-out the array word-wise until i >= arrayLength
928  for (i = 0; i < arrayLengthInWords * sizeof(uint32_t); i += 4) {
929  HWREG(array + i) = 0;
930  }
931 
932  // If i != arrayLength, there are some remaining bytes to zero-out
933  if (arrayLength % sizeof(uint32_t)) {
934  // Subtract 4 from i, since i has already overshot the array
935  for (i -= 4; i < arrayLength; i++) {
936  HWREGB(array + i * sizeof(uint32_t));
937  }
938  }
939 }

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.