Minor formatting fixups.

clang-format mangled this a little.

Change-Id: Ic4d8de0e1f6e926efbe8d14e390fe874b4a7cdcb
Reviewed-on: https://boringssl-review.googlesource.com/12467
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2016-11-27 08:52:35 -05:00 committed by Adam Langley
parent bfe5f08170
commit e4a9dbcf02

View File

@ -109,9 +109,8 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) {
return r; return r;
} }
if (w <= 0 || w > 7) /* 'signed char' can represent integers with absolute /* 'signed char' can represent integers with absolute values less than 2^7 */
values less than 2^7 */ if (w <= 0 || w > 7) {
{
OPENSSL_PUT_ERROR(EC, ERR_R_INTERNAL_ERROR); OPENSSL_PUT_ERROR(EC, ERR_R_INTERNAL_ERROR);
goto err; goto err;
} }
@ -129,20 +128,18 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) {
} }
len = BN_num_bits(scalar); len = BN_num_bits(scalar);
r = OPENSSL_malloc( /* The modified wNAF may be one digit longer than binary representation
len + * (*ret_len will be set to the actual length, i.e. at most
1); /* modified wNAF may be one digit longer than binary representation * BN_num_bits(scalar) + 1). */
* (*ret_len will be set to the actual length, i.e. at most r = OPENSSL_malloc(len + 1);
* BN_num_bits(scalar) + 1) */
if (r == NULL) { if (r == NULL) {
OPENSSL_PUT_ERROR(EC, ERR_R_MALLOC_FAILURE); OPENSSL_PUT_ERROR(EC, ERR_R_MALLOC_FAILURE);
goto err; goto err;
} }
window_val = scalar->d[0] & mask; window_val = scalar->d[0] & mask;
j = 0; j = 0;
while ((window_val != 0) || /* If j+w+1 >= len, window_val will not increase. */
(j + w + 1 < len)) /* if j+w+1 >= len, window_val will not increase */ while (window_val != 0 || j + w + 1 < len) {
{
int digit = 0; int digit = 0;
/* 0 <= window_val <= 2^(w+1) */ /* 0 <= window_val <= 2^(w+1) */
@ -174,9 +171,8 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) {
window_val -= digit; window_val -= digit;
/* now window_val is 0 or 2^(w+1) in standard wNAF generation; /* Now window_val is 0 or 2^(w+1) in standard wNAF generation;
* for modified window NAFs, it may also be 2^w * for modified window NAFs, it may also be 2^w. */
*/
if (window_val != 0 && window_val != next_bit && window_val != bit) { if (window_val != 0 && window_val != next_bit && window_val != bit) {
OPENSSL_PUT_ERROR(EC, ERR_R_INTERNAL_ERROR); OPENSSL_PUT_ERROR(EC, ERR_R_INTERNAL_ERROR);
goto err; goto err;