From 3e8a44c2aa34cf5b05a473255ba248c9de6e517e Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Thu, 28 Nov 2013 17:31:46 +0100 Subject: [PATCH] ntru: Fix compiler warning caused by ++/-- on righthand side of an assignment The behavior of stuff like x = --x; (or x++) is not defined. --- .../plugins/ntru/ntru_crypto/ntru_crypto_ntru_encrypt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libstrongswan/plugins/ntru/ntru_crypto/ntru_crypto_ntru_encrypt.c b/src/libstrongswan/plugins/ntru/ntru_crypto/ntru_crypto_ntru_encrypt.c index ea230a074..40d80d316 100644 --- a/src/libstrongswan/plugins/ntru/ntru_crypto/ntru_crypto_ntru_encrypt.c +++ b/src/libstrongswan/plugins/ntru/ntru_crypto/ntru_crypto_ntru_encrypt.c @@ -591,9 +591,9 @@ ntru_crypto_ntru_decrypt( for (i = 0; i < cmprime_len; i++) { if (Mtrin_buf[i] == 1) - ringel_buf2[i] = --ringel_buf2[i] & mod_q_mask; + ringel_buf2[i] = (ringel_buf2[i] - 1) & mod_q_mask; else if (Mtrin_buf[i] == 2) - ringel_buf2[i] = ++ringel_buf2[i] & mod_q_mask; + ringel_buf2[i] = (ringel_buf2[i] + 1) & mod_q_mask; } if (params->is_product_form) ringel_buf2[i] = (ringel_buf2[i] + m1) & mod_q_mask; @@ -940,11 +940,11 @@ ntru_crypto_ntru_encrypt_keygen( for (i = 0; i < dF3; i++) { uint16_t index = F_buf[dF3_offset + i]; - ringel_buf1[index] = ++ringel_buf1[index] & mod_q_mask; + ringel_buf1[index] = (ringel_buf1[index] + 1) & mod_q_mask; } for (; i < (dF3 << 1); i++) { uint16_t index = F_buf[dF3_offset + i]; - ringel_buf1[index] = --ringel_buf1[index] & mod_q_mask; + ringel_buf1[index] = (ringel_buf1[index] - 1) & mod_q_mask; } } else {