From edf7aaf229fa08bd085ce254848f6b1dd8a4b91f Mon Sep 17 00:00:00 2001 From: hasufell Date: Thu, 5 Jun 2014 19:12:39 +0200 Subject: [PATCH] ENC: be less fault tolerant --- src/ntru_encrypt.c | 13 +++++-------- src/ntru_encrypt.h | 5 +---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/ntru_encrypt.c b/src/ntru_encrypt.c index 6f79b40..8376724 100644 --- a/src/ntru_encrypt.c +++ b/src/ntru_encrypt.c @@ -42,7 +42,7 @@ /*------------------------------------------------------------------------*/ -bool +void ntru_encrypt_poly( const fmpz_poly_t msg_bin, const fmpz_poly_t pub_key, @@ -53,7 +53,7 @@ ntru_encrypt_poly( fmpz_poly_t tmp_poly_msg; if (!msg_bin || !pub_key || !rnd || !out || !params) - return false; + NTRU_ABORT_DEBUG("Unexpected NULL parameters"); /* allow aliasing */ fmpz_poly_init(tmp_poly_msg); @@ -66,8 +66,6 @@ ntru_encrypt_poly( fmpz_poly_mod_unsigned(out, params->q); fmpz_poly_clear(tmp_poly_msg); - - return true; } /*------------------------------------------------------------------------*/ @@ -84,17 +82,16 @@ ntru_encrypt_string( fmpz_poly_t **poly_array; if (!msg || !msg->len) - return NULL; + NTRU_ABORT_DEBUG("Unexpected NULL parameters"); poly_array = ascii_to_bin_poly_arr(msg, params); while (*poly_array[i]) { - if (!ntru_encrypt_poly(*poly_array[i], + ntru_encrypt_poly(*poly_array[i], pub_key, rnd, *poly_array[i], - params)) - NTRU_ABORT("failed encrypting string!\n"); + params); i++; } diff --git a/src/ntru_encrypt.h b/src/ntru_encrypt.h index 49416ac..7ac907a 100644 --- a/src/ntru_encrypt.h +++ b/src/ntru_encrypt.h @@ -33,8 +33,6 @@ #include "ntru_poly.h" #include "ntru_string.h" -#include - #include #include @@ -60,9 +58,8 @@ * @param out the output poly which is in the range {0, q-1} * (not ternary!) [out] * @param params ntru_params the ntru context - * @return true/false for success/failure */ -bool +void ntru_encrypt_poly( const fmpz_poly_t msg_tern, const fmpz_poly_t pub_key,