NXP Reader Library  v17.1.0.2535

Compile switches used to find the optimum trade-off between performance, memory footprint and supported features. More...

Collaboration diagram for Compile Switch:

Macros

#define PH_CRYPTOSYM_SW_DES
 Enables DES support. More...
 
#define PH_CRYPTOSYM_SW_AES
 Enables AES support. More...
 
#define PH_CRYPTOSYM_SW_ONLINE_KEYSCHEDULING
 Enables online key scheduling. More...
 
#define PH_CRYPTOSYM_SW_ONLINE_CMAC_SUBKEY_CALCULATION
 Enables online CMAC SubKey calculation. More...
 
#define PH_CRYPTOSYM_SW_ROM_OPTIMIZATION
 Enables ROM optimizations in the AES algorithm. More...
 
#define PH_CRYTOSYM_SW_FAST_RAM
 Enables 8051 data storage specifier. More...
 
#define PH_CRYPTOSYM_SW_CONST_ROM
 ROM specifier - not set per default.
 
#define PH_CRYPTOSYM_SW_MAX_BLOCK_SIZE   PH_CRYPTOSYM_AES_BLOCK_SIZE
 Maximum Block Size of the currently supported ciphers.
 
#define PH_CRYPTOSYM_MAX_BLOCK_SIZE   PH_CRYPTOSYM_SW_MAX_BLOCK_SIZE
 Maximum Block Size of the currently supported ciphers.
 
#define PH_CRYPTOSYM_SW_KEY_BUFFER_SIZE   32U
 Maximum Key buffer Size of the currently supported ciphers.
 

Detailed Description

Compile switches used to find the optimum trade-off between performance, memory footprint and supported features.

Macro Definition Documentation

◆ PH_CRYPTOSYM_SW_DES

#define PH_CRYPTOSYM_SW_DES

Enables DES support.

Defines that the DES algorithm is supported. The defines for general DES capabilities like block sizes etc. are not affected as they do not add to the memory footprint.

◆ PH_CRYPTOSYM_SW_AES

#define PH_CRYPTOSYM_SW_AES

Enables AES support.

Defines that the AES algorithm is supported. The defines for general AES capabilities like block sizes etc. are not affected as they do not add to the memory footprint.

◆ PH_CRYPTOSYM_SW_ONLINE_KEYSCHEDULING

#define PH_CRYPTOSYM_SW_ONLINE_KEYSCHEDULING

Enables online key scheduling.

This define enables for both AES and DES the online key scheduling. This means, that the round keys are not pre-calculated at key loading, but they are always calculated when a new block is going to be encrypted or decrypted.

The following advantages come out of enabling online key scheduling:

  • The pKey entry of the private data param structure decreases significantly from 384(DES enabled)/256(DES disabled) to 32 bytes.
  • As the private data structure has to be created for each instance, the above mentioned savings count for each instance.
  • Key loading is very fast (as there is almost nothing performed any more.
  • On 8051 the keys can be located in fast RAM which counters some of the performance decrease compared to disabling that feature.

The following disadvantages come out of enabling online key scheduling:

  • Encryption gets slower as in addition to the ciphering also the round key generation has to be performed.
  • For decryption in AES the situation is even worse, as the key scheduling is executed twice for each decryption.
  • On small platforms like 8051 big key buffers can never reside in fast RAM as they exceed the memory size of data and data.

On 8051 platforms in combination with the PH_CRYPTOSYM_SW_USE_8051_DATA_STORAGE enabling online key scheduling even gives better results on execution time if only 1 or 2 blocks are encrypted with a given key. In case of keys are used longer (which is most likely the standard case), it is faster to disable that feature. Also note, that e.g. for a MIFARE Plus (R) instance of the library, two crypto instances are required, and as a consequence online key scheduling can save 704(DES enabled)/(DES disabled)448 bytes of RAM.

◆ PH_CRYPTOSYM_SW_ONLINE_CMAC_SUBKEY_CALCULATION

#define PH_CRYPTOSYM_SW_ONLINE_CMAC_SUBKEY_CALCULATION

Enables online CMAC SubKey calculation.

This define enables for both AES and DES the online CMAC SubKey calculation. This means, that the CMAC SubKeys are not stored in the context of the individual instance of the crypto lib, but they are newly calculated for each MAC.

The following advantages come out of enabling online CMAC SubKey calculation:

  • 32 bytes of RAM can be saved in the private DataParams (so they are saved on each instance of the crypto library).

The following disadvantages come out of online CMAC SubKey calculation:

  • Each CMAC calculation needs 1 additional encryption and 2 additional shift operations, so the execution speed decreases.

◆ PH_CRYPTOSYM_SW_ROM_OPTIMIZATION

#define PH_CRYPTOSYM_SW_ROM_OPTIMIZATION

Enables ROM optimizations in the AES algorithm.

This define removes some of the lookup tables in the AES implementation to save ROM space.

The following advantages come out of enabling ROM optimizations:

  • 3 lookup tables of 256 bytes can be saved (some additional code is needed, so in fact only ~600 bytes are saved).

The following disadvantages come out of enabling ROM optimizations:

  • The MixColumn and MixColumnInv implementation of the AES are getting slower.

◆ PH_CRYTOSYM_SW_FAST_RAM

#define PH_CRYTOSYM_SW_FAST_RAM

Enables 8051 data storage specifier.

This define allows to specify any value for PH_CRYTOSYM_SW_FAST_RAM. It takes care, that the buffers are recopied correctly, and that most of the time consuming calculations are done on this fast memory. In case of PH_CRYPTOSYM_SW_ONLINE_KEYSCHEDULING is set, even the key scheduling can be performed on this fast memory. Fast RAM specifier - not set per default