Creates a Key Split context initialized with the given parameters.
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)
Degree of polynomial. Degree must be greater than one.
The size (in bits) of prime. This value must be 256 (SB_KS_PRIME_256_BITS).
The size (in bytes) of prime and secret. This value must be 32 (SB_KS_PRIME_256_BYTES).
Prime number value.
Value of secret to split.
Array of key indexes; it must contain degree elements.
Array of shares corresponding to the index array. specified in index.
An RNG context object.
A yield context object.
A Key Split context pointer.
A global context.
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.
degree is less than two.
primeBits or primeBytes is incorrect.
prime is NULL, or secret is NULL and index or share is NULL.
rngCtx is NULL.
Key Split Context pointer is NULL.
Supplied prime is not a prime, or supplied secret is not less than the prime.