MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / shsUpdate

Function shsUpdate

src/core/sha.cpp:262–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260 between calls to shsUpdate() */
261
262void shsUpdate(SHS_INFO* shsInfo, uint8* buffer, int count)
263 {
264 /* Update bitcount */
265 if( ( shsInfo->countLo + ( ( uint32 ) count << 3 ) ) < shsInfo->countLo )
266 shsInfo->countHi++; /* Carry from low to high bitCount */
267 shsInfo->countLo += ( ( uint32 ) count << 3 );
268 shsInfo->countHi += ( ( uint32 ) count >> 29 );
269
270 /* Process data in SHS_BLOCKSIZE chunks */
271 while( count >= SHS_BLOCKSIZE )
272 {
273 memcpy( (char *) shsInfo->data, (char *) buffer, SHS_BLOCKSIZE );
274#ifndef WORDS_BIGENDIAN
275 byteReverse( shsInfo->data, SHS_BLOCKSIZE );
276#endif /* #ifndef WORDS_BIGENDIAN */
277 shsTransform( shsInfo );
278 buffer += SHS_BLOCKSIZE;
279 count -= SHS_BLOCKSIZE;
280 }
281
282 /* Handle any remaining bytes of data. This should only happen once
283 on the final lot of data */
284 memcpy( (char *) shsInfo->data, (char *) buffer, count );
285 }
286
287void shsFinal(SHS_INFO *shsInfo)
288{

Callers 2

UpdateMethod · 0.85
mainFunction · 0.85

Calls 2

shsTransformFunction · 0.85
byteReverseFunction · 0.70

Tested by

no test coverage detected