2 static void hmac_gen(hash_t hash, int iter,
3 const char *out, int nout,
4 const char *msg, int nmsg,
5 const char *pass, int npass,
6 const char *salt, int nsalt);
10 uint8_t *opad = alloc0(nout);
11 uint8_t *ipad = alloc0(nout);
12 uint8_t *buf = alloc0(nout);
13 uint8_t *tmp1 = alloc0(nout+nmsg);
14 uint8_t *tmp2 = alloc0(nout+2);
18 else if (npass < nout)
19 memcpy(buf, key, npass);
21 for (int i = 0; i < nout; i++) {
22 opad[i] = 0x5c ^ key[i];
23 ipad[i] = 0x36 ^ key[i];
26 memcpy(tmp1, ipad, message);
27 hash(tmp, ipad + message);