POLY: add erase_polynom() function

This commit is contained in:
hasufell 2014-04-17 17:34:48 +02:00 committed by malte
parent f8b1649279
commit ed1fb0f0a9
2 changed files with 16 additions and 0 deletions

View File

@ -134,6 +134,20 @@ pb_poly *build_polynom(int const * const c,
return new_poly;
}
/**
* Sets all the polynomial coefficients to +0.
*
* @param poly the polynomial
* @param len the length of the polynomial
*/
void erase_polynom(pb_poly *poly, size_t len)
{
for (unsigned int i = 0; i < len ; i++) {
mp_set(&(poly->terms[i]), 0);
mp_abs(&(poly->terms[i]), &(poly->terms[i]));
}
}
/**
* This deletes the internal structure of a polynomial,
* and frees the pointer. Don't call this on stack variables,

View File

@ -126,6 +126,8 @@ pb_poly *build_polynom(int const * const c,
const size_t len,
ntru_context *ctx);
void erase_polynom(pb_poly *poly, size_t len);
void delete_polynom(pb_poly *new_poly);
void pb_starmultiply(pb_poly *a,