MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / sha256_update

Function sha256_update

sha256.c:248–284  ·  view source on GitHub ↗

* SHA-256 process buffer */

Source from the content-addressed store, hash-verified

246 * SHA-256 process buffer
247 */
248void sha256_update( sha256_context *ctx, const unsigned char *input,
249 size_t ilen )
250{
251 size_t fill;
252 uint32_t left;
253
254 if( ilen == 0 )
255 return;
256
257 left = ctx->total[0] & 0x3F;
258 fill = 64 - left;
259
260 ctx->total[0] += (uint32_t) ilen;
261 ctx->total[0] &= 0xFFFFFFFF;
262
263 if( ctx->total[0] < (uint32_t) ilen )
264 ctx->total[1]++;
265
266 if( left && ilen >= fill )
267 {
268 memcpy( (void *) (ctx->buffer + left), input, fill );
269 sha256_process( ctx, ctx->buffer );
270 input += fill;
271 ilen -= fill;
272 left = 0;
273 }
274
275 while( ilen >= 64 )
276 {
277 sha256_process( ctx, input );
278 input += 64;
279 ilen -= 64;
280 }
281
282 if( ilen > 0 )
283 memcpy( (void *) (ctx->buffer + left), input, ilen );
284}
285
286static const unsigned char sha256_padding[64] =
287{

Callers 8

sha256_finishFunction · 0.85
sha256Function · 0.85
sha256_fileFunction · 0.85
sha256_hmac_startsFunction · 0.85
sha256_hmac_updateFunction · 0.85
sha256_hmac_finishFunction · 0.85
sha256_hmac_resetFunction · 0.85
sha256_self_testFunction · 0.85

Calls 1

sha256_processFunction · 0.85

Tested by

no test coverage detected