3.2.6.6 ECC System Service

The ECC Service provides APIs to execute the following functionality:

  1. Reading the Serial number from the ECC-608 device.
  2. Reading the certificate – device/ signer/ root.
  3. Switching between TrustNGo and TrustFlex ECC-608 devices on the RNWF11 Add On Board.
  4. Writing into a Slot in the ECC-608 device.
  5. Reading from a Slot.

The RNWF11 provides the configuration options for ECC System Service.

RNWF Supported ECC608 Variants – From the dropdown list, choose the required secure device. Available options are:
  • TNGTLS
  • TFLEX
Figure 3-49. ECC System Service MCC Configuration
The ECC-608 Service API prototype is as follows:
RNWF_RESULT_t RNWF_ECC_SrvCtrl(RNWF_ECC_SERVICE_t request, void *input);

The following table lists the RNWF11 services and reports the results to the application over the return code.

Table 3-27. System Service Options Table
Option/CommandInputRemarks
RNWF_ECC_RD_SERNoneReads the Serial Number from the ECC device
RNWF_ECC_WR_DEV_TYPEDevice TypeSwitches to TrustNGo or TrustFlex
RNWF_ECC_RD_CERTCertificate Type, No of Bytes to readReads the n bytes from the certificate – device/ signer/ root and lets the user know about the remaining bytes
RNWF_ECC_WR_SLOTSlot, Offset, Length, DataWrites the data into the ‘Data’ Zone of the slot number provided by the user
RNWF_ECC_WR_ZONE_SLOTZone, Slot, Offset, Length, DataWrites the ‘Data’ into the Zone and the slot number provided by the user
RNWF_ECC_RD_SLOTSlot, Offset, LengthReads the data into the buffer from the ‘Data’ Zone of the slot number provided by the user
RNWF_ECC_RD_ZONE_SLOTZone, Slot, Offset, LengthReads the data into the buffer from the Zone and the slot number provided by the user
Following is an example of reading a certificate from the ECC device.
RNWF_ECC_CERT_CFG_t cert_cfg;
int main(void)
{            
memset(&cert_cfg, 0, sizeof(cert_cfg));
        cert_cfg.cert_type = 1; //Device certificate
        cert_cfg.length = 1000; //Number of bytes to be read
        RNWF_ECC_SrvCtrl(RNWF_ECC_RD_CERT, &cert_cfg);
        printf("Bytes Read %d ; Bytes Remaning = %d\r\n", cert_cfg.bytes_read, cert_cfg.remaining_bytes);
        printf("Cert:%s\r\n", cert_cfg.cert);
}
Following is an example of reading data from the ECC device slot.
int main(void)
{            
	RNWF_ECC_SLOT_CFG_t slot_cfg;
        memset(&slot_cfg, 0, sizeof(slot_cfg));
        slot_cfg.length = 16;
        slot_cfg.offset = 0;
        slot_cfg.slot_num = 8;
        slot_cfg.zone_type = 2;
        RNWF_ECC_SrvCtrl(RNWF_ECC_RD_ZONE_SLOT, &slot_cfg);
        printf("Slot Data:%s\r\n", slot_cfg.data);                        
}