Apps     Components     Interfaces     All Files     Source Tree     source: tos.lib.TinySec.SkipJackM.nc

Component: SkipJackM

From the NIST description of SkipJack.

Provided Interfaces

Variables

Function Index

Function Descriptions

BlockCipher.init

command result_t BlockCipher.init (CipherContext *context, uint8_t blockSize, uint8_t keySize, uint8_t *key)

Initialize the BlockCipher context.

Parameters:

context - structure to hold the opaque data from this initialization call. It should be passed to future invocations of this module which use this particular key.

blockSize - size of the block in bytes. Some cipher implementation may support multiple block sizes, in which case any valid size is valid.

keySize - key size in bytes

key - pointer to the key

Returns: Whether initialization was successful. The command may be unsuccessful if the key size or blockSize are not valid for the given cipher implementation.

BlockCipher.encrypt

async command result_t BlockCipher.encrypt (CipherContext *context, uint8_t *plainBlock, uint8_t *cipherBlock)

Encrypts a single block (of blockSize) using the key in the keySize.

Parameters:

context - holds the module specific opaque data related to the key (perhaps key expansions).

plainBlock - a plaintext block of blockSize

cipherBlock - the resulting ciphertext block of blockSize

Returns: Whether the encryption was successful. Possible failure reasons include not calling init().

BlockCipher.decrypt

async command result_t BlockCipher.decrypt (CipherContext *context, uint8_t *cipherBlock, uint8_t *plainBlock)

Decrypts a single block (of blockSize) using the key in the keySize. Not all ciphers will implement this function (since providing encryption is a useful primitive).

Parameters:

context - holds the module specific opaque data related to the key (perhaps key expansions).

cipherBlock - a ciphertext block of blockSize

plainBlock - the resulting plaintext block of blockSize

Returns: Whether the decryption was successful. Possible failure reasons include not calling init() or an unimplimented decrypt function.

setupKey

result_t setupKey(CipherContext *context, uint8_t *key, uint8_t keysize)

Performs the key expansion on the real secret.

Parameters:

secret - key


BlockCipherInfo.getPreferredBlockSize

async command uint8_t BlockCipherInfo.getPreferredBlockSize (void)

Returns the preferred block size that this cipher operates with. It is always safe to call this function before the init() call has been made.
Returns: the preferred block size for this cipher. In the case where the cipher operates with multiple block sizes, this will pick one particular size (deterministically).