Main Page | Data Structures | File List | Data Fields | Globals

sec-game.h File Reference


Detailed Description

This is the security library header file that interfaces to the smart card.

This header file provides access to smart-card functions for the game to access.

Author:
Rod Boyce
Date:
06/12/04

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  tsSMARTCARD_INFO

Enumerations

enum  teSECURITY_GENERIC {
  SEC_3DES_KEY_SIZE = 24,
  sw1LeWarning = 0x61
}
enum  teSECURITY_CLASS { SEC_CLASS = 0x80 }
enum  teSECURITY_INST {
  SEC_SET_SESSION_ID = 0x00,
  SEC_AUTHENTICATE_FPGA = 0x02,
  SEC_GET_SESSION_KEY = 0x04,
  SEC_SET_SESSION_KEY = 0x06,
  SEC_SET_SECRET_KEY = 0x08,
  SEC_ZERO_COUNTERS = 0x0a,
  SEC_READ_COUNTERS = 0x0c
}

Functions

int sec_OpenSmartCard (tsSMARTCARD_INFO *psSmartCard, BYTE bKeyId, BYTE *abKey, int zlKeySize)
 Open the smart card and enable security.

int sec_CloseSmartCard (tsSMARTCARD_INFO *psSmartCard)
 Close the smart card comms channel.

int sec_AuthFpga (tsSMARTCARD_INFO *psSmartCard, unsigned char *pabData, int zLen)
 Send a packet of data ot the FPGA and return the response,.

char * sec_GetZcbriErorStr (ZCBCIRET tRv)
 Return the error code from a ZCBRI fn in string form.

char * sec_GetZccriErorStr (ZCCRIRET tRv)
 Convert an error code form a ZCCRI function to string form.

int sec_SetSessionId (tsSMARTCARD_INFO *psSmartCard, unsigned long CurSessionId)
 Use by the application to set a session ID for communicating with the smart card.

int sec_GetDesSessionKey (tsSMARTCARD_INFO *psSmartCard, LONG lIdx, BYTE *pabDesKeyBuf)
 get a DES session key from the smart card


Variables

unsigned char abKeyGame [8]


Enumeration Type Documentation

enum teSECURITY_CLASS
 

Enumeration values:
SEC_CLASS  The security class id

enum teSECURITY_GENERIC
 

Enumeration values:
SEC_3DES_KEY_SIZE 
sw1LeWarning 

enum teSECURITY_INST
 

Enumeration values:
SEC_SET_SESSION_ID  The Instruction number to set the session ID
SEC_AUTHENTICATE_FPGA  The instruction to authenticate the FPGA
SEC_GET_SESSION_KEY  Retrieve a session key from the smart card
SEC_SET_SESSION_KEY  Set a session key with this instruction ID
SEC_SET_SECRET_KEY  Set the secret key
SEC_ZERO_COUNTERS  Reset the admin counters to 0
SEC_READ_COUNTERS  Read the admin counters


Function Documentation

int sec_AuthFpga tsSMARTCARD_INFO psSmartCard,
unsigned char *  pabData,
int  zLen
 

Send a packet of data ot the FPGA and return the response,.

Given a block of data send that to the FPGA and send the reply back to the calling applicaiton. The basic declaration for this command is: Command &H80 &H02 AuthFPGA( SessionId As Long, FpgaData As String*8 )

Date:
02/11/04
Author:
Rod Boyce
Parameters:
psSmartCard - pointer to the smart card structure
pabData - pointer to the block of data to send to the smart card.
zLen - the nu,ber to bytes to send
Returns:
0 on success anything else on failure

History

Here is the call graph for this function:

int sec_CloseSmartCard tsSMARTCARD_INFO psSmartCard  ) 
 

Close the smart card comms channel.

Given the reader and the card infomation close the channel to that smart card.

Date:
02/12/04
Author:
Rod Boyce
Parameters:
psSmartCard - pointer to the smart card structure
Returns:
0 on success and anything els eon failure

History

Here is the call graph for this function:

int sec_GetDesSessionKey tsSMARTCARD_INFO psSmartCard,
LONG  lIdx,
BYTE *  pabDesKeyBuf
 

get a DES session key from the smart card

This command is called from the game to obtain DES session keys to decrypt encrypted game data. There is not restriction on the number of different keys except the size of the storage space in the smart card. The basic declaration is: Command &H80 &H06 GetSessionKey( SessionId As Long, Indx As Byte, SessionKey As Des3Key )

Date:
03/12/04
Author:
Rod Boyce
Parameters:
psSmartCard - pointer to the smart card structure
lIdx - The index of the session key to get from the smart card
pabDesKeyBuf - a pointer to the buffer to store the 3DES key in this MUST be 24 bytes
Returns:
0 for success anything else on failure
Note:
The DESkey buffer pointer is not checked for size if MUST be big enough to store the return value from the smart card. A 3DES key is 24-bytes or 192-bits.

Basic arrays are 1 based but arrays in C are 0 based this code will do on checking on the array size the basic card will return and error code and require resetting if the requested value is out of range.

History

Here is the call graph for this function:

char* sec_GetZcbriErorStr ZCBCIRET  tRv  ) 
 

Return the error code from a ZCBRI fn in string form.

Date:
02/12/04
Author:
Rod Boyce
Parameters:
tRv - An error code
Returns:
pointer to a string form of the error code.

History

Error codes returned by the ZcBri library calls

char* sec_GetZccriErorStr ZCCRIRET  tRv  ) 
 

Convert an error code form a ZCCRI function to string form.

Date:
02/12/04
Author:
Rod Boyce
Parameters:
tRv - Error code
Returns:
pointer to a string of the error code

History

Error codes returned by the ZCCri library calls

int sec_OpenSmartCard tsSMARTCARD_INFO psSmartCard,
BYTE  bKeyId,
BYTE *  abKey,
int  zlKeySize
 

Open the smart card and enable security.

Firstly connect to the Reader and then connect to the smart card. Once this is established enable security on the smart card channel.

Date:
01/12/04
Author:
Rod Boyce
Parameters:
psSmartCard - pointer to the smart card structure
bKeyId - The key number to set
abKey - Pointer to the encryption key to use
zlKeySize - The number of bytes in the encryption key
Returns:
0 on success and anything else on failure.

History

Here is the call graph for this function:

int sec_SetSessionId tsSMARTCARD_INFO psSmartCard,
unsigned long  CurSessionId
 

Use by the application to set a session ID for communicating with the smart card.

This is called at the initiation of communications with the smart card it is passed to as an extra parameter to the smart card if this value changes then the smart card will reject any further communication requests The basic declaration for this command is: Command &H80 &H00 SetSessionId( SessionId As Long )

Date:
02/12/04
Author:
Rod Boyce
Parameters:
psSmartCard - pointer to the smart card structure
CurSessionId - a 32-bit value that makes up a session id from the application
Returns:
0 on success anything else indicates a failure

History

Here is the call graph for this function:


Variable Documentation

unsigned char abKeyGame[ 8 ]
 

This key is the general key used by the game application for authentication and retrevial of encrypted session keys.


Generated on Thu Jan 20 16:17:37 2005 for Axis smart-card FPGA authentication scheme by doxygen 1.3.6