MCPcopy Create free account
hub / github.com/coreboot/coreboot / SHA1Update

Function SHA1Update

payloads/libpayload/crypto/sha1.c:137–154  ·  view source on GitHub ↗

* Run your data through this. */

Source from the content-addressed store, hash-verified

135 * Run your data through this.
136 */
137void
138SHA1Update(SHA1_CTX *context, const u_int8_t *data, size_t len)
139{
140 size_t i, j;
141
142 j = (size_t)((context->count >> 3) & 63);
143 context->count += (len << 3);
144 if ((j + len) > 63) {
145 (void)memcpy(&context->buffer[j], data, (i = 64-j));
146 SHA1Transform(context->state, context->buffer);
147 for ( ; i + 63 < len; i += 64)
148 SHA1Transform(context->state, (u_int8_t *)&data[i]);
149 j = 0;
150 } else {
151 i = 0;
152 }
153 (void)memcpy(&context->buffer[j], &data[i], len - i);
154}
155
156/*
157 * Add padding and return the message digest.

Callers 2

SHA1PadFunction · 0.85
sha1Function · 0.85

Calls 2

SHA1TransformFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected