User manual

NXP Semiconductors
UM10663
NXP Reader Library User Manual
UM10663
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2013. All rights reserved.
User Manual
COMPANY PUBLIC
Rev. 1.224 July 2013
257412
30 of 47
*pKeyStoreDataParams: pointer to the underlaying KeyStore parameter structure.
returnValues:
PH_ERR_SUCCESS
- operation successful.
PH_ERR_INVALID_DATA_PARAMS
wSizeOfDataParams
does not agree with defined size of AL
MFC component.
2.4.2 MF Authentication
- phalMfc_Authenticate()
This function loads a key from the key store area of PCD’s EEPROM into the Key buffer.
Then it performs entire procedure of three pass Authentication to the given EEPROM
block of the card. If Authentication passes through all the three phases successfully, then
the EEPROM block is fully accessible for data manipulation MIFARE Classic commands:
reading, writing, increment, decrement, restore and data transfer. Once access to block
is obtained, access to entire section (4 blocks) retains until next attempt to authenticate
to any EEPROM block of card. This function integrates two functions: . In case of
authentication by “software” defined key - out of PCD key storage area use
phhalHw_Rc663_Cmd_LoadKey()
function (section 2.1.4) to load the key into the Key buffer
and subsequently function
phhalHw_Rc663_MfcAuthenticate_Int()
(section 2.1.6) to
authenticate.
This function could be divided into two branches:
Software key store branch: unfortunately contains functions with de facto no executable
source code.
EEPROM key store: utilizes
phhalHw_Rc663_Cmd_LoadKeyE2
to load a key from EEPROM
into crypto unit then executes MIFARE three pass Authentication.
phStatus_t phalMfc_Authenticate(
void * pDataParams, [In]
uint8_t bBlockNo, [In]
uint8_t bKeyType, [In]
uint16_t wKeyNumber, [In]
uint16_t wKeyVersion, [In]
uint8_t *pUid, [In]
uint8_t bUidLength ); [In]
*pDataParams: pointer to the MIFARE Classic AL layer data parameter structure.
pDataParams->pKeyStoreDataParams == NULL
to run EEPROM key store branch. Otherwise
bodyless functions from the Software Key store branch run and authentication has no
effect.
bBlockNo: number of block in EEPROM of card to authenticate to. Authentication to
block enables access to entire section which the block is part of.
bKeyType: can be either
PHAL_MFC_KEYA
or
PHAL_MFC_KEYB
. Each block can be
authenticated by using anyone of these two keys specified for that block.[2]
wKeyNumber: key number from the PCD’s EEPROM to be used in authentication.
RC663 has key storage area of volume of 1024 bytes. This variable has no special
predefined match with block number of the MIFARE card. Developer must to manage
storing of the keys responsibly (by reliable system) to avoid later mismatch in
authentication.