From a35443a56a585dceef4b2c70f340fda8cb0d2325 Mon Sep 17 00:00:00 2001 From: hasufell Date: Thu, 5 Jun 2014 19:12:30 +0200 Subject: [PATCH] DEC: be less fault tolerant --- src/ntru_decrypt.c | 13 +++++-------- src/ntru_decrypt.h | 7 ++----- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/ntru_decrypt.c b/src/ntru_decrypt.c index a6fcbbc..f72c4eb 100644 --- a/src/ntru_decrypt.c +++ b/src/ntru_decrypt.c @@ -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++; } diff --git a/src/ntru_decrypt.h b/src/ntru_decrypt.h index f4f8b60..61d2a6f 100644 --- a/src/ntru_decrypt.h +++ b/src/ntru_decrypt.h @@ -32,8 +32,6 @@ #include "ntru_poly.h" #include "ntru_string.h" -#include - #include #include @@ -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(