hu_KDFDerive()

Derives a value of the requested length based on shared secret information, suitable for use as a key value.

Synopsis:

#include "hukdf.h"
 
int hu_KDFDerive(int algid, size_t secretLen, const unsigned char *sharedSecret, size_t addInfoLen, const unsigned char *addInfo, size_t keyLen, unsigned char *keyValue, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

algid

A KDF algorithm. The acceptable values are one of the HU_KDF_* macros.

secretLen

The length (in bytes) of the shared secret data.

sharedSecret

The shared secret data.

addInfoLen

The length (in bytes) of the additional information. (Optional)

addInfo

Additional information. (Optional - set to NULL if not used.)

keyLen

The length (in bytes) of the key buffer.

keyValue

The key buffer.

sbCtx

A global context.

Library:

libhuapi (For the qcc command, use the -l huapi option to link against this library)

Description:

Additional shared information may also be given.

For the IEEE KDF1 algorithm, the requested length must be the underlying digest algorithm's output length.

When the NIST Alternative 1 KDF is used, the underlying hash algorithm must be registered. If not, a not supported error for the hash algorithm will be returned.

Returns:

SB_ERR_KDF_BAD_ALGORITHM

The KDF algorithm identifier is invalid.

SB_ERR_NULL_INPUT_BUF

The shared secret value is NULL.

SB_ERR_BAD_INPUT_BUF_LEN

The length of the shared secret length is invalid.

SB_ERR_NULL_ADDINFO

The additional information value is NULL.

SB_ERR_NULL_OUTPUT_BUF

The key buffer is NULL.

SB_ERR_BAD_OUTPUT_BUF_LEN

The length of the key buffer length is invalid.

SB_SUCCESS

Success.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus