DEC: be less fault tolerant

This commit is contained in:
hasufell 2014-06-05 19:12:30 +02:00
parent eef192f0cc
commit a35443a56a
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 7 additions and 13 deletions

View File

@ -42,7 +42,7 @@
/*------------------------------------------------------------------------*/
bool
void
ntru_decrypt_poly(
const fmpz_poly_t encr_msg,
const fmpz_poly_t priv_key,
@ -56,7 +56,7 @@ ntru_decrypt_poly(
encr_msg_tmp;
if (!encr_msg || !priv_key || !priv_key_inv || !out_bin || !params)
return false;
NTRU_ABORT_DEBUG("Unexpected NULL parameters");
fmpz_poly_init(a);
fmpz_poly_zero(a);
@ -84,8 +84,6 @@ ntru_decrypt_poly(
fmpz_poly_clear(priv_key_tmp);
fmpz_poly_clear(priv_key_inv_tmp);
fmpz_poly_clear(encr_msg_tmp);
return true;
}
/*------------------------------------------------------------------------*/
@ -102,17 +100,16 @@ ntru_decrypt_string(
fmpz_poly_t **poly_array;
if (!encr_msg || !encr_msg->len)
return NULL;
NTRU_ABORT_DEBUG("Unexpected NULL parameters");
poly_array = base64_to_poly_arr(encr_msg, params);
while (*poly_array[i]) {
if (!ntru_decrypt_poly(*poly_array[i],
ntru_decrypt_poly(*poly_array[i],
priv_key,
priv_key_inv,
*poly_array[i],
params))
NTRU_ABORT("failed encrypting string!\n");
params);
i++;
}

View File

@ -32,8 +32,6 @@
#include "ntru_poly.h"
#include "ntru_string.h"
#include <stdbool.h>
#include <fmpz_poly.h>
#include <fmpz.h>
@ -49,9 +47,8 @@
* @param priv_key_inv the inverse polynome to the private key
* @param out_tern the resulting ternary polynom [out]
* @param params the ntru_params
* @return true/false for success/failure
*/
bool
void
ntru_decrypt_poly(
const fmpz_poly_t encr_msg,
const fmpz_poly_t priv_key,
@ -67,7 +64,7 @@ ntru_decrypt_poly(
* the message
* @param priv_key_inv the inverse polynome to the private key
* @param params the ntru_params
* @return the decrypted string or NULL on failure
* @return the decrypted string
*/
string *
ntru_decrypt_string(