CC3000HostDriver for device TI CC3000 some changes were made due to mbed compiler and the use of void*

Dependents:   CC3000Test

Embed: (wiki syntax)

« Back to documentation index

Security_api

Security_api

Functions

void expandKey (unsigned char *expandedKey, unsigned char *key)
 expandKey
unsigned char galois_mul2 (unsigned char value)
 galois_mul2
void aes_encr (unsigned char *state, unsigned char *expandedKey)
 aes_encr
void aes_decr (unsigned char *state, unsigned char *expandedKey)
 aes_decr
void aes_encrypt (unsigned char *state, unsigned char *key)
 aes_encrypt
void aes_decrypt (unsigned char *state, unsigned char *key)
 aes_decrypt
signed long aes_read_key (unsigned char *key)
 aes_read_key
signed long aes_write_key (unsigned char *key)
 aes_write_key

Function Documentation

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

aes_decr

Parameters:
[in]expandedKeyexpanded AES128 key
in\out]state 16 bytes of cipher text and plain text
Returns:
none

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

  • 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

Definition at line 304 of file security.cpp.

void aes_decrypt ( unsigned char *  state,
unsigned char *  key 
)

aes_decrypt

Parameters:
[in]keyAES128 key of size 16 bytes
in\out]state 16 bytes of cipher text and plain text
Returns:
none

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).

Definition at line 472 of file security.cpp.

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

aes_encr

Parameters:
[in]expandedKeyexpanded AES128 key
in/out]state 16 bytes of plain text and cipher text
Returns:
none

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

  • 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.

Definition at line 177 of file security.cpp.

void aes_encrypt ( unsigned char *  state,
unsigned char *  key 
)

aes_encrypt

Parameters:
[in]keyAES128 key of size 16 bytes
in\out]state 16 bytes of plain text and cipher text
Returns:
none

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).

Definition at line 447 of file security.cpp.

signed long aes_read_key ( unsigned char *  key )

aes_read_key

Parameters:
[out]keyAES128 key of size 16 bytes
Returns:
on success 0, error otherwise.

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

Definition at line 494 of file security.cpp.

signed long aes_write_key ( unsigned char *  key )

aes_write_key

Parameters:
[out]keyAES128 key of size 16 bytes
Returns:
on success 0, error otherwise.

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

Definition at line 517 of file security.cpp.

void expandKey ( unsigned char *  expandedKey,
unsigned char *  key 
)

expandKey

Parameters:
keyAES128 key - 16 bytes
expandedKeyexpanded AES128 key
Returns:
none

expend a 16 bytes key for AES128 implementation

Definition at line 103 of file security.cpp.

unsigned char galois_mul2 ( unsigned char  value )

galois_mul2

Parameters:
valueargument to multiply
Returns:
multiplied argument

multiply by 2 in the galois field

Definition at line 143 of file security.cpp.