ntru_mgf1_t *mgf1;
/* generate minimum MGF1 output */
+ DBG2(DBG_LIB, "MGF1 is seeded with %u octets", seed_len);
mgf1 = ntru_mgf1_create(hash_algid, chunk_create(seed, seed_len), TRUE);
if (!mgf1)
{
octets = buf;
octets_available = min_calls * md_len;
- DBG2(DBG_LIB, "MGF1 generates %u octets", octets_available);
+ DBG2(DBG_LIB, "MGF1 generates %u octets to extract %d trits",
+ octets_available, num_trits_needed);
if (!mgf1->get_mask(mgf1, octets_available, octets))
{
mgf1->destroy(mgf1);
octets = buf;
octets_available = md_len;
- DBG2(DBG_LIB, "MGF1 generates another %u octets", octets_available);
+ DBG2(DBG_LIB, "MGF1 generates another %u octets for the remaining "
+ "%u trits", octets_available, num_trits_needed);
if (!mgf1->get_mask(mgf1, octets_available, octets))
{
mgf1->destroy(mgf1);
octets = buf;
octets_available = md_len;
- DBG2(DBG_LIB, "MGF1 generates another %u octets", octets_available);
+ DBG2(DBG_LIB, "MGF1 generates another %u octets for the remaining "
+ "%u trits", octets_available, num_trits_needed);
if (!mgf1->get_mask(mgf1, octets_available, octets))
{
mgf1->destroy(mgf1);
ntru_mgf1_t *mgf1;
/* generate minimum MGF1 output */
+ DBG2(DBG_LIB, "MGF1 is seeded with %u octets", seed_len);
mgf1 = ntru_mgf1_create(hash_algid, chunk_create(seed, seed_len), TRUE);
if (!mgf1)
{
octets = buf;
octets_available = min_calls * md_len;
- DBG2(DBG_LIB, "MGF1 generates %u octets", octets_available);
- if (!mgf1->get_mask(mgf1, octets_available, octets))
- {
- mgf1->destroy(mgf1);
- return NTRU_MGF1_FAIL;
- }
-
/* init indices counts for number of polynomials being generated */
if (is_product_form) {
memset(used, 0, N);
/* generate indices (IGF-2) for all polynomials */
+ DBG2(DBG_LIB, "MGF1 generates %u octets for %u indices",
+ octets_available, num_indices);
+ if (!mgf1->get_mask(mgf1, octets_available, octets))
+ {
+ mgf1->destroy(mgf1);
+ return NTRU_MGF1_FAIL;
+ }
while (num_polys > 0) {
octets = buf;
octets_available = md_len;
- DBG2(DBG_LIB, "MGF1 generates another %u octets",
- octets_available);
+ DBG2(DBG_LIB, "MGF1 generates another %u octets for the "
+ "remaining %u indices", octets_available,
+ num_indices - index_cnt);
if (!mgf1->get_mask(mgf1, octets_available, octets))
{
mgf1->destroy(mgf1);
chunk_t seed;
seed = chunk_alloc(this->strength / BITS_PER_BYTE);
- DBG2(DBG_LIB, "DBRG requesting %u bytes of entropy", seed.len);
+ DBG2(DBG_LIB, "DRG requests %u bytes of entropy", seed.len);
if (!this->entropy->get_bytes(this->entropy, seed.len, seed.ptr))
{
entropy_len = (strength + strength/2) / BITS_PER_BYTE;
seed = chunk_alloc(entropy_len + pers_str.len);
- DBG2(DBG_LIB, "DBRG requesting %u bytes of entropy", entropy_len);
+ DBG2(DBG_LIB, "DRBG requests %u bytes of entropy", entropy_len);
if (!this->entropy->get_bytes(this->entropy, entropy_len, seed.ptr))
{