HSM Functions Reference

The Luna FM SDK package has a number of libraries that are required to use the functionality provided to the FM. This section provides information on these functions and the libraries that provide the function set.

Apart from the functions described in this section, the full set of PKCS#11 functions are also available to the FM. The PKCS#11 functions are described in the Cprov Programmer Manual, and the PKCS#11 standard. The library libfmcprov.a provides the PKCS#11 functions.

The HSM Functions section contains reference material for the following functions:

>Message Streaming Functions

>HIFACE Reply Management Functions

>Functionality Module Dispatch Switcher Functions

>FM Support Functions

>Serial Communication Functions

>High Resolution Timer Functions

>Current Application ID functions

> PKCS#11 State Management Functions

>FM Header Definition Macro

Subset of ISO C99 standard library

The FM SDK supports a subset of the ISO C 99 standard library as defined by ISO/IEC 9899:1999.  In general, floating point math, multibyte character, localization and I/O APIs are not supported.  printf and vprintf are exceptions and are redirected to the logging channel.

In addition to the standard library, C99 language features not present in ANSI C (C89/90) can be used.

The following functions are provided by libfmcrt.a:

assert.h assert
ctype.h

tolower, toupper

stdio.h

printf, sprintf, sscanf, vprintf, vsprintf, snprintf, vsnprintf, vsscanf

stdarg.h

va_arg(), va_start(), va_end(), va_copy()

stdlib.h

abs, atoi, atol, atoll, bsearch, calloc, div, free, labs, llabs, ldiv, lldiv, malloc,, realloc, strtol, strtoll, strtoull, stroul

string.h

memchr, memcmp, memcpy, memmove, memset, strcat, strchr, strcmp, strcpy, strcspn, strlen, strncat, strncmp, strncpy, strrchr, strspn, strstr, strerror, strtok 

time.h

asctime, clock, ctime, gmtime, localtime, mktime, strftime, time, difftime, clock, gettime

Unsupported Standard C APIs

The following standard headers and their contained APIs are not supported by the FM SDK:

>comple.h

>fenv.h

>float.h

>locale.h

>math.h

>signal.h

>tgmath.h

>wchar.h

>wctype.h

Request/Reply Message management functions

The following functions are provided by libfmsupt.a:

>SVC_GetReplyBuffer

>SVC_ConvertReqToReply

>SVC_SendReply

>SVC_ResizeReplyBuffer

>SVC_DiscardReplyBuffer

>SVC_GetUserReplyBuffLen

>SVC_GetRequest

>SVC_GetRequestLength

>SVC_GetReply

>SVC_GetReplyLength

High Precision Timers

>THR_UpdateTiming  

>THR_BeginTiming

Register Functionality module Custom handler function

The following functions are provided by libfmsupt.a :

>FMSW_RegisterRandomDispatch

>FMSW_RegisterStreamDispatch

Serial communication functions

The following functions are provided by libfmsupt.a :

>SERIAL_GetNumPorts

>SERIAL_Open

>SERIAL_Close

>SERIAL_InitPort

>SERIAL_SendData

>SERIAL_WaitReply

>SERIAL_RecieveData

>SERIAL_FlushRX

>SERIAL_GetControlLines

>SERIAL_SetControlLines

>SERIAL_SetMode

USB Access functions

NOTE   There is no direct USB support at this time.

Support Functions

>FM_GetNDRandom

>FM_AddToExtLog

>FM_GetCurrentAppId

>FM_SetCurrentAppId

>FM_GetHsmInfo