TrustCore SDK NanoCrypto API reference  version 7.0
rc4algo.h File Reference

Header file for the NanoCrypto RC4 APIs. More...

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS CloneRC4Ctx (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, BulkCtx *ppNewCtx)
 Clone RC4 context previously created with CreateRC4Ctx. More...
 
MOC_EXTERN BulkCtx CreateRC4Ctx (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *keyMaterial, sbyte4 keyLength, sbyte4 encrypt)
 Creates and initializes a new RC4 context. More...
 
MOC_EXTERN MSTATUS DeleteRC4Ctx (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *ctx)
 Deletes an RC4 context. More...
 
MOC_EXTERN MSTATUS DoRC4 (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *data, sbyte4 dataLength, sbyte4 encrypt, ubyte *iv)
 Performs the RC4 stream cipher operation to encrypt or decrypt a buffer of data. More...
 

Detailed Description

This file contains the NanoCrypto RC4 API methods.

rc4algo.h

Function Documentation

◆ CloneRC4Ctx()

MOC_EXTERN MSTATUS CloneRC4Ctx ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  pCtx,
BulkCtx *  ppNewCtx 
)
Parameters
pCtxPointer to a BulkCtx returned by CreateRC4Ctx.
ppNewCtxDouble pointer to the BulkCtx to be created and populated with the key data from the source key.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ CreateRC4Ctx()

MOC_EXTERN BulkCtx CreateRC4Ctx ( MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *  keyMaterial,
sbyte4  keyLength,
sbyte4  encrypt 
)

Creates and initializes a new RC4 context.

Parameters
keyMaterialBuffer of the input key material.
keyLengthThe length of the input key material.
encryptUnused. RC4 is a stream cipher.
Returns
If successful, pointer to a new RC4 context cast as a BulkCtx. Otherwise NULL is returned.

rc4algo.h

◆ DeleteRC4Ctx()

MOC_EXTERN MSTATUS DeleteRC4Ctx ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *  ctx)

Deletes and frees memory allocated for an RC4 context.

Parameters
ctxPointer to the location of the context to be deleted.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

rc4algo.h

◆ DoRC4()

MOC_EXTERN MSTATUS DoRC4 ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  data,
sbyte4  dataLength,
sbyte4  encrypt,
ubyte *  iv 
)

Performs the RC4 stream cipher operation to encrypt or decrypt a buffer of data.

Parameters
ctxPointer to a previously created RC4 context.
dataThe buffer of data to be encrypted or decrypted in-place.
dataLengthThe length of data in bytes.
encryptUnused. RC4 is a stream cipher.
ivUnused. No initialization vector is needed.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

rc4algo.h