www.beck-ipc.com

@CHIP-RTOS C Library - TCP/IP API


Crypt_3DES_MakeKey

Generates a 3DES subkey schedule based on a supplied 24 byte key.

int far Crypt_3DES_MakeKey (
             const unsigned char far * key,
             Crypt_3DesKeyScheduleS far * schedule ) ;

Parameters

key

[in]   Secret 24 random byte key to be used to generate the subkey schedule.

schedule

[out]   Pointer to Crypt_3DesKeyScheduleS structure to be initialized by this API.   The subkey schedule is written here.

Return Value

0 success:
else error code.

Comments

Each byte of the 24 byte key contains 7 key bits plus an odd parity bit (LS bit) for a total key size of 168 bits.   The parity bits are not tested by this API.   (If desired, this key byte odd parity check could be done on the user side.)

The key is tested to assure that it is not cryptographically too weak.   This test fails if the first 8 bytes match the second 8 bytes, or if the second group of 8 bytes match the third group of 8 bytes.   On failure, no subkey schedule is generated and error code 222 is returned.   (Note: If the odd parity bits are the only difference in the 8 byte sections of the key, then this quick check for key strength done by this API will have not accomplished its purpose and a weak key could be accepted here as ok without any error code resulting.)

No presetting of the memory at schedule is required by the caller.   This API fully initializes this block of memory with a new 3DES subkey schedule based on the provided key.

The 3DES cipher encryption/decryption speed improves slightly (~3%) when the Crypt_3DesKeyScheduleS 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

On the first call, this library function invokes a software interrupt which modifies the code at the calling site inside your application program.   A direct FAR JMP into the @CHIP-RTOS-x86 implementation for this function is installed so that on return and on any subsequent calls to this API this dynamic link reaches the function's implementation directly.

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3SC2x
    n/an/an/aV1.35V1.35

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.19

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


End of document