TI BLE5-Stack API Documentation
1.01.01.00
|
ECC ROM driver implementation for a CC26XX device. More...
Modules | |
ECC_STATUS | |
Files | |
file | ECCROMCC26XX.h |
ECC ROM driver implementation for a CC26XX device. | |
Data Structures | |
struct | ECCROMCC26XX_CurveParams |
ECCROMCC26XX Curve Parameters. More... | |
struct | ECCROMCC26XX_Params |
ECCROMCC26XX Parameters. More... | |
Macros | |
#define | ECCROMCC26XX_NIST_P256_KEY_LEN_IN_BYTES 32 |
#define | ECCROMCC26XX_NIST_P256_WORKZONE_LEN_IN_BYTES 684 |
#define | ECCROMCC26XX_WORKZONE_LEN_IN_BYTES(len, win) (4 * ((13 * (len)) + 13 + (3 * (len) * (1 << ((win) - 2))))) |
Compute ECC workzone length in bytes for a generic key length and window size. More... | |
Typedefs | |
typedef struct ECCROMCC26XX_CurveParams | ECCROMCC26XX_CurveParams |
ECCROMCC26XX Curve Parameters. More... | |
typedef void(* | ECCROMCC26XX_FreeCB) (uint8_t *pBuf) |
ECCROMCC26XX Free Callback. More... | |
typedef uint8_t *(* | ECCROMCC26XX_MallocCB) (uint16_t len) |
ECCROMCC26XX Malloc Callback. More... | |
typedef struct ECCROMCC26XX_Params | ECCROMCC26XX_Params |
ECCROMCC26XX Parameters. More... | |
Functions | |
int8_t | ECCROMCC26XX_genDHKey (uint8_t *privateKey, uint8_t *publicKeyX, uint8_t *publicKeyY, uint8_t *dHKeyX, uint8_t *dHKeyY, ECCROMCC26XX_Params *params) |
Generate Diffie-Hellman Shared Secret Key X and Y Coordinates. More... | |
int8_t | ECCROMCC26XX_genKeys (uint8_t *privateKey, uint8_t *publicKeyX, uint8_t *publicKeyY, ECCROMCC26XX_Params *params) |
Generate Public Key X and Y Coordinates. More... | |
void | ECCROMCC26XX_init (void) |
Initializes module's synchronization resources. Only needs to be called once, but safe to call multiple times. More... | |
void | ECCROMCC26XX_Params_init (ECCROMCC26XX_Params *params) |
Function to initialize the ECCROMCC26XX_Params struct to its defaults. params should not be modified until after this function is called. Default parameters use the NIST P-256 curve, timeout is set to wait indefinitely, malloc and free are NULL and status is set to ECCROMCC26XX_STATUS_SUCCESS. A client may call this function with the same params instance any number of times. More... | |
ECC ROM driver implementation for a CC26XX device.
============================================================================
The ECC ROM header file should be included in an application as follows:
The ECCROMCC26XX driver provides reentrant access to the ROM based ECC module. Access is given first come, first serve and subsequent calls block until all preceding callers have returned or the caller times out in which case execution returns to the caller but the operation is not performed.
Note: this implementation differs in byte ordering from the NIST Standard. It is not expected that keys input from a different implementation will match the output here.
For code examples, see Use Cases below.
### Performing a key and shared secret generation operation #
If an error occur during key generation, an error status will be returned and stored in the status field of the ECCROMCC26XX_Params instance passed as an argument.
API function | Description |
---|---|
ECCROMCC26XX_init() | Initializes module's synchronization resources |
ECCROMCC26XX_Params_init() | Initialize parameters for Key Generation |
ECCROMCC26XX_genKeys() | Generate Public Key X and Y Coordinates |
ECCROMCC26XX_genDHKey() | Generate Diffie-Hellman Shared Secret |
Functionality that currently not supported:
#define ECCROMCC26XX_NIST_P256_KEY_LEN_IN_BYTES 32 |
ECC key length in bytes for NIST P-256 keys.
#define ECCROMCC26XX_NIST_P256_WORKZONE_LEN_IN_BYTES 684 |
ECC Workzone length in bytes for NIST P-256 key and shared secret generation. For use with ECC Window Size 3 only. Used to store intermediary values in ECC calculations.
#define ECCROMCC26XX_WORKZONE_LEN_IN_BYTES | ( | len, | |
win | |||
) | (4 * ((13 * (len)) + 13 + (3 * (len) * (1 << ((win) - 2))))) |
Compute ECC workzone length in bytes for a generic key length and window size.
len is the length of the key in uint32_t blocks. it must not exceed 255 blocks in length. win is the window size, such that 1 < win < 6. Recommended setting is 3.
This workzone length is only valid for key and shared secret and signature generation. A different workzone length would be used for verification.
typedef struct ECCROMCC26XX_CurveParams ECCROMCC26XX_CurveParams |
ECCROMCC26XX Curve Parameters.
This holds the ECC Curve information to be used. Offset 0 of each param_* buffer contains the length of each parameter in uint32_t blocks, not including the first offset.
typedef void(* ECCROMCC26XX_FreeCB) (uint8_t *pBuf) |
ECCROMCC26XX Free Callback.
Required to free temporary key buffers during operation.
pBuf | - pointer to buffer to free. |
typedef uint8_t*(* ECCROMCC26XX_MallocCB) (uint16_t len) |
ECCROMCC26XX Malloc Callback.
Required to malloc temporary key buffers during operation.
len | - length in bytes of buffer to malloc. |
typedef struct ECCROMCC26XX_Params ECCROMCC26XX_Params |
ECCROMCC26XX Parameters.
Holds a client's parameters for performing an ECC operation.
int8_t ECCROMCC26XX_genDHKey | ( | uint8_t * | privateKey, |
uint8_t * | publicKeyX, | ||
uint8_t * | publicKeyY, | ||
uint8_t * | dHKeyX, | ||
uint8_t * | dHKeyY, | ||
ECCROMCC26XX_Params * | params | ||
) |
Generate Diffie-Hellman Shared Secret Key X and Y Coordinates.
privateKey | 32 byte input buffer of randomly generated bits. |
publicKeyX | 32 byte input buffer provided by client to store Public Key X Coordinate. |
publicKeyY | 32 byte input buffer provided by client to store Public Key Y Coordinate. |
dHKeyX | 32 byte output buffer provided by client to store Diffie-Hellman Key X Coordinate. |
dHKeyY | 32 byte output buffer provided by client to store Diffie-Hellman Key Y Coordinate. |
params | Pointer to a parameter block, if NULL operation will fail |
int8_t ECCROMCC26XX_genKeys | ( | uint8_t * | privateKey, |
uint8_t * | publicKeyX, | ||
uint8_t * | publicKeyY, | ||
ECCROMCC26XX_Params * | params | ||
) |
Generate Public Key X and Y Coordinates.
privateKey | 32 byte input buffer of randomly generated bits. |
publicKeyX | 32 byte output buffer provided by client to store Public Key X Coordinate. |
publicKeyY | 32 byte output buffer provided by client to store Public Key Y Coordinate. |
params | Pointer to a parameter block, if NULL operation will fail. |
void ECCROMCC26XX_init | ( | void | ) |
Initializes module's synchronization resources. Only needs to be called once, but safe to call multiple times.
void ECCROMCC26XX_Params_init | ( | ECCROMCC26XX_Params * | params | ) |
Function to initialize the ECCROMCC26XX_Params struct to its defaults. params should not be modified until after this function is called. Default parameters use the NIST P-256 curve, timeout is set to wait indefinitely, malloc and free are NULL and status is set to ECCROMCC26XX_STATUS_SUCCESS. A client may call this function with the same params instance any number of times.
params | Parameter structure to initialize. |