From 693cb4fc21d534c25e698485e33aaf52166ac0f1 Mon Sep 17 00:00:00 2001 From: Ken MacKay Date: Thu, 25 Jul 2013 21:53:53 -0700 Subject: [PATCH] Fixed a bug in the secp384r1 code. The carry bits were getting put into the wrong place, which would result in incorrect values in about 1/2^32 of cases. --- ecc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ecc.c b/ecc.c index 2914727..0410ce0 100644 --- a/ecc.c +++ b/ecc.c @@ -671,8 +671,8 @@ static void omega_mult(uint32_t *p_result, uint32_t *p_right) { /* Multiply by (2^128 + 2^96 - 2^32 + 1). */ vli_set(p_result, p_right); /* 1 */ - p_result[4 + NUM_ECC_DIGITS] = vli_add(p_result + 3, p_result + 3, p_right); /* 2^96 + 1 */ - p_result[5 + NUM_ECC_DIGITS] = vli_add(p_result + 4, p_result + 4, p_right); /* 2^128 + 2^96 + 1 */ + p_result[3 + NUM_ECC_DIGITS] = vli_add(p_result + 3, p_result + 3, p_right); /* 2^96 + 1 */ + p_result[4 + NUM_ECC_DIGITS] = vli_add(p_result + 4, p_result + 4, p_right); /* 2^128 + 2^96 + 1 */ if(vli_sub(p_result + 1, p_result + 1, p_right)) /* 2^128 + 2^96 - 2^32 + 1 */ { /* Propagate borrow if necessary. */ uint i;