123456789101112131415161718192021222324252627282930313233343536 |
- // Read Small User Zone
- //
- // The Read Small User Zone function is used to read data from CryptoMemory devices that
- // have 256 bytes or less in each user zone (AT88SC3216C, and smaller)
- // CryptoMemory Library Include Files
- #include "CM_LIB.h"
- #include "CM_I2C.h"
- #include "CM_I2C_L.h"
- #include "CM_GPA.h"
- // Read Small User Zone
- uint8_t cm_ReadSmallZone(uint8_t ucCryptoAddr, uint8_t* pucBuffer, uint8_t ucCount)
- {
- uint8_t ucReturn;
- ucCM_InsBuff[0] = 0xb2;
- ucCM_InsBuff[1] = 0;
- ucCM_InsBuff[2] = ucCryptoAddr;
- ucCM_InsBuff[3] = ucCount;
- // Two bytes of the command must be included in the polynominals
- cm_GPAcmd2(ucCM_InsBuff);
-
- // Read the data
- if ((ucReturn = cm_ReadCommand(ucCM_InsBuff, pucBuffer, ucCount)) != SUCCESS) return ucReturn;
-
- // Include the data in the polynominals and decrypt it required
- cm_GPAdecrypt(ucCM_Encrypt, pucBuffer, ucCount);
- // Done
- return SUCCESS;
- }
|