Multos Forums

   

hardcoded limit for in/output data size for the apdu commands?

Rank

Total Posts: 2

Joined 2013-01-30

PM

Is there a hardcoded limit for in/output data size for the apdu commands when using multos cards. We are using a ML3-36k-r1 and all output data is truncated to 255 bytes.

From my understanding of the cards should be able to consume/produce more data than 255 as in/output.

Thanks,
Eske

     
RankRankRank

Total Posts: 74

Joined 2012-02-21

PM

You can check the maximum TPDU sizes for the product by looking at the MIR. This is the M3 MIR entry.

It is possible to return more than 255 bytes from the application and use multiple GET RESPONSE commands to recover the data. Here is an example application that returns 272 bytes of data.

#pragma attribute("aid", "f0 00 00 A1")
#pragma attribute("dir", "61 10 4f 4 f0 00 00 A1 50 8 54 65 73 74 20 61 70 70")

#include <multoscomms.h>
#include <string.h>

#define ERR_OK          0x9000
#define ERR_WRONGCLASS  0x6402
#define ERR_BAD_INS     0x6404

#define CMD_RANDOM      0x10
#define MYAPP_CLA       0x70

#pragma melpublic
char randdata[272];

#pragma melstatic
char buff[8];

void
main
(void)
{
  int i
;

  if (
CLA != MYAPP_CLA)
    
ExitSW(ERR_WRONGCLASS);

  switch (
INS)
    
{
    
case CMD_RANDOM:
      if (!
CheckCase(1))
        
ExitSW(ERR_WRONGCLASS);

   for(
i=0;i<34;++)
   
{
    
// Generate 8 bytes of random data
    
__code(PRIM,0xC4);

    
// Store to buffer
    
__code (STORE__typechk(char *, buff), 8);

    
// Copy to public
    
memcpy(randdata+(i*8),buff,8);
   
}

   
// Mark first and last 8 bytes
   
memset(randdata,0xCC,8);
   
memset(randdata+264,0xDD,8);
      
      
ExitLa(272);

    default:
      
ExitSW(ERR_BAD_INS);
  
}

To generate and read the random data, the APDU sequence is as follows (expected Status Words returned are in brackets):


70100000 (6100)
00C00000FF (6111)
00C0000011 (9000)

At present, the maximum amount of data you can return like this is equal to the size of the Public data area.