API  2.2
TSmarT Software Library
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions

Functions

void aes_encrypt (unsigned char *state, unsigned char *key)
 AES128 encryption: Given AES128 key and 16 bytes plain text, cipher text of 16 bytes is computed. The AES implementation is in mode ECB (Electronic Code Book). More...
 
void aes_decrypt (unsigned char *state, unsigned char *key)
 AES128 decryption: Given AES128 key and 16 bytes cipher text, plain text of 16 bytes is computed The AES implementation is in mode ECB (Electronic Code Book). More...
 
signed long aes_read_key (unsigned char *key)
 Reads AES128 key from EEPROM Reads the AES128 key from fileID #12 in EEPROM returns an error if the key does not exist. More...
 
signed long aes_write_key (unsigned char *key)
 writes AES128 key from EEPROM Writes the AES128 key to fileID #12 in EEPROM More...
 
void expandKey (unsigned char *expandedKey, unsigned char *key)
 expend a 16 bytes key for AES128 implementation More...
 
unsigned char galois_mul2 (unsigned char value)
 multiply by 2 in the galois field More...
 
void aes_encr (unsigned char *state, unsigned char *expandedKey)
 internal implementation of AES128 encryption. straight forward aes encryption implementation first the group of operations More...
 
void aes_decr (unsigned char *state, unsigned char *expandedKey)
 internal implementation of AES128 decryption. straight forward aes decryption implementation the order of substeps is the exact reverse of decryption inverse functions: More...
 

Detailed Description

Function Documentation

void aes_decr ( unsigned char *  state,
unsigned char *  expandedKey 
)

internal implementation of AES128 decryption. straight forward aes decryption implementation the order of substeps is the exact reverse of decryption inverse functions:

aes_decr

Parameters
expandedKeyexpanded AES128 key
state16 bytes of cipher text and plain text
      - addRoundKey is its own inverse
      - rsbox is inverse of sbox
      - rightshift instead of leftshift
      - invMixColumns = barreto + mixColumns
     no further subfunctions to save cycles for function calls
     no structuring with "for (....)" to save cycles
void aes_decrypt ( unsigned char *  state,
unsigned char *  key 
)

AES128 decryption: Given AES128 key and 16 bytes cipher text, plain text of 16 bytes is computed The AES implementation is in mode ECB (Electronic Code Book).

aes_decrypt

Parameters
keyAES128 key of size 16 bytes
state16 bytes of cipher text and plain text
Returns
none
void aes_encr ( unsigned char *  state,
unsigned char *  expandedKey 
)

internal implementation of AES128 encryption. straight forward aes encryption implementation first the group of operations

aes_encr

Parameters
expandedKeyexpanded AES128 key
state16 bytes of plain text and cipher text
Returns
none
    - addRoundKey
    - subbytes
    - shiftrows
    - mixcolums
    is executed 9 times, after this addroundkey to finish the 9th 
    round, after that the 10th round without mixcolums
    no further subfunctions to save cycles for function calls
    no structuring with "for (....)" to save cycles.
void aes_encrypt ( unsigned char *  state,
unsigned char *  key 
)

AES128 encryption: Given AES128 key and 16 bytes plain text, cipher text of 16 bytes is computed. The AES implementation is in mode ECB (Electronic Code Book).

aes_encrypt

Parameters
keyAES128 key of size 16 bytes
state16 bytes of plain text and cipher text
Returns
none
signed long aes_read_key ( unsigned char *  key)

Reads AES128 key from EEPROM Reads the AES128 key from fileID #12 in EEPROM returns an error if the key does not exist.

aes_read_key

Parameters
[out]keyAES128 key of size 16 bytes
Returns
on success 0, error otherwise.
signed long aes_write_key ( unsigned char *  key)

writes AES128 key from EEPROM Writes the AES128 key to fileID #12 in EEPROM

aes_write_key

Parameters
[out]keyAES128 key of size 16 bytes
Returns
on success 0, error otherwise.
void expandKey ( unsigned char *  expandedKey,
unsigned char *  key 
)

expend a 16 bytes key for AES128 implementation

expandKey

Parameters
keyAES128 key - 16 bytes
expandedKeyexpanded AES128 key
Returns
none
unsigned char galois_mul2 ( unsigned char  value)

multiply by 2 in the galois field

galois_mul2

Parameters
valueargument to multiply
Returns
multiplied argument