From 6f08a3666d71a4992b4af037164493ad633b8b1b Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Fri, 15 Feb 2008 18:03:03 +0000 Subject: [PATCH] aeslib: fix register write boundaries --- libfprint/aeslib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libfprint/aeslib.c b/libfprint/aeslib.c index 31d0461..bf9d0f2 100644 --- a/libfprint/aeslib.c +++ b/libfprint/aeslib.c @@ -78,7 +78,6 @@ static int do_write_regv(struct write_regv_data *wdata, int upper_bound) .data = data, .length = alloc_size, }; - fp_dbg("write batch of %d regs", num); for (i = offset; i < offset + num; i++) { const struct aes_regwrite *regwrite = &wdata->regs[i]; @@ -119,13 +118,14 @@ static void continue_write_regv(struct write_regv_data *wdata) offset++; } + wdata->offset = offset; regs_remaining = wdata->num_regs - offset; limit = MIN(regs_remaining, MAX_REGWRITES_PER_REQUEST); - upper_bound = offset + limit; + upper_bound = offset + limit - 1; /* determine if we can write the entire of the regs at once, or if there * is a zero dividing things up */ - for (i = offset; i < offset + limit; i++) + for (i = offset; i <= upper_bound; i++) if (!wdata->regs[i].reg) { upper_bound = i - 1; break;