+void
+sha1_hmac_update(sha1_hmac_context *hd, const byte *data, uns datalen)
+{
+ // Just update the inner digest
+ sha1_update(&hd->ictx, data, datalen);
+}
+
+byte *sha1_hmac_final(sha1_hmac_context *hd)
+{
+ // Finish the inner digest
+ byte *isha = sha1_final(&hd->ictx);
+
+ // Finish the outer digest
+ sha1_update(&hd->octx, isha, SHA1_SIZE);
+ return sha1_final(&hd->octx);
+}
+
+void
+sha1_hmac(byte *outbuf, const byte *key, uns keylen, const byte *data, uns datalen)
+{
+ sha1_hmac_context hd;
+ sha1_hmac_init(&hd, key, keylen);
+ sha1_hmac_update(&hd, data, datalen);
+ byte *osha = sha1_hmac_final(&hd);