Skip to content

Commit 19a74a2

Browse files
committed
batch_interface: rename and reorder some variables
1 parent 9505fd1 commit 19a74a2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/modules/batch/main_impl.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ secp256k1_batch* secp256k1_batch_create(const secp256k1_context* ctx, size_t max
104104
size_t batch_size = sizeof(secp256k1_batch);
105105
size_t batch_scratch_size = secp256k1_batch_scratch_size(2*max_terms);
106106
secp256k1_batch* batch = (secp256k1_batch*)checked_malloc(&ctx->error_callback, batch_size);
107-
unsigned char null_array[16] = {0};
107+
unsigned char zeros[16] = {0};
108108

109109
VERIFY_CHECK(ctx != NULL);
110110
ARG_CHECK(max_terms != 0);
@@ -139,7 +139,7 @@ secp256k1_batch* secp256k1_batch_create(const secp256k1_context* ctx, size_t max
139139
secp256k1_sha256_write(&batch->sha256, aux_rand16, 16);
140140
} else {
141141
/* use 16 bytes of 0x0000...000, if no fresh randomness provided */
142-
secp256k1_sha256_write(&batch->sha256, null_array, 16);
142+
secp256k1_sha256_write(&batch->sha256, zeros, 16);
143143
}
144144
batch->len = 0;
145145
batch->result = 1;
@@ -179,7 +179,6 @@ int secp256k1_batch_usable(const secp256k1_context *ctx, const secp256k1_batch *
179179
*/
180180
int secp256k1_batch_verify(const secp256k1_context *ctx, secp256k1_batch *batch) {
181181
secp256k1_gej resj;
182-
int mid_res;
183182

184183
VERIFY_CHECK(ctx != NULL);
185184
ARG_CHECK(batch != NULL);
@@ -189,10 +188,8 @@ int secp256k1_batch_verify(const secp256k1_context *ctx, secp256k1_batch *batch)
189188
}
190189

191190
if (batch->len > 0) {
192-
if(batch->scalars != NULL && batch->points != NULL) {
193-
mid_res = secp256k1_ecmult_strauss_batch_prealloc_scratch(&ctx->error_callback, batch->data, &resj, batch->scalars, batch->points, &batch->sc_g, batch->len) && secp256k1_gej_is_infinity(&resj);
194-
batch->result = batch->result && mid_res;
195-
}
191+
int mid_res = secp256k1_ecmult_strauss_batch_prealloc_scratch(&ctx->error_callback, batch->data, &resj, batch->scalars, batch->points, &batch->sc_g, batch->len) && secp256k1_gej_is_infinity(&resj);
192+
batch->result = batch->result && mid_res;
196193
}
197194

198195
return batch->result;

0 commit comments

Comments
 (0)