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

Function AES_GMAC_Update

freebsd/opencrypto/gmac.c:77–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77int
78AES_GMAC_Update(void *ctx, const void *vdata, u_int len)
79{
80 struct aes_gmac_ctx *agc;
81 const uint8_t *data;
82 struct gf128 v;
83 uint8_t buf[GMAC_BLOCK_LEN] = {};
84 int i;
85
86 agc = ctx;
87 data = vdata;
88 v = agc->hash;
89
90 while (len > 0) {
91 if (len >= 4*GMAC_BLOCK_LEN) {
92 i = 4*GMAC_BLOCK_LEN;
93 v = gf128_mul4b(v, data, &agc->ghashtbl);
94 } else if (len >= GMAC_BLOCK_LEN) {
95 i = GMAC_BLOCK_LEN;
96 v = gf128_add(v, gf128_read(data));
97 v = gf128_mul(v, &agc->ghashtbl.tbls[0]);
98 } else {
99 i = len;
100 bcopy(data, buf, i);
101 v = gf128_add(v, gf128_read(&buf[0]));
102 v = gf128_mul(v, &agc->ghashtbl.tbls[0]);
103 explicit_bzero(buf, sizeof buf);
104 }
105 len -= i;
106 data += i;
107 }
108
109 agc->hash = v;
110 explicit_bzero(&v, sizeof v);
111
112 return (0);
113}
114
115void
116AES_GMAC_Final(uint8_t *digest, void *ctx)

Callers

nothing calls this directly

Calls 5

gf128_mul4bFunction · 0.85
gf128_addFunction · 0.85
gf128_readFunction · 0.85
gf128_mulFunction · 0.85
explicit_bzeroFunction · 0.85

Tested by

no test coverage detected