43.3.4.5 Fast Copy/Clear
Purpose
This service performs a copy from a memory area to another or a memory area clear.
How to Use the Service
Description
This service copies a number X into another number R, padding with zero on the MSB side up to the length specified for R.
R = X
If the lengths of R and X are equal, a complete fast copy is processed.
If the length of R is strictly greater than the length of X, X is first copied in the Low Significant Bytes side of R, and R is padded with zeros on the Most Significant Bytes side.
If the pointer on the X area equals zero, R is filled with zeros. This operation can also be made by using the Fill service (see Fill).
The service name for this operation is
FastCopy
.
Parameters Definition
This service can easily be accessed through the use
of the PUKCL_FastCopy()
macro.
Parameter | Type | Direction | Location | Data Length | Before Executing the Service | After Executing the Service |
---|---|---|---|---|---|---|
nu1XBase | nu1 | I | Crypto RAM | u2XLength | Base of X | Base of X number untouched |
nu1RBase | nu1 | I | Crypto RAM | u2RLength | Base of R | Base of R filled with X |
u2RLength | u2 | I | – | – | Length of R | Length of R |
u2XLength | u2 | I | – | – | Length of X | Length of X |
Code Example
PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// Initialize parameters
PUKCL_FastCopy(nu1XBase) = <Base of the X number>;
PUKCL_FastCopy(nu1RBase) = <Base of the R number>;
PUKCL_FastCopy(u2XLength) = <Length of the X number>;
PUKCL_FastCopy(u2RLength) = <Length of the R number>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library...
vPUKCL_Process(FastCopy,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
{
...
}
else // Manage the error
Constraints
The parameter placements that are not allowed are are as follows.
If nu1XBase equals zero, no checks are made on nu1XBase (fixed) and u2XLength (unused).
The following conditions must be avoided to ensure that the service works correctly:
- nu1XBase or nu1RBase are not aligned on 32-bit boundaries
- u2XLength or u2RLength is either: <4, >0xffc or not a 32-bit length or u2XLength >u2RLength
- {nu1XBase, u2XLength} or {nu1RBase, u2RLength} do not entirely lie in Crypto RAM
- {nu1XBase, u2XLength} overlaps {nu1RBase,u2RLength}
Status Returned Values
Returned status | Importance | Meaning |
---|---|---|
PUKCL_OK | – | Service functioned correctly |