#include "../inc/hw_types.h"
#include "../inc/hw_memmap.h"
#include "../inc/hw_ints.h"
#include "../inc/hw_pka.h"
#include "../inc/hw_pka_ram.h"
#include "interrupt.h"
#include "sys_ctrl.h"
#include "debug.h"
#include <string.h>
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_ |
Macros | |
#define | PKA_STATUS_SUCCESS 0 |
Success. More... | |
#define | PKA_STATUS_FAILURE 1 |
Failure. More... | |
#define | PKA_STATUS_INVALID_PARAM 2 |
Invalid parameter. More... | |
#define | PKA_STATUS_BUF_UNDERFLOW 3 |
Buffer underflow. More... | |
#define | PKA_STATUS_RESULT_0 4 |
Result is all zeros. More... | |
#define | PKA_STATUS_A_GREATER_THAN_B 5 |
Big number compare return status if the first big number is greater than the second. More... | |
#define | PKA_STATUS_A_LESS_THAN_B 6 |
Big number compare return status if the first big number is less than the second. More... | |
#define | PKA_STATUS_EQUAL 7 |
Big number compare return status if the first big number is equal to the second. More... | |
#define | PKA_STATUS_OPERATION_BUSY 8 |
PKA operation is in progress. More... | |
#define | PKA_STATUS_OPERATION_RDY 9 |
No PKA operation is in progress. More... | |
#define | PKA_STATUS_LOCATION_IN_USE 10 |
Location in PKA RAM is not available. More... | |
#define | PKA_STATUS_X_ZERO 11 |
X coordinate of public key is 0. More... | |
#define | PKA_STATUS_Y_ZERO 12 |
Y coordinate of public key is 0. More... | |
#define | PKA_STATUS_X_LARGER_THAN_PRIME 13 |
X coordinate of public key is larger than the curve prime. More... | |
#define | PKA_STATUS_Y_LARGER_THAN_PRIME 14 |
Y coordinate of public key is larger than the curve prime. More... | |
#define | PKA_STATUS_POINT_NOT_ON_CURVE 15 |
The public key is not on the specified elliptic curve. More... | |
#define | PKA_STATUS_RESULT_ADDRESS_INCORRECT 16 |
The address of the result passed into one of the PKA*GetResult functions is incorrect. More... | |
#define | PKA_STATUS_POINT_AT_INFINITY 17 |
The ECC operation resulted in the point at infinity. More... | |
#define | NISTP224_PARAM_SIZE_BYTES 28 |
#define | NISTP256_PARAM_SIZE_BYTES 32 |
#define | NISTP384_PARAM_SIZE_BYTES 48 |
#define | NISTP521_PARAM_SIZE_BYTES 66 |
#define | BrainpoolP256R1_PARAM_SIZE_BYTES 32 |
#define | BrainpoolP384R1_PARAM_SIZE_BYTES 48 |
#define | BrainpoolP512R1_PARAM_SIZE_BYTES 64 |
#define | Curve25519_PARAM_SIZE_BYTES 32 |
Typedefs | |
typedef struct PKA_EccPoint224_ | PKA_EccPoint224 |
typedef struct PKA_EccPoint256_ | PKA_EccPoint256 |
typedef struct PKA_EccPoint384_ | PKA_EccPoint384 |
typedef struct PKA_EccPoint512_ | PKA_EccPoint512 |
typedef struct PKA_EccPoint521_ | 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... | |