MCPcopy Create free account
hub / github.com/F-Stack/f-stack / SipBuf

Function SipBuf

freebsd/crypto/siphash/siphash.c:93–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93static size_t
94SipBuf(SIPHASH_CTX *ctx, const uint8_t **src, size_t len, int final)
95{
96 size_t x = 0;
97
98 KASSERT((!final && len > 0) || (final && len == 0),
99 ("%s: invalid parameters", __func__));
100
101 if (!final) {
102 x = MIN(len, sizeof(ctx->buf.b64) - ctx->buflen);
103 bcopy(*src, &ctx->buf.b8[ctx->buflen], x);
104 ctx->buflen += x;
105 *src += x;
106 } else
107 ctx->buf.b8[7] = (uint8_t)ctx->bytes;
108
109 if (ctx->buflen == 8 || final) {
110 ctx->v[3] ^= le64toh(ctx->buf.b64);
111 SipRounds(ctx, 0);
112 ctx->v[0] ^= le64toh(ctx->buf.b64);
113 ctx->buf.b64 = 0;
114 ctx->buflen = 0;
115 }
116 return (x);
117}
118
119void
120SipHash_Update(SIPHASH_CTX *ctx, const void *src, size_t len)

Callers 2

SipHash_UpdateFunction · 0.85
SipHash_EndFunction · 0.85

Calls 1

SipRoundsFunction · 0.85

Tested by

no test coverage detected