* SHA-512 process buffer */
| 239 | * SHA-512 process buffer |
| 240 | */ |
| 241 | void sha512_update( sha512_context *ctx, const unsigned char *input, |
| 242 | size_t ilen ) |
| 243 | { |
| 244 | size_t fill; |
| 245 | unsigned int left; |
| 246 | |
| 247 | if( ilen == 0 ) |
| 248 | return; |
| 249 | |
| 250 | left = (unsigned int) (ctx->total[0] & 0x7F); |
| 251 | fill = 128 - left; |
| 252 | |
| 253 | ctx->total[0] += (uint64_t) ilen; |
| 254 | |
| 255 | if( ctx->total[0] < (uint64_t) ilen ) |
| 256 | ctx->total[1]++; |
| 257 | |
| 258 | if( left && ilen >= fill ) |
| 259 | { |
| 260 | memcpy( (void *) (ctx->buffer + left), input, fill ); |
| 261 | sha512_process( ctx, ctx->buffer ); |
| 262 | input += fill; |
| 263 | ilen -= fill; |
| 264 | left = 0; |
| 265 | } |
| 266 | |
| 267 | while( ilen >= 128 ) |
| 268 | { |
| 269 | sha512_process( ctx, input ); |
| 270 | input += 128; |
| 271 | ilen -= 128; |
| 272 | } |
| 273 | |
| 274 | if( ilen > 0 ) |
| 275 | memcpy( (void *) (ctx->buffer + left), input, ilen ); |
| 276 | } |
| 277 | |
| 278 | static const unsigned char sha512_padding[128] = |
| 279 | { |
no test coverage detected