Mercurial > dovecot > original-hg > dovecot-1.2
comparison src/lib/sha2.c @ 8393:44f3bf2d0671 HEAD
sha256_loop() takes now const void *data parameter.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 13 Nov 2008 12:05:28 +0200 |
parents | 2cba4c0f3b4f |
children |
comparison
equal
deleted
inserted
replaced
8392:3b6999dc112f | 8393:44f3bf2d0671 |
---|---|
176 | 176 |
177 ctx->len = 0; | 177 ctx->len = 0; |
178 ctx->tot_len = 0; | 178 ctx->tot_len = 0; |
179 } | 179 } |
180 | 180 |
181 void sha256_loop(struct sha256_ctx *ctx, const unsigned char *data, | 181 void sha256_loop(struct sha256_ctx *ctx, const void *data, |
182 size_t len) | 182 size_t len) |
183 { | 183 { |
184 const unsigned char *shifted_message; | 184 const unsigned char *shifted_message; |
185 size_t block_nb; | 185 size_t block_nb; |
186 size_t new_len, rem_len, tmp_len; | 186 size_t new_len, rem_len, tmp_len; |
196 } | 196 } |
197 | 197 |
198 new_len = len - rem_len; | 198 new_len = len - rem_len; |
199 block_nb = new_len / SHA256_BLOCK_SIZE; | 199 block_nb = new_len / SHA256_BLOCK_SIZE; |
200 | 200 |
201 shifted_message = data + rem_len; | 201 shifted_message = CONST_PTR_OFFSET(data, rem_len); |
202 | 202 |
203 sha256_transf(ctx, ctx->block, 1); | 203 sha256_transf(ctx, ctx->block, 1); |
204 sha256_transf(ctx, shifted_message, block_nb); | 204 sha256_transf(ctx, shifted_message, block_nb); |
205 | 205 |
206 rem_len = new_len % SHA256_BLOCK_SIZE; | 206 rem_len = new_len % SHA256_BLOCK_SIZE; |