globalplatform
Data Structures | Functions
util.h File Reference
#include "globalplatform/types.h"
#include "globalplatform/library.h"
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TLV
 

Functions

OPGP_NO_API LONG read_TLV (PBYTE buffer, DWORD length, TLV *tlv)
 Reads a TLV struct from the given buffer. More...
 
OPGP_NO_API DWORD convert_byte (BYTE b)
 Converts a ISO 7816-4 Le Byte into its value. More...
 
OPGP_NO_API DWORD get_short (PBYTE buf, DWORD offset)
 Returns an unsigned short int from the given position. More...
 
OPGP_NO_API DWORD get_int (PBYTE buf, DWORD offset)
 Returns an unsigned int from the given position. More...
 
DWORD get_number (PBYTE buf, DWORD offset, BYTE numLength)
 Returns an unsigned int from the given position by taking just numLength bytes starting at offset into account. More...
 
OPGP_NO_API LONG parse_apdu_case (PBYTE apduCommand, DWORD apduCommandLength, PBYTE caseAPDU, PBYTE lc, PBYTE le)
 Parse the APDU case.
 

Detailed Description

This file contains all GlobalPlatform utility functionality.

Function Documentation

◆ convert_byte()

OPGP_NO_API DWORD convert_byte ( BYTE  b)

Converts a ISO 7816-4 Le Byte into its value.

Parameters
b[in] The Le BYTE.
Returns
Value of b.

◆ get_int()

OPGP_NO_API DWORD get_int ( PBYTE  buf,
DWORD  offset 
)

Returns an unsigned int from the given position.

Parameters
buf[in] The buffer.
offset[in] The offset in the buffer.
Returns
the unsigned int value.

◆ get_number()

DWORD get_number ( PBYTE  buf,
DWORD  offset,
BYTE  numLength 
)

Returns an unsigned int from the given position by taking just numLength bytes starting at offset into account.

Parameters
buf[in] The buffer.
offset[in] The offset in the buffer.
numLengthThe length of the number.
Returns
the unsigned int value.

◆ get_short()

OPGP_NO_API DWORD get_short ( PBYTE  buf,
DWORD  offset 
)

Returns an unsigned short int from the given position.

Parameters
buf[in] The buffer.
offset[in] The offset in the buffer.
Returns
the unsigned short int value.

◆ read_TLV()

OPGP_NO_API LONG read_TLV ( PBYTE  buffer,
DWORD  length,
TLV tlv 
)

Reads a TLV struct from the given buffer.

The tag must be coded on at most two octet and the length must be < 65535.

Parameters
buffer[in] The buffer.
length[in] The length of the buffer.
*tlv[out] the returned TLV struct.
Returns
-1 in case of error, consumed length otherwise.