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

sec-admin.c File Reference


Detailed Description

This is the security library that interfaces to the admin fn's on the smart card.

This module will provide access to the administration functions on the smart-card. the smart card mush be opened with the admin security key otherwise an error will be returned and the smart card will have to be reset. These admin functions provide the ability to write session keys to the smart card, write a secret key to the smart card, and read / reset the authentication counters on the smart card.

Note:
THIS LIBRARY SHOULD NEVER BE SHIPPED WITH A GAME OTHERWISE THE GAME COULD BE COMPROMISED
Author:
Rod Boyce
Date:
06/12/04

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zccri.h>
#include <zcbci.h>
#include "key-admin.h"
#include "sec-game.h"
#include "sec-admin.h"

Include dependency graph for sec-admin.c:

Include dependency graph

Defines

#define _GNU_SOURCE

Functions

int sec_AdminSetDesSessionKey (tsSMARTCARD_INFO *psSmartCard, LONG lIdx, BYTE *pabDesKeyBuf)
 set a DES session key on the smart card

int sec_AdminSetSecretKey (tsSMARTCARD_INFO *psSmartCard, BYTE *pabSecKeyBuf)
 Set the secret key on the smart card.

int sec_AdminZeroAuthCntrs (tsSMARTCARD_INFO *psSmartCard)
 Zero out the authentication counters.

int sec_AdminReadAuthCntrs (tsSMARTCARD_INFO *psSmartCard, LONG *plFailure, LONG *plSuccess)
 Read the auth counters from the smart card.


Variables

unsigned char abKeyAdmin [8] = { 0xc7, 0xd6, 0xea, 0x9b, 0xb7, 0x96, 0x39, 0xeb }

Define Documentation

#define _GNU_SOURCE
 


Function Documentation

sec_AdminReadAuthCntrs tsSMARTCARD_INFO psSmartCard,
LONG *  plFailure,
LONG *  plSuccess
 

Read the auth counters from the smart card.

Read the auth counters from the smart card. These counters only indicate comms failures in comms to the smart card. The basic declaration is: Command &H80 &H0c ReadCounters( SessionId As Long, Failure As Long, Success As Long )

Date:
07/12/04
Author:
Rod Boyce
Parameters:
psSmartCard - pointer to the smart card structure
plFailure - pointer to a long value to store the failure count in.
plSuccess - pointer to a long value to store the number of success
Returns:
0 on success anything else is a failure

History

Here is the call graph for this function:

sec_AdminSetDesSessionKey tsSMARTCARD_INFO psSmartCard,
LONG  lIdx,
BYTE *  pabDesKeyBuf
 

set a DES session key on the smart card

This command is called from the admin interface to set a DES session key. The key is firstly encrypted with the FPGA hardware key. The basic declaration is: Command &H80 &H04 SetSessionKey( SessionId As Long, Indx As Long, 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 a buffer that contains the 3DES key.
Returns:
0 for success anything else on failure

History

Here is the call graph for this function:

sec_AdminSetSecretKey tsSMARTCARD_INFO psSmartCard,
BYTE *  pabSecKeyBuf
 

Set the secret key on the smart card.

This function will set the secret key to a known value on the smart card. This key is stored in pllain text on the smart card. The basic declaration is: Command &H80 &H08 SetSecretKey( SessionId As Long, Magic As Long, SessionKey As Des3Key )

Date:
06/12/04
Author:
Rod Boyce
Parameters:
psSmartCard - pointer to the smart card structure
pabSecKeyBuf - Pointer to the secret key used for verifing the FPGA.
Returns:
0 on success anything else a failure

History

Here is the call graph for this function:

sec_AdminZeroAuthCntrs tsSMARTCARD_INFO psSmartCard  ) 
 

Zero out the authentication counters.

This function is an admin function to reset the auth counters. The counters are FPGA success and failure counters from the smart cards view. The failure counter only increments if there is a comms failure. The basic declaration is: Command &H80 &H0a ZeroCounters( SessionId As Long )

Date:
06/12/04
Author:
Rod Boyce
Parameters:
psSmartCard - pointer to the smart card structure
Returns:
0 on success anything else a failure

History

Here is the call graph for this function:


Variable Documentation

unsigned char abKeyAdmin[ 8 ] = { 0xc7, 0xd6, 0xea, 0x9b, 0xb7, 0x96, 0x39, 0xeb }
 

This key is the administration key used to store session keys and the secret key


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