Public Key Encryption Library
This Library provides a set of routines for easier handling of the Public Key Encryption module available on CEC1x02.
Library Routines
- pke_status
- pke_reset
- pke_start
- pke_done_status
- pke_clear_scm
- pke_scm_clear_slot
- pke_power
- pke_busy
- pke_set_operand_slot
- pke_get_operand_slot
- pke_set_operand_slots
- pke_get_slot_addr
- pke_fill_slot
- pke_write_scm
- pke_write_scm32
- pke_read_scm
- modular_arithm
- PKE_ists_clear
pke_status
Prototype |
uint32_t pke_status(); |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Description |
The routine returns the status of the PKE block. |
||||||||||
Parameters |
None. |
||||||||||
Returns |
The routine returns the PKE block status. The important status bits are listed below :
|
||||||||||
Requires |
Nothing. |
||||||||||
Notes |
None. |
pke_reset
Prototype |
void pke_reset(); |
---|---|
Description |
This routine resets the PKE block. |
Parameters |
None. |
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
None. |
pke_start
Prototype |
void pke_start(uint8_t ien); |
---|---|
Description |
The function starts the PKE block. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
None. |
pke_done_status
Prototype |
uint8_t pke_done_status(uint32_t *status_value); |
---|---|
Description |
The routine is used to check the done status of the PKE block. |
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
None. |
pke_clear_scm
Prototype |
void pke_clear_scm(); |
---|---|
Description |
This routine clears the PKE block’s shared crypto memory (1.e. This routine fills the SCM slot with 0’s). The caller must ensure the PKE engine is idle and not in sleep state (clock gated) before calling this routine. |
Parameters |
None. |
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Valid only for CEC1302 MCU. |
pke_scm_clear_slot
Prototype |
void pke_scm_clear_slot(uint8_t slot_num); |
---|---|
Description |
This routine clears a specified slot in SCM. That is it fills the specified slot in SCM with 0’s. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
None. |
pke_power
Prototype |
void pke_power(uint8_t pwr_on); |
||||||
---|---|---|---|---|---|---|---|
Description |
This routine controls the Gate on/off clocks to PKE block. Before setting PCR PKE sleep enable, write 0 to the PKE control register to stop the engine. |
||||||
Parameters |
|
||||||
Returns |
Nothing. |
||||||
Requires |
Nothing. |
||||||
Notes |
None. |
pke_busy
Prototype |
uint8_t pke_busy(); |
---|---|
Description |
This routine returns the PKE busy status. PKE status register bits are read-only and are cleared upon reading. Reading also clears PKE block interrupt signal. |
Parameters |
None. |
Returns |
|
Requires |
Nothing. |
Notes |
None. |
pke_set_operand_slot
Prototype |
void pke_set_operand_slot(uint8_t operand, uint8_t slot_num); |
---|---|
Description |
This routine sets the slot for the selected operand. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Valid only for CEC1702 MCU. |
pke_get_operand_slot
Prototype |
void pke_get_operand_slot(uint8_t operand); |
---|---|
Description |
This routine returns the slot number for the specified operand. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Valid only for CEC1702 MCU. |
pke_set_operand_slots
Prototype |
void pke_set_operand_slots(uint32_t operand); |
---|---|
Description |
This routine sets the slots for the operand 0, 1, 2. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Valid only for CEC1702 MCU. |
pke_get_slot_addr
Prototype |
uint32_t pke_get_slot_addr(uint8_t slot_num); |
---|---|
Description |
This routine returns the address of the slot in the crypto memory. |
Parameters |
|
Returns |
Nothing. |
Requires |
Address of the slot in the crypto memory. |
Notes |
Valid only for CEC1702 MCU. |
pke_fill_slot
Prototype |
void pke_fill_slot(const uint8_t slot_num, const uint32_t fill_val); |
---|---|
Description |
This routine fills the slot memory with value. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Valid only for CEC1702 MCU. |
pke_write_scm
Prototype |
// for CEC1302 MCU :
void pke_write_scm(uint8_t *pdata, uint16_t num_bytes, uint8_t slot_num, uint8_t reverse_byte_order); // for CEC1702 MCU :void pke_write_scm(const uint8_t *pdata, uint16_t num_bytes, uint8_t slot_num, uint8_t reverse_byte_order); |
---|---|
Description |
This routine is used to write specified amount of data to a specified SCM slot. PKE command register operand size field must be programmed before this routine is called. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
None. |
pke_write_scm32
Prototype |
void pke_write_scm32(uint8_t *pdata, uint16_t num_bytes, uint8_t slot_num, uint8_t reverse_byte_order); |
---|---|
Description |
This routine is used to write specified amount of data to a specified SCM slot as dword. PKE command register operand size field must be programmed before this routine is called. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
Valid only for CEC1702 MCU. |
pke_read_scm
Prototype |
// for CEC1302 MCU :
uint16_t pke_read_scm(uint16_t *dest, uint16_t nbytes, uint16_t slot_num, uint8_t reverse_byte_order); // for CEC1702 MCU :uint16_t pke_read_scm(uint8_t *dest, uint16_t nbytes, uint8_t slot_num, uint8_t reverse_byte_order); |
---|---|
Description |
This routine is used to read specified amount of data from a specified SCM slot. |
Parameters |
|
Returns |
The routine returns the number of bytes copied to the destination. |
Requires |
Nothing. |
Notes |
None. |
modular_arithm
Prototype |
uint8_t modular_arithm(uint8_t op, uint16_t op_bit_len, uint8_t flags); |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Description |
This routine checks if the modular arithmetic operand. |
||||||||||
Parameters |
|
||||||||||
Returns |
The routine returns the number of bytes copied to the destination. |
||||||||||
Requires |
Caller must program operand location using pke_set_operand_slots and program data into operand slots using pke_write_scm. |
||||||||||
Notes |
Valid only for CEC1702 MCU. |
PKE_ists_clear
Prototype |
uint32_t pke_ists_clear(); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Description |
This routine reads and clears Status bit for PKE and the interrupt source bits for PKE block. |
||||||||
Parameters |
None. |
||||||||
Returns |
The routine returns the status result in which :
|
||||||||
Requires |
Caller must program operand location using pke_set_operand_slots and program data into operand slots using pke_write_scm. |
||||||||
Notes |
Valid only for CEC1702 MCU. |
What do you think about this topic ? Send us feedback!