Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

Security

Data Structures

Typedefs

Functions


Typedef Documentation

typedef struct _Twofish_key Twofish_key
 

Twofish key structure holding the internal state. Set up by twofish_setup().


Function Documentation

u8 password u8 key,
u8  len_8,
const u8 text
 

Ask for password/key. The resulting key is in format: key[0] is nr of chars (septets), then follow the chars compressed to 7b padded with len_8-key[0].

Note:
Number of chars is (len_8-1)*8/7, not the len_8.
Warning:
SIM Toolkit function, usable only in stk_thread().
Parameters:
key pointer on buf[len_8] to fill the resulting key in
len_8 number of bytes the resulting key should have
text if NULL then default "Key" text is used, ALPHA coding or STRING_SLV coding, can be from RAM, EEPROM, PROGMEM
Returns:
APP_OK if key valid, APP_END if user end, APP_BACK if user back.
Examples:
certs.c, and mc.c.

u8 twofish_cbc_decrypt u8 in,
u8 out,
u8  nr_blocks,
Twofish_key key
 

Decrypt in CBC mode.

Parameters:
in pointer on input buffer (len has to be nr_blocks*16) stored in RAM, EEPROM, PROGMEM
out pointer on output buffer (len has to be nr_blocks*16), RAM or EEPROM
nr_blocks number of blocks
key key
Returns:
NO_ERROR, ERR_NO_RAM

u8 twofish_cbc_encrypt u8 in,
u8 out,
u8  nr_blocks,
Twofish_key key
 

Encrypt in CBC mode.

Parameters:
in pointer on input buffer (len has to be nr_blocks*16), stored in RAM, EEPROM, PROGMEM
out pointer on output buffer (len has to be nr_blocks*16), RAM or EEPROM
nr_blocks number of blocks
key key
Returns:
NO_ERROR, ERR_NO_RAM

void twofish_ecb_decrypt u8 ct,
u8 pt,
Twofish_key key
 

Decrypt cipher text to plain text.

Parameters:
ct cipher text of len 16 bytes, stored in RAM, EEPROM or PROGMEM.
pt plain text, RAM or EEPROM.
key 
Examples:
certs.c, and test_prot_mem.c.

void twofish_ecb_encrypt u8 pt,
u8 ct,
Twofish_key key
 

Encrypt plain text to cipher text.

Parameters:
ct cipher text of len 16 bytes, stored in RAM, EEPROM or PROGMEM.
pt plain text, RAM or EEPROM.
key 
Examples:
certs.c, and test_prot_mem.c.

u8 twofish_setup u8 key,
u8  keylen,
Twofish_key skey
 

Prepare twofish key structure for de/encryption.

Parameters:
key pointer on '\0' terminated key, can be RAM, EEPROM, PROGMEM.
keylen requested keylen 16 (=128bits), 24 (=192bits), 32 (=256bits).
skey result.
Returns:
NO_ERROR or ERR_TWOFISH_KEYLEN, ERR_NO_RAM.
Examples:
certs.c, and test_prot_mem.c.

void xrand u8  buf[8]  ) 
 

Returns random 8 bytes. The random number generator is influenced by several variables: previous random, 8bit timer running permanently, EF_BCCH, EF_LOCINFO (random TMSI), random input for GSM algorithm. Everything together is randomly twofished.

Parameters:
buf 
Examples:
certs.c.


Copyright © 2004-2006 BLADOX
Turbo version 1.2