User manual

106
The example above shows that the CHARON core is not obliged to support the indicated
operation. It also shows why the loadable component instance must retain the chapi_in
descriptor.
4.23 Encrypting critical data
The operation of encrypting protected data belongs to the class of operations called
“Protection and license verification”. The CHARON core enables the component
encrypting critical data. Both the CHARON core and the loadable component may initiate
such an operation, but only the emulator can be a target.
In order to perform the operation, the initiator invokes a routine identified by the
encrypt_data_block field of the chapi_in descriptor. The initiator provides a buffer containing
critical data. The length of the buffer (in bytes) must be a multiple of 8. The buffer’s
address and length are indicated by buf and len arguments respectively. Encrypted data
will overwrite originally supplied data in buffer buf. The procedure is invoked as follows:
const chapi_in * ci = …;
if (ci->encrypt_data_block) {
ci->encrypt_data_block(ci, buf, len);
}
The example above shows that the CHARON core is not obliged to support the indicated
operation. It also shows why the loadable component instance must retain the chapi_in
descriptor.
4.24 Decrypting critical data
The operation of decrypting protected data belongs to the class of operations called
“Protection and license verification”. The CHARON core enables the component
decrypting encrypted data. Both the CHARON core and the loadable component may
initiate such an operation, but only the emulator can be a target.
In order to perform the operation, the initiator invokes a routine identified by the
decrypt_data_block field of the chapi_in descriptor. The initiator provides a buffer containing
encrypted data. The length of the buffer (in bytes) must be a multiple of 8. The buffer’s
address and length are indicated by buf and len arguments respectively. Decrypted data
will overwrite originally supplied data in buffer buf. The procedure is invoked as follows:
const chapi_in * ci = …;
if (ci->decrypt_data_block) {
ci->decrypt_data_block(ci, buf, len);
}
The example above shows that the CHARON core is not obliged to support the indicated
operation. It also shows why the loadable component instance must retain the chapi_in
descriptor.