POLY: add delete_polynom() function
This deletes both the internal structure and the pointer.
This commit is contained in:
parent
b33b0c6b1a
commit
4a7e50a194
14
src/poly.c
14
src/poly.c
@ -74,6 +74,20 @@ void init_polynom_size(pb_poly *new_poly, mp_int *chara, int size)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This deletes the internal structure of a polynomial,
|
||||
* and frees the pointer. Don't call this on stack variables,
|
||||
* this is intended for use after ntru_ functions, that
|
||||
* return a polynomial pointer.
|
||||
*
|
||||
* @param poly the polynomial to delete
|
||||
*/
|
||||
void delete_polynom(pb_poly *poly)
|
||||
{
|
||||
pb_clear(poly);
|
||||
free(poly);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the polynomial in a human readable format to stdout.
|
||||
*
|
||||
|
@ -33,6 +33,8 @@ void init_polynom(pb_poly *new_poly, mp_int *chara);
|
||||
|
||||
void init_polynom_size(pb_poly *new_poly, mp_int *chara, int size);
|
||||
|
||||
void delete_polynom(pb_poly *new_poly);
|
||||
|
||||
void draw_polynom(pb_poly * const poly);
|
||||
|
||||
#endif /* NTRU_POLY_H */
|
||||
|
Loading…
Reference in New Issue
Block a user