hu_KSBegin()

Creates a Key Split context initialized with the given parameters.

Synopsis:

#include "huks.h"
 
int hu_KSBegin(size_t degree, size_t primeBits, size_t primeBytes, const unsigned char *prime, const unsigned char *secret, const size_t *index, unsigned char *const *share, sb_RNGCtx rngCtx, sb_YieldCtx yieldCtx, sb_Context *ksContext, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

degree

Degree of polynomial. Degree must be greater than one.

primeBits

The size (in bits) of prime. This value must be 256 (SB_KS_PRIME_256_BITS).

primeBytes

The size (in bytes) of prime and secret. This value must be 32 (SB_KS_PRIME_256_BYTES).

prime

Prime number value.

secret

Value of secret to split.

index

Array of key indexes; it must contain degree elements.

share

Array of shares corresponding to the index array. specified in index.

rngCtx

An RNG context object.

yieldCtx

A yield context object.

ksContext

A Key Split context pointer.

sbCtx

A global context.

Library:

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

Description:

The behaviour of this function depends on whether secret is specified.

If secret is specified, then a brand new key splitting polynomial is randomly generated from which shared keys can be produced. This function should only be called once for any given secret, after which hu_KSGetShare() can be called multiple times to return shares which can be used to rebuild the polynomial in the future. Note that at least degree shares are required to rebuild secret, so hu_KSGetShare() must be called at least degree times with index=1, 2, .., degree (, degree+1, ....

If secret not specified (i.e. it is set to NULL), then the index and share parameters from ksContext are used to rebuild the polynomial.

Currently, only prime bit size of 256 is supported. Any 256-bit prime, including hu_kePrime256 can be used.

Returns:

SB_ERR_BAD_PARAMETER

degree is less than two.

SB_ERR_BAD_INPUT_LEN

primeBits or primeBytes is incorrect.

SB_ERR_NULL_INPUT_LEN

prime is NULL, or secret is NULL and index or share is NULL.

SB_ERR_NULL_RNG

rngCtx is NULL.

SB_ERR_NULL_CONTEXT

Key Split Context pointer is NULL.

SB_ERR_BAD_INPUT

Supplied prime is not a prime, or supplied secret is not less than the prime.

SB_SUCCESS

Success.

Last modified: 2014-05-14



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

comments powered by Disqus