www.beck-ipc.com

@CHIP-RTOS C Library - TCP/IP API


Crypt_AES_MakeEncryptKey

Generate AES encryption key.

int Crypt_AES_MakeEncryptKey ( const Crypt_GenericKey *key,                                Crypt_AES_ContextPtr aescontext );

Parameters

key

[in]   Pointer to Generic key structure

aescontext

[out]   Pointer to AES context structure where internal key information will be put by this API.

Return Value

0: Success
-1: failed

Comments

This API creates an AES encryption key based on supplied key material.

The AES (Advanced Encryption Standard) key size is selected by the caller's key->keyBits value.   The key->keyDataPtr must be set to reference the key material (usually some randomly selected values).   The same key material must be used for both this Crypt_AES_MakeEncryptKey() and the Crypt_AES_MakeDecryptKey() in order for a given message to be succesfully encrypted and decrypted.

The amount of key material provided must cover the key size.   So this means that for a 128 bit key, 16 bytes of key material are required.   For 192 bit key, 24 bytes are required.   And for a 256 bit key, 32 bytes are required.

The object referenced by the aescontext argument, while allocated by the user, is used only by the AES API to maintain the key state information.   The user should ignore this object's contents.   No particular preset is required on it by the user.

The AES cipher encryption/decryption speed improves slightly (~4%) when the Crypt_AES_Context object is allocated from the system's fast RAM heap area. Go here for a summary of cipher method execution times.

See Also

RTOS API

This library function invokes a RTOS software interrupt. Refer to this RTOS API function's documentation for more details.

On SC1x3/SC2x (RTOS version >= 1.35, CLIB version >= 2.19) there is also a version of this function available which uses dynamic linking instead of the software interrupt.   This reduces the function's overhead and thus speeds up your application.   This function's name is Crypt_AES_MakeEncryptKey_Dyn, however you should not use this function directly.   Instead you should add the define TCPIP_DYN_LINK to your program before including the CLIB's header file(s), as follows:

    #define TCPIP_DYN_LINK
    #include <clib.h>


This compilation switch will map the original function's name to the dynamic link version.   In this manner, you can easily switch existing programs over to the dynamic link API.

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3SC2x
    n/an/an/aV1.11V1.00

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.08

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document