|
RSA BSAFE Cert-C
API Reference
|
Cert-C System Service Provider
The Cert-C System service provider manages memory, operates on memory
blocks and strings, and obtains the time with platform-specific library functions that
are modeled after conventional C library functions. These functions are called directly by Cert-C.
The Cert-C System service provider implements an interface between standard system calls required by the Cert-C library and platform specific system calls. There is only a single
service provider for this service, and it does not need to be initialized. There is no additional
default information.
The header files for this provider originate in Crypto-C and are not included in the
header files lists in this online reference. The functions for this provider are described on this
page; click on any of the function names to jump to the function.
Managing Memory
The Cert-C System service provider manages memory with the
following platform-specific functions:
Function |
Description |
T_malloc |
Allocates a block of memory |
T_realloc |
Changes the length of an allocated block of memory |
T_free |
Frees an allocated block of memory |
Memory Block Operations
The Cert-C System service provider operates on memory blocks with the
following platform-specific functions:
Function |
Description |
T_memcmp |
Compares two blocks of memory |
T_memcpy |
Copies a block of memory |
T_memmove |
Copies a block of memory (the input and output blocks may overlap) |
T_memset |
Sets a block of memory to a given value |
String Operations
The Cert-C System service provider operates on
NUL
-terminated strings with the
following platform-specific functions:
Obtaining the time
The Cert-C System service provider obtains the
time with the following platform-specific function:
Function |
Description |
T_time |
Obtains the current time |
Top
Cert-C System Service Provider Functions
void T_free |
( |
POINTER |
block |
|
) |
; |
|
|
Use the T_free function to free an allocated block of memory.
The value of block must be allocated using
T_malloc, reallocated using
T_realloc, or set to NULL_PTR .
If block is NULL_PTR , T_free performs
no operation. |
Parameters
block |
This input parameter is a block address. |
Returns
Top
POINTER T_malloc |
( |
unsigned int |
len |
|
) |
; |
|
|
Use the T_malloc function to allocate a block of memory
of at least len bytes. The value of len can be
0 , in this case T_malloc returns a valid
non-NULL_PTR value. |
Parameters
len |
This input parameter is the length of the block. |
Returns
If successful, returns the address of the block; otherwise,
returns NULL_PTR if there is insufficient memory. |
Top
int T_memcmp |
( |
POINTER |
firstBlock, |
|
|
POINTER |
secondBlock, |
|
|
unsigned int |
len |
|
) |
; |
|
|
Use the T_memcmp function to compare the first len
of firstBlock and secondBlock. If the value of
len is 0 , T_memcmp returns 0 .
T_memcmp compares the blocks by scanning the blocks, from
lowest address to highest, until a difference is found. The
smaller-valued block is the one with the smaller-valued byte at the point
of difference. If no difference is found, the blocks are equal.
|
Parameters
firstBlock |
This input parameter is the first block of memory. |
secondBlock |
This input parameter is the second block of memory. |
len |
This input parameter is the length of the blocks. |
Returns
< 0 | firstBlock is smaller-valued. |
= 0 | The blocks are equal. |
> 0 | firstBlock is larger-valued |
|
Top
void T_memcpy |
( |
POINTER |
output, |
|
|
POINTER |
input, |
|
|
unsigned int |
len |
|
) |
; |
|
|
Use the T_memcpy function to copy a block of memory. The first
len bytes of input are copied to output.
The value of len can be 0 , in which case output
and input are ignored. The ability to handle overlapping blocks
correctly depends on the implementation, and therefore should be avoided.
For overlapping blocks, use
T_memmove.
|
Parameters
output |
This input/output parameter is the output block. |
input |
This input parameter is the input block. |
len |
This input parameter is the length of the blocks. |
Returns
Top
void T_memmove |
( |
POINTER |
output, |
|
|
POINTER |
input, |
|
|
unsigned int |
len |
|
) |
; |
|
|
Use the T_memmove function to copy a block of memory. The first
len bytes of input are copied to output.
The input and output blocks may overlap.
The value of len can be 0 , in which case
output is undefined.
|
Parameters
output |
This input/output parameter is the output block. |
input |
This input parameter is the input block. |
len |
This input parameter is the length of the blocks. |
Returns
Top
void T_memset |
( |
POINTER |
output, |
|
|
int |
value, |
|
|
unsigned int |
len |
|
) |
; |
|
|
Use the T_memset function to set a block of memory to a
given value. The first len bytes of output are set
to value. If the value of len is 0 ,
output is ignored.
|
Parameters
output |
This input/output parameter is the output block. |
value |
This input parameter is value to which output is set. |
len |
This input parameter is the length of the block. |
Returns
Top
POINTER T_realloc |
( |
POINTER |
block, |
|
|
unsigned int |
len |
|
) |
; |
|
|
Use the T_realloc function to change the size of block
to len. T_realloc allocates a memory block of length
len bytes, copies as many bytes as possible from the old memory
block to the new one, and frees the old block. The address of the new block
can be different from the address of the old block. The value of len
can be 0 , in which case T_realloc returns a valid
NULL_PTR value. On error, block is freed using
T_free. The value of block must be
allocated using T_malloc, reallocated using
T_realloc , or set to NULL_PTR .
If block is NULL_PTR , T_realloc
performs as T_malloc.
|
Parameters
block |
This input parameter is the input block. |
len |
This input parameter is the length of the block. |
Returns
If successful, returns the address of the new block; otherwise, returns
NULL_PTR to indicate an error.
|
Top
int T_strcmp |
( |
char |
*firstString, |
|
|
char |
*secondString |
|
) |
; |
|
|
Use the T_strcmp function to compare
firstString and secondString.
The data in firstString and secondString
must be NUL -terminated. T_strcmp compares the
strings by scanning the strings, from lowest address to highest,
until a difference is found. The smaller-valued string is the one
with the smaller-valued byte at the point of difference. If no difference
is found up to the length of the shortest string, the strings are equal
if they have the same length; otherwise, the longer string has the
larger value. The strings are not considered equal if their lengths differ.
|
Parameters
firstString |
This input parameter is the first string to compare. |
secondString |
This input parameter is the second string to compare. |
Returns
< 0 | firstString's value
is smaller than secondString's value. |
= 0 | firstString's value
is equal to secondString's value. |
> 0 | firstString's value
is greater than secondString's value. |
|
Top
void T_strcpy |
( |
char |
*output, |
|
|
char |
*input |
|
) |
; |
|
|
Use the T_strcpy function to copy all bytes of input,
up to and including the first NUL byte, to output.
|
Parameters
output |
This input/output parameter is the copied string. |
input |
This input parameter is the string to copy. |
Returns
Top
int T_strlen |
( |
char |
*string |
|
) |
; |
|
|
Use the T_strlen function to compute the length of a string
(the number of bytes up to, but not including, the first
NUL byte).
|
Parameters
string |
This input parameter is the input string. |
Returns
Top
void T_time |
( |
UINT4 |
*time |
|
) |
; |
|
|
Use the T_time function to obtain the current time in
seconds since 12:00 a.m. GMT, January 1, 1970, storing the result
in time.
Note: Cert-C expects this function to be used
to write the time into the provided UINT4 parameter. On some platforms,
the standard time() system function call may write more bytes than are
present in a UNIT4 . If the input time pointer is passed
directly to the system time() function, verify that the size
is correct.
|
Parameters
time |
This output parameter is the current time. |
Returns
Top
RSA BSAFE® Cert-C 2.7 API Reference