This module contains APIs to program and use the PKA.
|
file | pka.h |
| This file contains the prototype of PKA driver APIs.
|
|
|
PKA_Handle | PKA_open (uint32_t index) |
| Function to Open PKA instance, enable PKA engine, Initialize clocks and Load PKA Fw. More...
|
|
PKA_Return_t | PKA_close (PKA_Handle handle) |
| Function to close a PKA module specified by the PKA handle. More...
|
|
PKA_Return_t | PKA_RSAPrivate (PKA_Handle handle, const uint32_t m[PKA_BIGINT_MAX], const struct PKA_RSAPrivkey *k, uint32_t result[PKA_BIGINT_MAX]) |
| This Function performs Decryption or Signing operations. More...
|
|
PKA_Return_t | PKA_RSAPublic (PKA_Handle handle, const uint32_t m[PKA_BIGINT_MAX], const struct PKA_RSAPubkey *k, uint32_t result[PKA_BIGINT_MAX]) |
| This Function performs Encryption or Verification operations. More...
|
|
PKA_Return_t | PKA_ECDSASign (PKA_Handle handle, const struct PKA_ECPrimeCurveP *cp, const uint32_t priv[PKA_EC_BIGINT_MAX], const uint32_t k[PKA_EC_BIGINT_MAX], const uint32_t h[PKA_EC_BIGINT_MAX], struct PKA_ECDSASig *sig) |
| ECDSA sign primitive function. More...
|
|
PKA_Return_t | PKA_ECDSAVerify (PKA_Handle handle, const struct PKA_ECPrimeCurveP *cp, const struct PKA_ECPoint *pub, const struct PKA_ECDSASig *sig, const uint32_t h[PKA_EC_BIGINT_MAX]) |
| ECDSA verify primitive function. More...
|
|
◆ PKA_BIGINT_MAX
#define PKA_BIGINT_MAX (130U) |
Max size of bigint in words - for RSA
◆ PKA_EC_BIGINT_MAX
#define PKA_EC_BIGINT_MAX (18U) |
Max size of bigint in words - for ECDSA
◆ PKA_EC_PARAM_MAXLEN
#define PKA_EC_PARAM_MAXLEN (68U) |
Maximum length of a big integer used in EC crypto in bytes, enough to accommodate 521-bit prime curves
◆ PKA_BIGINT_LEN
#define PKA_BIGINT_LEN |
( |
|
bytelen | ) |
(((bytelen) / 4U) + 1U) |
Length of a biginteger array in words, the +1 is for the size
◆ PKA_RSA_KEY_E_MAXLEN
#define PKA_RSA_KEY_E_MAXLEN (8U) |
◆ PKA_RSA_KEY_N_MAXLEN
#define PKA_RSA_KEY_N_MAXLEN (520U) |
◆ PKA_RSA_KEY_PQ_MAXLEN
RSA KEY PQ maximun length
◆ PKA_RSA_SIG_MAXLEN
RSA KEY SIG maximun length
◆ PKA_Handle
Handle to the PKA driver.
◆ PKA_Return_t
PKA Driver Error code.
The enumeration describes all the possible return and error codes which the PKA Driver can return
Enumerator |
---|
PKA_RETURN_SUCCESS | Success/pass return code
|
PKA_RETURN_FAILURE | General or unspecified failure/error
|
◆ PKA_open()
Function to Open PKA instance, enable PKA engine, Initialize clocks and Load PKA Fw.
- Returns
- A PKA_Handle on success or a NULL on an error or if it has been opened already
◆ PKA_close()
Function to close a PKA module specified by the PKA handle.
- Parameters
-
◆ PKA_RSAPrivate()
This Function performs Decryption or Signing operations.
- Parameters
-
handle | PKA_Handle returned from PKA_open() |
m | m value in bigint format. |
k | RSA private key |
result | Result of the operation in bigint format. caller must allocate memory size of (2 * sizeof(p)) for the result. |
- Returns
- PKA_RETURN_SUCCESS if requested operation completed. PKA_RETURN_FAILURE if requested operation not completed.
◆ PKA_RSAPublic()
This Function performs Encryption or Verification operations.
- Parameters
-
handle | PKA_Handle returned from PKA_open() |
m | m value in bigint format. |
k | RSA public key |
result | Result of the operation in bigint format. caller must allocate the same memory as s and n for this array. |
- Returns
- PKA_RETURN_SUCCESS if requested operation completed. PKA_RETURN_FAILURE if requested operation not completed.
◆ PKA_ECDSASign()
ECDSA sign primitive function.
- Parameters
-
handle | PKA_Handle returned from PKA_open() |
cp | EC curve parameters |
priv | EC private key |
k | Random number for each signing |
h | Hash value of message to sign in bigint format |
sig | ECDSA Signature - 'r' and 's' values |
- Returns
- PKA_RETURN_SUCCESS if requested operation completed. PKA_RETURN_FAILURE if requested operation not completed.
◆ PKA_ECDSAVerify()
ECDSA verify primitive function.
- Parameters
-
handle | PKA_Handle returned from PKA_open() |
cp | EC curve parameters |
pub | EC Public key |
sig | ECDSA Signature - 'r' & 's' value in bigint format |
h | Hash value of message to verify in bigint format |
- Returns
- PKA_RETURN_SUCCESS if requested operation completed. PKA_RETURN_FAILURE if requested operation not completed.
◆ gPkaConfig
Externally defined driver configuration array.
◆ gPkaConfigNum
Externally defined driver configuration Num.